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