wxOwnerDrawnComboBox Class Reference

#include <odcombo.h>

Inheritance diagram for wxOwnerDrawnComboBox:

wxComboCtrl wxGenericComboControl wxComboCtrlBase List of all members.

Public Member Functions

 wxOwnerDrawnComboBox ()
 wxOwnerDrawnComboBox (wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxComboBoxNameStr)
bool Create (wxWindow *parent, wxWindowID id, const wxString &value=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxComboBoxNameStr)
 wxOwnerDrawnComboBox (wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, const wxArrayString &choices, long style, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxComboBoxNameStr)
bool Create (wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxComboBoxNameStr)
bool Create (wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, const wxArrayString &choices, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxComboBoxNameStr)
virtual ~wxOwnerDrawnComboBox ()
void SetPopupControl (wxVListBoxComboPopup *popup)
virtual void Clear ()
virtual void Delete (int n)
virtual int GetCount () const
virtual wxString GetString (int n) const
virtual void SetString (int n, const wxString &s)
virtual int FindString (const wxString &s, bool bCase) const
virtual int FindString (const wxString &s) const
virtual void Select (int n)
virtual int GetSelection () const
virtual void SetSelection (int n)
virtual void SetSelection (long from, long to)
virtual int GetWidestItemWidth ()
virtual int GetWidestItem ()

Protected Member Functions

virtual void OnDrawItem (wxDC &dc, const wxRect &rect, int item, int flags) const
virtual wxCoord OnMeasureItem (size_t item) const
virtual wxCoord OnMeasureItemWidth (size_t item) const
virtual void OnDrawBackground (wxDC &dc, const wxRect &rect, int item, int flags) const
virtual void DoSetPopupControl (wxComboPopup *popup)
void ClearClientDatas ()
wxVListBoxComboPopupGetVListBoxComboPopup () const
virtual int DoAppend (const wxString &item)
virtual int DoInsert (const wxString &item, int pos)
virtual void DoSetItemClientData (int n, void *clientData)
virtual void * DoGetItemClientData (int n) const
virtual void DoSetItemClientObject (int n, wxClientData *clientData)
virtual wxClientData * DoGetItemClientObject (int n) const

Protected Attributes

wxArrayString m_initChs

Private Member Functions

void Init ()

Friends

class wxVListBoxComboPopup

Detailed Description

Definition at line 231 of file odcombo.h.


Constructor & Destructor Documentation

wxOwnerDrawnComboBox::wxOwnerDrawnComboBox  )  [inline]
 

Definition at line 239 of file odcombo.h.

00239 : wxComboCtrl() { Init(); }

wxOwnerDrawnComboBox::wxOwnerDrawnComboBox wxWindow *  parent,
wxWindowID  id,
const wxString &  value,
const wxPoint &  pos,
const wxSize &  size,
int  n,
const wxString  choices[],
long  style = 0,
const wxValidator &  validator = wxDefaultValidator,
const wxString &  name = wxComboBoxNameStr
[inline]
 

Definition at line 241 of file odcombo.h.

00251         : wxComboCtrl()
00252     {
00253         Init();
00254 
00255         (void)Create(parent, id, value, pos, size, n,
00256                      choices, style, validator, name);
00257     }

wxOwnerDrawnComboBox::wxOwnerDrawnComboBox wxWindow *  parent,
wxWindowID  id,
const wxString &  value,
const wxPoint &  pos,
const wxSize &  size,
const wxArrayString &  choices,
long  style,
const wxValidator &  validator = wxDefaultValidator,
const wxString &  name = wxComboBoxNameStr
 

Definition at line 786 of file odcombo.cpp.

00795     : wxComboCtrl()
00796 {
00797     Init();
00798 
00799     Create(parent,id,value,pos,size,choices,style, validator, name);
00800 }

wxOwnerDrawnComboBox::~wxOwnerDrawnComboBox  )  [virtual]
 

