]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/combo.h
Use correct reload flags on all platforms to avoid compilation errors
[wxWidgets.git] / include / wx / generic / combo.h
CommitLineData
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
129c8cf3
RR
12#ifndef _WX_GENERIC_COMBOCTRL_H_
13#define _WX_GENERIC_COMBOCTRL_H_
a340b80d 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
9a83f860
VZ
29#define wxACTION_COMBOBOX_POPUP wxT("popup")
30#define wxACTION_COMBOBOX_DISMISS wxT("dismiss")
a340b80d
VZ
31
32#endif
33
10ba2677
JS
34#include "wx/dcbuffer.h"
35
f36e602b 36extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
a340b80d 37
53a2db12 38class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase
a340b80d
VZ
39{
40public:
41 // ctors and such
129c8cf3
RR
42 wxGenericComboCtrl() : wxComboCtrlBase() { Init(); }
43
44 wxGenericComboCtrl(wxWindow *parent,
45 wxWindowID id = wxID_ANY,
46 const wxString& value = wxEmptyString,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
49 long style = 0,
50 const wxValidator& validator = wxDefaultValidator,
51 const wxString& name = wxComboBoxNameStr)
a57d600f 52 : wxComboCtrlBase()
a340b80d
VZ
53 {
54 Init();
55
56 (void)Create(parent, id, value, pos, size, style, validator, name);
57 }
58
59 bool Create(wxWindow *parent,
60 wxWindowID id = wxID_ANY,
61 const wxString& value = wxEmptyString,
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize,
64 long style = 0,
65 const wxValidator& validator = wxDefaultValidator,
66 const wxString& name = wxComboBoxNameStr);
67
129c8cf3 68 virtual ~wxGenericComboCtrl();
a340b80d 69
8e9ec723
RR
70 void SetCustomPaintWidth( int width );
71
b445b6a7
VZ
72 virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const;
73
a57d600f 74 static int GetFeatures() { return wxComboCtrlFeatures::All; }
a340b80d
VZ
75
76#if defined(__WXUNIVERSAL__)
77 // we have our own input handler and our own actions
78 virtual bool PerformAction(const wxControlAction& action,
79 long numArg = 0l,
80 const wxString& strArg = wxEmptyString);
81#endif
82
83protected:
84
fda62793 85 // Dummies for platform-specific wxTextEntry implementations
084a875a
JS
86#if defined(__WXUNIVERSAL__)
87 // Looks like there's nothing we need to override here
db1087d2
JS
88#elif defined(__WXMOTIF__)
89 virtual WXWidget GetTextWidget() const { return NULL; }
084a875a 90#elif defined(__WXGTK__)
f179b35e 91#if defined(__WXGTK20__)
fda62793
JS
92 virtual GtkEditable *GetEditable() const { return NULL; }
93 virtual GtkEntry *GetEntry() const { return NULL; }
f179b35e 94#endif
fda62793
JS
95#elif defined(__WXMAC__)
96 // Looks like there's nothing we need to override here
97#elif defined(__WXPM__)
98 virtual WXHWND GetEditHWND() const { return NULL; }
99#endif
100
10ba2677
JS
101 // For better transparent background rendering
102 virtual bool HasTransparentBackground()
103 {
104 #if wxALWAYS_NATIVE_DOUBLE_BUFFER
105 #ifdef __WXGTK__
106 // Sanity check for GTK+
107 return IsDoubleBuffered();
108 #else
109 return true;
110 #endif
111 #else
112 return false;
113 #endif
114 }
115
a340b80d
VZ
116 // Mandatory virtuals
117 virtual void OnResize();
118
119 // Event handlers
120 void OnPaintEvent( wxPaintEvent& event );
121 void OnMouseEvent( wxMouseEvent& event );
122
123private:
124 void Init();
125
126 DECLARE_EVENT_TABLE()
127
129c8cf3 128 DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl)
a340b80d
VZ
129};
130
131
132#ifndef _WX_COMBOCONTROL_H_
133
a57d600f 134// If native wxComboCtrl was not defined, then prepare a simple
a340b80d
VZ
135// front-end so that wxRTTI works as expected.
136
53a2db12 137class WXDLLIMPEXP_CORE wxComboCtrl : public wxGenericComboCtrl
a340b80d
VZ
138{
139public:
129c8cf3 140 wxComboCtrl() : wxGenericComboCtrl() {}
a340b80d 141
a57d600f 142 wxComboCtrl(wxWindow *parent,
129c8cf3
RR
143 wxWindowID id = wxID_ANY,
144 const wxString& value = wxEmptyString,
145 const wxPoint& pos = wxDefaultPosition,
146 const wxSize& size = wxDefaultSize,
147 long style = 0,
148 const wxValidator& validator = wxDefaultValidator,
149 const wxString& name = wxComboBoxNameStr)
150 : wxGenericComboCtrl()
a340b80d
VZ
151 {
152 (void)Create(parent, id, value, pos, size, style, validator, name);
153 }
154
a57d600f 155 virtual ~wxComboCtrl() {}
a340b80d
VZ
156
157protected:
158
159private:
a57d600f 160 DECLARE_DYNAMIC_CLASS(wxComboCtrl)
a340b80d
VZ
161};
162
163#endif // _WX_COMBOCONTROL_H_
164
165#else
166
129c8cf3 167#define wxGenericComboCtrl wxComboCtrl
a340b80d
VZ
168
169#endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED)
170
a57d600f 171#endif // wxUSE_COMBOCTRL
a340b80d 172#endif
129c8cf3 173 // _WX_GENERIC_COMBOCTRL_H_