~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

« back to all changes in this revision

Viewing changes to include/wx/generic/combo.h

  • Committer: Brian Sidebotham
  • Date: 2013-08-03 14:30:08 UTC
  • Revision ID: brian.sidebotham@gmail.com-20130803143008-c7806tkych1tp6fc
Initial import into Bazaar

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////////////////////
 
2
// Name:        wx/generic/combo.h
 
3
// Purpose:     Generic wxComboCtrl
 
4
// Author:      Jaakko Salli
 
5
// Modified by:
 
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
/////////////////////////////////////////////////////////////////////////////
 
11
 
 
12
#ifndef _WX_GENERIC_COMBOCTRL_H_
 
13
#define _WX_GENERIC_COMBOCTRL_H_
 
14
 
 
15
#if wxUSE_COMBOCTRL
 
16
 
 
17
// Only define generic if native doesn't have all the features
 
18
#if !defined(wxCOMBOCONTROL_FULLY_FEATURED)
 
19
 
 
20
// ----------------------------------------------------------------------------
 
21
// Generic wxComboCtrl
 
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     wxT("popup")
 
30
#define wxACTION_COMBOBOX_DISMISS   wxT("dismiss")
 
31
 
 
32
#endif
 
33
 
 
34
#include "wx/dcbuffer.h"
 
35
 
 
36
extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
 
37
 
 
38
class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase
 
39
{
 
40
public:
 
41
    // ctors and such
 
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)
 
52
        : wxComboCtrlBase()
 
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
 
 
68
    virtual ~wxGenericComboCtrl();
 
69
 
 
70
    void SetCustomPaintWidth( int width );
 
71
 
 
72
    virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const;
 
73
 
 
74
    static int GetFeatures() { return wxComboCtrlFeatures::All; }
 
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
 
 
83
protected:
 
84
 
 
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; }
 
94
#endif
 
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
 
 
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
 
 
116
    // Mandatory virtuals
 
117
    virtual void OnResize();
 
118
 
 
119
    // Event handlers
 
120
    void OnPaintEvent( wxPaintEvent& event );
 
121
    void OnMouseEvent( wxMouseEvent& event );
 
122
 
 
123
private:
 
124
    void Init();
 
125
 
 
126
    DECLARE_EVENT_TABLE()
 
127
 
 
128
    DECLARE_DYNAMIC_CLASS(wxGenericComboCtrl)
 
129
};
 
130
 
 
131
 
 
132
#ifndef _WX_COMBOCONTROL_H_
 
133
 
 
134
// If native wxComboCtrl was not defined, then prepare a simple
 
135
// front-end so that wxRTTI works as expected.
 
136
 
 
137
class WXDLLIMPEXP_CORE wxComboCtrl : public wxGenericComboCtrl
 
138
{
 
139
public:
 
140
    wxComboCtrl() : wxGenericComboCtrl() {}
 
141
 
 
142
    wxComboCtrl(wxWindow *parent,
 
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()
 
151
    {
 
152
        (void)Create(parent, id, value, pos, size, style, validator, name);
 
153
    }
 
154
 
 
155
    virtual ~wxComboCtrl() {}
 
156
 
 
157
protected:
 
158
 
 
159
private:
 
160
    DECLARE_DYNAMIC_CLASS(wxComboCtrl)
 
161
};
 
162
 
 
163
#endif // _WX_COMBOCONTROL_H_
 
164
 
 
165
#else
 
166
 
 
167
#define wxGenericComboCtrl   wxComboCtrl
 
168
 
 
169
#endif // !defined(wxCOMBOCONTROL_FULLY_FEATURED)
 
170
 
 
171
#endif // wxUSE_COMBOCTRL
 
172
#endif
 
173
    // _WX_GENERIC_COMBOCTRL_H_