]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/combobox.h
fix warnings in EventsSuppressor ctor from gcc with -O option
[wxWidgets.git] / include / wx / gtk / combobox.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
853dcc57 2// Name: wx/gtk/combobox.h
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
5// Created: 01/02/97
5ebd1fb2 6// Id: $Id$
dbf858b5 7// Copyright: (c) 1998 Robert Roebling
7d8268a1 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
0416c418
PC
11#ifndef _WX_GTK_COMBOBOX_H_
12#define _WX_GTK_COMBOBOX_H_
7f4dc78d 13
c801d85f
KB
14//-----------------------------------------------------------------------------
15// wxComboBox
16//-----------------------------------------------------------------------------
17
0ec1179b
VZ
18class WXDLLIMPEXP_CORE wxComboBox : public wxControl,
19 public wxComboBoxBase
7f4dc78d 20{
fd0eed64 21public:
0ec1179b
VZ
22 wxComboBox() { m_strings = NULL; }
23 wxComboBox(wxWindow *parent,
24 wxWindowID id,
25 const wxString& value = wxEmptyString,
26 const wxPoint& pos = wxDefaultPosition,
27 const wxSize& size = wxDefaultSize,
28 int n = 0, const wxString choices[] = NULL,
29 long style = 0,
30 const wxValidator& validator = wxDefaultValidator,
31 const wxString& name = wxComboBoxNameStr)
738f9e5a
RR
32 {
33 Create(parent, id, value, pos, size, n, choices, style, validator, name);
34 }
0ec1179b
VZ
35
36 wxComboBox(wxWindow *parent, wxWindowID id,
37 const wxString& value,
38 const wxPoint& pos,
39 const wxSize& size,
40 const wxArrayString& choices,
41 long style = 0,
42 const wxValidator& validator = wxDefaultValidator,
43 const wxString& name = wxComboBoxNameStr)
584ad2a3
MB
44 {
45 Create(parent, id, value, pos, size, choices, style, validator, name);
46 }
6f6f938f 47
d3c7fc99 48 virtual ~wxComboBox();
6f6f938f 49
738f9e5a 50 bool Create(wxWindow *parent, wxWindowID id,
0ec1179b
VZ
51 const wxString& value = wxEmptyString,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 int n = 0, const wxString choices[] = (const wxString *) NULL,
55 long style = 0,
56 const wxValidator& validator = wxDefaultValidator,
57 const wxString& name = wxComboBoxNameStr);
584ad2a3 58 bool Create(wxWindow *parent, wxWindowID id,
0ec1179b
VZ
59 const wxString& value,
60 const wxPoint& pos,
61 const wxSize& size,
62 const wxArrayString& choices,
63 long style = 0,
64 const wxValidator& validator = wxDefaultValidator,
65 const wxString& name = wxComboBoxNameStr);
7f4dc78d 66
d95c5149 67 // From wxItemContainerImmutable:
aa61d352 68 virtual unsigned int GetCount() const;
d95c5149 69 virtual wxString GetString(unsigned int n) const;
aa61d352 70 virtual void SetString(unsigned int n, const wxString &text);
d95c5149
MR
71 virtual int FindString(const wxString& s, bool bCase = false) const;
72 virtual void SetSelection(int n);
73 virtual int GetSelection() const;
d95c5149 74
0ec1179b
VZ
75 // from wxTextEntry: we need to override them to avoid virtual function
76 // hiding
77 virtual void SetSelection(long from, long to)
78 {
79 wxTextEntry::SetSelection(from, to);
80 }
d95c5149 81
0ec1179b
VZ
82 virtual void GetSelection(long *from, long *to) const
83 {
84 return wxTextEntry::GetSelection(from, to);
85 }
86
87 virtual wxString GetStringSelection() const
88 {
89 return wxItemContainer::GetStringSelection();
90 }
91
92 // From wxComboBoxBase:
93 virtual int GetCurrentSelection() const;
30ed6e5c 94
2b5f62a0 95 virtual void SetFocus();
30ed6e5c 96
738f9e5a
RR
97 void OnSize( wxSizeEvent &event );
98 void OnChar( wxKeyEvent &event );
30ed6e5c 99
150e31d2
JS
100 // Standard event handling
101 void OnCut(wxCommandEvent& event);
102 void OnCopy(wxCommandEvent& event);
103 void OnPaste(wxCommandEvent& event);
104 void OnUndo(wxCommandEvent& event);
105 void OnRedo(wxCommandEvent& event);
106 void OnDelete(wxCommandEvent& event);
107 void OnSelectAll(wxCommandEvent& event);
108
109 void OnUpdateCut(wxUpdateUIEvent& event);
110 void OnUpdateCopy(wxUpdateUIEvent& event);
111 void OnUpdatePaste(wxUpdateUIEvent& event);
112 void OnUpdateUndo(wxUpdateUIEvent& event);
113 void OnUpdateRedo(wxUpdateUIEvent& event);
114 void OnUpdateDelete(wxUpdateUIEvent& event);
115 void OnUpdateSelectAll(wxUpdateUIEvent& event);
116
a236aa20
VZ
117 bool m_ignoreNextUpdate:1;
118 wxArrayPtrVoid m_clientData;
119 int m_prevSelection;
738f9e5a
RR
120
121 void DisableEvents();
122 void EnableEvents();
738f9e5a 123 GtkWidget* GetConnectWidget();
30ed6e5c 124
6f6f938f
VZ
125 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
126
9d522606
RD
127 static wxVisualAttributes
128 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
150e31d2 129
3c75d8ba
PC
130 virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
131
f68586e5 132protected:
d95c5149 133 // From wxWindowGTK:
ef5c70f9
VZ
134 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
135 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
d95c5149
MR
136
137 // From wxItemContainer:
a236aa20
VZ
138 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
139 unsigned int pos,
140 void **clientData, wxClientDataType type);
aa61d352
VZ
141 virtual void DoSetItemClientData(unsigned int n, void* clientData);
142 virtual void* DoGetItemClientData(unsigned int n) const;
0ec1179b
VZ
143 virtual void DoClear();
144 virtual void DoDeleteOneItem(unsigned int n);
6f6f938f 145
d95c5149 146 // From wxControl:
f68586e5
VZ
147 virtual wxSize DoGetBestSize() const;
148
3c75d8ba
PC
149 // Widgets that use the style->base colour for the BG colour should
150 // override this and return true.
151 virtual bool UseGTKStyleBase() const { return true; }
152
153private:
0ec1179b
VZ
154 // From wxTextEntry:
155 virtual const wxWindow *GetEditableWindow() const { return this; }
156 virtual GtkEditable *GetEditable() const;
157 virtual void EnableTextChangedEvents(bool enable)
158 {
159 if ( enable )
160 EnableEvents();
161 else
162 DisableEvents();
163 }
164
a236aa20
VZ
165 // this array is only used for controls with wxCB_SORT style, so only
166 // allocate it if it's needed (hence using pointer)
167 wxSortedArrayString *m_strings;
168
6f6f938f 169 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
738f9e5a 170 DECLARE_EVENT_TABLE()
7f4dc78d
RR
171};
172
0416c418 173#endif // _WX_GTK_COMBOBOX_H_