1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/combobox.h
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_GTK_COMBOBOX_H_
12 #define _WX_GTK_COMBOBOX_H_
14 //-----------------------------------------------------------------------------
16 //-----------------------------------------------------------------------------
18 class WXDLLIMPEXP_CORE wxComboBox
: public wxControl
, public wxComboBoxBase
21 inline wxComboBox() {}
22 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
23 const wxString
& value
= wxEmptyString
,
24 const wxPoint
& pos
= wxDefaultPosition
,
25 const wxSize
& size
= wxDefaultSize
,
26 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
28 const wxValidator
& validator
= wxDefaultValidator
,
29 const wxString
& name
= wxComboBoxNameStr
)
31 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
33 inline wxComboBox(wxWindow
*parent
, wxWindowID id
,
34 const wxString
& value
,
37 const wxArrayString
& choices
,
39 const wxValidator
& validator
= wxDefaultValidator
,
40 const wxString
& name
= wxComboBoxNameStr
)
42 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
47 bool Create(wxWindow
*parent
, wxWindowID id
,
48 const wxString
& value
= wxEmptyString
,
49 const wxPoint
& pos
= wxDefaultPosition
,
50 const wxSize
& size
= wxDefaultSize
,
51 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
53 const wxValidator
& validator
= wxDefaultValidator
,
54 const wxString
& name
= wxComboBoxNameStr
);
55 bool Create(wxWindow
*parent
, wxWindowID id
,
56 const wxString
& value
,
59 const wxArrayString
& choices
,
61 const wxValidator
& validator
= wxDefaultValidator
,
62 const wxString
& name
= wxComboBoxNameStr
);
64 // From wxItemContainerImmutable:
65 virtual unsigned int GetCount() const;
66 virtual wxString
GetString(unsigned int n
) const;
67 virtual void SetString(unsigned int n
, const wxString
&text
);
68 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
69 virtual void SetSelection(int n
);
70 virtual int GetSelection() const;
71 wxString
GetStringSelection() const; // not a virtual in parent class
73 // From wxItemContainer:
75 virtual void Delete(unsigned int n
);
77 // From wxBomboBoxBase:
78 virtual wxString
GetValue() const;
79 virtual void SetValue(const wxString
& value
);
83 virtual void SetInsertionPoint( long pos
);
84 virtual long GetInsertionPoint() const;
85 virtual wxTextPos
GetLastPosition() const;
86 virtual void Replace( long from
, long to
, const wxString
& value
);
87 virtual void SetSelection( long from
, long to
);
88 virtual void SetEditable( bool editable
);
89 virtual void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
90 virtual void Remove(long from
, long to
) { Replace(from
, to
, wxEmptyString
); }
91 virtual bool IsEditable() const;
94 virtual void SelectAll();
95 virtual bool CanCopy() const;
96 virtual bool CanCut() const;
97 virtual bool CanPaste() const;
98 virtual bool CanUndo() const;
99 virtual bool CanRedo() const;
102 bool HasSelection() const;
103 void GetSelection( long* from
, long* to
) const;
104 int GetCurrentSelection() const;
106 virtual void SetFocus();
108 void OnSize( wxSizeEvent
&event
);
109 void OnChar( wxKeyEvent
&event
);
111 // Standard event handling
112 void OnCut(wxCommandEvent
& event
);
113 void OnCopy(wxCommandEvent
& event
);
114 void OnPaste(wxCommandEvent
& event
);
115 void OnUndo(wxCommandEvent
& event
);
116 void OnRedo(wxCommandEvent
& event
);
117 void OnDelete(wxCommandEvent
& event
);
118 void OnSelectAll(wxCommandEvent
& event
);
120 void OnUpdateCut(wxUpdateUIEvent
& event
);
121 void OnUpdateCopy(wxUpdateUIEvent
& event
);
122 void OnUpdatePaste(wxUpdateUIEvent
& event
);
123 void OnUpdateUndo(wxUpdateUIEvent
& event
);
124 void OnUpdateRedo(wxUpdateUIEvent
& event
);
125 void OnUpdateDelete(wxUpdateUIEvent
& event
);
126 void OnUpdateSelectAll(wxUpdateUIEvent
& event
);
128 bool m_ignoreNextUpdate
:1;
129 wxList m_clientDataList
;
130 wxList m_clientObjectList
;
133 void DisableEvents();
135 GtkWidget
* GetConnectWidget();
137 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
139 static wxVisualAttributes
140 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
144 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
145 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
147 // From wxItemContainer:
148 virtual int DoAppend(const wxString
& item
);
149 virtual int DoInsert(const wxString
& item
, unsigned int pos
);
151 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
152 virtual void* DoGetItemClientData(unsigned int n
) const;
153 virtual void DoSetItemClientObject(unsigned int n
, wxClientData
* clientData
);
154 virtual wxClientData
* DoGetItemClientObject(unsigned int n
) const;
157 virtual wxSize
DoGetBestSize() const;
159 // Widgets that use the style->base colour for the BG colour should
160 // override this and return true.
161 virtual bool UseGTKStyleBase() const { return true; }
164 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox
)
165 DECLARE_EVENT_TABLE()
168 #endif // _WX_GTK_COMBOBOX_H_