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