wxComboControl and wxOwnerDrawnComboBox (patch 1479938)
[wxWidgets.git] / include / wx / generic / combo.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/combo.h
3 // Purpose: Generic wxComboControl
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
15 #if wxUSE_COMBOCONTROL
16
17 // Only define generic if native doesn't have all the features
18 #if !defined(wxCOMBOCONTROL_FULLY_FEATURED)
19
20 // ----------------------------------------------------------------------------
21 // Generic wxComboControl
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
34
35 class WXDLLEXPORT wxGenericComboControl : public wxComboControlBase
36 {
37 public:
38 // ctors and such
39 wxGenericComboControl() : wxComboControlBase() { Init(); }
40
41 wxGenericComboControl(wxWindow *parent,
42 wxWindowID id = wxID_ANY,
43 const wxString& value = wxEmptyString,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 long style = 0,
47 const wxValidator& validator = wxDefaultValidator,
48 const wxString& name = wxComboBoxNameStr)
49 : wxComboControlBase()
50 {
51 Init();
52
53 (void)Create(parent, id, value, pos, size, style, validator, name);
54 }
55
56 bool Create(wxWindow *parent,
57 wxWindowID id = wxID_ANY,
58 const wxString& value = wxEmptyString,
59 const wxPoint& pos = wxDefaultPosition,
60 const wxSize& size = wxDefaultSize,
61 long style = 0,
62 const wxValidator& validator = wxDefaultValidator,
63 const wxString& name = wxComboBoxNameStr);
64
65 virtual ~wxGenericComboControl();
66
67 static int GetFeatures() { return wxComboControlFeatures::All; }
68
69 #if defined(__WXUNIVERSAL__)
70 // we have our own input handler and our own actions
71 virtual bool PerformAction(const wxControlAction& action,
72 long numArg = 0l,
73 const wxString& strArg = wxEmptyString);
74 #endif
75
76 protected:
77
78 // Mandatory virtuals
79 virtual void OnResize();
80
81 // Event handlers
82 void OnPaintEvent( wxPaintEvent& event );
83 void OnMouseEvent( wxMouseEvent& event );
84
85 private:
86 void Init();
87
88 DECLARE_EVENT_TABLE()
89
90 DECLARE_DYNAMIC_CLASS(wxGenericComboControl)
91 };
92
93
94 #ifndef _WX_COMBOCONTROL_H_
95
96 // If native wxComboControl was not defined, then prepare a simple
97 // front-end so that wxRTTI works as expected.
98
99 class WXDLLEXPORT wxComboControl : public wxGenericComboControl
100 {
101 public:
102 wxComboControl() : wxGenericComboControl() {}
103
104 wxComboControl(wxWindow *parent,
105 wxWindowID id = wxID_ANY,
106 const wxString& value = wxEmptyString,
107 const wxPoint& pos = wxDefaultPosition,
108 const wxSize& size = wxDefaultSize,
109 long style = 0,
110 const wxValidator& validator = wxDefaultValidator,
111 const wxString& name = wxComboBoxNameStr)
112 : wxGenericComboControl()
113 {
114 (void)Create(parent, id, value, pos, size, style, validator, name);
115 }
116
117 virtual ~wxComboControl() {}
118
119 protected:
120
121 private:
122 DECLARE_DYNAMIC_CLASS(wxComboControl)
123 };
124
125 #endif // _WX_COMBOCONTROL_H_
126
127 #else
128
129 #define wxGenericComboControl wxComboControl
130
131 #endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED)
132
133 #endif // wxUSE_COMBOCONTROL
134 #endif
135 // _WX_GENERIC_COMBOCONTROL_H_