]>
Commit | Line | Data |
---|---|---|
3c1f8cb1 VZ |
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 | ||
3c1f8cb1 | 15 | // forward declared |
b5dbe15d VS |
16 | class WXDLLIMPEXP_FWD_CORE wxButton; |
17 | class WXDLLIMPEXP_FWD_CORE wxStaticLine; | |
3c1f8cb1 | 18 | |
3c1f8cb1 VZ |
19 | // ---------------------------------------------------------------------------- |
20 | // wxGenericCollapsiblePane | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
3c6fa826 | 23 | class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase |
3c1f8cb1 VZ |
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, | |
037c7b4c | 33 | long style = wxCP_DEFAULT_STYLE, |
3c1f8cb1 | 34 | const wxValidator& val = wxDefaultValidator, |
037c7b4c | 35 | const wxString& name = wxCollapsiblePaneNameStr) |
3c1f8cb1 VZ |
36 | { |
37 | Init(); | |
38 | ||
39 | Create(parent, winid, label, pos, size, style, val, name); | |
40 | } | |
41 | ||
42 | void Init() | |
43 | { | |
44 | m_pButton = NULL; | |
3c1f8cb1 | 45 | m_pPane = NULL; |
912c3932 VZ |
46 | m_pStaticLine = NULL; |
47 | m_sz = NULL; | |
3c1f8cb1 VZ |
48 | } |
49 | ||
912c3932 VZ |
50 | ~wxGenericCollapsiblePane(); |
51 | ||
3c1f8cb1 VZ |
52 | bool Create(wxWindow *parent, |
53 | wxWindowID winid, | |
54 | const wxString& label, | |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
037c7b4c | 57 | long style = wxCP_DEFAULT_STYLE, |
3c1f8cb1 | 58 | const wxValidator& val = wxDefaultValidator, |
037c7b4c | 59 | const wxString& name = wxCollapsiblePaneNameStr); |
3c1f8cb1 | 60 | |
2cbf7014 VZ |
61 | // public wxCollapsiblePane API |
62 | virtual void Collapse(bool collapse = true); | |
63 | virtual void SetLabel(const wxString &label); | |
3c1f8cb1 | 64 | |
2cbf7014 | 65 | virtual bool IsCollapsed() const |
3c1f8cb1 | 66 | { return m_pPane==NULL || !m_pPane->IsShown(); } |
2cbf7014 | 67 | virtual wxWindow *GetPane() const |
3c1f8cb1 | 68 | { return m_pPane; } |
2cbf7014 | 69 | virtual wxString GetLabel() const |
3c1f8cb1 VZ |
70 | { return m_strLabel; } |
71 | ||
bc48a5d7 | 72 | virtual bool Layout(); |
4223cec5 VZ |
73 | |
74 | // implementation only, don't use | |
75 | void OnStateChange(const wxSize& sizeNew); | |
76 | ||
abbe3d37 | 77 | protected: |
2cbf7014 VZ |
78 | // overridden methods |
79 | virtual wxSize DoGetBestSize() const; | |
3c1f8cb1 VZ |
80 | |
81 | wxString GetBtnLabel() const; | |
912c3932 | 82 | int GetBorder() const; |
3c1f8cb1 | 83 | |
2cbf7014 | 84 | // child controls |
3c1f8cb1 | 85 | wxButton *m_pButton; |
912c3932 | 86 | wxStaticLine *m_pStaticLine; |
3c1f8cb1 | 87 | wxWindow *m_pPane; |
912c3932 | 88 | wxSizer *m_sz; |
3c1f8cb1 VZ |
89 | |
90 | // the button label without ">>" or "<<" | |
91 | wxString m_strLabel; | |
92 | ||
93 | private: | |
2cbf7014 VZ |
94 | // event handlers |
95 | void OnButton(wxCommandEvent &ev); | |
96 | void OnSize(wxSizeEvent &ev); | |
97 | ||
3c1f8cb1 VZ |
98 | DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane) |
99 | DECLARE_EVENT_TABLE() | |
100 | }; | |
101 | ||
2cbf7014 | 102 | #endif // _WX_COLLAPSABLE_PANE_H_GENERIC_ |