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 #include "wx/choice.h"
16 typedef struct _GtkEntry GtkEntry
;
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 class WXDLLIMPEXP_CORE wxComboBox
: public wxChoice
,
27 : wxChoice(), wxTextEntry()
31 wxComboBox(wxWindow
*parent
,
33 const wxString
& value
= wxEmptyString
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 const wxSize
& size
= wxDefaultSize
,
36 int n
= 0, const wxString choices
[] = NULL
,
38 const wxValidator
& validator
= wxDefaultValidator
,
39 const wxString
& name
= wxComboBoxNameStr
)
40 : wxChoice(), wxTextEntry()
43 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
46 wxComboBox(wxWindow
*parent
, wxWindowID id
,
47 const wxString
& value
,
50 const wxArrayString
& choices
,
52 const wxValidator
& validator
= wxDefaultValidator
,
53 const wxString
& name
= wxComboBoxNameStr
)
54 : wxChoice(), wxTextEntry()
57 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
60 bool Create(wxWindow
*parent
, wxWindowID id
,
61 const wxString
& value
= wxEmptyString
,
62 const wxPoint
& pos
= wxDefaultPosition
,
63 const wxSize
& size
= wxDefaultSize
,
64 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
66 const wxValidator
& validator
= wxDefaultValidator
,
67 const wxString
& name
= wxComboBoxNameStr
);
68 bool Create(wxWindow
*parent
, wxWindowID id
,
69 const wxString
& value
,
72 const wxArrayString
& choices
,
74 const wxValidator
& validator
= wxDefaultValidator
,
75 const wxString
& name
= wxComboBoxNameStr
);
77 // Set/GetSelection() from wxTextEntry and wxChoice
79 virtual void SetSelection(int n
) { wxChoice::SetSelection(n
); }
80 virtual void SetSelection(long from
, long to
)
81 { wxTextEntry::SetSelection(from
, to
); }
83 virtual int GetSelection() const { return wxChoice::GetSelection(); }
84 virtual void GetSelection(long *from
, long *to
) const
85 { return wxTextEntry::GetSelection(from
, to
); }
87 virtual wxString
GetStringSelection() const
89 return wxItemContainer::GetStringSelection();
92 virtual void Dismiss();
97 wxItemContainer::Clear();
100 bool IsEmpty() const { return wxItemContainer::IsEmpty(); }
102 void OnChar( wxKeyEvent
&event
);
104 // Standard event handling
105 void OnCut(wxCommandEvent
& event
);
106 void OnCopy(wxCommandEvent
& event
);
107 void OnPaste(wxCommandEvent
& event
);
108 void OnUndo(wxCommandEvent
& event
);
109 void OnRedo(wxCommandEvent
& event
);
110 void OnDelete(wxCommandEvent
& event
);
111 void OnSelectAll(wxCommandEvent
& event
);
113 void OnUpdateCut(wxUpdateUIEvent
& event
);
114 void OnUpdateCopy(wxUpdateUIEvent
& event
);
115 void OnUpdatePaste(wxUpdateUIEvent
& event
);
116 void OnUpdateUndo(wxUpdateUIEvent
& event
);
117 void OnUpdateRedo(wxUpdateUIEvent
& event
);
118 void OnUpdateDelete(wxUpdateUIEvent
& event
);
119 void OnUpdateSelectAll(wxUpdateUIEvent
& event
);
121 virtual void GTKDisableEvents();
122 virtual void GTKEnableEvents();
123 GtkWidget
* GetConnectWidget();
125 static wxVisualAttributes
126 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
130 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
132 // Widgets that use the style->base colour for the BG colour should
133 // override this and return true.
134 virtual bool UseGTKStyleBase() const { return true; }
136 // Override in derived classes to create combo box widgets with
137 // custom list stores.
138 virtual void GTKCreateComboBoxWidget();
140 virtual GtkEntry
*GetEntry() const
147 virtual wxWindow
*GetEditableWindow() { return this; }
148 virtual GtkEditable
*GetEditable() const;
149 virtual void EnableTextChangedEvents(bool enable
);
153 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox
)
154 DECLARE_EVENT_TABLE()
157 #endif // _WX_GTK_COMBOBOX_H_