]>
Commit | Line | Data |
---|---|---|
a340b80d VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/generic/combo.h | |
a57d600f | 3 | // Purpose: Generic wxComboCtrl |
a340b80d VZ |
4 | // Author: Jaakko Salli |
5 | // Modified by: | |
6 | // Created: Apr-30-2006 | |
a340b80d VZ |
7 | // Copyright: (c) Jaakko Salli |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
129c8cf3 RR |
11 | #ifndef _WX_GENERIC_COMBOCTRL_H_ |
12 | #define _WX_GENERIC_COMBOCTRL_H_ | |
a340b80d | 13 | |
a57d600f | 14 | #if wxUSE_COMBOCTRL |
a340b80d VZ |
15 | |
16 | // Only define generic if native doesn't have all the features | |
17 | #if !defined(wxCOMBOCONTROL_FULLY_FEATURED) | |
18 | ||
19 | // ---------------------------------------------------------------------------- | |
a57d600f | 20 | // Generic wxComboCtrl |
a340b80d VZ |
21 | // ---------------------------------------------------------------------------- |
22 | ||
23 | #if defined(__WXUNIVERSAL__) | |
24 | ||
25 | // all actions of single line text controls are supported | |
26 | ||
27 | // popup/dismiss the choice window | |
9a83f860 VZ |
28 | #define wxACTION_COMBOBOX_POPUP wxT("popup") |
29 | #define wxACTION_COMBOBOX_DISMISS wxT("dismiss") | |
a340b80d VZ |
30 | |
31 | #endif | |
32 | ||
10ba2677 JS |
33 | #include "wx/dcbuffer.h" |
34 | ||
f36e602b | 35 | extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; |
a340b80d | 36 | |
53a2db12 | 37 | class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase |
a340b80d VZ |
38 | { |
39 | public: | |
40 | // ctors and such | |
129c8cf3 RR |
41 | wxGenericComboCtrl() : wxComboCtrlBase() { Init(); } |
42 | ||
43 | wxGenericComboCtrl(wxWindow *parent, | |
44 | wxWindowID id = wxID_ANY, | |
45 | const wxString& value = wxEmptyString, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = 0, | |
49 | const wxValidator& validator = wxDefaultValidator, | |
50 | const wxString& name = wxComboBoxNameStr) | |
a57d600f | 51 | : wxComboCtrlBase() |
a340b80d VZ |
52 | { |
53 | Init(); | |
54 | ||
55 | (void)Create(parent, id, value, pos, size, style, validator, name); | |
56 | } | |
57 | ||
58 | bool Create(wxWindow *parent, | |
59 | wxWindowID id = wxID_ANY, | |
60 | const wxString& value = wxEmptyString, | |
61 | const wxPoint& pos = wxDefaultPosition, | |
62 | const wxSize& size = wxDefaultSize, | |
63 | long style = 0, | |
64 | const wxValidator& validator = wxDefaultValidator, | |
65 | const wxString& name = wxComboBoxNameStr); | |
66 | ||
129c8cf3 | 67 | virtual ~wxGenericComboCtrl(); |
a340b80d | 68 | |
8e9ec723 RR |
69 | void SetCustomPaintWidth( int width ); |
70 | ||
b445b6a7 VZ |
71 | virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const; |
72 | ||
a57d600f | 73 | static int GetFeatures() { return wxComboCtrlFeatures::All; } |
a340b80d VZ |
74 | |
75 | #if defined(__WXUNIVERSAL__) | |
76 | // we have our own input handler and our own actions | |
77 | virtual bool PerformAction(const wxControlAction& action, | |
78 | long numArg = 0l, | |
79 | const wxString& strArg = wxEmptyString); | |
80 | #endif | |
81 | ||
82 | protected: | |
83 | ||
fda62793 | 84 | // Dummies for platform-specific wxTextEntry implementations |
084a875a JS |
85 | #if defined(__WXUNIVERSAL__) |
86 | // Looks like there's nothing we need to override here | |
db1087d2 JS |
87 | #elif defined(__WXMOTIF__) |
88 | virtual WXWidget GetTextWidget() const { return NULL; } | |
084a875a | 89 | #elif defined(__WXGTK__) |
f179b35e | 90 | #if defined(__WXGTK20__) |
fda62793 JS |
91 | virtual GtkEditable *GetEditable() const { return NULL; } |
92 | virtual GtkEntry *GetEntry() const { return NULL; } | |
f179b35e | 93 | #endif |
fda62793 JS |
94 | #elif defined(__WXMAC__) |
95 | // Looks like there's nothing we need to override here | |
96 | #elif defined(__WXPM__) | |
97 | virtual WXHWND GetEditHWND() const { return NULL; } | |
98 | #endif | |
99 | ||
10ba2677 JS |
100 | // For better transparent background rendering |
101 | virtual bool HasTransparentBackground() | |
102 | { | |
103 | #if wxALWAYS_NATIVE_DOUBLE_BUFFER | |
104 | #ifdef __WXGTK__ | |
105 | // Sanity check for GTK+ | |
106 | return IsDoubleBuffered(); | |
107 | #else | |
108 | return true; | |
109 | #endif | |
110 | #else | |
111 | return false; | |
112 | #endif | |
113 | } | |
114 | ||
a340b80d VZ |
115 | // Mandatory virtuals |
116 | virtual void OnResize(); | |
117 | ||
118 | // Event handlers | |
119 | void OnPaintEvent( wxPaintEvent& event ); | |
120 | void OnMouseEvent( wxMouseEvent& event ); | |
121 | ||
122 | private: | |
123 | void Init(); | |
124 | ||
125 | DECLARE_EVENT_TABLE() | |
126 | ||
129c8cf3 | 127 | DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl) |
a340b80d VZ |
128 | }; |
129 | ||
130 | ||
131 | #ifndef _WX_COMBOCONTROL_H_ | |
132 | ||
a57d600f | 133 | // If native wxComboCtrl was not defined, then prepare a simple |
a340b80d VZ |
134 | // front-end so that wxRTTI works as expected. |
135 | ||
53a2db12 | 136 | class WXDLLIMPEXP_CORE wxComboCtrl : public wxGenericComboCtrl |
a340b80d VZ |
137 | { |
138 | public: | |
129c8cf3 | 139 | wxComboCtrl() : wxGenericComboCtrl() {} |
a340b80d | 140 | |
a57d600f | 141 | wxComboCtrl(wxWindow *parent, |
129c8cf3 RR |
142 | wxWindowID id = wxID_ANY, |
143 | const wxString& value = wxEmptyString, | |
144 | const wxPoint& pos = wxDefaultPosition, | |
145 | const wxSize& size = wxDefaultSize, | |
146 | long style = 0, | |
147 | const wxValidator& validator = wxDefaultValidator, | |
148 | const wxString& name = wxComboBoxNameStr) | |
149 | : wxGenericComboCtrl() | |
a340b80d VZ |
150 | { |
151 | (void)Create(parent, id, value, pos, size, style, validator, name); | |
152 | } | |
153 | ||
a57d600f | 154 | virtual ~wxComboCtrl() {} |
a340b80d VZ |
155 | |
156 | protected: | |
157 | ||
158 | private: | |
a57d600f | 159 | DECLARE_DYNAMIC_CLASS(wxComboCtrl) |
a340b80d VZ |
160 | }; |
161 | ||
162 | #endif // _WX_COMBOCONTROL_H_ | |
163 | ||
164 | #else | |
165 | ||
129c8cf3 | 166 | #define wxGenericComboCtrl wxComboCtrl |
a340b80d VZ |
167 | |
168 | #endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED) | |
169 | ||
a57d600f | 170 | #endif // wxUSE_COMBOCTRL |
a340b80d | 171 | #endif |
129c8cf3 | 172 | // _WX_GENERIC_COMBOCTRL_H_ |