]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/combo.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[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 // 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
15 // determine whether there is native wxComboCtrl, so make sure you
16 // use it in all native wxComboCtrls.
17
18 #if wxUSE_COMBOCTRL
19
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
28 // ----------------------------------------------------------------------------
29 // Native wxComboCtrl
30 // ----------------------------------------------------------------------------
31
32 // Define this only if native implementation includes all features
33 #define wxCOMBOCONTROL_FULLY_FEATURED
34
35 extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
36
37 class WXDLLIMPEXP_CORE wxComboCtrl : public wxComboCtrlBase
38 {
39 public:
40 // ctors and such
41 wxComboCtrl() : wxComboCtrlBase() { Init(); }
42
43 wxComboCtrl(wxWindow *parent,
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)
51 : wxComboCtrlBase()
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
67 virtual ~wxComboCtrl();
68
69 virtual void PrepareBackground( wxDC& dc, const wxRect& rect, int flags ) const;
70 virtual bool IsKeyPopupToggle(const wxKeyEvent& event) const;
71
72 static int GetFeatures() { return wxComboCtrlFeatures::All; }
73
74 #if wxUSE_COMBOCTRL_POPUP_ANIMATION
75 void OnTimerEvent(wxTimerEvent& WXUNUSED(event)) { DoTimerEvent(); }
76
77 protected:
78 void DoTimerEvent();
79
80 virtual bool AnimateShow( const wxRect& rect, int flags );
81 #endif // wxUSE_COMBOCTRL_POPUP_ANIMATION
82
83 protected:
84
85 // Dummy method - we override all functions that call this
86 virtual WXHWND GetEditHWND() const { return NULL; }
87
88 // customization
89 virtual void OnResize();
90 virtual wxCoord GetNativeTextIndent() const;
91
92 // event handlers
93 void OnPaintEvent( wxPaintEvent& event );
94 void OnMouseEvent( wxMouseEvent& event );
95
96 virtual bool HasTransparentBackground() { return IsDoubleBuffered(); }
97
98 private:
99 void Init();
100
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
109 DECLARE_EVENT_TABLE()
110
111 DECLARE_DYNAMIC_CLASS(wxComboCtrl)
112 };
113
114
115 #endif // wxUSE_COMBOCTRL
116 #endif
117 // _WX_COMBOCONTROL_H_