]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/collpaneg.h
added Show/HideWithEffect() and implemented them using AnimateWindow() for Win32
[wxWidgets.git] / include / wx / generic / collpaneg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/collpaneg.h
3 // Purpose: wxGenericCollapsiblePane
4 // Author: Francesco Montorsi
5 // Modified by:
6 // Created: 8/10/2006
7 // RCS-ID: $Id$
8 // Copyright: (c) Francesco Montorsi
9 // Licence: wxWindows Licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COLLAPSABLE_PANE_H_GENERIC_
13 #define _WX_COLLAPSABLE_PANE_H_GENERIC_
14
15 // forward declared
16 class WXDLLIMPEXP_FWD_CORE wxButton;
17 class WXDLLIMPEXP_FWD_CORE wxStaticLine;
18
19 // ----------------------------------------------------------------------------
20 // wxGenericCollapsiblePane
21 // ----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase
24 {
25 public:
26 wxGenericCollapsiblePane() { Init(); }
27
28 wxGenericCollapsiblePane(wxWindow *parent,
29 wxWindowID winid,
30 const wxString& label,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize,
33 long style = wxCP_DEFAULT_STYLE,
34 const wxValidator& val = wxDefaultValidator,
35 const wxString& name = wxCollapsiblePaneNameStr)
36 {
37 Init();
38
39 Create(parent, winid, label, pos, size, style, val, name);
40 }
41
42 void Init()
43 {
44 m_pButton = NULL;
45 m_pPane = NULL;
46 m_pStaticLine = NULL;
47 m_sz = NULL;
48 }
49
50 ~wxGenericCollapsiblePane();
51
52 bool Create(wxWindow *parent,
53 wxWindowID winid,
54 const wxString& label,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 long style = wxCP_DEFAULT_STYLE,
58 const wxValidator& val = wxDefaultValidator,
59 const wxString& name = wxCollapsiblePaneNameStr);
60
61 // public wxCollapsiblePane API
62 virtual void Collapse(bool collapse = true);
63 virtual void SetLabel(const wxString &label);
64
65 virtual bool IsCollapsed() const
66 { return m_pPane==NULL || !m_pPane->IsShown(); }
67 virtual wxWindow *GetPane() const
68 { return m_pPane; }
69 virtual wxString GetLabel() const
70 { return m_strLabel; }
71
72 virtual bool Layout();
73
74 // implementation only, don't use
75 void OnStateChange(const wxSize& sizeNew);
76
77 protected:
78 // overridden methods
79 virtual wxSize DoGetBestSize() const;
80
81 wxString GetBtnLabel() const;
82 int GetBorder() const;
83
84 // child controls
85 wxButton *m_pButton;
86 wxStaticLine *m_pStaticLine;
87 wxWindow *m_pPane;
88 wxSizer *m_sz;
89
90 // the button label without ">>" or "<<"
91 wxString m_strLabel;
92
93 private:
94 // event handlers
95 void OnButton(wxCommandEvent &ev);
96 void OnSize(wxSizeEvent &ev);
97
98 DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
99 DECLARE_EVENT_TABLE()
100 };
101
102 #endif // _WX_COLLAPSABLE_PANE_H_GENERIC_