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