]>
Commit | Line | Data |
---|---|---|
a340b80d VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/msw/combo.h | |
a57d600f | 3 | // Purpose: wxComboCtrl class |
a340b80d VZ |
4 | // Author: Jaakko Salli |
5 | // Modified by: | |
6 | // Created: Apr-30-2006 | |
a340b80d VZ |
7 | // Copyright: (c) Jaakko Salli |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_COMBOCONTROL_H_ | |
12 | #define _WX_COMBOCONTROL_H_ | |
13 | ||
14 | // NB: Definition of _WX_COMBOCONTROL_H_ is used in wx/generic/combo.h to | |
a57d600f VZ |
15 | // determine whether there is native wxComboCtrl, so make sure you |
16 | // use it in all native wxComboCtrls. | |
a340b80d | 17 | |
a57d600f | 18 | #if wxUSE_COMBOCTRL |
a340b80d | 19 | |
30be036c RR |
20 | #if !defined(__WXWINCE__) && wxUSE_TIMER |
21 | #include "wx/timer.h" | |
22 | #define wxUSE_COMBOCTRL_POPUP_ANIMATION 1 | |
23 | #else | |
24 | #define wxUSE_COMBOCTRL_POPUP_ANIMATION 0 | |
25 | #endif | |
26 | ||
27 | ||
a340b80d | 28 | // ---------------------------------------------------------------------------- |
a57d600f | 29 | // Native wxComboCtrl |
a340b80d VZ |
30 | // ---------------------------------------------------------------------------- |
31 | ||
32 | // Define this only if native implementation includes all features | |
33 | #define wxCOMBOCONTROL_FULLY_FEATURED | |
34 | ||
fba05595 | 35 | extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; |
7c982668 | 36 | |
53a2db12 | 37 | class WXDLLIMPEXP_CORE wxComboCtrl : public wxComboCtrlBase |
a340b80d VZ |
38 | { |
39 | public: | |
40 | // ctors and such | |
a57d600f | 41 | wxComboCtrl() : wxComboCtrlBase() { Init(); } |
a340b80d | 42 | |
a57d600f | 43 | wxComboCtrl(wxWindow *parent, |
a340b80d VZ |
44 | wxWindowID id = wxID_ANY, |
45 | const wxString& value = wxEmptyString, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = 0, | |
49 | const wxValidator& validator = wxDefaultValidator, | |
50 | const wxString& name = wxComboBoxNameStr) | |
a57d600f | 51 | : wxComboCtrlBase() |
a340b80d VZ |
52 | { |
53 | Init(); | |
54 | ||
55 | (void)Create(parent, id, value, pos, size, style, validator, name); | |
56 | } | |
57 | ||
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, | |
63 | long style = 0, | |
64 | const wxValidator& validator = wxDefaultValidator, | |
65 | const wxString& name = wxComboBoxNameStr); | |
66 | ||
a57d600f | 67 | virtual ~wxComboCtrl(); |
a340b80d | 68 | |
118f5fbd | 69 | virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const; |
b445b6a7 | 70 | virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const; |
a340b80d | 71 | |
a57d600f | 72 | static int GetFeatures() { return wxComboCtrlFeatures::All; } |
a340b80d | 73 | |
30be036c | 74 | #if wxUSE_COMBOCTRL_POPUP_ANIMATION |
952555f7 VZ |
75 | void OnTimerEvent(wxTimerEvent& WXUNUSED(event)) { DoTimerEvent(); } |
76 | ||
1c3693e8 | 77 | protected: |
952555f7 VZ |
78 | void DoTimerEvent(); |
79 | ||
1c3693e8 | 80 | virtual bool AnimateShow( const wxRect& rect, int flags ); |
952555f7 | 81 | #endif // wxUSE_COMBOCTRL_POPUP_ANIMATION |
30be036c | 82 | |
a340b80d VZ |
83 | protected: |
84 | ||
fda62793 JS |
85 | // Dummy method - we override all functions that call this |
86 | virtual WXHWND GetEditHWND() const { return NULL; } | |
87 | ||
a340b80d VZ |
88 | // customization |
89 | virtual void OnResize(); | |
90 | virtual wxCoord GetNativeTextIndent() const; | |
a340b80d VZ |
91 | |
92 | // event handlers | |
93 | void OnPaintEvent( wxPaintEvent& event ); | |
94 | void OnMouseEvent( wxMouseEvent& event ); | |
95 | ||
9cb80f3f JS |
96 | virtual bool HasTransparentBackground() { return IsDoubleBuffered(); } |
97 | ||
a340b80d VZ |
98 | private: |
99 | void Init(); | |
100 | ||
30be036c RR |
101 | #if wxUSE_COMBOCTRL_POPUP_ANIMATION |
102 | // Popup animation related | |
103 | wxLongLong m_animStart; | |
104 | wxTimer m_animTimer; | |
105 | wxRect m_animRect; | |
106 | int m_animFlags; | |
107 | #endif | |
108 | ||
a340b80d VZ |
109 | DECLARE_EVENT_TABLE() |
110 | ||
a57d600f | 111 | DECLARE_DYNAMIC_CLASS(wxComboCtrl) |
a340b80d VZ |
112 | }; |
113 | ||
114 | ||
a57d600f | 115 | #endif // wxUSE_COMBOCTRL |
a340b80d VZ |
116 | #endif |
117 | // _WX_COMBOCONTROL_H_ |