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/choice.h"
21 WXDLLEXPORT_DATA(extern const wxChar
*) wxComboBoxNameStr
;
24 class WXDLLEXPORT wxComboBox
: public wxControl
, public wxComboBoxBase
26 DECLARE_DYNAMIC_CLASS(wxComboBox
)
29 inline wxComboBox() {}
30 virtual ~wxComboBox();
31 // override the base class virtuals involved in geometry calculations
32 virtual wxSize
DoGetBestSize() const;
33 virtual void DoMoveWindow(int x
, int y
, int width
, int height
);
35 // forward these functions to all subcontrols
36 virtual bool Enable(bool enable
= true);
37 virtual bool Show(bool show
= true);
38 virtual void SetFocus();
41 virtual void DelegateTextChanged( const wxString
& value
);
42 virtual void DelegateChoice( const wxString
& value
);
44 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
45 const wxString
& value
= wxEmptyString
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
,
48 int n
= 0, const wxString choices
[] = NULL
,
50 const wxValidator
& validator
= wxDefaultValidator
,
51 const wxString
& name
= wxComboBoxNameStr
)
53 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
55 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
56 const wxString
& value
,
59 const wxArrayString
& choices
,
61 const wxValidator
& validator
= wxDefaultValidator
,
62 const wxString
& name
= wxComboBoxNameStr
)
64 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
67 bool Create(wxWindow
*parent
, wxWindowID id
,
68 const wxString
& value
= wxEmptyString
,
69 const wxPoint
& pos
= wxDefaultPosition
,
70 const wxSize
& size
= wxDefaultSize
,
71 int n
= 0, const wxString choices
[] = NULL
,
73 const wxValidator
& validator
= wxDefaultValidator
,
74 const wxString
& name
= wxComboBoxNameStr
);
75 bool Create(wxWindow
*parent
, wxWindowID id
,
76 const wxString
& value
,
79 const wxArrayString
& choices
,
81 const wxValidator
& validator
= wxDefaultValidator
,
82 const wxString
& name
= wxComboBoxNameStr
);
85 virtual void Delete(int n
);
88 virtual int GetSelection() const ;
89 virtual void SetSelection(int n
);
90 virtual void Select(int n
) { SetSelection(n
) ; }
91 virtual int FindString(const wxString
& s
) const;
92 virtual wxString
GetString(int n
) const ;
93 virtual wxString
GetStringSelection() const ;
94 virtual void SetString(int n
, const wxString
& s
) ;
95 virtual bool SetStringSelection(const wxString
& sel
);
97 // Text field functions
98 virtual wxString
GetValue() const ;
99 virtual void SetValue(const wxString
& value
);
101 // Clipboard operations
104 virtual void Paste();
105 virtual void SetInsertionPoint(long pos
);
106 virtual void SetInsertionPointEnd();
107 virtual long GetInsertionPoint() const ;
108 virtual wxTextPos
GetLastPosition() const ;
109 virtual void Replace(long from
, long to
, const wxString
& value
);
110 virtual void Remove(long from
, long to
);
111 virtual void SetSelection(long from
, long to
);
112 virtual void SetEditable(bool editable
);
113 virtual int GetCount() const { return m_choice
->GetCount() ; }
115 virtual bool IsEditable() const ;
117 virtual void Undo() ;
118 virtual void Redo() ;
119 virtual void SelectAll() ;
121 virtual bool CanCopy() const ;
122 virtual bool CanCut() const ;
123 virtual bool CanPaste() const ;
124 virtual bool CanUndo() const ;
125 virtual bool CanRedo() const ;
127 void MacHandleControlClick( WXWidget control
, wxInt16 controlpart
, bool mouseStillDown
) ;
129 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
132 virtual int DoAppend(const wxString
& item
) ;
133 virtual int DoInsert(const wxString
& item
, int pos
) ;
135 virtual void DoSetItemClientData(int n
, void* clientData
) ;
136 virtual void* DoGetItemClientData(int n
) const ;
137 virtual void DoSetItemClientObject(int n
, wxClientData
* clientData
) ;
138 virtual wxClientData
* DoGetItemClientObject(int n
) const ;