]>
Commit | Line | Data |
---|---|---|
6762286d | 1 | ///////////////////////////////////////////////////////////////////////////// |
c84030e0 | 2 | // Name: wx/osx/combobox.h |
6762286d SC |
3 | // Purpose: wxComboBox class |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_COMBOBOX_H_ | |
13 | #define _WX_COMBOBOX_H_ | |
14 | ||
15 | #include "wx/containr.h" | |
16 | #include "wx/choice.h" | |
c84030e0 | 17 | #include "wx/textctrl.h" |
6762286d SC |
18 | |
19 | WXDLLIMPEXP_DATA_CORE(extern const char) wxComboBoxNameStr[]; | |
20 | ||
c84030e0 KO |
21 | WX_DEFINE_ARRAY( char * , wxComboBoxDataArray ) ; |
22 | ||
6762286d SC |
23 | // forward declaration of private implementation classes |
24 | ||
25 | class wxComboBoxText; | |
26 | class wxComboBoxChoice; | |
c84030e0 | 27 | class wxComboWidgetImpl; |
6762286d SC |
28 | |
29 | // Combobox item | |
30 | class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase | |
31 | { | |
32 | DECLARE_DYNAMIC_CLASS(wxComboBox) | |
33 | ||
34 | public: | |
35 | virtual ~wxComboBox(); | |
36 | ||
c84030e0 | 37 | #if wxOSX_USE_CARBON |
6762286d SC |
38 | // forward these functions to all subcontrols |
39 | virtual bool Enable(bool enable = true); | |
40 | virtual bool Show(bool show = true); | |
f941a30b | 41 | #endif |
6762286d SC |
42 | |
43 | // callback functions | |
44 | virtual void DelegateTextChanged( const wxString& value ); | |
45 | virtual void DelegateChoice( const wxString& value ); | |
46 | ||
47 | wxComboBox() { Init(); } | |
48 | ||
49 | wxComboBox(wxWindow *parent, wxWindowID id, | |
50 | const wxString& value = wxEmptyString, | |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | int n = 0, const wxString choices[] = NULL, | |
54 | long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxComboBoxNameStr) | |
57 | { | |
58 | Init(); | |
59 | Create(parent, id, value, pos, size, n, choices, style, validator, name); | |
60 | } | |
61 | ||
62 | wxComboBox(wxWindow *parent, wxWindowID id, | |
63 | const wxString& value, | |
64 | const wxPoint& pos, | |
65 | const wxSize& size, | |
66 | const wxArrayString& choices, | |
67 | long style = 0, | |
68 | const wxValidator& validator = wxDefaultValidator, | |
69 | const wxString& name = wxComboBoxNameStr) | |
70 | { | |
71 | Init(); | |
72 | Create(parent, id, value, pos, size, choices, style, validator, name); | |
73 | } | |
74 | ||
75 | bool Create(wxWindow *parent, wxWindowID id, | |
76 | const wxString& value = wxEmptyString, | |
77 | const wxPoint& pos = wxDefaultPosition, | |
78 | const wxSize& size = wxDefaultSize, | |
79 | int n = 0, const wxString choices[] = NULL, | |
80 | long style = 0, | |
81 | const wxValidator& validator = wxDefaultValidator, | |
82 | const wxString& name = wxComboBoxNameStr); | |
83 | ||
84 | bool Create(wxWindow *parent, wxWindowID id, | |
85 | const wxString& value, | |
86 | const wxPoint& pos, | |
87 | const wxSize& size, | |
88 | const wxArrayString& choices, | |
89 | long style = 0, | |
90 | const wxValidator& validator = wxDefaultValidator, | |
91 | const wxString& name = wxComboBoxNameStr); | |
92 | ||
93 | virtual int GetSelection() const; | |
c84030e0 | 94 | virtual void GetSelection(long *from, long *to) const; |
6762286d | 95 | virtual void SetSelection(int n); |
c84030e0 | 96 | virtual void SetSelection(long from, long to); |
6762286d SC |
97 | virtual int FindString(const wxString& s, bool bCase = false) const; |
98 | virtual wxString GetString(unsigned int n) const; | |
99 | virtual wxString GetStringSelection() const; | |
100 | virtual void SetString(unsigned int n, const wxString& s); | |
101 | ||
c84030e0 KO |
102 | virtual unsigned int GetCount() const; |
103 | ||
104 | // these methods are provided by wxTextEntry for the native impl. | |
105 | #if wxOSX_USE_CARBON | |
6762286d SC |
106 | // Text field functions |
107 | virtual void SetValue(const wxString& value); | |
108 | virtual wxString GetValue() const; | |
109 | virtual void WriteText(const wxString& text); | |
6762286d SC |
110 | |
111 | // Clipboard operations | |
112 | virtual void Copy(); | |
113 | virtual void Cut(); | |
114 | virtual void Paste(); | |
115 | virtual void SetInsertionPoint(long pos); | |
116 | virtual void SetInsertionPointEnd(); | |
117 | virtual long GetInsertionPoint() const; | |
118 | virtual wxTextPos GetLastPosition() const; | |
119 | virtual void Replace(long from, long to, const wxString& value); | |
120 | virtual void Remove(long from, long to); | |
6762286d SC |
121 | virtual void SetEditable(bool editable); |
122 | virtual bool IsEditable() const; | |
123 | ||
6762286d SC |
124 | virtual void Undo(); |
125 | virtual void Redo(); | |
126 | virtual void SelectAll(); | |
127 | ||
128 | virtual bool CanCopy() const; | |
129 | virtual bool CanCut() const; | |
130 | virtual bool CanPaste() const; | |
131 | virtual bool CanUndo() const; | |
132 | virtual bool CanRedo() const; | |
133 | ||
134 | virtual wxClientDataType GetClientDataType() const; | |
356fd0b5 VZ |
135 | |
136 | virtual wxTextWidgetImpl* GetTextPeer() const; | |
137 | #endif // wxOSX_USE_CARBON | |
c84030e0 KO |
138 | |
139 | ||
6762286d SC |
140 | |
141 | // osx specific event handling common for all osx-ports | |
00c89b22 | 142 | |
12b5f4b4 | 143 | virtual bool OSXHandleClicked( double timestampsec ); |
6762286d | 144 | |
c84030e0 | 145 | #if wxOSX_USE_CARBON |
6762286d SC |
146 | wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST |
147 | ||
148 | WX_DECLARE_CONTROL_CONTAINER(); | |
f941a30b | 149 | #endif |
6762286d | 150 | |
c84030e0 KO |
151 | #if wxOSX_USE_COCOA |
152 | wxComboWidgetImpl* GetComboPeer() const; | |
153 | #endif | |
6762286d SC |
154 | protected: |
155 | // common part of all ctors | |
156 | void Init(); | |
157 | ||
158 | // List functions | |
159 | virtual void DoDeleteOneItem(unsigned int n); | |
160 | virtual void DoClear(); | |
161 | ||
00c89b22 | 162 | // wxTextEntry functions |
c84030e0 | 163 | #if wxOSX_USE_CARBON |
00c89b22 | 164 | virtual wxString DoGetValue() const; |
c84030e0 | 165 | #endif |
00c89b22 VZ |
166 | virtual wxWindow *GetEditableWindow() { return this; } |
167 | ||
6762286d SC |
168 | // override the base class virtuals involved in geometry calculations |
169 | virtual wxSize DoGetBestSize() const; | |
5bd77105 | 170 | #if wxOSX_USE_CARBON |
6762286d | 171 | virtual void DoMoveWindow(int x, int y, int width, int height); |
f941a30b | 172 | #endif |
6762286d SC |
173 | |
174 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, | |
175 | unsigned int pos, | |
176 | void **clientData, wxClientDataType type); | |
177 | ||
178 | virtual void DoSetItemClientData(unsigned int n, void* clientData); | |
179 | virtual void * DoGetItemClientData(unsigned int n) const; | |
180 | ||
c84030e0 | 181 | #if wxOSX_USE_CARBON |
6762286d | 182 | virtual void SetClientDataType(wxClientDataType clientDataItemsType); |
c84030e0 | 183 | #endif |
6762286d | 184 | |
d9d551f6 SC |
185 | virtual void EnableTextChangedEvents(bool enable); |
186 | ||
6762286d SC |
187 | // the subcontrols |
188 | wxComboBoxText* m_text; | |
189 | wxComboBoxChoice* m_choice; | |
190 | ||
c84030e0 KO |
191 | wxComboBoxDataArray m_datas; |
192 | ||
193 | #if wxOSX_USE_CARBON | |
6762286d | 194 | DECLARE_EVENT_TABLE() |
f941a30b | 195 | #endif |
6762286d SC |
196 | }; |
197 | ||
198 | #endif // _WX_COMBOBOX_H_ |