]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/combobox.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[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
dbf858b5 6// Copyright: (c) 1998 Robert Roebling
7d8268a1 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
0416c418
PC
10#ifndef _WX_GTK_COMBOBOX_H_
11#define _WX_GTK_COMBOBOX_H_
7f4dc78d 12
a2c94110
VZ
13#include "wx/choice.h"
14
ff654490
VZ
15typedef struct _GtkEntry GtkEntry;
16
c801d85f
KB
17//-----------------------------------------------------------------------------
18// wxComboBox
19//-----------------------------------------------------------------------------
20
a2c94110
VZ
21class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
22 public wxTextEntry
7f4dc78d 23{
fd0eed64 24public:
e78c1d78
RR
25 wxComboBox()
26 : wxChoice(), wxTextEntry()
27 {
28 Init();
29 }
0ec1179b
VZ
30 wxComboBox(wxWindow *parent,
31 wxWindowID id,
32 const wxString& value = wxEmptyString,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 int n = 0, const wxString choices[] = NULL,
36 long style = 0,
37 const wxValidator& validator = wxDefaultValidator,
38 const wxString& name = wxComboBoxNameStr)
e78c1d78 39 : wxChoice(), wxTextEntry()
738f9e5a 40 {
e78c1d78 41 Init();
738f9e5a
RR
42 Create(parent, id, value, pos, size, n, choices, style, validator, name);
43 }
0ec1179b
VZ
44
45 wxComboBox(wxWindow *parent, wxWindowID id,
46 const wxString& value,
47 const wxPoint& pos,
48 const wxSize& size,
49 const wxArrayString& choices,
50 long style = 0,
51 const wxValidator& validator = wxDefaultValidator,
52 const wxString& name = wxComboBoxNameStr)
e78c1d78 53 : wxChoice(), wxTextEntry()
584ad2a3 54 {
e78c1d78 55 Init();
584ad2a3
MB
56 Create(parent, id, value, pos, size, choices, style, validator, name);
57 }
8ab75332 58 ~wxComboBox();
6f6f938f 59
738f9e5a 60 bool Create(wxWindow *parent, wxWindowID id,
0ec1179b
VZ
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,
65 long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxComboBoxNameStr);
584ad2a3 68 bool Create(wxWindow *parent, wxWindowID id,
0ec1179b
VZ
69 const wxString& value,
70 const wxPoint& pos,
71 const wxSize& size,
72 const wxArrayString& choices,
73 long style = 0,
74 const wxValidator& validator = wxDefaultValidator,
75 const wxString& name = wxComboBoxNameStr);
7f4dc78d 76
a2c94110 77 // Set/GetSelection() from wxTextEntry and wxChoice
d95c5149 78
a2c94110 79 virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
0ec1179b 80 virtual void SetSelection(long from, long to)
a2c94110 81 { wxTextEntry::SetSelection(from, to); }
d95c5149 82
a2c94110 83 virtual int GetSelection() const { return wxChoice::GetSelection(); }
0ec1179b 84 virtual void GetSelection(long *from, long *to) const
a2c94110 85 { return wxTextEntry::GetSelection(from, to); }
0ec1179b
VZ
86
87 virtual wxString GetStringSelection() const
88 {
89 return wxItemContainer::GetStringSelection();
90 }
a9ed8caa
VZ
91
92 virtual void SetString(unsigned int n, const wxString& string);
93
d1d1f817
VZ
94 virtual void Popup();
95 virtual void Dismiss();
0ec1179b 96
a2c94110
VZ
97 virtual void Clear()
98 {
99 wxTextEntry::Clear();
100 wxItemContainer::Clear();
101 }
102
36a96421
VZ
103 // See wxComboBoxBase discussion of IsEmpty().
104 bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
105 bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
30ed6e5c 106
738f9e5a 107 void OnChar( wxKeyEvent &event );
30ed6e5c 108
9572bf1d
RR
109 virtual void SetValue(const wxString& value);
110
150e31d2
JS
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);
119
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);
127
dec7b5a8
RR
128 virtual void GTKDisableEvents();
129 virtual void GTKEnableEvents();
738f9e5a 130 GtkWidget* GetConnectWidget();
30ed6e5c 131
9d522606
RD
132 static wxVisualAttributes
133 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
150e31d2 134
f68586e5 135protected:
d95c5149 136 // From wxWindowGTK:
ef5c70f9 137 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
d95c5149 138
3c75d8ba
PC
139 // Widgets that use the style->base colour for the BG colour should
140 // override this and return true.
141 virtual bool UseGTKStyleBase() const { return true; }
142
e78c1d78
RR
143 // Override in derived classes to create combo box widgets with
144 // custom list stores.
145 virtual void GTKCreateComboBoxWidget();
146
7a78a937
VZ
147 virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const;
148
0847e36e
JS
149 virtual GtkEntry *GetEntry() const
150 { return m_entry; }
e78c1d78
RR
151
152 GtkEntry* m_entry;
ff654490 153
3c75d8ba 154private:
0ec1179b 155 // From wxTextEntry:
63f7d502 156 virtual wxWindow *GetEditableWindow() { return this; }
0ec1179b 157 virtual GtkEditable *GetEditable() const;
b526f9d6 158 virtual void EnableTextChangedEvents(bool enable);
0ec1179b 159
e78c1d78
RR
160 void Init();
161
6f6f938f 162 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
738f9e5a 163 DECLARE_EVENT_TABLE()
7f4dc78d
RR
164};
165
0416c418 166#endif // _WX_GTK_COMBOBOX_H_