1
/////////////////////////////////////////////////////////////////////////////
2
// Name: wx/generic/combo.h
3
// Purpose: Generic wxComboCtrl
4
// Author: Jaakko Salli
6
// Created: Apr-30-2006
7
// RCS-ID: $Id: combo.h 67255 2011-03-20 10:59:22Z JMS $
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
#include "wx/dcbuffer.h"
36
extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
38
class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase
42
wxGenericComboCtrl() : wxComboCtrlBase() { Init(); }
44
wxGenericComboCtrl(wxWindow *parent,
45
wxWindowID id = wxID_ANY,
46
const wxString& value = wxEmptyString,
47
const wxPoint& pos = wxDefaultPosition,
48
const wxSize& size = wxDefaultSize,
50
const wxValidator& validator = wxDefaultValidator,
51
const wxString& name = wxComboBoxNameStr)
56
(void)Create(parent, id, value, pos, size, style, validator, name);
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,
65
const wxValidator& validator = wxDefaultValidator,
66
const wxString& name = wxComboBoxNameStr);
68
virtual ~wxGenericComboCtrl();
70
void SetCustomPaintWidth( int width );
72
virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const;
74
static int GetFeatures() { return wxComboCtrlFeatures::All; }
76
#if defined(__WXUNIVERSAL__)
77
// we have our own input handler and our own actions
78
virtual bool PerformAction(const wxControlAction& action,
80
const wxString& strArg = wxEmptyString);
85
// Dummies for platform-specific wxTextEntry implementations
86
#if defined(__WXUNIVERSAL__)
87
// Looks like there's nothing we need to override here
88
#elif defined(__WXMOTIF__)
89
virtual WXWidget GetTextWidget() const { return NULL; }
90
#elif defined(__WXGTK__)
91
#if defined(__WXGTK20__)
92
virtual GtkEditable *GetEditable() const { return NULL; }
93
virtual GtkEntry *GetEntry() const { return NULL; }
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; }
101
// For better transparent background rendering
102
virtual bool HasTransparentBackground()
104
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
106
// Sanity check for GTK+
107
return IsDoubleBuffered();
116
// Mandatory virtuals
117
virtual void OnResize();
120
void OnPaintEvent( wxPaintEvent& event );
121
void OnMouseEvent( wxMouseEvent& event );
126
DECLARE_EVENT_TABLE()
128
DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl)
132
#ifndef _WX_COMBOCONTROL_H_
134
// If native wxComboCtrl was not defined, then prepare a simple
135
// front-end so that wxRTTI works as expected.
137
class WXDLLIMPEXP_CORE wxComboCtrl : public wxGenericComboCtrl
140
wxComboCtrl() : wxGenericComboCtrl() {}
142
wxComboCtrl(wxWindow *parent,
143
wxWindowID id = wxID_ANY,
144
const wxString& value = wxEmptyString,
145
const wxPoint& pos = wxDefaultPosition,
146
const wxSize& size = wxDefaultSize,
148
const wxValidator& validator = wxDefaultValidator,
149
const wxString& name = wxComboBoxNameStr)
150
: wxGenericComboCtrl()
152
(void)Create(parent, id, value, pos, size, style, validator, name);
155
virtual ~wxComboCtrl() {}
160
DECLARE_DYNAMIC_CLASS(wxComboCtrl)
163
#endif // _WX_COMBOCONTROL_H_
167
#define wxGenericComboCtrl wxComboCtrl
169
#endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED)
171
#endif // wxUSE_COMBOCTRL
173
// _WX_GENERIC_COMBOCTRL_H_