Definition at line 846 of file odcombo.cpp.

00847 {
00848     if ( m_popupInterface )
00849         GetVListBoxComboPopup()->ClearClientDatas();
00850 }


Member Function Documentation

void wxOwnerDrawnComboBox::Clear  )  [virtual]
 

Definition at line 875 of file odcombo.cpp.

00876 {
00877     EnsurePopupControl();
00878 
00879     GetVListBoxComboPopup()->Clear();
00880 
00881     SetValue(wxEmptyString);
00882 }

void wxOwnerDrawnComboBox::ClearClientDatas  )  [protected]
 

bool wxOwnerDrawnComboBox::Create wxWindow *  parent,
wxWindowID  id,
const wxString &  value,
const wxPoint &  pos,
const wxSize &  size,
const wxArrayString &  choices,
long  style = 0,
const wxValidator &  validator = wxDefaultValidator,
const wxString &  name = wxComboBoxNameStr
 

Definition at line 802 of file odcombo.cpp.

00811 {
00812     m_initChs = choices;
00813     //wxCArrayString chs(choices);
00814 
00815     //return Create(parent, id, value, pos, size, chs.GetCount(),
00816     //              chs.GetStrings(), style, validator, name);
00817     return Create(parent, id, value, pos, size, 0,
00818                   NULL, style, validator, name);
00819 }

bool wxOwnerDrawnComboBox::Create wxWindow *  parent,
wxWindowID  id,
const wxString &  value,
const wxPoint &  pos,
const wxSize &  size,
int  n,
const wxString  choices[],
long  style = 0,
const wxValidator &  validator = wxDefaultValidator,
const wxString &  name = wxComboBoxNameStr
 

Definition at line 821 of file odcombo.cpp.

00831 {
00832 
00833     if ( !Create(parent, id, value, pos, size, style,
00834                  validator, name) )
00835     {
00836         return false;
00837     }
00838 
00839     int i;
00840     for ( i=0; i<n; i++ )
00841         m_initChs.Add(choices[i]);
00842 
00843     return true;
00844 }

bool wxOwnerDrawnComboBox::Create wxWindow *  parent,
wxWindowID  id,
const wxString &  value = wxEmptyString,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = 0,
const wxValidator &  validator = wxDefaultValidator,
const wxString &  name = wxComboBoxNameStr
 

Reimplemented from wxGenericComboControl.

Definition at line 774 of file odcombo.cpp.

00782 {
00783     return wxComboCtrl::Create(parent,id,value,pos,size,style,validator,name);
00784 }

void wxOwnerDrawnComboBox::Delete int  n  )  [virtual]
 

Definition at line 884 of file odcombo.cpp.

00885 {
00886     wxCHECK_RET( IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::Delete") );
00887 
00888     if ( GetSelection() == (int) n )
00889         SetValue(wxEmptyString);
00890 
00891     GetVListBoxComboPopup()->Delete(n);
00892 }

int wxOwnerDrawnComboBox::DoAppend const wxString &  item  )  [protected, virtual]
 

Definition at line 958 of file odcombo.cpp.

00959 {
00960     EnsurePopupControl();
00961     wxASSERT(m_popupInterface);
00962 
00963     return GetVListBoxComboPopup()->Append(item);
00964 }

void * wxOwnerDrawnComboBox::DoGetItemClientData int  n  )  const [protected, virtual]
 

Definition at line 987 of file odcombo.cpp.

00988 {
00989     if ( !m_popupInterface )
00990         return NULL;
00991 
00992     return GetVListBoxComboPopup()->GetItemClientData(n);
00993 }

wxClientData * wxOwnerDrawnComboBox::DoGetItemClientObject int  n  )  const [protected, virtual]
 

Definition at line 1000 of file odcombo.cpp.

01001 {
01002     return (wxClientData*) DoGetItemClientData(n);
01003 }

int wxOwnerDrawnComboBox::DoInsert const wxString &  item,
int  pos
[protected, virtual]
 

