]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/combobox.h
Auto complete file names in the text controls of wx{File,Dir}PickerCtrl.
[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
143
144 // osx specific event handling common for all osx-ports
145
146 virtual bool OSXHandleClicked( double timestampsec );
147
148 #if wxOSX_USE_COCOA
149 wxComboWidgetImpl* GetComboPeer() const;
150 #endif
151 protected:
152 // List functions
153 virtual void DoDeleteOneItem(unsigned int n);
154 virtual void DoClear();
155
156 // wxTextEntry functions
157 #if wxOSX_USE_CARBON
158 virtual wxString DoGetValue() const;
159 #endif
160 virtual wxWindow *GetEditableWindow() { return this; }
161
162 // override the base class virtuals involved in geometry calculations
163 virtual wxSize DoGetBestSize() const;
164 #if wxOSX_USE_CARBON
165 virtual void DoMoveWindow(int x, int y, int width, int height);
166 #endif
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
175 #if wxOSX_USE_CARBON
176 virtual void SetClientDataType(wxClientDataType clientDataItemsType);
177 #endif
178
179 virtual void EnableTextChangedEvents(bool enable);
180
181 // the subcontrols
182 wxComboBoxText* m_text;
183 wxComboBoxChoice* m_choice;
184
185 wxComboBoxDataArray m_datas;
186 };
187
188 #endif // _WX_COMBOBOX_H_