]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/combobox.h
going private for m_peer to give a foundation for better encapsulation
[wxWidgets.git] / include / wx / osx / combobox.h
CommitLineData
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
19WX_DEFINE_ARRAY( char * , wxComboBoxDataArray ) ;
20
6762286d
SC
21// forward declaration of private implementation classes
22
23class wxComboBoxText;
24class wxComboBoxChoice;
c84030e0 25class wxComboWidgetImpl;
6762286d
SC
26
27// Combobox item
28class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase
29{
30 DECLARE_DYNAMIC_CLASS(wxComboBox)
31
32 public:
33 virtual ~wxComboBox();
34
c84030e0 35#if wxOSX_USE_CARBON
6762286d
SC
36 // forward these functions to all subcontrols
37 virtual bool Enable(bool enable = true);
38 virtual bool Show(bool show = true);
f941a30b 39#endif
6762286d
SC
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;
c84030e0 92 virtual void GetSelection(long *from, long *to) const;
6762286d 93 virtual void SetSelection(int n);
c84030e0 94 virtual void SetSelection(long from, long to);
6762286d
SC
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
c84030e0 100 virtual unsigned int GetCount() const;
ce00f59b 101
c84030e0
KO
102// these methods are provided by wxTextEntry for the native impl.
103#if wxOSX_USE_CARBON
6762286d
SC
104 // Text field functions
105 virtual void SetValue(const wxString& value);
106 virtual wxString GetValue() const;
107 virtual void WriteText(const wxString& text);
6762286d
SC
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);
6762286d
SC
119 virtual void SetEditable(bool editable);
120 virtual bool IsEditable() const;
121
6762286d
SC
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;
356fd0b5
VZ
133
134 virtual wxTextWidgetImpl* GetTextPeer() const;
135#endif // wxOSX_USE_CARBON
c84030e0
KO
136
137
6762286d
SC
138
139 // osx specific event handling common for all osx-ports
00c89b22 140
12b5f4b4 141 virtual bool OSXHandleClicked( double timestampsec );
6762286d 142
c84030e0 143#if wxOSX_USE_CARBON
6762286d
SC
144 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
145
146 WX_DECLARE_CONTROL_CONTAINER();
f941a30b 147#endif
6762286d 148
c84030e0
KO
149#if wxOSX_USE_COCOA
150 wxComboWidgetImpl* GetComboPeer() const;
151#endif
6762286d
SC
152protected:
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
00c89b22 160 // wxTextEntry functions
c84030e0 161#if wxOSX_USE_CARBON
00c89b22 162 virtual wxString DoGetValue() const;
c84030e0 163#endif
00c89b22
VZ
164 virtual wxWindow *GetEditableWindow() { return this; }
165
6762286d
SC
166 // override the base class virtuals involved in geometry calculations
167 virtual wxSize DoGetBestSize() const;
5bd77105 168#if wxOSX_USE_CARBON
6762286d 169 virtual void DoMoveWindow(int x, int y, int width, int height);
f941a30b 170#endif
6762286d
SC
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
c84030e0 179#if wxOSX_USE_CARBON
6762286d 180 virtual void SetClientDataType(wxClientDataType clientDataItemsType);
c84030e0 181#endif
6762286d 182
d9d551f6
SC
183 virtual void EnableTextChangedEvents(bool enable);
184
6762286d
SC
185 // the subcontrols
186 wxComboBoxText* m_text;
187 wxComboBoxChoice* m_choice;
188
c84030e0
KO
189 wxComboBoxDataArray m_datas;
190
191#if wxOSX_USE_CARBON
6762286d 192 DECLARE_EVENT_TABLE()
f941a30b 193#endif
6762286d
SC
194};
195
196#endif // _WX_COMBOBOX_H_