1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/carbon/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"
18 WXDLLIMPEXP_DATA_CORE(extern const char) wxComboBoxNameStr
[];
20 // forward declaration of private implementation classes
23 class wxComboBoxChoice
;
26 class WXDLLIMPEXP_CORE wxComboBox
: public wxControl
, public wxComboBoxBase
28 DECLARE_DYNAMIC_CLASS(wxComboBox
)
31 virtual ~wxComboBox();
33 #ifndef wxOSX_USE_NATIVE_COMBOBOX
34 // forward these functions to all subcontrols
35 virtual bool Enable(bool enable
= true);
36 virtual bool Show(bool show
= true);
40 virtual void DelegateTextChanged( const wxString
& value
);
41 virtual void DelegateChoice( const wxString
& value
);
43 wxComboBox() { Init(); }
45 wxComboBox(wxWindow
*parent
, wxWindowID id
,
46 const wxString
& value
= wxEmptyString
,
47 const wxPoint
& pos
= wxDefaultPosition
,
48 const wxSize
& size
= wxDefaultSize
,
49 int n
= 0, const wxString choices
[] = NULL
,
51 const wxValidator
& validator
= wxDefaultValidator
,
52 const wxString
& name
= wxComboBoxNameStr
)
55 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
58 wxComboBox(wxWindow
*parent
, wxWindowID id
,
59 const wxString
& value
,
62 const wxArrayString
& choices
,
64 const wxValidator
& validator
= wxDefaultValidator
,
65 const wxString
& name
= wxComboBoxNameStr
)
68 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
71 bool Create(wxWindow
*parent
, wxWindowID id
,
72 const wxString
& value
= wxEmptyString
,
73 const wxPoint
& pos
= wxDefaultPosition
,
74 const wxSize
& size
= wxDefaultSize
,
75 int n
= 0, const wxString choices
[] = NULL
,
77 const wxValidator
& validator
= wxDefaultValidator
,
78 const wxString
& name
= wxComboBoxNameStr
);
80 bool Create(wxWindow
*parent
, wxWindowID id
,
81 const wxString
& value
,
84 const wxArrayString
& choices
,
86 const wxValidator
& validator
= wxDefaultValidator
,
87 const wxString
& name
= wxComboBoxNameStr
);
89 virtual int GetSelection() const;
90 virtual void SetSelection(int n
);
91 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
92 virtual wxString
GetString(unsigned int n
) const;
93 virtual wxString
GetStringSelection() const;
94 virtual void SetString(unsigned int n
, const wxString
& s
);
96 // Text field functions
97 virtual void SetValue(const wxString
& value
);
98 virtual wxString
GetValue() const;
99 virtual void WriteText(const wxString
& text
);
100 virtual void GetSelection(long *from
, long *to
) const;
102 // Clipboard operations
105 virtual void Paste();
106 virtual void SetInsertionPoint(long pos
);
107 virtual void SetInsertionPointEnd();
108 virtual long GetInsertionPoint() const;
109 virtual wxTextPos
GetLastPosition() const;
110 virtual void Replace(long from
, long to
, const wxString
& value
);
111 virtual void Remove(long from
, long to
);
112 virtual void SetSelection(long from
, long to
);
113 virtual void SetEditable(bool editable
);
114 virtual bool IsEditable() const;
116 virtual unsigned int GetCount() const;
120 virtual void SelectAll();
122 virtual bool CanCopy() const;
123 virtual bool CanCut() const;
124 virtual bool CanPaste() const;
125 virtual bool CanUndo() const;
126 virtual bool CanRedo() const;
128 virtual wxClientDataType
GetClientDataType() const;
130 // osx specific event handling common for all osx-ports
132 virtual bool OSXHandleClicked( double timestampsec
);
134 #ifndef wxOSX_USE_NATIVE_COMBOBOX
135 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
137 WX_DECLARE_CONTROL_CONTAINER();
141 // common part of all ctors
145 virtual void DoDeleteOneItem(unsigned int n
);
146 virtual void DoClear();
148 // wxTextEntry functions
149 virtual wxString
DoGetValue() const;
150 virtual wxWindow
*GetEditableWindow() { return this; }
152 #ifndef wxOSX_USE_NATIVE_COMBOBOX
153 // override the base class virtuals involved in geometry calculations
154 virtual wxSize
DoGetBestSize() const;
155 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
158 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
160 void **clientData
, wxClientDataType type
);
162 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
163 virtual void * DoGetItemClientData(unsigned int n
) const;
165 virtual void SetClientDataType(wxClientDataType clientDataItemsType
);
167 virtual void EnableTextChangedEvents(bool enable
);
170 wxComboBoxText
* m_text
;
171 wxComboBoxChoice
* m_choice
;
173 #ifndef wxOSX_USE_NATIVE_COMBOBOX
174 DECLARE_EVENT_TABLE()
178 #endif // _WX_COMBOBOX_H_