]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/combobox.h
No code changes, fixed various typos.
[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 : public wxControl, public wxComboBoxBase
29 {
30 DECLARE_DYNAMIC_CLASS(wxComboBox)
31
32 public:
33 virtual ~wxComboBox();
34
35 #if wxOSX_USE_CARBON
36 // forward these functions to all subcontrols
37 virtual bool Enable(bool enable = true);
38 virtual bool Show(bool show = true);
39 #endif
40
41 // callback functions
42 virtual void DelegateTextChanged( const wxString& value );
43 virtual void DelegateChoice( const wxString& value );
44
45 wxComboBox() { Init(); }
46
47 wxComboBox(wxWindow *parent, wxWindowID id,
48 const wxString& value = wxEmptyString,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 int n = 0, const wxString choices[] = NULL,
52 long style = 0,
53 const wxValidator& validator = wxDefaultValidator,
54 const wxString& name = wxComboBoxNameStr)
55 {
56 Init();
57 Create(parent, id, value, pos, size, n, choices, style, validator, name);
58 }
59
60 wxComboBox(wxWindow *parent, wxWindowID id,
61 const wxString& value,
62 const wxPoint& pos,
63 const wxSize& size,
64 const wxArrayString& choices,
65 long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxComboBoxNameStr)
68 {
69 Init();
70 Create(parent, id, value, pos, size, choices, style, validator, name);
71 }
72
73 bool Create(wxWindow *parent, wxWindowID id,
74 const wxString& value = wxEmptyString,
75 const wxPoint& pos = wxDefaultPosition,
76 const wxSize& size = wxDefaultSize,
77 int n = 0, const wxString choices[] = NULL,
78 long style = 0,
79 const wxValidator& validator = wxDefaultValidator,
80 const wxString& name = wxComboBoxNameStr);
81
82 bool Create(wxWindow *parent, wxWindowID id,
83 const wxString& value,
84 const wxPoint& pos,
85 const wxSize& size,
86 const wxArrayString& choices,
87 long style = 0,
88 const wxValidator& validator = wxDefaultValidator,
89 const wxString& name = wxComboBoxNameStr);
90
91 virtual int GetSelection() const;
92 virtual void GetSelection(long *from, long *to) const;
93 virtual void SetSelection(int n);
94 virtual void SetSelection(long from, long to);
95 virtual int FindString(const wxString& s, bool bCase = false) const;
96 virtual wxString GetString(unsigned int n) const;
97 virtual wxString GetStringSelection() const;
98 virtual void SetString(unsigned int n, const wxString& s);
99
100 virtual unsigned int GetCount() const;
101
102 // these methods are provided by wxTextEntry for the native impl.
103 #if wxOSX_USE_CARBON
104 // Text field functions
105 virtual void SetValue(const wxString& value);
106 virtual wxString GetValue() const;
107 virtual void WriteText(const wxString& text);
108
109 // Clipboard operations
110 virtual void Copy();
111 virtual void Cut();
112 virtual void Paste();
113 virtual void SetInsertionPoint(long pos);
114 virtual void SetInsertionPointEnd();
115 virtual long GetInsertionPoint() const;
116 virtual wxTextPos GetLastPosition() const;
117 virtual void Replace(long from, long to, const wxString& value);
118 virtual void Remove(long from, long to);
119 virtual void SetEditable(bool editable);
120 virtual bool IsEditable() const;
121
122 virtual void Undo();
123 virtual void Redo();
124 virtual void SelectAll();
125
126 virtual bool CanCopy() const;
127 virtual bool CanCut() const;
128 virtual bool CanPaste() const;
129 virtual bool CanUndo() const;
130 virtual bool CanRedo() const;
131
132 virtual wxClientDataType GetClientDataType() const;
133
134 virtual wxTextWidgetImpl* GetTextPeer() const;
135 #endif // wxOSX_USE_CARBON
136
137
138
139 // osx specific event handling common for all osx-ports
140
141 virtual bool OSXHandleClicked( double timestampsec );
142
143 #if wxOSX_USE_CARBON
144 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
145
146 WX_DECLARE_CONTROL_CONTAINER();
147 #endif
148
149 #if wxOSX_USE_COCOA
150 wxComboWidgetImpl* GetComboPeer() const;
151 #endif
152 protected:
153 // common part of all ctors
154 void Init();
155
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 #if wxOSX_USE_CARBON
192 DECLARE_EVENT_TABLE()
193 #endif
194 };
195
196 #endif // _WX_COMBOBOX_H_