| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: combobox.h |
| 3 | // Purpose: wxComboBox class |
| 4 | // Author: David Webster |
| 5 | // Modified by: |
| 6 | // Created: 10/13/99 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) David Webster |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_COMBOBOX_H_ |
| 13 | #define _WX_COMBOBOX_H_ |
| 14 | |
| 15 | #include "wx/choice.h" |
| 16 | #include "wx/textentry.h" |
| 17 | |
| 18 | #if wxUSE_COMBOBOX |
| 19 | |
| 20 | // Combobox item |
| 21 | class WXDLLIMPEXP_CORE wxComboBox : public wxChoice, |
| 22 | public wxTextEntry |
| 23 | { |
| 24 | |
| 25 | public: |
| 26 | inline wxComboBox() {} |
| 27 | |
| 28 | inline wxComboBox( wxWindow* pParent |
| 29 | ,wxWindowID vId |
| 30 | ,const wxString& rsValue = wxEmptyString |
| 31 | ,const wxPoint& rPos = wxDefaultPosition |
| 32 | ,const wxSize& rSize = wxDefaultSize |
| 33 | ,int n = 0 |
| 34 | ,const wxString asChoices[] = NULL |
| 35 | ,long lStyle = 0 |
| 36 | ,const wxValidator& rValidator = wxDefaultValidator |
| 37 | ,const wxString& rsName = wxComboBoxNameStr |
| 38 | ) |
| 39 | { |
| 40 | Create( pParent |
| 41 | ,vId |
| 42 | ,rsValue |
| 43 | ,rPos |
| 44 | ,rSize |
| 45 | ,n |
| 46 | ,asChoices |
| 47 | ,lStyle |
| 48 | ,rValidator |
| 49 | ,rsName |
| 50 | ); |
| 51 | } |
| 52 | |
| 53 | inline wxComboBox( wxWindow* pParent |
| 54 | ,wxWindowID vId |
| 55 | ,const wxString& rsValue |
| 56 | ,const wxPoint& rPos |
| 57 | ,const wxSize& rSize |
| 58 | ,const wxArrayString& asChoices |
| 59 | ,long lStyle = 0 |
| 60 | ,const wxValidator& rValidator = wxDefaultValidator |
| 61 | ,const wxString& rsName = wxComboBoxNameStr |
| 62 | ) |
| 63 | { |
| 64 | Create( pParent |
| 65 | ,vId |
| 66 | ,rsValue |
| 67 | ,rPos |
| 68 | ,rSize |
| 69 | ,asChoices |
| 70 | ,lStyle |
| 71 | ,rValidator |
| 72 | ,rsName |
| 73 | ); |
| 74 | } |
| 75 | |
| 76 | bool Create( wxWindow* pParent |
| 77 | ,wxWindowID vId |
| 78 | ,const wxString& rsValue = wxEmptyString |
| 79 | ,const wxPoint& rPos = wxDefaultPosition |
| 80 | ,const wxSize& rSize = wxDefaultSize |
| 81 | ,int n = 0 |
| 82 | ,const wxString asChoices[] = NULL |
| 83 | ,long lStyle = 0 |
| 84 | ,const wxValidator& rValidator = wxDefaultValidator |
| 85 | ,const wxString& rsName = wxComboBoxNameStr |
| 86 | ); |
| 87 | |
| 88 | bool Create( wxWindow* pParent |
| 89 | ,wxWindowID vId |
| 90 | ,const wxString& rsValue |
| 91 | ,const wxPoint& rPos |
| 92 | ,const wxSize& rSize |
| 93 | ,const wxArrayString& asChoices |
| 94 | ,long lStyle = 0 |
| 95 | ,const wxValidator& rValidator = wxDefaultValidator |
| 96 | ,const wxString& rsName = wxComboBoxNameStr |
| 97 | ); |
| 98 | |
| 99 | // resolve ambiguities among virtual functions inherited from both base |
| 100 | // classes |
| 101 | virtual void Clear(); |
| 102 | virtual wxString GetValue() const; |
| 103 | virtual void SetValue(const wxString& value); |
| 104 | virtual wxString GetStringSelection() const |
| 105 | { return wxChoice::GetStringSelection(); } |
| 106 | |
| 107 | inline virtual void SetSelection(int n) { wxChoice::SetSelection(n); } |
| 108 | virtual void SetSelection(long from, long to) |
| 109 | { wxTextEntry::SetSelection(from, to); } |
| 110 | virtual int GetSelection() const { return wxChoice::GetSelection(); } |
| 111 | virtual void GetSelection(long *from, long *to) const |
| 112 | { wxTextEntry::GetSelection(from, to); } |
| 113 | |
| 114 | virtual bool IsEditable() const; |
| 115 | |
| 116 | virtual bool OS2Command( WXUINT uParam |
| 117 | ,WXWORD wId |
| 118 | ); |
| 119 | bool ProcessEditMsg( WXUINT uMsg |
| 120 | ,WXWPARAM wParam |
| 121 | ,WXLPARAM lParam |
| 122 | ); |
| 123 | |
| 124 | private: |
| 125 | // implement wxTextEntry pure virtual methods |
| 126 | virtual wxWindow *GetEditableWindow() { return this; } |
| 127 | virtual WXHWND GetEditHWND() const { return m_hWnd; } |
| 128 | |
| 129 | DECLARE_DYNAMIC_CLASS(wxComboBox) |
| 130 | }; // end of CLASS wxComboBox |
| 131 | |
| 132 | #endif // wxUSE_COMBOBOX |
| 133 | #endif |
| 134 | // _WX_COMBOBOX_H_ |