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 WXDLLEXPORT 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
);
99 virtual void SetInsertionPoint(long pos
);
100 virtual void SetInsertionPointEnd();
101 virtual long GetInsertionPoint() const;
102 virtual wxTextPos
GetLastPosition() const;
103 virtual void Replace(long from
, long to
, const wxString
& value
);
104 virtual void Remove(long from
, long to
);
105 virtual void SetSelection(long from
, long to
);
106 virtual void SetEditable(bool editable
);
107 virtual bool IsEditable() const;
111 virtual void SelectAll();
113 virtual bool CanCopy() const;
114 virtual bool CanCut() const;
115 virtual bool CanPaste() const;
116 virtual bool CanUndo() const;
117 virtual bool CanRedo() const;
119 // wxControlWithItems methods
120 virtual void DoClear();
121 virtual void DoDeleteOneItem(unsigned int n
);
122 virtual unsigned int GetCount() const;
123 virtual wxString
GetString(unsigned int n
) const;
124 virtual void SetString(unsigned int n
, const wxString
& s
);
125 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
126 virtual void SetSelection(int n
);
127 virtual int GetSelection() const;
129 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
131 // we have our own input handler and our own actions
132 // (but wxComboCtrl already handled Popup/Dismiss)
134 virtual bool PerformAction(const wxControlAction& action,
136 const wxString& strArg = wxEmptyString);
139 static wxInputHandler
*GetStdInputHandler(wxInputHandler
*handlerDef
);
140 virtual wxInputHandler
*DoGetStdInputHandler(wxInputHandler
*handlerDef
)
142 return GetStdInputHandler(handlerDef
);
146 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
148 void **clientData
, wxClientDataType type
);
150 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
151 virtual void* DoGetItemClientData(unsigned int n
) const;
153 // common part of all ctors
156 // get the associated listbox
157 wxListBox
*GetLBox() const { return m_lbox
; }
163 //DECLARE_EVENT_TABLE()
164 DECLARE_DYNAMIC_CLASS(wxComboBox
)
167 #endif // _WX_UNIV_COMBOBOX_H_