]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/combobox.h
Implement GetPageText for the OSX WebKit implementation.
[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.
37class WXDLLIMPEXP_CORE wxComboBox : public wxComboCtrl, public wxItemContainer
1e6feb95
VZ
38{
39public:
40 // ctors and such
6463b9f5 41 wxComboBox() { Init(); }
1e6feb95
VZ
42
43 wxComboBox(wxWindow *parent,
44 wxWindowID id,
45 const wxString& value = wxEmptyString,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize,
48 int n = 0,
ba1e9d6c 49 const wxString choices[] = (const wxString *) NULL,
1e6feb95
VZ
50 long style = 0,
51 const wxValidator& validator = wxDefaultValidator,
6463b9f5
JS
52 const wxString& name = wxComboBoxNameStr)
53 {
54 Init();
55
56 (void)Create(parent, id, value, pos, size, n, choices,
57 style, validator, name);
58 }
584ad2a3
MB
59 wxComboBox(wxWindow *parent,
60 wxWindowID id,
61 const wxString& value,
62 const wxPoint& pos,
63 const wxSize& size,
64 const wxArrayString& choices,
65 long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxComboBoxNameStr);
1e6feb95
VZ
68
69 bool Create(wxWindow *parent,
70 wxWindowID id,
71 const wxString& value = wxEmptyString,
72 const wxPoint& pos = wxDefaultPosition,
73 const wxSize& size = wxDefaultSize,
74 int n = 0,
75 const wxString choices[] = (const wxString *) NULL,
76 long style = 0,
77 const wxValidator& validator = wxDefaultValidator,
78 const wxString& name = wxComboBoxNameStr);
584ad2a3
MB
79 bool Create(wxWindow *parent,
80 wxWindowID id,
81 const wxString& value,
82 const wxPoint& pos,
83 const wxSize& size,
84 const wxArrayString& choices,
85 long style = 0,
86 const wxValidator& validator = wxDefaultValidator,
87 const wxString& name = wxComboBoxNameStr);
1e6feb95
VZ
88
89 virtual ~wxComboBox();
90
91 // the wxUniversal-specific methods
92 // --------------------------------
93
94 // implement the combobox interface
95
96 // wxTextCtrl methods
3373e900 97 virtual wxString GetValue() const { return DoGetValue(); }
1e6feb95 98 virtual void SetValue(const wxString& value);
0ec1179b 99 virtual void WriteText(const wxString& value);
1e6feb95
VZ
100 virtual void Copy();
101 virtual void Cut();
102 virtual void Paste();
103 virtual void SetInsertionPoint(long pos);
104 virtual void SetInsertionPointEnd();
105 virtual long GetInsertionPoint() const;
7d8268a1 106 virtual wxTextPos GetLastPosition() const;
1e6feb95
VZ
107 virtual void Replace(long from, long to, const wxString& value);
108 virtual void Remove(long from, long to);
109 virtual void SetSelection(long from, long to);
0ec1179b 110 virtual void GetSelection(long *from, long *to) const;
1e6feb95 111 virtual void SetEditable(bool editable);
150e31d2
JS
112 virtual bool IsEditable() const;
113
114 virtual void Undo();
115 virtual void Redo();
116 virtual void SelectAll();
117
118 virtual bool CanCopy() const;
119 virtual bool CanCut() const;
120 virtual bool CanPaste() const;
121 virtual bool CanUndo() const;
122 virtual bool CanRedo() const;
1e6feb95 123
a7f62f39
JS
124 // override these methods to disambiguate between two base classes versions
125 virtual void Clear()
126 {
127 wxComboCtrl::Clear();
128 wxItemContainer::Clear();
129 }
130
131 bool IsEmpty() const { return wxItemContainer::IsEmpty(); }
132
1e6feb95 133 // wxControlWithItems methods
a236aa20
VZ
134 virtual void DoClear();
135 virtual void DoDeleteOneItem(unsigned int n);
aa61d352
VZ
136 virtual unsigned int GetCount() const;
137 virtual wxString GetString(unsigned int n) const;
138 virtual void SetString(unsigned int n, const wxString& s);
853dcc57 139 virtual int FindString(const wxString& s, bool bCase = false) const;
c6179a84 140 virtual void SetSelection(int n);
1e6feb95 141 virtual int GetSelection() const;
0ec1179b 142 virtual wxString GetStringSelection() const;
dcfb179b 143
6f6f938f 144 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
990ff5ec 145
6d0ce565 146 // we have our own input handler and our own actions
a57d600f 147 // (but wxComboCtrl already handled Popup/Dismiss)
6d0ce565
VZ
148 /*
149 virtual bool PerformAction(const wxControlAction& action,
150 long numArg = 0l,
151 const wxString& strArg = wxEmptyString);
152 */
153
9467bdb7
VZ
154 static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
155 virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
156 {
157 return GetStdInputHandler(handlerDef);
158 }
159
131b1fba
VZ
160 // we delegate our client data handling to wxListBox which we use for the
161 // items, so override this and other methods dealing with the client data
b152d8c5 162 virtual wxClientDataType GetClientDataType() const;
131b1fba
VZ
163 virtual void SetClientDataType(wxClientDataType clientDataItemsType);
164
1e6feb95 165protected:
3373e900
VZ
166 virtual wxString DoGetValue() const;
167
a236aa20
VZ
168 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
169 unsigned int pos,
170 void **clientData, wxClientDataType type);
171
aa61d352
VZ
172 virtual void DoSetItemClientData(unsigned int n, void* clientData);
173 virtual void* DoGetItemClientData(unsigned int n) const;
1e6feb95 174
131b1fba 175
1e6feb95
VZ
176 // common part of all ctors
177 void Init();
178
179 // get the associated listbox
180 wxListBox *GetLBox() const { return m_lbox; }
181
182private:
63f7d502
VZ
183 // implement wxTextEntry pure virtual method
184 virtual wxWindow *GetEditableWindow() { return this; }
185
1e6feb95
VZ
186 // the popup listbox
187 wxListBox *m_lbox;
188
189 //DECLARE_EVENT_TABLE()
190 DECLARE_DYNAMIC_CLASS(wxComboBox)
191};
192
1e6feb95 193#endif // _WX_UNIV_COMBOBOX_H_