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