]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/collpaneg.h
Change event names to clarify that they are only fired by button clicks, and note...
[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 #if wxUSE_BUTTON && wxUSE_STATLINE
16
17 // forward declared
18 class WXDLLEXPORT wxButton;
19 class WXDLLEXPORT wxStaticLine;
20
21 // class name
22 extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[];
23
24 // ----------------------------------------------------------------------------
25 // wxGenericCollapsiblePane
26 // ----------------------------------------------------------------------------
27
28 class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase
29 {
30 public:
31 wxGenericCollapsiblePane() { Init(); }
32
33 wxGenericCollapsiblePane(wxWindow *parent,
34 wxWindowID winid,
35 const wxString& label,
36 const wxPoint& pos = wxDefaultPosition,
37 const wxSize& size = wxDefaultSize,
38 long style = wxCP_DEFAULT_STYLE,
39 const wxValidator& val = wxDefaultValidator,
40 const wxString& name = wxCollapsiblePaneNameStr)
41 {
42 Init();
43
44 Create(parent, winid, label, pos, size, style, val, name);
45 }
46
47 void Init()
48 {
49 m_pButton = NULL;
50 m_pPane = NULL;
51 m_pStaticLine = NULL;
52 m_sz = NULL;
53 }
54
55 ~wxGenericCollapsiblePane();
56
57 bool Create(wxWindow *parent,
58 wxWindowID winid,
59 const wxString& label,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
62 long style = wxCP_DEFAULT_STYLE,
63 const wxValidator& val = wxDefaultValidator,
64 const wxString& name = wxCollapsiblePaneNameStr);
65
66 // public wxCollapsiblePane API
67 virtual void Collapse(bool collapse = true);
68 virtual void SetLabel(const wxString &label);
69
70 virtual bool IsCollapsed() const
71 { return m_pPane==NULL || !m_pPane->IsShown(); }
72 virtual wxWindow *GetPane() const
73 { return m_pPane; }
74 virtual wxString GetLabel() const
75 { return m_strLabel; }
76
77 virtual bool Layout();
78
79 // implementation only, don't use
80 void OnStateChange(const wxSize& sizeNew);
81
82 protected:
83 // overridden methods
84 virtual wxSize DoGetBestSize() const;
85
86 wxString GetBtnLabel() const;
87 int GetBorder() const;
88
89 // child controls
90 wxButton *m_pButton;
91 wxStaticLine *m_pStaticLine;
92 wxWindow *m_pPane;
93 wxSizer *m_sz;
94
95 // the button label without ">>" or "<<"
96 wxString m_strLabel;
97
98 private:
99 // event handlers
100 void OnButton(wxCommandEvent &ev);
101 void OnSize(wxSizeEvent &ev);
102
103 DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
104 DECLARE_EVENT_TABLE()
105 };
106
107 #endif // wxUSE_BUTTON && wxUSE_STATLINE
108 #endif // _WX_COLLAPSABLE_PANE_H_GENERIC_