]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/collpaneg.h
Add new wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED event. Implement for all backends, exten...
[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 // forward declared
16 class WXDLLIMPEXP_FWD_CORE wxButton;
17 class WXDLLIMPEXP_FWD_CORE wxStaticLine;
18 #if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
19 class WXDLLIMPEXP_FWD_CORE wxDisclosureTriangle;
20 #endif
21
22 #include "wx/containr.h"
23
24 // ----------------------------------------------------------------------------
25 // wxGenericCollapsiblePane
26 // ----------------------------------------------------------------------------
27
28 class WXDLLIMPEXP_CORE wxGenericCollapsiblePane :
29 public wxNavigationEnabled<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 = wxCP_DEFAULT_STYLE,
40 const wxValidator& val = wxDefaultValidator,
41 const wxString& name = wxCollapsiblePaneNameStr)
42 {
43 Init();
44
45 Create(parent, winid, label, pos, size, style, val, name);
46 }
47
48 virtual ~wxGenericCollapsiblePane();
49
50 bool Create(wxWindow *parent,
51 wxWindowID winid,
52 const wxString& label,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = wxCP_DEFAULT_STYLE,
56 const wxValidator& val = wxDefaultValidator,
57 const wxString& name = wxCollapsiblePaneNameStr);
58
59 // public wxCollapsiblePane API
60 virtual void Collapse(bool collapse = true);
61 virtual void SetLabel(const wxString &label);
62
63 virtual bool IsCollapsed() const
64 { return m_pPane==NULL || !m_pPane->IsShown(); }
65 virtual wxWindow *GetPane() const
66 { return m_pPane; }
67 virtual wxString GetLabel() const
68 { return m_strLabel; }
69
70 virtual bool Layout();
71
72
73 // for the generic collapsible pane only:
74 wxControl* GetControlWidget() const
75 { return (wxControl*)m_pButton; }
76
77 // implementation only, don't use
78 void OnStateChange(const wxSize& sizeNew);
79
80 protected:
81 // overridden methods
82 virtual wxSize DoGetBestSize() const;
83
84 wxString GetBtnLabel() const;
85 int GetBorder() const;
86
87 // child controls
88 #if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
89 wxDisclosureTriangle *m_pButton;
90 #else
91 wxButton *m_pButton;
92 #endif
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 void Init();
102
103 // event handlers
104 void OnButton(wxCommandEvent &ev);
105 void OnSize(wxSizeEvent &ev);
106
107 DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
108 DECLARE_EVENT_TABLE()
109 };
110
111 #endif // _WX_COLLAPSABLE_PANE_H_GENERIC_