1 /*
2  Copyright (C) 2010-2014 Kristian Duske
3 
4  This file is part of TrenchBroom.
5 
6  TrenchBroom is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  TrenchBroom is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef TrenchBroom_CollapsibleTitledPanel
21 #define TrenchBroom_CollapsibleTitledPanel
22 
23 #include "View/TitleBar.h"
24 
25 class wxStaticText;
26 
27 wxDECLARE_EVENT(TITLE_BAR_CLICK, wxCommandEvent);
28 
29 namespace TrenchBroom {
30     namespace View {
31         class BorderLine;
32 
33         class CollapsibleTitleBar : public TitleBar {
34         private:
35             wxStaticText* m_stateText;
36         public:
37             CollapsibleTitleBar(wxWindow* parent, const wxString& title, const wxString& stateText);
38 
39             void setStateText(const wxString& stateText);
40         private:
41             void OnClick(wxMouseEvent& event);
42         };
43 
44         class CollapsibleTitledPanel : public wxPanel {
45         private:
46             CollapsibleTitleBar* m_titleBar;
47             BorderLine* m_divider;
48             wxPanel* m_panel;
49             bool m_expanded;
50         public:
51             CollapsibleTitledPanel(wxWindow* parent, const wxString& title, bool initiallyExpanded = true);
52 
53             wxWindow* getPanel() const;
54 
55             void expand();
56             void collapse();
57             bool expanded() const;
58             void setExpanded(bool expanded);
59 
60             void OnTitleBarClick(wxCommandEvent& event);
61         private:
62             void update();
63         };
64     }
65 }
66 
67 #endif /* defined(TrenchBroom_CollapsibleTitledPanel) */
68