down list, not just a wxListBox.
So we define a base wxComboControl which can use any control as pop down
- list and wxComboBox deriving from it which implements the standard wxWindows
+ list and wxComboBox deriving from it which implements the standard wxWidgets
combobox API. wxComboControl needs to be told somehow which control to use
and this is done by SetPopupControl(). However, we need something more than
just a wxControl in this method as, for example, we need to call
// called before showing the control to set the initial selection - notice
// that the text passed to this method might not correspond to any valid
// item (if the user edited it directly), in which case the method should
- // just return FALSE but not emit any errors
+ // just return false but not emit any errors
virtual bool SetSelection(const wxString& value) = 0;
// called immediately after the control is shown
void ShowPopup();
void HidePopup();
- // return TRUE if the popup is currently shown
+ // return true if the popup is currently shown
bool IsPopupShown() const { return m_isPopupShown; }
// get the popup window containing the popup control
virtual void OnDismiss();
// forward these functions to all subcontrols
- virtual bool Enable(bool enable = TRUE);
- virtual bool Show(bool show = TRUE);
+ virtual bool Enable(bool enable = true);
+ virtual bool Show(bool show = true);
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip( wxToolTip *tip );
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
- const wxString *choices = (const wxString *) NULL,
+ const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr)
(void)Create(parent, id, value, pos, size, n, choices,
style, validator, name);
}
+ wxComboBox(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);
bool Create(wxWindow *parent,
wxWindowID id,
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 ~wxComboBox();
void SetStringSelection(const wxString& WXUNUSED(s)) { }
- // we have to redefine these functions here to avoid ambiguities in classes
- // deriving from us which would arise otherwise because we inherit these
- // methods (with different signatures) from both wxItemContainer via
- // wxComboBoxBase (with "int n" parameter) and from wxEvtHandler via
- // wxControl and wxComboControl (without)
- //
- // hopefully, a smart compiler can optimize away these simple inline
- // wrappers so we don't suffer much from this
-
- void SetClientData(void *data)
- {
- wxControl::SetClientData(data);
- }
-
- void *GetClientData() const
- {
- return wxControl::GetClientData();
- }
-
- void SetClientObject(wxClientData *data)
- {
- wxControl::SetClientObject(data);
- }
-
- wxClientData *GetClientObject() const
- {
- return wxControl::GetClientObject();
- }
-
- void SetClientData(int n, void* clientData)
- {
- wxItemContainer::SetClientData(n, clientData);
- }
-
- void* GetClientData(int n) const
- {
- return wxItemContainer::GetClientData(n);
- }
-
- void SetClientObject(int n, wxClientData* clientData)
- {
- wxItemContainer::SetClientObject(n, clientData);
- }
-
- wxClientData* GetClientObject(int n) const
- {
- return wxItemContainer::GetClientObject(n);
- }
+ wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
protected:
virtual int DoAppend(const wxString& item);