]>
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 | ||
12 | #ifndef _WX_GENERIC_COMBOCONTROL_H_ | |
13 | #define _WX_GENERIC_COMBOCONTROL_H_ | |
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 | |
29 | #define wxACTION_COMBOBOX_POPUP _T("popup") | |
30 | #define wxACTION_COMBOBOX_DISMISS _T("dismiss") | |
31 | ||
32 | #endif | |
33 | ||
dbaf49a9 | 34 | extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxComboBoxNameStr[]; |
a340b80d | 35 | |
a57d600f | 36 | class WXDLLEXPORT wxGenericComboControl : public wxComboCtrlBase |
a340b80d VZ |
37 | { |
38 | public: | |
39 | // ctors and such | |
a57d600f | 40 | wxGenericComboControl() : wxComboCtrlBase() { Init(); } |
a340b80d VZ |
41 | |
42 | wxGenericComboControl(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 | ||
66 | virtual ~wxGenericComboControl(); | |
67 | ||
a57d600f | 68 | static int GetFeatures() { return wxComboCtrlFeatures::All; } |
a340b80d VZ |
69 | |
70 | #if defined(__WXUNIVERSAL__) | |
71 | // we have our own input handler and our own actions | |
72 | virtual bool PerformAction(const wxControlAction& action, | |
73 | long numArg = 0l, | |
74 | const wxString& strArg = wxEmptyString); | |
75 | #endif | |
76 | ||
77 | protected: | |
78 | ||
79 | // Mandatory virtuals | |
80 | virtual void OnResize(); | |
81 | ||
82 | // Event handlers | |
83 | void OnPaintEvent( wxPaintEvent& event ); | |
84 | void OnMouseEvent( wxMouseEvent& event ); | |
85 | ||
86 | private: | |
87 | void Init(); | |
88 | ||
89 | DECLARE_EVENT_TABLE() | |
90 | ||
91 | DECLARE_DYNAMIC_CLASS(wxGenericComboControl) | |
92 | }; | |
93 | ||
94 | ||
95 | #ifndef _WX_COMBOCONTROL_H_ | |
96 | ||
a57d600f | 97 | // If native wxComboCtrl was not defined, then prepare a simple |
a340b80d VZ |
98 | // front-end so that wxRTTI works as expected. |
99 | ||
a57d600f | 100 | class WXDLLEXPORT wxComboCtrl : public wxGenericComboControl |
a340b80d VZ |
101 | { |
102 | public: | |
a57d600f | 103 | wxComboCtrl() : wxGenericComboControl() {} |
a340b80d | 104 | |
a57d600f | 105 | wxComboCtrl(wxWindow *parent, |
a340b80d VZ |
106 | wxWindowID id = wxID_ANY, |
107 | const wxString& value = wxEmptyString, | |
108 | const wxPoint& pos = wxDefaultPosition, | |
109 | const wxSize& size = wxDefaultSize, | |
110 | long style = 0, | |
111 | const wxValidator& validator = wxDefaultValidator, | |
112 | const wxString& name = wxComboBoxNameStr) | |
113 | : wxGenericComboControl() | |
114 | { | |
115 | (void)Create(parent, id, value, pos, size, style, validator, name); | |
116 | } | |
117 | ||
a57d600f | 118 | virtual ~wxComboCtrl() {} |
a340b80d VZ |
119 | |
120 | protected: | |
121 | ||
122 | private: | |
a57d600f | 123 | DECLARE_DYNAMIC_CLASS(wxComboCtrl) |
a340b80d VZ |
124 | }; |
125 | ||
126 | #endif // _WX_COMBOCONTROL_H_ | |
127 | ||
128 | #else | |
129 | ||
a57d600f | 130 | #define wxGenericComboControl wxComboCtrl |
a340b80d VZ |
131 | |
132 | #endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED) | |
133 | ||
a57d600f | 134 | #endif // wxUSE_COMBOCTRL |
a340b80d VZ |
135 | #endif |
136 | // _WX_GENERIC_COMBOCONTROL_H_ |