]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/collpaneg.h
use gtk_expander_new_with_mnemonic() instead of just gtk_expander_new()
[wxWidgets.git] / include / wx / generic / collpaneg.h
CommitLineData
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
15#include "wx/button.h"
16
17
18// the ID of the wxButton used to collapse/expand the panel
19#define wxCP_BUTTON_ID 12356
20
21// the number of pixels to leave between the button and the static line and
22// between the button and the pane
23#define wxCP_MARGIN 10
24
25// forward declared
26class WXDLLEXPORT wxStaticLine;
27
28// class name
29extern WXDLLEXPORT_DATA(const wxChar) wxGenericCollapsiblePaneNameStr[];
30
31
32
33// ----------------------------------------------------------------------------
34// wxGenericCollapsiblePane
35// ----------------------------------------------------------------------------
36
37class WXDLLEXPORT wxGenericCollapsiblePane : public wxCollapsiblePaneBase
38{
39public:
40 wxGenericCollapsiblePane() { Init(); }
41
42 wxGenericCollapsiblePane(wxWindow *parent,
43 wxWindowID winid,
44 const wxString& label,
45 const wxPoint& pos = wxDefaultPosition,
46 const wxSize& size = wxDefaultSize,
47 long style = wxTAB_TRAVERSAL | wxNO_BORDER,
48 const wxValidator& val = wxDefaultValidator,
49 const wxString& name = wxGenericCollapsiblePaneNameStr)
50 {
51 Init();
52
53 Create(parent, winid, label, pos, size, style, val, name);
54 }
55
56 void Init()
57 {
58 m_pButton = NULL;
59 m_pStatLine = NULL;
60 m_pPane = NULL;
61 }
62
63 bool Create(wxWindow *parent,
64 wxWindowID winid,
65 const wxString& label,
66 const wxPoint& pos = wxDefaultPosition,
67 const wxSize& size = wxDefaultSize,
68 long style = wxTAB_TRAVERSAL | wxNO_BORDER,
69 const wxValidator& val = wxDefaultValidator,
70 const wxString& name = wxGenericCollapsiblePaneNameStr);
71
72
73public: // public API
74
75 void Collapse(bool collapse = true);
76 void SetLabel(const wxString &label);
77
78 bool IsCollapsed() const
79 { return m_pPane==NULL || !m_pPane->IsShown(); }
80 wxWindow *GetPane() const
81 { return m_pPane; }
82 wxString GetLabel() const
83 { return m_strLabel; }
84
85 wxWindow *GetTopLevelParent();
86
87public: // event handlers
88
89 void OnButton(wxCommandEvent &ev);
90 void OnSize(wxSizeEvent &ev);
91
92protected: // internal utils
93
94 void LayoutChildren();
95
96 wxString GetBtnLabel() const;
97 virtual wxSize DoGetBestSize() const;
98
99protected:
100
101 wxButton *m_pButton;
102 wxStaticLine *m_pStatLine;
103 wxWindow *m_pPane;
104
105 // the button label without ">>" or "<<"
106 wxString m_strLabel;
107
108private:
109 DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
110 DECLARE_EVENT_TABLE()
111};
112
113
114#endif
115 // _WX_COLLAPSABLE_PANE_H_GENERIC_