1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/combo.h
3 // Purpose: Generic wxComboCtrl
4 // Author: Jaakko Salli
6 // Created: Apr-30-2006
7 // Copyright: (c) Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_GENERIC_COMBOCTRL_H_
12 #define _WX_GENERIC_COMBOCTRL_H_
16 // Only define generic if native doesn't have all the features
17 #if !defined(wxCOMBOCONTROL_FULLY_FEATURED)
19 // ----------------------------------------------------------------------------
20 // Generic wxComboCtrl
21 // ----------------------------------------------------------------------------
23 #if defined(__WXUNIVERSAL__)
25 // all actions of single line text controls are supported
27 // popup/dismiss the choice window
28 #define wxACTION_COMBOBOX_POPUP wxT("popup")
29 #define wxACTION_COMBOBOX_DISMISS wxT("dismiss")
33 #include "wx/dcbuffer.h"
35 extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr
[];
37 class WXDLLIMPEXP_CORE wxGenericComboCtrl
: public wxComboCtrlBase
41 wxGenericComboCtrl() : wxComboCtrlBase() { Init(); }
43 wxGenericComboCtrl(wxWindow
*parent
,
44 wxWindowID id
= wxID_ANY
,
45 const wxString
& value
= wxEmptyString
,
46 const wxPoint
& pos
= wxDefaultPosition
,
47 const wxSize
& size
= wxDefaultSize
,
49 const wxValidator
& validator
= wxDefaultValidator
,
50 const wxString
& name
= wxComboBoxNameStr
)
55 (void)Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
58 bool Create(wxWindow
*parent
,
59 wxWindowID id
= wxID_ANY
,
60 const wxString
& value
= wxEmptyString
,
61 const wxPoint
& pos
= wxDefaultPosition
,
62 const wxSize
& size
= wxDefaultSize
,
64 const wxValidator
& validator
= wxDefaultValidator
,
65 const wxString
& name
= wxComboBoxNameStr
);
67 virtual ~wxGenericComboCtrl();
69 void SetCustomPaintWidth( int width
);
71 virtual bool IsKeyPopupToggle(const wxKeyEvent
& event
) const;
73 static int GetFeatures() { return wxComboCtrlFeatures::All
; }
75 #if defined(__WXUNIVERSAL__)
76 // we have our own input handler and our own actions
77 virtual bool PerformAction(const wxControlAction
& action
,
79 const wxString
& strArg
= wxEmptyString
);
84 // Dummies for platform-specific wxTextEntry implementations
85 #if defined(__WXUNIVERSAL__)
86 // Looks like there's nothing we need to override here
87 #elif defined(__WXMOTIF__)
88 virtual WXWidget
GetTextWidget() const { return NULL
; }
89 #elif defined(__WXGTK__)
90 #if defined(__WXGTK20__)
91 virtual GtkEditable
*GetEditable() const { return NULL
; }
92 virtual GtkEntry
*GetEntry() const { return NULL
; }
94 #elif defined(__WXMAC__)
95 // Looks like there's nothing we need to override here
96 #elif defined(__WXPM__)
97 virtual WXHWND
GetEditHWND() const { return NULL
; }
100 // For better transparent background rendering
101 virtual bool HasTransparentBackground()
103 #if wxALWAYS_NATIVE_DOUBLE_BUFFER
105 // Sanity check for GTK+
106 return IsDoubleBuffered();
115 // Mandatory virtuals
116 virtual void OnResize();
119 void OnPaintEvent( wxPaintEvent
& event
);
120 void OnMouseEvent( wxMouseEvent
& event
);
125 DECLARE_EVENT_TABLE()
127 DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl
)
131 #ifndef _WX_COMBOCONTROL_H_
133 // If native wxComboCtrl was not defined, then prepare a simple
134 // front-end so that wxRTTI works as expected.
136 class WXDLLIMPEXP_CORE wxComboCtrl
: public wxGenericComboCtrl
139 wxComboCtrl() : wxGenericComboCtrl() {}
141 wxComboCtrl(wxWindow
*parent
,
142 wxWindowID id
= wxID_ANY
,
143 const wxString
& value
= wxEmptyString
,
144 const wxPoint
& pos
= wxDefaultPosition
,
145 const wxSize
& size
= wxDefaultSize
,
147 const wxValidator
& validator
= wxDefaultValidator
,
148 const wxString
& name
= wxComboBoxNameStr
)
149 : wxGenericComboCtrl()
151 (void)Create(parent
, id
, value
, pos
, size
, style
, validator
, name
);
154 virtual ~wxComboCtrl() {}
159 DECLARE_DYNAMIC_CLASS(wxComboCtrl
)
162 #endif // _WX_COMBOCONTROL_H_
166 #define wxGenericComboCtrl wxComboCtrl
168 #endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED)
170 #endif // wxUSE_COMBOCTRL
172 // _WX_GENERIC_COMBOCTRL_H_