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 #include "TitledPanel.h" 21 22 #include "View/BorderLine.h" 23 #include "View/TitleBar.h" 24 #include "View/ViewConstants.h" 25 26 #include <wx/sizer.h> 27 28 namespace TrenchBroom { 29 namespace View { TitledPanel(wxWindow * parent,const wxString & title,const bool showDivider)30 TitledPanel::TitledPanel(wxWindow* parent, const wxString& title, const bool showDivider) : 31 wxPanel(parent), 32 m_panel(new wxPanel(this)) { 33 const int hMargin = showDivider ? LayoutConstants::NarrowHMargin : 0; 34 const int vMargin = showDivider ? LayoutConstants::NarrowVMargin : 0; 35 36 wxSizer* sizer = new wxBoxSizer(wxVERTICAL); 37 sizer->Add(new TitleBar(this, title, hMargin, vMargin), 0, wxEXPAND); 38 if (showDivider) 39 sizer->Add(new BorderLine(this, BorderLine::Direction_Horizontal), 0, wxEXPAND); 40 sizer->Add(m_panel, 1, wxEXPAND); 41 SetSizer(sizer); 42 } 43 getPanel() const44 wxWindow* TitledPanel::getPanel() const { 45 return m_panel; 46 } 47 } 48 } 49