1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/combobox.h
3 // Purpose: the universal combobox
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_UNIV_COMBOBOX_H_
14 #define _WX_UNIV_COMBOBOX_H_
18 class WXDLLIMPEXP_FWD_CORE wxListBox
;
20 // ----------------------------------------------------------------------------
21 // NB: some actions supported by this control are in wx/generic/combo.h
22 // ----------------------------------------------------------------------------
24 // choose the next/prev/specified (by numArg) item
25 #define wxACTION_COMBOBOX_SELECT_NEXT _T("next")
26 #define wxACTION_COMBOBOX_SELECT_PREV _T("prev")
27 #define wxACTION_COMBOBOX_SELECT _T("select")
30 // ----------------------------------------------------------------------------
31 // wxComboBox: a combination of text control and a listbox
32 // ----------------------------------------------------------------------------
34 class WXDLLIMPEXP_CORE wxComboBox
: public wxComboCtrl
, public wxComboBoxBase
38 wxComboBox() { Init(); }
40 wxComboBox(wxWindow
*parent
,
42 const wxString
& value
= wxEmptyString
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 const wxSize
& size
= wxDefaultSize
,
46 const wxString choices
[] = (const wxString
*) NULL
,
48 const wxValidator
& validator
= wxDefaultValidator
,
49 const wxString
& name
= wxComboBoxNameStr
)
53 (void)Create(parent
, id
, value
, pos
, size
, n
, choices
,
54 style
, validator
, name
);
56 wxComboBox(wxWindow
*parent
,
58 const wxString
& value
,
61 const wxArrayString
& choices
,
63 const wxValidator
& validator
= wxDefaultValidator
,
64 const wxString
& name
= wxComboBoxNameStr
);
66 bool Create(wxWindow
*parent
,
68 const wxString
& value
= wxEmptyString
,
69 const wxPoint
& pos
= wxDefaultPosition
,
70 const wxSize
& size
= wxDefaultSize
,
72 const wxString choices
[] = (const wxString
*) NULL
,
74 const wxValidator
& validator
= wxDefaultValidator
,
75 const wxString
& name
= wxComboBoxNameStr
);
76 bool Create(wxWindow
*parent
,
78 const wxString
& value
,
81 const wxArrayString
& choices
,
83 const wxValidator
& validator
= wxDefaultValidator
,
84 const wxString
& name
= wxComboBoxNameStr
);
86 virtual ~wxComboBox();
88 // the wxUniversal-specific methods
89 // --------------------------------
91 // implement the combobox interface
94 virtual wxString
GetValue() const;
95 virtual void SetValue(const wxString
& value
);
96 virtual void WriteText(const wxString
& value
);
100 virtual void SetInsertionPoint(long pos
);
101 virtual void SetInsertionPointEnd();
102 virtual long GetInsertionPoint() const;
103 virtual wxTextPos
GetLastPosition() const;
104 virtual void Replace(long from
, long to
, const wxString
& value
);
105 virtual void Remove(long from
, long to
);
106 virtual void SetSelection(long from
, long to
);
107 virtual void GetSelection(long *from
, long *to
) const;
108 virtual void SetEditable(bool editable
);
109 virtual bool IsEditable() const;
113 virtual void SelectAll();
115 virtual bool CanCopy() const;
116 virtual bool CanCut() const;
117 virtual bool CanPaste() const;
118 virtual bool CanUndo() const;
119 virtual bool CanRedo() const;
121 // wxControlWithItems methods
122 virtual void DoClear();
123 virtual void DoDeleteOneItem(unsigned int n
);
124 virtual unsigned int GetCount() const;
125 virtual wxString
GetString(unsigned int n
) const;
126 virtual void SetString(unsigned int n
, const wxString
& s
);
127 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
128 virtual void SetSelection(int n
);
129 virtual int GetSelection() const;
130 virtual wxString
GetStringSelection() const;
132 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
134 // we have our own input handler and our own actions
135 // (but wxComboCtrl already handled Popup/Dismiss)
137 virtual bool PerformAction(const wxControlAction& action,
139 const wxString& strArg = wxEmptyString);
142 static wxInputHandler
*GetStdInputHandler(wxInputHandler
*handlerDef
);
143 virtual wxInputHandler
*DoGetStdInputHandler(wxInputHandler
*handlerDef
)
145 return GetStdInputHandler(handlerDef
);
148 // we delegate our client data handling to wxListBox which we use for the
149 // items, so override this and other methods dealing with the client data
150 virtual wxClientDataType
GetClientDataType() const;
151 virtual void SetClientDataType(wxClientDataType clientDataItemsType
);
154 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
156 void **clientData
, wxClientDataType type
);
158 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
159 virtual void* DoGetItemClientData(unsigned int n
) const;
162 // common part of all ctors
165 // get the associated listbox
166 wxListBox
*GetLBox() const { return m_lbox
; }
169 // implement wxTextEntry pure virtual method
170 virtual wxWindow
*GetEditableWindow() { return this; }
175 //DECLARE_EVENT_TABLE()
176 DECLARE_DYNAMIC_CLASS(wxComboBox
)
179 #endif // _WX_UNIV_COMBOBOX_H_