1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/combobox.h
3 // Purpose: wxComboBox class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_COMBOBOX_H_
13 #define _WX_COMBOBOX_H_
15 #include "wx/containr.h"
16 #include "wx/choice.h"
17 #include "wx/textctrl.h"
19 WX_DEFINE_ARRAY( char * , wxComboBoxDataArray
) ;
21 // forward declaration of private implementation classes
24 class wxComboBoxChoice
;
25 class wxComboWidgetImpl
;
28 class WXDLLIMPEXP_CORE wxComboBox
: public wxControl
, public wxComboBoxBase
30 DECLARE_DYNAMIC_CLASS(wxComboBox
)
33 virtual ~wxComboBox();
36 // forward these functions to all subcontrols
37 virtual bool Enable(bool enable
= true);
38 virtual bool Show(bool show
= true);
42 virtual void DelegateTextChanged( const wxString
& value
);
43 virtual void DelegateChoice( const wxString
& value
);
45 wxComboBox() { Init(); }
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
,
53 const wxValidator
& validator
= wxDefaultValidator
,
54 const wxString
& name
= wxComboBoxNameStr
)
57 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
60 wxComboBox(wxWindow
*parent
, wxWindowID id
,
61 const wxString
& value
,
64 const wxArrayString
& choices
,
66 const wxValidator
& validator
= wxDefaultValidator
,
67 const wxString
& name
= wxComboBoxNameStr
)
70 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
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
,
79 const wxValidator
& validator
= wxDefaultValidator
,
80 const wxString
& name
= wxComboBoxNameStr
);
82 bool Create(wxWindow
*parent
, wxWindowID id
,
83 const wxString
& value
,
86 const wxArrayString
& choices
,
88 const wxValidator
& validator
= wxDefaultValidator
,
89 const wxString
& name
= wxComboBoxNameStr
);
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
);
100 virtual unsigned int GetCount() const;
102 // these methods are provided by wxTextEntry for the native impl.
104 // Text field functions
105 virtual void SetValue(const wxString
& value
);
106 virtual wxString
GetValue() const;
107 virtual void WriteText(const wxString
& text
);
109 // Clipboard operations
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;
124 virtual void SelectAll();
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;
132 virtual wxClientDataType
GetClientDataType() const;
134 virtual wxTextWidgetImpl
* GetTextPeer() const;
135 #endif // wxOSX_USE_CARBON
139 // osx specific event handling common for all osx-ports
141 virtual bool OSXHandleClicked( double timestampsec
);
144 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
146 WX_DECLARE_CONTROL_CONTAINER();
150 wxComboWidgetImpl
* GetComboPeer() const;
153 // common part of all ctors
157 virtual void DoDeleteOneItem(unsigned int n
);
158 virtual void DoClear();
160 // wxTextEntry functions
162 virtual wxString
DoGetValue() const;
164 virtual wxWindow
*GetEditableWindow() { return this; }
166 // override the base class virtuals involved in geometry calculations
167 virtual wxSize
DoGetBestSize() const;
169 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
172 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
174 void **clientData
, wxClientDataType type
);
176 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
177 virtual void * DoGetItemClientData(unsigned int n
) const;
180 virtual void SetClientDataType(wxClientDataType clientDataItemsType
);
183 virtual void EnableTextChangedEvents(bool enable
);
186 wxComboBoxText
* m_text
;
187 wxComboBoxChoice
* m_choice
;
189 wxComboBoxDataArray m_datas
;
192 DECLARE_EVENT_TABLE()
196 #endif // _WX_COMBOBOX_H_