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 // forward these functions to all subcontrols
34 virtual bool Enable(bool enable
= true);
35 virtual bool Show(bool show
= true);
38 virtual void DelegateTextChanged( const wxString
& value
);
39 virtual void DelegateChoice( const wxString
& value
);
41 wxComboBox() { Init(); }
43 wxComboBox(wxWindow
*parent
, wxWindowID id
,
44 const wxString
& value
= wxEmptyString
,
45 const wxPoint
& pos
= wxDefaultPosition
,
46 const wxSize
& size
= wxDefaultSize
,
47 int n
= 0, const wxString choices
[] = NULL
,
49 const wxValidator
& validator
= wxDefaultValidator
,
50 const wxString
& name
= wxComboBoxNameStr
)
53 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
56 wxComboBox(wxWindow
*parent
, wxWindowID id
,
57 const wxString
& value
,
60 const wxArrayString
& choices
,
62 const wxValidator
& validator
= wxDefaultValidator
,
63 const wxString
& name
= wxComboBoxNameStr
)
66 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
69 bool Create(wxWindow
*parent
, wxWindowID id
,
70 const wxString
& value
= wxEmptyString
,
71 const wxPoint
& pos
= wxDefaultPosition
,
72 const wxSize
& size
= wxDefaultSize
,
73 int n
= 0, const wxString choices
[] = NULL
,
75 const wxValidator
& validator
= wxDefaultValidator
,
76 const wxString
& name
= wxComboBoxNameStr
);
78 bool Create(wxWindow
*parent
, wxWindowID id
,
79 const wxString
& value
,
82 const wxArrayString
& choices
,
84 const wxValidator
& validator
= wxDefaultValidator
,
85 const wxString
& name
= wxComboBoxNameStr
);
87 virtual int GetSelection() const;
88 virtual void SetSelection(int n
);
89 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
90 virtual wxString
GetString(unsigned int n
) const;
91 virtual wxString
GetStringSelection() const;
92 virtual void SetString(unsigned int n
, const wxString
& s
);
94 // Text field functions
95 virtual void SetValue(const wxString
& value
);
96 virtual wxString
GetValue() const;
97 virtual void WriteText(const wxString
& text
);
98 virtual void GetSelection(long *from
, long *to
) const;
100 // Clipboard operations
103 virtual void Paste();
104 virtual void SetInsertionPoint(long pos
);
105 virtual void SetInsertionPointEnd();
106 virtual long GetInsertionPoint() const;
107 virtual wxTextPos
GetLastPosition() const;
108 virtual void Replace(long from
, long to
, const wxString
& value
);
109 virtual void Remove(long from
, long to
);
110 virtual void SetSelection(long from
, long to
);
111 virtual void SetEditable(bool editable
);
112 virtual bool IsEditable() const;
114 virtual unsigned int GetCount() const;
118 virtual void SelectAll();
120 virtual bool CanCopy() const;
121 virtual bool CanCut() const;
122 virtual bool CanPaste() const;
123 virtual bool CanUndo() const;
124 virtual bool CanRedo() const;
126 virtual wxClientDataType
GetClientDataType() const;
128 // osx specific event handling common for all osx-ports
130 virtual bool OSXHandleClicked( double timestampsec
);
132 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
134 WX_DECLARE_CONTROL_CONTAINER();
137 // common part of all ctors
141 virtual void DoDeleteOneItem(unsigned int n
);
142 virtual void DoClear();
144 // wxTextEntry functions
145 virtual wxString
DoGetValue() const;
146 virtual wxWindow
*GetEditableWindow() { return this; }
148 // override the base class virtuals involved in geometry calculations
149 virtual wxSize
DoGetBestSize() const;
150 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
152 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
154 void **clientData
, wxClientDataType type
);
156 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
157 virtual void * DoGetItemClientData(unsigned int n
) const;
159 virtual void SetClientDataType(wxClientDataType clientDataItemsType
);
161 virtual void EnableTextChangedEvents(bool enable
);
164 wxComboBoxText
* m_text
;
165 wxComboBoxChoice
* m_choice
;
167 DECLARE_EVENT_TABLE()
170 #endif // _WX_COMBOBOX_H_