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