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 "MapViewBar.h"
21 
22 #include "PreferenceManager.h"
23 #include "Preferences.h"
24 #include "View/MapDocument.h"
25 #include "View/ViewConstants.h"
26 #include "View/ViewEditor.h"
27 #include "View/wxUtils.h"
28 
29 #include <wx/dcclient.h>
30 #include <wx/simplebook.h>
31 #include <wx/sizer.h>
32 #include <wx/srchctrl.h>
33 #include <wx/statbmp.h>
34 #include <wx/stattext.h>
35 
36 namespace TrenchBroom {
37     namespace View {
MapViewBar(wxWindow * parent,MapDocumentWPtr document)38         MapViewBar::MapViewBar(wxWindow* parent, MapDocumentWPtr document) :
39         ContainerBar(parent, wxBOTTOM),
40         m_document(document),
41         m_toolBook(NULL),
42         m_viewEditor(NULL) {
43 #if defined __APPLE__
44             SetWindowVariant(wxWINDOW_VARIANT_SMALL);
45 #endif
46             createGui(document);
47         }
48 
toolBook()49         wxBookCtrlBase* MapViewBar::toolBook() {
50             return m_toolBook;
51         }
52 
OnSearchPatternChanged(wxCommandEvent & event)53         void MapViewBar::OnSearchPatternChanged(wxCommandEvent& event) {
54             if (IsBeingDeleted()) return;
55         }
56 
createGui(MapDocumentWPtr document)57         void MapViewBar::createGui(MapDocumentWPtr document) {
58             m_toolBook = new wxSimplebook(this);
59             m_viewEditor = new ViewPopupEditor(this, document);
60 
61             wxSizer* hSizer = new wxBoxSizer(wxHORIZONTAL);
62             hSizer->AddSpacer(LayoutConstants::NarrowHMargin);
63             hSizer->Add(m_toolBook, 1, wxEXPAND);
64             hSizer->AddSpacer(LayoutConstants::MediumHMargin);
65             hSizer->Add(m_viewEditor, 0, wxALIGN_CENTRE_VERTICAL);
66             hSizer->AddSpacer(LayoutConstants::NarrowHMargin);
67 
68             wxSizer* vSizer = new wxBoxSizer(wxVERTICAL);
69             vSizer->AddSpacer(LayoutConstants::NarrowVMargin);
70             vSizer->Add(hSizer, 1, wxEXPAND);
71             vSizer->AddSpacer(LayoutConstants::NarrowVMargin);
72 
73             SetSizer(vSizer);
74         }
75     }
76 }
77