Added dummy-wxTextEntry implementation section for wxUniversal
[wxWidgets.git] / include / wx / generic / combo.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/combo.h
3 // Purpose: Generic wxComboCtrl
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_COMBOCTRL_H_
13 #define _WX_GENERIC_COMBOCTRL_H_
14
15 #if wxUSE_COMBOCTRL
16
17 // Only define generic if native doesn't have all the features
18 #if !defined(wxCOMBOCONTROL_FULLY_FEATURED)
19
20 // ----------------------------------------------------------------------------
21 // Generic wxComboCtrl
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 wxT("popup")
30 #define wxACTION_COMBOBOX_DISMISS wxT("dismiss")
31
32 #endif
33
34 extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
35
36 class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase
37 {
38 public:
39 // ctors and such
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)
50 : wxComboCtrlBase()
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 ~wxGenericComboCtrl();
67
68 void SetCustomPaintWidth( int width );
69
70 virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const;
71
72 static int GetFeatures() { return wxComboCtrlFeatures::All; }
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
83 // Dummies for platform-specific wxTextEntry implementations
84 #if defined(__WXUNIVERSAL__)
85 // Looks like there's nothing we need to override here
86 #elif defined(__WXGTK__)
87 virtual GtkEditable *GetEditable() const { return NULL; }
88 virtual GtkEntry *GetEntry() const { return NULL; }
89 #elif defined(__WXMAC__)
90 // Looks like there's nothing we need to override here
91 #elif defined(__WXPM__)
92 virtual WXHWND GetEditHWND() const { return NULL; }
93 #endif
94
95 // Mandatory virtuals
96 virtual void OnResize();
97
98 // Event handlers
99 void OnPaintEvent( wxPaintEvent& event );
100 void OnMouseEvent( wxMouseEvent& event );
101
102 private:
103 void Init();
104
105 DECLARE_EVENT_TABLE()
106
107 DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl)
108 };
109
110
111 #ifndef _WX_COMBOCONTROL_H_
112
113 // If native wxComboCtrl was not defined, then prepare a simple
114 // front-end so that wxRTTI works as expected.
115
116 class WXDLLIMPEXP_CORE wxComboCtrl : public wxGenericComboCtrl
117 {
118 public:
119 wxComboCtrl() : wxGenericComboCtrl() {}
120
121 wxComboCtrl(wxWindow *parent,
122 wxWindowID id = wxID_ANY,
123 const wxString& value = wxEmptyString,
124 const wxPoint& pos = wxDefaultPosition,
125 const wxSize& size = wxDefaultSize,
126 long style = 0,
127 const wxValidator& validator = wxDefaultValidator,
128 const wxString& name = wxComboBoxNameStr)
129 : wxGenericComboCtrl()
130 {
131 (void)Create(parent, id, value, pos, size, style, validator, name);
132 }
133
134 virtual ~wxComboCtrl() {}
135
136 protected:
137
138 private:
139 DECLARE_DYNAMIC_CLASS(wxComboCtrl)
140 };
141
142 #endif // _WX_COMBOCONTROL_H_
143
144 #else
145
146 #define wxGenericComboCtrl wxComboCtrl
147
148 #endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED)
149
150 #endif // wxUSE_COMBOCTRL
151 #endif
152 // _WX_GENERIC_COMBOCTRL_H_