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