]>
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; | |
5ea93bd3 | 18 | #if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) |
162adae5 SC |
19 | class WXDLLIMPEXP_FWD_CORE wxDisclosureTriangle; |
20 | #endif | |
3c1f8cb1 | 21 | |
68b1c878 VZ |
22 | #include "wx/containr.h" |
23 | ||
3c1f8cb1 VZ |
24 | // ---------------------------------------------------------------------------- |
25 | // wxGenericCollapsiblePane | |
26 | // ---------------------------------------------------------------------------- | |
27 | ||
90230407 VZ |
28 | class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : |
29 | public wxNavigationEnabled<wxCollapsiblePaneBase> | |
3c1f8cb1 VZ |
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, | |
037c7b4c | 39 | long style = wxCP_DEFAULT_STYLE, |
3c1f8cb1 | 40 | const wxValidator& val = wxDefaultValidator, |
037c7b4c | 41 | const wxString& name = wxCollapsiblePaneNameStr) |
3c1f8cb1 VZ |
42 | { |
43 | Init(); | |
44 | ||
45 | Create(parent, winid, label, pos, size, style, val, name); | |
46 | } | |
47 | ||
68b1c878 | 48 | virtual ~wxGenericCollapsiblePane(); |
912c3932 | 49 | |
3c1f8cb1 VZ |
50 | bool Create(wxWindow *parent, |
51 | wxWindowID winid, | |
52 | const wxString& label, | |
53 | const wxPoint& pos = wxDefaultPosition, | |
54 | const wxSize& size = wxDefaultSize, | |
037c7b4c | 55 | long style = wxCP_DEFAULT_STYLE, |
3c1f8cb1 | 56 | const wxValidator& val = wxDefaultValidator, |
037c7b4c | 57 | const wxString& name = wxCollapsiblePaneNameStr); |
3c1f8cb1 | 58 | |
2cbf7014 VZ |
59 | // public wxCollapsiblePane API |
60 | virtual void Collapse(bool collapse = true); | |
61 | virtual void SetLabel(const wxString &label); | |
3c1f8cb1 | 62 | |
2cbf7014 | 63 | virtual bool IsCollapsed() const |
3c1f8cb1 | 64 | { return m_pPane==NULL || !m_pPane->IsShown(); } |
2cbf7014 | 65 | virtual wxWindow *GetPane() const |
3c1f8cb1 | 66 | { return m_pPane; } |
2cbf7014 | 67 | virtual wxString GetLabel() const |
3c1f8cb1 VZ |
68 | { return m_strLabel; } |
69 | ||
bc48a5d7 | 70 | virtual bool Layout(); |
4223cec5 | 71 | |
7737e2fd FM |
72 | |
73 | // for the generic collapsible pane only: | |
74 | wxControl* GetControlWidget() const | |
6dbf7a37 | 75 | { return (wxControl*)m_pButton; } |
7737e2fd | 76 | |
4223cec5 VZ |
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 |
5ea93bd3 | 88 | #if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) |
47922888 RR |
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: | |
68b1c878 VZ |
101 | void Init(); |
102 | ||
2cbf7014 VZ |
103 | // event handlers |
104 | void OnButton(wxCommandEvent &ev); | |
105 | void OnSize(wxSizeEvent &ev); | |
106 | ||
3c1f8cb1 VZ |
107 | DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane) |
108 | DECLARE_EVENT_TABLE() | |
109 | }; | |
110 | ||
2cbf7014 | 111 | #endif // _WX_COLLAPSABLE_PANE_H_GENERIC_ |