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_EntityBrowser
21 #define TrenchBroom_EntityBrowser
22 
23 #include "StringUtils.h"
24 #include "View/GLAttribs.h"
25 #include "View/ViewTypes.h"
26 
27 #include <wx/panel.h>
28 
29 class wxToggleButton;
30 class wxChoice;
31 class wxGLContext;
32 class wxScrollBar;
33 class wxSearchCtrl;
34 
35 namespace TrenchBroom {
36     namespace IO {
37         class Path;
38     }
39 
40     namespace View {
41         class EntityBrowserView;
42         class GLContextManager;
43 
44         class EntityBrowser : public wxPanel {
45         private:
46             MapDocumentWPtr m_document;
47             wxChoice* m_sortOrderChoice;
48             wxToggleButton* m_groupButton;
49             wxToggleButton* m_usedButton;
50             wxSearchCtrl* m_filterBox;
51             wxScrollBar* m_scrollBar;
52             EntityBrowserView* m_view;
53         public:
54             EntityBrowser(wxWindow* parent, MapDocumentWPtr document, GLContextManager& contextManager);
55             ~EntityBrowser();
56 
57             void reload();
58 
59             void OnSortOrderChanged(wxCommandEvent& event);
60             void OnGroupButtonToggled(wxCommandEvent& event);
61             void OnUsedButtonToggled(wxCommandEvent& event);
62             void OnFilterPatternChanged(wxCommandEvent& event);
63         private:
64             void createGui(GLContextManager& contextManager);
65 
66             void bindObservers();
67             void unbindObservers();
68 
69             void documentWasNewed(MapDocument* document);
70             void documentWasLoaded(MapDocument* document);
71 
72             void modsDidChange();
73             void entityDefinitionsDidChange();
74             void preferenceDidChange(const IO::Path& path);
75         };
76     }
77 }
78 
79 #endif /* defined(TrenchBroom_EntityBrowser) */
80