-class WXDLLEXPORT wxComboControl : public wxControl
-{
-public:
- // construction
- wxComboControl()
- {
- Init();
- }
-
- wxComboControl(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)
- {
- Init();
-
- (void)Create(parent, id, value, pos, size, style, validator, name);
- }
-
- 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);
-
- virtual ~wxComboControl();
-
- // a combo control needs a control for popup window it displays
- void SetPopupControl(wxComboPopup *popup);
- wxComboPopup *GetPopupControl() const { return m_popup; }
-
- // show/hide popup window
- void ShowPopup();
- void HidePopup();
-
- // return true if the popup is currently shown
- bool IsPopupShown() const { return m_isPopupShown; }
-
- // get the popup window containing the popup control
- wxPopupComboWindow *GetPopupWindow() const { return m_winPopup; }
-
- // get the text control which is part of the combobox
- wxTextCtrl *GetText() const { return m_text; }
-
- // implementation only from now on
- // -------------------------------
-
- // notifications from wxComboPopup (shouldn't be called by anybody else)
-
- // called when the user selects something in the popup: this normally hides
- // the popup and sets the text to the new value
- virtual void OnSelect(const wxString& value);
-
- // called when the user dismisses the popup
- virtual void OnDismiss();
-
- // forward these functions to all subcontrols
- virtual bool Enable(bool enable = true);
- virtual bool Show(bool show = true);
-
-#if wxUSE_TOOLTIPS
- virtual void DoSetToolTip( wxToolTip *tip );
-#endif // wxUSE_TOOLTIPS
-
- // we have our own input handler and our own actions
- virtual bool PerformAction(const wxControlAction& action,
- long numArg = 0l,
- const wxString& strArg = wxEmptyString);
-
-protected:
- // override the base class virtuals involved into geometry calculations
- virtual wxSize DoGetBestClientSize() const;
- virtual void DoMoveWindow(int x, int y, int width, int height);
- virtual void DoSetSize(int x, int y,
- int width, int height,
- int sizeFlags = wxSIZE_AUTO);
-
- // event handlers
- void OnKey(wxKeyEvent& event);
-
- // common part of all ctors
- void Init();
-
-private:
- // the text control and button we show all the time
- wxTextCtrl *m_text;
- wxButton *m_btn;
-
- // the popup control
- wxComboPopup *m_popup;
-
- // and the popup window containing it
- wxPopupComboWindow *m_winPopup;
-
- // the height of the combobox popup as calculated in Create()
- wxCoord m_heightPopup;
-
- // is the popup window currenty shown?
- bool m_isPopupShown;