]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/combobox.h
Make wxDragImage ctors taking hot spot point really deprecated in wxMSW.
[wxWidgets.git] / include / wx / gtk / combobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/combobox.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id: $Id$
7 // Copyright: (c) 1998 Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GTK_COMBOBOX_H_
12 #define _WX_GTK_COMBOBOX_H_
13
14 #include "wx/choice.h"
15
16 typedef struct _GtkEntry GtkEntry;
17
18 //-----------------------------------------------------------------------------
19 // wxComboBox
20 //-----------------------------------------------------------------------------
21
22 class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
23 public wxTextEntry
24 {
25 public:
26 wxComboBox()
27 : wxChoice(), wxTextEntry()
28 {
29 Init();
30 }
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)
40 : wxChoice(), wxTextEntry()
41 {
42 Init();
43 Create(parent, id, value, pos, size, n, choices, style, validator, name);
44 }
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)
54 : wxChoice(), wxTextEntry()
55 {
56 Init();
57 Create(parent, id, value, pos, size, choices, style, validator, name);
58 }
59
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,
65 long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxComboBoxNameStr);
68 bool Create(wxWindow *parent, wxWindowID id,
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);
76
77 // Set/GetSelection() from wxTextEntry and wxChoice
78
79 virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
80 virtual void SetSelection(long from, long to)
81 { wxTextEntry::SetSelection(from, to); }
82
83 virtual int GetSelection() const { return wxChoice::GetSelection(); }
84 virtual void GetSelection(long *from, long *to) const
85 { return wxTextEntry::GetSelection(from, to); }
86
87 virtual wxString GetStringSelection() const
88 {
89 return wxItemContainer::GetStringSelection();
90 }
91 virtual void Popup();
92 virtual void Dismiss();
93
94 virtual void Clear()
95 {
96 wxTextEntry::Clear();
97 wxItemContainer::Clear();
98 }
99
100 // See wxComboBoxBase discussion of IsEmpty().
101 bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
102 bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
103
104 void OnChar( wxKeyEvent &event );
105
106 virtual void SetValue(const wxString& value);
107
108 // Standard event handling
109 void OnCut(wxCommandEvent& event);
110 void OnCopy(wxCommandEvent& event);
111 void OnPaste(wxCommandEvent& event);
112 void OnUndo(wxCommandEvent& event);
113 void OnRedo(wxCommandEvent& event);
114 void OnDelete(wxCommandEvent& event);
115 void OnSelectAll(wxCommandEvent& event);
116
117 void OnUpdateCut(wxUpdateUIEvent& event);
118 void OnUpdateCopy(wxUpdateUIEvent& event);
119 void OnUpdatePaste(wxUpdateUIEvent& event);
120 void OnUpdateUndo(wxUpdateUIEvent& event);
121 void OnUpdateRedo(wxUpdateUIEvent& event);
122 void OnUpdateDelete(wxUpdateUIEvent& event);
123 void OnUpdateSelectAll(wxUpdateUIEvent& event);
124
125 virtual void GTKDisableEvents();
126 virtual void GTKEnableEvents();
127 GtkWidget* GetConnectWidget();
128
129 static wxVisualAttributes
130 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
131
132 protected:
133 // From wxWindowGTK:
134 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
135
136 // Widgets that use the style->base colour for the BG colour should
137 // override this and return true.
138 virtual bool UseGTKStyleBase() const { return true; }
139
140 // Override in derived classes to create combo box widgets with
141 // custom list stores.
142 virtual void GTKCreateComboBoxWidget();
143
144 virtual GtkEntry *GetEntry() const
145 { return m_entry; }
146
147 GtkEntry* m_entry;
148
149 private:
150 // From wxTextEntry:
151 virtual wxWindow *GetEditableWindow() { return this; }
152 virtual GtkEditable *GetEditable() const;
153 virtual void EnableTextChangedEvents(bool enable);
154
155 void Init();
156
157 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
158 DECLARE_EVENT_TABLE()
159 };
160
161 #endif // _WX_GTK_COMBOBOX_H_