Definition at line 966 of file odcombo.cpp.

00967 {
00968     EnsurePopupControl();
00969 
00970     wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
00971 #if 0
00972     wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));
00973 #endif
00974 
00975     GetVListBoxComboPopup()->Insert(item,pos);
00976 
00977     return pos;
00978 }

void wxOwnerDrawnComboBox::DoSetItemClientData int  n,
void *  clientData
[protected, virtual]
 

Definition at line 980 of file odcombo.cpp.

00981 {
00982     EnsurePopupControl();
00983 
00984     GetVListBoxComboPopup()->SetItemClientData(n,clientData,m_clientDataItemsType);
00985 }

void wxOwnerDrawnComboBox::DoSetItemClientObject int  n,
wxClientData *  clientData
[protected, virtual]
 

Definition at line 995 of file odcombo.cpp.

00996 {
00997     DoSetItemClientData(n, (void*) clientData);
00998 }

void wxOwnerDrawnComboBox::DoSetPopupControl wxComboPopup popup  )  [protected, virtual]
 

Reimplemented from wxComboCtrlBase.

Definition at line 852 of file odcombo.cpp.

00853 {
00854     if ( !popup )
00855     {
00856         popup = new wxVListBoxComboPopup();
00857     }
00858 
00859     wxComboCtrl::DoSetPopupControl(popup);
00860 
00861     wxASSERT(popup);
00862 
00863     // Add initial choices to the wxVListBox
00864     if ( !GetVListBoxComboPopup()->GetCount() )
00865     {
00866         GetVListBoxComboPopup()->Populate(m_initChs);
00867         m_initChs.Clear();
00868     }
00869 }

virtual int wxOwnerDrawnComboBox::FindString const wxString &  s  )  const [inline, virtual]
 

Definition at line 314 of file odcombo.h.

00314 {return FindString (s, false);}

int wxOwnerDrawnComboBox::FindString const wxString &  s,
bool  bCase
const [virtual]
 

Definition at line 921 of file odcombo.cpp.

00922 {
00923     if ( !m_popupInterface )
00924         return m_initChs.Index(s, bCase);
00925 
00926     return GetVListBoxComboPopup()->FindString(s, bCase);
00927 }

int wxOwnerDrawnComboBox::GetCount  )  const [virtual]
 

Definition at line 894 of file odcombo.cpp.

00895 {
00896     if ( !m_popupInterface )
00897         return m_initChs.GetCount();
00898 
00899     return GetVListBoxComboPopup()->GetCount();
00900 }

int wxOwnerDrawnComboBox::GetSelection  )  const [virtual]
 

Definition at line 950 of file odcombo.cpp.

00951 {
00952     if ( !m_popupInterface )
00953         return m_initChs.Index(m_valueString);
00954 
00955     return GetVListBoxComboPopup()->GetSelection();
00956 }

wxString wxOwnerDrawnComboBox::GetString int  n  )  const [virtual]
 

Definition at line 902 of file odcombo.cpp.

00903 {
00904     wxCHECK_MSG( IsValid(n), wxEmptyString, _T("invalid index in wxOwnerDrawnComboBox::GetString") );
00905 
00906     if ( !m_popupInterface )
00907         return m_initChs.Item(n);
00908 
00909     return GetVListBoxComboPopup()->GetString(n);
00910 }

wxVListBoxComboPopup* wxOwnerDrawnComboBox::GetVListBoxComboPopup  )  const [inline, protected]
 

Definition at line 359 of file odcombo.h.

00360     {
00361         return (wxVListBoxComboPopup*) m_popupInterface;
00362     }

virtual int wxOwnerDrawnComboBox::GetWidestItem  )  [inline, virtual]
 

Definition at line 330 of file odcombo.h.

virtual int wxOwnerDrawnComboBox::GetWidestItemWidth  )  [inline, virtual]
 

Definition at line 327 of file odcombo.h.

