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
:
29 public wxWindowWithItems
<
31 wxNavigationEnabled
<wxControl
>,
37 DECLARE_DYNAMIC_CLASS(wxComboBox
)
40 virtual ~wxComboBox();
43 // forward these functions to all subcontrols
44 virtual bool Enable(bool enable
= true);
45 virtual bool Show(bool show
= true);
49 virtual void DelegateTextChanged( const wxString
& value
);
50 virtual void DelegateChoice( const wxString
& value
);
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
,
60 const wxValidator
& validator
= wxDefaultValidator
,
61 const wxString
& name
= wxComboBoxNameStr
)
63 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
66 wxComboBox(wxWindow
*parent
, wxWindowID id
,
67 const wxString
& value
,
70 const wxArrayString
& choices
,
72 const wxValidator
& validator
= wxDefaultValidator
,
73 const wxString
& name
= wxComboBoxNameStr
)
75 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
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
,
84 const wxValidator
& validator
= wxDefaultValidator
,
85 const wxString
& name
= wxComboBoxNameStr
);
87 bool Create(wxWindow
*parent
, wxWindowID id
,
88 const wxString
& value
,
91 const wxArrayString
& choices
,
93 const wxValidator
& validator
= wxDefaultValidator
,
94 const wxString
& name
= wxComboBoxNameStr
);
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
);
105 virtual unsigned int GetCount() const;
107 // these methods are provided by wxTextEntry for the native impl.
109 // Text field functions
110 virtual void SetValue(const wxString
& value
);
111 virtual wxString
GetValue() const;
112 virtual void WriteText(const wxString
& text
);
114 // Clipboard operations
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;
129 virtual void SelectAll();
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;
137 virtual wxClientDataType
GetClientDataType() const;
139 virtual wxTextWidgetImpl
* GetTextPeer() const;
140 #endif // wxOSX_USE_CARBON
143 virtual void Popup();
144 virtual void Dismiss();
145 #endif // wxOSX_USE_COCOA
148 // osx specific event handling common for all osx-ports
150 virtual bool OSXHandleClicked( double timestampsec
);
153 wxComboWidgetImpl
* GetComboPeer() const;
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 #endif // _WX_COMBOBOX_H_