1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/combobox.h
3 // Purpose: wxComboBox class
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_COMBOBOX_H_
12 #define _WX_COMBOBOX_H_
14 #include "wx/containr.h"
15 #include "wx/choice.h"
16 #include "wx/textctrl.h"
18 WX_DEFINE_ARRAY( char * , wxComboBoxDataArray
) ;
20 // forward declaration of private implementation classes
23 class wxComboBoxChoice
;
24 class wxComboWidgetImpl
;
27 class WXDLLIMPEXP_CORE wxComboBox
:
28 public wxWindowWithItems
<
30 wxNavigationEnabled
<wxControl
>,
36 DECLARE_DYNAMIC_CLASS(wxComboBox
)
39 virtual ~wxComboBox();
42 // forward these functions to all subcontrols
43 virtual bool Enable(bool enable
= true);
44 virtual bool Show(bool show
= true);
48 virtual void DelegateTextChanged( const wxString
& value
);
49 virtual void DelegateChoice( const wxString
& value
);
53 wxComboBox(wxWindow
*parent
, wxWindowID id
,
54 const wxString
& value
= wxEmptyString
,
55 const wxPoint
& pos
= wxDefaultPosition
,
56 const wxSize
& size
= wxDefaultSize
,
57 int n
= 0, const wxString choices
[] = NULL
,
59 const wxValidator
& validator
= wxDefaultValidator
,
60 const wxString
& name
= wxComboBoxNameStr
)
62 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
65 wxComboBox(wxWindow
*parent
, wxWindowID id
,
66 const wxString
& value
,
69 const wxArrayString
& choices
,
71 const wxValidator
& validator
= wxDefaultValidator
,
72 const wxString
& name
= wxComboBoxNameStr
)
74 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
77 bool Create(wxWindow
*parent
, wxWindowID id
,
78 const wxString
& value
= wxEmptyString
,
79 const wxPoint
& pos
= wxDefaultPosition
,
80 const wxSize
& size
= wxDefaultSize
,
81 int n
= 0, const wxString choices
[] = NULL
,
83 const wxValidator
& validator
= wxDefaultValidator
,
84 const wxString
& name
= wxComboBoxNameStr
);
86 bool Create(wxWindow
*parent
, wxWindowID id
,
87 const wxString
& value
,
90 const wxArrayString
& choices
,
92 const wxValidator
& validator
= wxDefaultValidator
,
93 const wxString
& name
= wxComboBoxNameStr
);
95 virtual int GetSelection() const;
96 virtual void GetSelection(long *from
, long *to
) const;
97 virtual void SetSelection(int n
);
98 virtual void SetSelection(long from
, long to
);
99 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
100 virtual wxString
GetString(unsigned int n
) const;
101 virtual wxString
GetStringSelection() const;
102 virtual void SetString(unsigned int n
, const wxString
& s
);
104 virtual unsigned int GetCount() const;
106 virtual void SetValue(const wxString
& value
);
107 // these methods are provided by wxTextEntry for the native impl.
109 // Text field functions
110 virtual wxString
GetValue() const;
111 virtual void WriteText(const wxString
& text
);
113 // Clipboard operations
116 virtual void Paste();
117 virtual void SetInsertionPoint(long pos
);
118 virtual void SetInsertionPointEnd();
119 virtual long GetInsertionPoint() const;
120 virtual wxTextPos
GetLastPosition() const;
121 virtual void Replace(long from
, long to
, const wxString
& value
);
122 virtual void Remove(long from
, long to
);
123 virtual void SetEditable(bool editable
);
124 virtual bool IsEditable() const;
128 virtual void SelectAll();
130 virtual bool CanCopy() const;
131 virtual bool CanCut() const;
132 virtual bool CanPaste() const;
133 virtual bool CanUndo() const;
134 virtual bool CanRedo() const;
136 virtual wxClientDataType
GetClientDataType() const;
138 virtual wxTextWidgetImpl
* GetTextPeer() const;
139 #endif // wxOSX_USE_CARBON
142 virtual void Popup();
143 virtual void Dismiss();
144 #endif // wxOSX_USE_COCOA
147 // osx specific event handling common for all osx-ports
149 virtual bool OSXHandleClicked( double timestampsec
);
152 wxComboWidgetImpl
* GetComboPeer() const;
156 virtual void DoDeleteOneItem(unsigned int n
);
157 virtual void DoClear();
159 // wxTextEntry functions
161 virtual wxString
DoGetValue() const;
163 virtual wxWindow
*GetEditableWindow() { return this; }
165 // override the base class virtuals involved in geometry calculations
166 virtual wxSize
DoGetBestSize() const;
168 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
171 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
173 void **clientData
, wxClientDataType type
);
175 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
176 virtual void * DoGetItemClientData(unsigned int n
) const;
179 virtual void SetClientDataType(wxClientDataType clientDataItemsType
);
182 virtual void EnableTextChangedEvents(bool enable
);
185 wxComboBoxText
* m_text
;
186 wxComboBoxChoice
* m_choice
;
188 wxComboBoxDataArray m_datas
;
191 #endif // _WX_COMBOBOX_H_