]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/combo.h
Fix generation of key events for non-alphabetic keys under Windows.
[wxWidgets.git] / include / wx / msw / combo.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/combo.h
3 // Purpose: wxComboCtrl class
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
12 #ifndef _WX_COMBOCONTROL_H_
13 #define _WX_COMBOCONTROL_H_
14
15 // NB: Definition of _WX_COMBOCONTROL_H_ is used in wx/generic/combo.h to
16 // determine whether there is native wxComboCtrl, so make sure you
17 // use it in all native wxComboCtrls.
18
19 #if wxUSE_COMBOCTRL
20
21 #if !defined(__WXWINCE__) && wxUSE_TIMER
22 #include "wx/timer.h"
23 #define wxUSE_COMBOCTRL_POPUP_ANIMATION 1
24 #else
25 #define wxUSE_COMBOCTRL_POPUP_ANIMATION 0
26 #endif
27
28
29 // ----------------------------------------------------------------------------
30 // Native wxComboCtrl
31 // ----------------------------------------------------------------------------
32
33 // Define this only if native implementation includes all features
34 #define wxCOMBOCONTROL_FULLY_FEATURED
35
36 extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
37
38 class WXDLLIMPEXP_CORE wxComboCtrl : public wxComboCtrlBase
39 {
40 public:
41 // ctors and such
42 wxComboCtrl() : wxComboCtrlBase() { Init(); }
43
44 wxComboCtrl(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 ~wxComboCtrl();
69
70 virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const;
71 virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const;
72
73 static int GetFeatures() { return wxComboCtrlFeatures::All; }
74
75 #if wxUSE_COMBOCTRL_POPUP_ANIMATION
76 void OnTimerEvent(wxTimerEvent& WXUNUSED(event)) { DoTimerEvent(); }
77
78 protected:
79 void DoTimerEvent();
80
81 virtual bool AnimateShow( const wxRect& rect, int flags );
82 #endif // wxUSE_COMBOCTRL_POPUP_ANIMATION
83
84 protected:
85
86 // customization
87 virtual void OnResize();
88 virtual wxCoord GetNativeTextIndent() const;
89
90 // event handlers
91 void OnPaintEvent( wxPaintEvent& event );
92 void OnMouseEvent( wxMouseEvent& event );
93
94 private:
95 void Init();
96
97 #if wxUSE_COMBOCTRL_POPUP_ANIMATION
98 // Popup animation related
99 wxLongLong m_animStart;
100 wxTimer m_animTimer;
101 wxRect m_animRect;
102 int m_animFlags;
103 #endif
104
105 DECLARE_EVENT_TABLE()
106
107 DECLARE_DYNAMIC_CLASS(wxComboCtrl)
108 };
109
110
111 #endif // wxUSE_COMBOCTRL
112 #endif
113 // _WX_COMBOCONTROL_H_