]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/combobox.h
Fixed wxWindowOS2::Reparent.
[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
VZ
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")
28
1e6feb95
VZ
29
30// ----------------------------------------------------------------------------
31// wxComboBox: a combination of text control and a listbox
32// ----------------------------------------------------------------------------
33
53a2db12 34class WXDLLIMPEXP_CORE wxComboBox : public wxComboCtrl, public wxComboBoxBase
1e6feb95
VZ
35{
36public:
37 // ctors and such
6463b9f5 38 wxComboBox() { Init(); }
1e6feb95
VZ
39
40 wxComboBox(wxWindow *parent,
41 wxWindowID id,
42 const wxString& value = wxEmptyString,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
45 int n = 0,
ba1e9d6c 46 const wxString choices[] = (const wxString *) NULL,
1e6feb95
VZ
47 long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
6463b9f5
JS
49 const wxString& name = wxComboBoxNameStr)
50 {
51 Init();
52
53 (void)Create(parent, id, value, pos, size, n, choices,
54 style, validator, name);
55 }
584ad2a3
MB
56 wxComboBox(wxWindow *parent,
57 wxWindowID id,
58 const wxString& value,
59 const wxPoint& pos,
60 const wxSize& size,
61 const wxArrayString& choices,
62 long style = 0,
63 const wxValidator& validator = wxDefaultValidator,
64 const wxString& name = wxComboBoxNameStr);
1e6feb95
VZ
65
66 bool Create(wxWindow *parent,
67 wxWindowID id,
68 const wxString& value = wxEmptyString,
69 const wxPoint& pos = wxDefaultPosition,
70 const wxSize& size = wxDefaultSize,
71 int n = 0,
72 const wxString choices[] = (const wxString *) NULL,
73 long style = 0,
74 const wxValidator& validator = wxDefaultValidator,
75 const wxString& name = wxComboBoxNameStr);
584ad2a3
MB
76 bool Create(wxWindow *parent,
77 wxWindowID id,
78 const wxString& value,
79 const wxPoint& pos,
80 const wxSize& size,
81 const wxArrayString& choices,
82 long style = 0,
83 const wxValidator& validator = wxDefaultValidator,
84 const wxString& name = wxComboBoxNameStr);
1e6feb95
VZ
85
86 virtual ~wxComboBox();
87
88 // the wxUniversal-specific methods
89 // --------------------------------
90
91 // implement the combobox interface
92
93 // wxTextCtrl methods
94 virtual wxString GetValue() const;
95 virtual void SetValue(const wxString& value);
0ec1179b 96 virtual void WriteText(const wxString& value);
1e6feb95
VZ
97 virtual void Copy();
98 virtual void Cut();
99 virtual void Paste();
100 virtual void SetInsertionPoint(long pos);
101 virtual void SetInsertionPointEnd();
102 virtual long GetInsertionPoint() const;
7d8268a1 103 virtual wxTextPos GetLastPosition() const;
1e6feb95
VZ
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);
0ec1179b 107 virtual void GetSelection(long *from, long *to) const;
1e6feb95 108 virtual void SetEditable(bool editable);
150e31d2
JS
109 virtual bool IsEditable() const;
110
111 virtual void Undo();
112 virtual void Redo();
113 virtual void SelectAll();
114
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;
1e6feb95
VZ
120
121 // wxControlWithItems methods
a236aa20
VZ
122 virtual void DoClear();
123 virtual void DoDeleteOneItem(unsigned int n);
aa61d352
VZ
124 virtual unsigned int GetCount() const;
125 virtual wxString GetString(unsigned int n) const;
126 virtual void SetString(unsigned int n, const wxString& s);
853dcc57 127 virtual int FindString(const wxString& s, bool bCase = false) const;
c6179a84 128 virtual void SetSelection(int n);
1e6feb95 129 virtual int GetSelection() const;
0ec1179b 130 virtual wxString GetStringSelection() const;
dcfb179b 131
6f6f938f 132 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
990ff5ec 133
6d0ce565 134 // we have our own input handler and our own actions
a57d600f 135 // (but wxComboCtrl already handled Popup/Dismiss)
6d0ce565
VZ
136 /*
137 virtual bool PerformAction(const wxControlAction& action,
138 long numArg = 0l,
139 const wxString& strArg = wxEmptyString);
140 */
141
9467bdb7
VZ
142 static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
143 virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
144 {
145 return GetStdInputHandler(handlerDef);
146 }
147
131b1fba
VZ
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
b152d8c5 150 virtual wxClientDataType GetClientDataType() const;
131b1fba
VZ
151 virtual void SetClientDataType(wxClientDataType clientDataItemsType);
152
1e6feb95 153protected:
a236aa20
VZ
154 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
155 unsigned int pos,
156 void **clientData, wxClientDataType type);
157
aa61d352
VZ
158 virtual void DoSetItemClientData(unsigned int n, void* clientData);
159 virtual void* DoGetItemClientData(unsigned int n) const;
1e6feb95 160
131b1fba 161
1e6feb95
VZ
162 // common part of all ctors
163 void Init();
164
165 // get the associated listbox
166 wxListBox *GetLBox() const { return m_lbox; }
167
168private:
169 // the popup listbox
170 wxListBox *m_lbox;
171
172 //DECLARE_EVENT_TABLE()
173 DECLARE_DYNAMIC_CLASS(wxComboBox)
174};
175
1e6feb95 176#endif // _WX_UNIV_COMBOBOX_H_