]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/combobox.h
Fix compilation in !wxUSE_LOG_DEBUG && !HAVE_VARIADIC_MACROS case.
[wxWidgets.git] / include / wx / osx / combobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/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 #include "wx/textctrl.h"
18
19 WX_DEFINE_ARRAY( char * , wxComboBoxDataArray ) ;
20
21 // forward declaration of private implementation classes
22
23 class wxComboBoxText;
24 class wxComboBoxChoice;
25 class wxComboWidgetImpl;
26
27 // Combobox item
28 class WXDLLIMPEXP_CORE wxComboBox :
29 public wxWindowWithItems<
30 #if wxOSX_USE_CARBON
31 wxNavigationEnabled<wxControl>,
32 #else
33 wxControl,
34 #endif
35 wxComboBoxBase>
36 {
37 DECLARE_DYNAMIC_CLASS(wxComboBox)
38
39 public:
40 virtual ~wxComboBox();
41
42 #if wxOSX_USE_CARBON
43 // forward these functions to all subcontrols
44 virtual bool Enable(bool enable = true);
45 virtual bool Show(bool show = true);
46 #endif
47
48 // callback functions
49 virtual void DelegateTextChanged( const wxString& value );
50 virtual void DelegateChoice( const wxString& value );
51
52 wxComboBox() { }
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 {
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 {
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;
97 virtual void GetSelection(long *from, long *to) const;
98 virtual void SetSelection(int n);
99 virtual void SetSelection(long from, long to);
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
105 virtual unsigned int GetCount() const;
106
107 // these methods are provided by wxTextEntry for the native impl.
108 #if wxOSX_USE_CARBON
109 // Text field functions
110 virtual void SetValue(const wxString& value);
111 virtual wxString GetValue() const;
112 virtual void WriteText(const wxString& text);
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);
124 virtual void SetEditable(bool editable);
125 virtual bool IsEditable() const;
126
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;
138
139 virtual wxTextWidgetImpl* GetTextPeer() const;
140 #endif // wxOSX_USE_CARBON
141
142 #if wxOSX_USE_COCOA
143 virtual void Popup();
144 virtual void Dismiss();
145 #endif // wxOSX_USE_COCOA
146
147
148 // osx specific event handling common for all osx-ports
149
150 virtual bool OSXHandleClicked( double timestampsec );
151
152 #if wxOSX_USE_COCOA
153 wxComboWidgetImpl* GetComboPeer() const;
154 #endif
155 protected:
156 // List functions
157 virtual void DoDeleteOneItem(unsigned int n);
158 virtual void DoClear();
159
160 // wxTextEntry functions
161 #if wxOSX_USE_CARBON
162 virtual wxString DoGetValue() const;
163 #endif
164 virtual wxWindow *GetEditableWindow() { return this; }
165
166 // override the base class virtuals involved in geometry calculations
167 virtual wxSize DoGetBestSize() const;
168 #if wxOSX_USE_CARBON
169 virtual void DoMoveWindow(int x, int y, int width, int height);
170 #endif
171
172 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
173 unsigned int pos,
174 void **clientData, wxClientDataType type);
175
176 virtual void DoSetItemClientData(unsigned int n, void* clientData);
177 virtual void * DoGetItemClientData(unsigned int n) const;
178
179 #if wxOSX_USE_CARBON
180 virtual void SetClientDataType(wxClientDataType clientDataItemsType);
181 #endif
182
183 virtual void EnableTextChangedEvents(bool enable);
184
185 // the subcontrols
186 wxComboBoxText* m_text;
187 wxComboBoxChoice* m_choice;
188
189 wxComboBoxDataArray m_datas;
190 };
191
192 #endif // _WX_COMBOBOX_H_