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