void wxOwnerDrawnComboBox::Init  )  [private]
 

Reimplemented from wxGenericComboControl.

Definition at line 770 of file odcombo.cpp.

00771 {
00772 }

void wxOwnerDrawnComboBox::OnDrawBackground wxDC &  dc,
const wxRect &  rect,
int  item,
int  flags
const [protected, virtual]
 

Definition at line 1036 of file odcombo.cpp.

01037 {
01038     // we need to render selected and current items differently
01039     if ( GetVListBoxComboPopup()->IsCurrent((size_t)item) ||
01040          (flags & wxODCB_PAINTING_CONTROL) )
01041     {
01042         DrawFocusBackground(dc,
01043                             rect,
01044                             (flags&wxODCB_PAINTING_CONTROL?0:wxCONTROL_ISSUBMENU) |
01045                             wxCONTROL_SELECTED);
01046     }
01047     //else: do nothing for the normal items
01048 }

void wxOwnerDrawnComboBox::OnDrawItem wxDC &  dc,
const wxRect &  rect,
int  item,
int  flags
const [protected, virtual]
 

Definition at line 1009 of file odcombo.cpp.

01013 {
01014     if ( flags & wxODCB_PAINTING_CONTROL )
01015     {
01016         dc.DrawText( GetValue(),
01017                      rect.x + GetTextIndent(),
01018                      (rect.height-dc.GetCharHeight())/2 + rect.y );
01019     }
01020     else
01021     {
01022         dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2, rect.y );
01023     }
01024 }

virtual wxCoord wxOwnerDrawnComboBox::OnMeasureItem size_t  item  )  const [protected, virtual]
 

virtual wxCoord wxOwnerDrawnComboBox::OnMeasureItemWidth size_t  item  )  const [protected, virtual]
 

void wxOwnerDrawnComboBox::Select int  n  )  [virtual]
 

Definition at line 929 of file odcombo.cpp.

00930 {
00931     EnsurePopupControl();
00932 
00933     wxCHECK_RET( (n == wxNOT_FOUND) || IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::Select") );
00934 
00935     GetVListBoxComboPopup()->SetSelection(n);
00936 
00937     wxString str;
00938     if ( n >= 0 )
00939         str = GetVListBoxComboPopup()->GetString(n);
00940 
00941     // Refresh text portion in control
00942     if ( m_text )
00943         m_text->SetValue( str );
00944     else
00945         m_valueString = str;
00946 
00947     Refresh();
00948 }

void wxOwnerDrawnComboBox::SetPopupControl wxVListBoxComboPopup popup  )  [inline]
 

Definition at line 302 of file odcombo.h.

00303     {
00304         DoSetPopupControl(popup);
00305     }

virtual void wxOwnerDrawnComboBox::SetSelection long  from,
long  to
[inline, virtual]
 

Reimplemented from wxComboCtrlBase.

Definition at line 321 of file odcombo.h.

00322     {
00323         wxComboCtrl::SetSelection(from,to);
00324     }

virtual void wxOwnerDrawnComboBox::SetSelection int  n  )  [inline, virtual]
 

Definition at line 317 of file odcombo.h.

00317 { Select(n); }

void wxOwnerDrawnComboBox::SetString int  n,
const wxString &  s
[virtual]
 

Definition at line 912 of file odcombo.cpp.

00913 {
00914     EnsurePopupControl();
00915 
00916     wxCHECK_RET( IsValid(n), _T("invalid index in wxOwnerDrawnComboBox::SetString") );
00917 
00918     GetVListBoxComboPopup()->SetString(n,s);
00919 }


Friends And Related Function Documentation

friend class wxVListBoxComboPopup [friend]
 

Definition at line 235 of file odcombo.h.


Member Data Documentation

wxArrayString wxOwnerDrawnComboBox::m_initChs [protected]
 

Definition at line 374 of file odcombo.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:03:19 2007 for Camelot by  doxygen 1.4.4