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 WXDLLEXPORT_DATA(extern const wxChar
) wxComboBoxNameStr
[];
20 // forward declaration of private implementation classes
22 class wxComboBoxText
;
23 class wxComboBoxChoice
;
26 class WXDLLEXPORT 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
);
88 virtual void Delete(int n
);
91 virtual int GetSelection() const ;
92 int GetCurrentSelection() const { return GetSelection(); }
93 virtual void SetSelection(int n
);
94 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
95 virtual wxString
GetString(int n
) const ;
96 virtual wxString
GetStringSelection() const ;
97 virtual void SetString(int n
, const wxString
& s
) ;
99 // Text field functions
100 virtual wxString
GetValue() const ;
101 virtual void SetValue(const wxString
& value
);
103 // Clipboard operations
106 virtual void Paste();
107 virtual void SetInsertionPoint(long pos
);
108 virtual void SetInsertionPointEnd();
109 virtual long GetInsertionPoint() const ;
110 virtual wxTextPos
GetLastPosition() const ;
111 virtual void Replace(long from
, long to
, const wxString
& value
);
112 virtual void Remove(long from
, long to
);
113 virtual void SetSelection(long from
, long to
);
114 virtual void SetEditable(bool editable
);
115 virtual int GetCount() const ;
117 virtual bool IsEditable() const ;
119 virtual void Undo() ;
120 virtual void Redo() ;
121 virtual void SelectAll() ;
123 virtual bool CanCopy() const ;
124 virtual bool CanCut() const ;
125 virtual bool CanPaste() const ;
126 virtual bool CanUndo() const ;
127 virtual bool CanRedo() const ;
129 wxInt32
MacControlHit( WXEVENTHANDLERREF handler
, WXEVENTREF event
) ;
131 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
133 WX_DECLARE_CONTROL_CONTAINER();
135 // override the base class virtuals involved in geometry calculations
136 virtual wxSize
DoGetBestSize() const;
137 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
139 // common part of all ctors
142 virtual int DoAppend(const wxString
& item
) ;
143 virtual int DoInsert(const wxString
& item
, int pos
) ;
145 virtual void DoSetItemClientData(int n
, void* clientData
) ;
146 virtual void* DoGetItemClientData(int n
) const ;
147 virtual void DoSetItemClientObject(int n
, wxClientData
* clientData
) ;
148 virtual wxClientData
* DoGetItemClientObject(int n
) const ;
153 wxComboBoxText
* m_text
;
154 wxComboBoxChoice
* m_choice
;
156 DECLARE_EVENT_TABLE()