1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/combo.h
3 // Purpose: Generic wxComboCtrl
4 // Author: Jaakko Salli
6 // Created: Apr-30-2006
8 // Copyright: (c) Jaakko Salli
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GENERIC_COMBOCTRL_H_
13 #define _WX_GENERIC_COMBOCTRL_H_
17 // Only define generic if native doesn't have all the features
18 #if !defined(wxCOMBOCONTROL_FULLY_FEATURED)
20 // ----------------------------------------------------------------------------
21 // Generic wxComboCtrl
22 // ----------------------------------------------------------------------------
24 #if defined(__WXUNIVERSAL__)
26 // all actions of single line text controls are supported
28 // popup/dismiss the choice window
29 #define wxACTION_COMBOBOX_POPUP wxT("popup")
30 #define wxACTION_COMBOBOX_DISMISS wxT("dismiss")
34 extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr
[];
36 class WXDLLIMPEXP_CORE wxGenericComboCtrl
: public wxComboCtrlBase
40 wxGenericComboCtrl() : wxComboCtrlBase() { Init(); }
42 wxGenericComboCtrl(wxWindow
*parent
,
43 wxWindowID id
= wxID_ANY
,
44 const wxString
& value
= wxEmptyString
,
45 const wxPoint
& pos
= wxDefaultPosition
,
46 const wxSize
& size
= wxDefaultSize
,
48 const wxValidator
& validator
= wxDefaultValidator
,
49 const wxString
& name
= wxComboBoxNameStr
)
54 (void)Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
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
,
63 const wxValidator
& validator
= wxDefaultValidator
,
64 const wxString
& name
= wxComboBoxNameStr
);
66 virtual ~wxGenericComboCtrl();
68 void SetCustomPaintWidth( int width
);
70 virtual bool IsKeyPopupToggle(const wxKeyEvent
& event
) const;
72 static int GetFeatures() { return wxComboCtrlFeatures::All
; }
74 #if defined(__WXUNIVERSAL__)
75 // we have our own input handler and our own actions
76 virtual bool PerformAction(const wxControlAction
& action
,
78 const wxString
& strArg
= wxEmptyString
);
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(__WXMOTIF__)
87 virtual WXWidget
GetTextWidget() const { return NULL
; }
88 #elif defined(__WXGTK__)
89 #if defined(__WXGTK20__)
90 virtual GtkEditable
*GetEditable() const { return NULL
; }
91 virtual GtkEntry
*GetEntry() const { return NULL
; }
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
; }
100 virtual void OnResize();
103 void OnPaintEvent( wxPaintEvent
& event
);
104 void OnMouseEvent( wxMouseEvent
& event
);
109 DECLARE_EVENT_TABLE()
111 DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl
)
115 #ifndef _WX_COMBOCONTROL_H_
117 // If native wxComboCtrl was not defined, then prepare a simple
118 // front-end so that wxRTTI works as expected.
120 class WXDLLIMPEXP_CORE wxComboCtrl
: public wxGenericComboCtrl
123 wxComboCtrl() : wxGenericComboCtrl() {}
125 wxComboCtrl(wxWindow
*parent
,
126 wxWindowID id
= wxID_ANY
,
127 const wxString
& value
= wxEmptyString
,
128 const wxPoint
& pos
= wxDefaultPosition
,
129 const wxSize
& size
= wxDefaultSize
,
131 const wxValidator
& validator
= wxDefaultValidator
,
132 const wxString
& name
= wxComboBoxNameStr
)
133 : wxGenericComboCtrl()
135 (void)Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
138 virtual ~wxComboCtrl() {}
143 DECLARE_DYNAMIC_CLASS(wxComboCtrl
)
146 #endif // _WX_COMBOCONTROL_H_
150 #define wxGenericComboCtrl wxComboCtrl
152 #endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED)
154 #endif // wxUSE_COMBOCTRL
156 // _WX_GENERIC_COMBOCTRL_H_