]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/combobox.h
Reapply wxWeakRef patch again
[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:
0ec1179b
VZ
26 wxComboBox() { m_strings = NULL; }
27 wxComboBox(wxWindow *parent,
28 wxWindowID id,
29 const wxString& value = wxEmptyString,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 int n = 0, const wxString choices[] = NULL,
33 long style = 0,
34 const wxValidator& validator = wxDefaultValidator,
35 const wxString& name = wxComboBoxNameStr)
738f9e5a
RR
36 {
37 Create(parent, id, value, pos, size, n, choices, style, validator, name);
38 }
0ec1179b
VZ
39
40 wxComboBox(wxWindow *parent, wxWindowID id,
41 const wxString& value,
42 const wxPoint& pos,
43 const wxSize& size,
44 const wxArrayString& choices,
45 long style = 0,
46 const wxValidator& validator = wxDefaultValidator,
47 const wxString& name = wxComboBoxNameStr)
584ad2a3
MB
48 {
49 Create(parent, id, value, pos, size, choices, style, validator, name);
50 }
6f6f938f 51
738f9e5a 52 bool Create(wxWindow *parent, wxWindowID id,
0ec1179b
VZ
53 const wxString& value = wxEmptyString,
54 const wxPoint& pos = wxDefaultPosition,
55 const wxSize& size = wxDefaultSize,
56 int n = 0, const wxString choices[] = (const wxString *) NULL,
57 long style = 0,
58 const wxValidator& validator = wxDefaultValidator,
59 const wxString& name = wxComboBoxNameStr);
584ad2a3 60 bool Create(wxWindow *parent, wxWindowID id,
0ec1179b
VZ
61 const wxString& value,
62 const wxPoint& pos,
63 const wxSize& size,
64 const wxArrayString& choices,
65 long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxComboBoxNameStr);
7f4dc78d 68
a2c94110 69 // Set/GetSelection() from wxTextEntry and wxChoice
d95c5149 70
a2c94110 71 virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
0ec1179b 72 virtual void SetSelection(long from, long to)
a2c94110 73 { wxTextEntry::SetSelection(from, to); }
d95c5149 74
a2c94110 75 virtual int GetSelection() const { return wxChoice::GetSelection(); }
0ec1179b 76 virtual void GetSelection(long *from, long *to) const
a2c94110 77 { return wxTextEntry::GetSelection(from, to); }
0ec1179b
VZ
78
79 virtual wxString GetStringSelection() const
80 {
81 return wxItemContainer::GetStringSelection();
82 }
83
a2c94110
VZ
84 virtual void Clear()
85 {
86 wxTextEntry::Clear();
87 wxItemContainer::Clear();
88 }
89
90 bool IsEmpty() const { return wxItemContainer::IsEmpty(); }
30ed6e5c 91
738f9e5a 92 void OnChar( wxKeyEvent &event );
30ed6e5c 93
150e31d2
JS
94 // Standard event handling
95 void OnCut(wxCommandEvent& event);
96 void OnCopy(wxCommandEvent& event);
97 void OnPaste(wxCommandEvent& event);
98 void OnUndo(wxCommandEvent& event);
99 void OnRedo(wxCommandEvent& event);
100 void OnDelete(wxCommandEvent& event);
101 void OnSelectAll(wxCommandEvent& event);
102
103 void OnUpdateCut(wxUpdateUIEvent& event);
104 void OnUpdateCopy(wxUpdateUIEvent& event);
105 void OnUpdatePaste(wxUpdateUIEvent& event);
106 void OnUpdateUndo(wxUpdateUIEvent& event);
107 void OnUpdateRedo(wxUpdateUIEvent& event);
108 void OnUpdateDelete(wxUpdateUIEvent& event);
109 void OnUpdateSelectAll(wxUpdateUIEvent& event);
110
a2c94110
VZ
111 virtual void DisableEvents();
112 virtual void EnableEvents();
738f9e5a 113 GtkWidget* GetConnectWidget();
30ed6e5c 114
9d522606
RD
115 static wxVisualAttributes
116 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
150e31d2 117
f68586e5 118protected:
d95c5149 119 // From wxWindowGTK:
ef5c70f9 120 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
d95c5149 121
3c75d8ba
PC
122 // Widgets that use the style->base colour for the BG colour should
123 // override this and return true.
124 virtual bool UseGTKStyleBase() const { return true; }
125
ff654490
VZ
126 // return the GtkEntry part of the combobox
127 GtkEntry *GetEntry() const;
128
3c75d8ba 129private:
0ec1179b
VZ
130 // From wxTextEntry:
131 virtual const wxWindow *GetEditableWindow() const { return this; }
132 virtual GtkEditable *GetEditable() const;
133 virtual void EnableTextChangedEvents(bool enable)
134 {
135 if ( enable )
136 EnableEvents();
137 else
138 DisableEvents();
139 }
140
6f6f938f 141 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
738f9e5a 142 DECLARE_EVENT_TABLE()
7f4dc78d
RR
143};
144
0416c418 145#endif // _WX_GTK_COMBOBOX_H_