]>
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 | |
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 | |
a57d600f VZ |
16 | // determine whether there is native wxComboCtrl, so make sure you |
17 | // use it in all native wxComboCtrls. | |
a340b80d | 18 | |
a57d600f | 19 | #if wxUSE_COMBOCTRL |
a340b80d | 20 | |
30be036c RR |
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 | ||
a340b80d | 29 | // ---------------------------------------------------------------------------- |
a57d600f | 30 | // Native wxComboCtrl |
a340b80d VZ |
31 | // ---------------------------------------------------------------------------- |
32 | ||
33 | // Define this only if native implementation includes all features | |
34 | #define wxCOMBOCONTROL_FULLY_FEATURED | |
35 | ||
fba05595 | 36 | extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; |
7c982668 | 37 | |
53a2db12 | 38 | class WXDLLIMPEXP_CORE wxComboCtrl : public wxComboCtrlBase |
a340b80d VZ |
39 | { |
40 | public: | |
41 | // ctors and such | |
a57d600f | 42 | wxComboCtrl() : wxComboCtrlBase() { Init(); } |
a340b80d | 43 | |
a57d600f | 44 | wxComboCtrl(wxWindow *parent, |
a340b80d VZ |
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 | ||
a57d600f | 68 | virtual ~wxComboCtrl(); |
a340b80d | 69 | |
118f5fbd | 70 | virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const; |
b445b6a7 | 71 | virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const; |
a340b80d | 72 | |
a57d600f | 73 | static int GetFeatures() { return wxComboCtrlFeatures::All; } |
a340b80d | 74 | |
30be036c | 75 | #if wxUSE_COMBOCTRL_POPUP_ANIMATION |
952555f7 VZ |
76 | void OnTimerEvent(wxTimerEvent& WXUNUSED(event)) { DoTimerEvent(); } |
77 | ||
1c3693e8 | 78 | protected: |
952555f7 VZ |
79 | void DoTimerEvent(); |
80 | ||
1c3693e8 | 81 | virtual bool AnimateShow( const wxRect& rect, int flags ); |
952555f7 | 82 | #endif // wxUSE_COMBOCTRL_POPUP_ANIMATION |
30be036c | 83 | |
a340b80d VZ |
84 | protected: |
85 | ||
fda62793 JS |
86 | // Dummy method - we override all functions that call this |
87 | virtual WXHWND GetEditHWND() const { return NULL; } | |
88 | ||
a340b80d VZ |
89 | // customization |
90 | virtual void OnResize(); | |
91 | virtual wxCoord GetNativeTextIndent() const; | |
a340b80d VZ |
92 | |
93 | // event handlers | |
94 | void OnPaintEvent( wxPaintEvent& event ); | |
95 | void OnMouseEvent( wxMouseEvent& event ); | |
96 | ||
97 | private: | |
98 | void Init(); | |
99 | ||
30be036c RR |
100 | #if wxUSE_COMBOCTRL_POPUP_ANIMATION |
101 | // Popup animation related | |
102 | wxLongLong m_animStart; | |
103 | wxTimer m_animTimer; | |
104 | wxRect m_animRect; | |
105 | int m_animFlags; | |
106 | #endif | |
107 | ||
a340b80d VZ |
108 | DECLARE_EVENT_TABLE() |
109 | ||
a57d600f | 110 | DECLARE_DYNAMIC_CLASS(wxComboCtrl) |
a340b80d VZ |
111 | }; |
112 | ||
113 | ||
a57d600f | 114 | #endif // wxUSE_COMBOCTRL |
a340b80d VZ |
115 | #endif |
116 | // _WX_COMBOCONTROL_H_ |