]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/combobox.h
Remove "ED" suffix from EVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICKED.
[wxWidgets.git] / include / wx / univ / combobox.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/combobox.h
3 // Purpose: the universal combobox
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 30.08.00
7 // RCS-ID: $Id$
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12
13 #ifndef _WX_UNIV_COMBOBOX_H_
14 #define _WX_UNIV_COMBOBOX_H_
15
16 #include "wx/combo.h"
17
18 class WXDLLIMPEXP_FWD_CORE wxListBox;
19
20 // ----------------------------------------------------------------------------
21 // NB: some actions supported by this control are in wx/generic/combo.h
22 // ----------------------------------------------------------------------------
23
24 // choose the next/prev/specified (by numArg) item
25 #define wxACTION_COMBOBOX_SELECT_NEXT wxT("next")
26 #define wxACTION_COMBOBOX_SELECT_PREV wxT("prev")
27 #define wxACTION_COMBOBOX_SELECT wxT("select")
28
29
30 // ----------------------------------------------------------------------------
31 // wxComboBox: a combination of text control and a listbox
32 // ----------------------------------------------------------------------------
33
34 // NB: Normally we'd like wxComboBox to inherit from wxComboBoxBase, but here
35 // we can't really do that since both wxComboBoxBase and wxComboCtrl inherit
36 // from wxTextCtrl.
37 class WXDLLIMPEXP_CORE wxComboBox :
38 public wxWindowWithItems<wxComboCtrl, wxItemContainer>
39 {
40 public:
41 // ctors and such
42 wxComboBox() { Init(); }
43
44 wxComboBox(wxWindow *parent,
45 wxWindowID id,
46 const wxString& value = wxEmptyString,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 int n = 0,
50 const wxString choices[] = (const wxString *) NULL,
51 long style = 0,
52 const wxValidator& validator = wxDefaultValidator,
53 const wxString& name = wxComboBoxNameStr)
54 {
55 Init();
56
57 (void)Create(parent, id, value, pos, size, n, choices,
58 style, validator, name);
59 }
60 wxComboBox(wxWindow *parent,
61 wxWindowID id,
62 const wxString& value,
63 const wxPoint& pos,
64 const wxSize& size,
65 const wxArrayString& choices,
66 long style = 0,
67 const wxValidator& validator = wxDefaultValidator,
68 const wxString& name = wxComboBoxNameStr);
69
70 bool Create(wxWindow *parent,
71 wxWindowID id,
72 const wxString& value = wxEmptyString,
73 const wxPoint& pos = wxDefaultPosition,
74 const wxSize& size = wxDefaultSize,
75 int n = 0,
76 const wxString choices[] = (const wxString *) NULL,
77 long style = 0,
78 const wxValidator& validator = wxDefaultValidator,
79 const wxString& name = wxComboBoxNameStr);
80 bool Create(wxWindow *parent,
81 wxWindowID id,
82 const wxString& value,
83 const wxPoint& pos,
84 const wxSize& size,
85 const wxArrayString& choices,
86 long style = 0,
87 const wxValidator& validator = wxDefaultValidator,
88 const wxString& name = wxComboBoxNameStr);
89
90 virtual ~wxComboBox();
91
92 // the wxUniversal-specific methods
93 // --------------------------------
94
95 // implement the combobox interface
96
97 // wxTextCtrl methods
98 virtual wxString GetValue() const { return DoGetValue(); }
99 virtual void SetValue(const wxString& value);
100 virtual void WriteText(const wxString& value);
101 virtual void Copy();
102 virtual void Cut();
103 virtual void Paste();
104 virtual void SetInsertionPoint(long pos);
105 virtual void SetInsertionPointEnd();
106 virtual long GetInsertionPoint() const;
107 virtual wxTextPos GetLastPosition() const;
108 virtual void Replace(long from, long to, const wxString& value);
109 virtual void Remove(long from, long to);
110 virtual void SetSelection(long from, long to);
111 virtual void GetSelection(long *from, long *to) const;
112 virtual void SetEditable(bool editable);
113 virtual bool IsEditable() const;
114
115 virtual void Undo();
116 virtual void Redo();
117 virtual void SelectAll();
118
119 virtual bool CanCopy() const;
120 virtual bool CanCut() const;
121 virtual bool CanPaste() const;
122 virtual bool CanUndo() const;
123 virtual bool CanRedo() const;
124
125 // override these methods to disambiguate between two base classes versions
126 virtual void Clear()
127 {
128 wxComboCtrl::Clear();
129 wxItemContainer::Clear();
130 }
131
132 // See wxComboBoxBase discussion of IsEmpty().
133 bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
134 bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
135
136 // wxControlWithItems methods
137 virtual void DoClear();
138 virtual void DoDeleteOneItem(unsigned int n);
139 virtual unsigned int GetCount() const;
140 virtual wxString GetString(unsigned int n) const;
141 virtual void SetString(unsigned int n, const wxString& s);
142 virtual int FindString(const wxString& s, bool bCase = false) const;
143 virtual void SetSelection(int n);
144 virtual int GetSelection() const;
145 virtual wxString GetStringSelection() const;
146
147 // we have our own input handler and our own actions
148 // (but wxComboCtrl already handled Popup/Dismiss)
149 /*
150 virtual bool PerformAction(const wxControlAction& action,
151 long numArg = 0l,
152 const wxString& strArg = wxEmptyString);
153 */
154
155 static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
156 virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
157 {
158 return GetStdInputHandler(handlerDef);
159 }
160
161 // we delegate our client data handling to wxListBox which we use for the
162 // items, so override this and other methods dealing with the client data
163 virtual wxClientDataType GetClientDataType() const;
164 virtual void SetClientDataType(wxClientDataType clientDataItemsType);
165
166 protected:
167 virtual wxString DoGetValue() const;
168
169 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
170 unsigned int pos,
171 void **clientData, wxClientDataType type);
172
173 virtual void DoSetItemClientData(unsigned int n, void* clientData);
174 virtual void* DoGetItemClientData(unsigned int n) const;
175
176
177 // common part of all ctors
178 void Init();
179
180 // get the associated listbox
181 wxListBox *GetLBox() const { return m_lbox; }
182
183 private:
184 // implement wxTextEntry pure virtual method
185 virtual wxWindow *GetEditableWindow() { return this; }
186
187 // the popup listbox
188 wxListBox *m_lbox;
189
190 //DECLARE_EVENT_TABLE()
191 DECLARE_DYNAMIC_CLASS(wxComboBox)
192 };
193
194 #endif // _WX_UNIV_COMBOBOX_H_