]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/combobox.h
Tidy up webview.h. Remove all of the doxygen comments which have now been moved to...
[wxWidgets.git] / include / wx / univ / combobox.h
CommitLineData
1e6feb95
VZ
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$
442b35b5 8// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 9// Licence: wxWindows licence
1e6feb95
VZ
10///////////////////////////////////////////////////////////////////////////////
11
1e6feb95
VZ
12
13#ifndef _WX_UNIV_COMBOBOX_H_
14#define _WX_UNIV_COMBOBOX_H_
15
6d0ce565
VZ
16#include "wx/combo.h"
17
b5dbe15d 18class WXDLLIMPEXP_FWD_CORE wxListBox;
1e6feb95
VZ
19
20// ----------------------------------------------------------------------------
6d0ce565 21// NB: some actions supported by this control are in wx/generic/combo.h
1e6feb95
VZ
22// ----------------------------------------------------------------------------
23
1e6feb95 24// choose the next/prev/specified (by numArg) item
9a83f860
VZ
25#define wxACTION_COMBOBOX_SELECT_NEXT wxT("next")
26#define wxACTION_COMBOBOX_SELECT_PREV wxT("prev")
27#define wxACTION_COMBOBOX_SELECT wxT("select")
1e6feb95 28
1e6feb95
VZ
29
30// ----------------------------------------------------------------------------
31// wxComboBox: a combination of text control and a listbox
32// ----------------------------------------------------------------------------
33
a7f62f39
JS
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.
bf8f1022
VZ
37class WXDLLIMPEXP_CORE wxComboBox :
38 public wxWindowWithItems<wxComboCtrl, wxItemContainer>
1e6feb95
VZ
39{
40public:
41 // ctors and such
6463b9f5 42 wxComboBox() { Init(); }
1e6feb95
VZ
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,
ba1e9d6c 50 const wxString choices[] = (const wxString *) NULL,
1e6feb95
VZ
51 long style = 0,
52 const wxValidator& validator = wxDefaultValidator,
6463b9f5
JS
53 const wxString& name = wxComboBoxNameStr)
54 {
55 Init();
56
57 (void)Create(parent, id, value, pos, size, n, choices,
58 style, validator, name);
59 }
584ad2a3
MB
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);
1e6feb95
VZ
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);
584ad2a3
MB
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);
1e6feb95
VZ
89
90 virtual ~wxComboBox();
91
92 // the wxUniversal-specific methods
93 // --------------------------------
94
95 // implement the combobox interface
96
97 // wxTextCtrl methods
3373e900 98 virtual wxString GetValue() const { return DoGetValue(); }
1e6feb95 99 virtual void SetValue(const wxString& value);
0ec1179b 100 virtual void WriteText(const wxString& value);
1e6feb95
VZ
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;
7d8268a1 107 virtual wxTextPos GetLastPosition() const;
1e6feb95
VZ
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);
0ec1179b 111 virtual void GetSelection(long *from, long *to) const;
1e6feb95 112 virtual void SetEditable(bool editable);
150e31d2
JS
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;
1e6feb95 124
a7f62f39
JS
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 bool IsEmpty() const { return wxItemContainer::IsEmpty(); }
133
1e6feb95 134 // wxControlWithItems methods
a236aa20
VZ
135 virtual void DoClear();
136 virtual void DoDeleteOneItem(unsigned int n);
aa61d352
VZ
137 virtual unsigned int GetCount() const;
138 virtual wxString GetString(unsigned int n) const;
139 virtual void SetString(unsigned int n, const wxString& s);
853dcc57 140 virtual int FindString(const wxString& s, bool bCase = false) const;
c6179a84 141 virtual void SetSelection(int n);
1e6feb95 142 virtual int GetSelection() const;
0ec1179b 143 virtual wxString GetStringSelection() const;
dcfb179b 144
6d0ce565 145 // we have our own input handler and our own actions
a57d600f 146 // (but wxComboCtrl already handled Popup/Dismiss)
6d0ce565
VZ
147 /*
148 virtual bool PerformAction(const wxControlAction& action,
149 long numArg = 0l,
150 const wxString& strArg = wxEmptyString);
151 */
152
9467bdb7
VZ
153 static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
154 virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
155 {
156 return GetStdInputHandler(handlerDef);
157 }
158
131b1fba
VZ
159 // we delegate our client data handling to wxListBox which we use for the
160 // items, so override this and other methods dealing with the client data
b152d8c5 161 virtual wxClientDataType GetClientDataType() const;
131b1fba
VZ
162 virtual void SetClientDataType(wxClientDataType clientDataItemsType);
163
1e6feb95 164protected:
3373e900
VZ
165 virtual wxString DoGetValue() const;
166
a236aa20
VZ
167 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
168 unsigned int pos,
169 void **clientData, wxClientDataType type);
170
aa61d352
VZ
171 virtual void DoSetItemClientData(unsigned int n, void* clientData);
172 virtual void* DoGetItemClientData(unsigned int n) const;
1e6feb95 173
131b1fba 174
1e6feb95
VZ
175 // common part of all ctors
176 void Init();
177
178 // get the associated listbox
179 wxListBox *GetLBox() const { return m_lbox; }
180
181private:
63f7d502
VZ
182 // implement wxTextEntry pure virtual method
183 virtual wxWindow *GetEditableWindow() { return this; }
184
1e6feb95
VZ
185 // the popup listbox
186 wxListBox *m_lbox;
187
188 //DECLARE_EVENT_TABLE()
189 DECLARE_DYNAMIC_CLASS(wxComboBox)
190};
191
1e6feb95 192#endif // _WX_UNIV_COMBOBOX_H_