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/choice.h"
17 WXDLLEXPORT_DATA(extern const wxChar
) wxComboBoxNameStr
[];
19 // forward declaration of private implementation classes
21 class wxComboBoxText
;
22 class wxComboBoxChoice
;
25 class WXDLLEXPORT wxComboBox
: public wxControl
, public wxComboBoxBase
27 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 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
42 const wxString
& value
= wxEmptyString
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 const wxSize
& size
= wxDefaultSize
,
45 int n
= 0, const wxString choices
[] = NULL
,
47 const wxValidator
& validator
= wxDefaultValidator
,
48 const wxString
& name
= wxComboBoxNameStr
)
50 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
52 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
53 const wxString
& value
,
56 const wxArrayString
& choices
,
58 const wxValidator
& validator
= wxDefaultValidator
,
59 const wxString
& name
= wxComboBoxNameStr
)
61 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
64 bool Create(wxWindow
*parent
, wxWindowID id
,
65 const wxString
& value
= wxEmptyString
,
66 const wxPoint
& pos
= wxDefaultPosition
,
67 const wxSize
& size
= wxDefaultSize
,
68 int n
= 0, const wxString choices
[] = NULL
,
70 const wxValidator
& validator
= wxDefaultValidator
,
71 const wxString
& name
= wxComboBoxNameStr
);
72 bool Create(wxWindow
*parent
, wxWindowID id
,
73 const wxString
& value
,
76 const wxArrayString
& choices
,
78 const wxValidator
& validator
= wxDefaultValidator
,
79 const wxString
& name
= wxComboBoxNameStr
);
82 virtual void Delete(int n
);
85 virtual int GetSelection() const ;
86 int GetCurrentSelection() const { return GetSelection(); }
87 virtual void SetSelection(int n
);
88 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
89 virtual wxString
GetString(int n
) const ;
90 virtual wxString
GetStringSelection() const ;
91 virtual void SetString(int n
, const wxString
& s
) ;
93 // Text field functions
94 virtual wxString
GetValue() const ;
95 virtual void SetValue(const wxString
& value
);
97 // Clipboard operations
100 virtual void Paste();
101 virtual void SetInsertionPoint(long pos
);
102 virtual void SetInsertionPointEnd();
103 virtual long GetInsertionPoint() const ;
104 virtual wxTextPos
GetLastPosition() const ;
105 virtual void Replace(long from
, long to
, const wxString
& value
);
106 virtual void Remove(long from
, long to
);
107 virtual void SetSelection(long from
, long to
);
108 virtual void SetEditable(bool editable
);
109 virtual int GetCount() const ;
111 virtual bool IsEditable() const ;
113 virtual void Undo() ;
114 virtual void Redo() ;
115 virtual void SelectAll() ;
117 virtual bool CanCopy() const ;
118 virtual bool CanCut() const ;
119 virtual bool CanPaste() const ;
120 virtual bool CanUndo() const ;
121 virtual bool CanRedo() const ;
123 wxInt32
MacControlHit( WXEVENTHANDLERREF handler
, WXEVENTREF event
) ;
125 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
127 WX_DECLARE_CONTROL_CONTAINER();
129 // override the base class virtuals involved in geometry calculations
130 virtual wxSize
DoGetBestSize() const;
131 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
133 virtual int DoAppend(const wxString
& item
) ;
134 virtual int DoInsert(const wxString
& item
, int pos
) ;
136 virtual void DoSetItemClientData(int n
, void* clientData
) ;
137 virtual void* DoGetItemClientData(int n
) const ;
138 virtual void DoSetItemClientObject(int n
, wxClientData
* clientData
) ;
139 virtual wxClientData
* DoGetItemClientObject(int n
) const ;
144 wxComboBoxText
* m_text
;
145 wxComboBoxChoice
* m_choice
;
147 DECLARE_EVENT_TABLE()