1 /////////////////////////////////////////////////////////////////////////////
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "combobox.h"
19 #include "wx/textctrl.h"
20 #include "wx/choice.h"
22 WXDLLEXPORT_DATA(extern const wxChar
*) wxComboBoxNameStr
;
24 // forward declaration of private implementation classes
26 class wxComboBoxText
;
27 class wxComboBoxChoice
;
30 class WXDLLEXPORT wxComboBox
: public wxControl
, public wxComboBoxBase
32 DECLARE_DYNAMIC_CLASS(wxComboBox
)
35 inline wxComboBox() {}
36 virtual ~wxComboBox();
37 // override the base class virtuals involved in geometry calculations
38 virtual wxSize
DoGetBestSize() const;
39 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
41 // forward these functions to all subcontrols
42 virtual bool Enable(bool enable
= TRUE
);
43 virtual bool Show(bool show
= TRUE
);
44 virtual void SetFocus();
47 virtual void DelegateTextChanged( const wxString
& value
);
48 virtual void DelegateChoice( const wxString
& value
);
50 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
51 const wxString
& value
= wxEmptyString
,
52 const wxPoint
& pos
= wxDefaultPosition
,
53 const wxSize
& size
= wxDefaultSize
,
54 int n
= 0, const wxString choices
[] = NULL
,
56 const wxValidator
& validator
= wxDefaultValidator
,
57 const wxString
& name
= wxComboBoxNameStr
)
59 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
61 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
62 const wxString
& value
,
65 const wxArrayString
& choices
,
67 const wxValidator
& validator
= wxDefaultValidator
,
68 const wxString
& name
= wxComboBoxNameStr
)
70 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
73 bool Create(wxWindow
*parent
, wxWindowID id
,
74 const wxString
& value
= wxEmptyString
,
75 const wxPoint
& pos
= wxDefaultPosition
,
76 const wxSize
& size
= wxDefaultSize
,
77 int n
= 0, const wxString choices
[] = NULL
,
79 const wxValidator
& validator
= wxDefaultValidator
,
80 const wxString
& name
= wxComboBoxNameStr
);
81 bool Create(wxWindow
*parent
, wxWindowID id
,
82 const wxString
& value
,
85 const wxArrayString
& choices
,
87 const wxValidator
& validator
= wxDefaultValidator
,
88 const wxString
& name
= wxComboBoxNameStr
);
91 virtual void Delete(int n
);
94 virtual int GetSelection() const ;
95 virtual void SetSelection(int n
);
96 virtual void Select(int n
) { SetSelection(n
) ; }
97 virtual int FindString(const wxString
& s
) const;
98 virtual wxString
GetString(int n
) const ;
99 virtual wxString
GetStringSelection() const ;
100 virtual void SetString(int n
, const wxString
& s
) ;
101 virtual bool SetStringSelection(const wxString
& sel
);
103 // Text field functions
104 virtual wxString
GetValue() const ;
105 virtual void SetValue(const wxString
& value
);
107 // Clipboard operations
110 virtual void Paste();
111 virtual void SetInsertionPoint(long pos
);
112 virtual void SetInsertionPointEnd();
113 virtual long GetInsertionPoint() const ;
114 virtual long GetLastPosition() const ;
115 virtual void Replace(long from
, long to
, const wxString
& value
);
116 virtual void Remove(long from
, long to
);
117 virtual void SetSelection(long from
, long to
);
118 virtual void SetEditable(bool editable
);
119 virtual int GetCount() const ;
121 virtual bool IsEditable() const ;
123 virtual void Undo() ;
124 virtual void Redo() ;
125 virtual void SelectAll() ;
127 virtual bool CanCopy() const ;
128 virtual bool CanCut() const ;
129 virtual bool CanPaste() const ;
130 virtual bool CanUndo() const ;
131 virtual bool CanRedo() const ;
133 wxInt32
MacControlHit( WXEVENTHANDLERREF handler
, WXEVENTREF event
) ;
135 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
138 virtual int DoAppend(const wxString
& item
) ;
139 virtual int DoInsert(const wxString
& item
, int pos
) ;
141 virtual void DoSetItemClientData(int n
, void* clientData
) ;
142 virtual void* DoGetItemClientData(int n
) const ;
143 virtual void DoSetItemClientObject(int n
, wxClientData
* clientData
) ;
144 virtual wxClientData
* DoGetItemClientObject(int n
) const ;
149 wxComboBoxText
* m_text
;
150 wxComboBoxChoice
* m_choice
;