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_Tool
21 #define TrenchBroom_Tool
22 
23 #include "Notifier.h"
24 
25 class wxBitmap;
26 class wxBookCtrlBase;
27 class wxWindow;
28 
29 namespace TrenchBroom {
30     namespace View {
31         class Tool {
32         private:
33             bool m_active;
34 
35             wxBookCtrlBase* m_book;
36             size_t m_pageIndex;
37         public:
38             Notifier1<Tool*> toolActivatedNotifier;
39             Notifier1<Tool*> toolDeactivatedNotifier;
40             Notifier1<Tool*> refreshViewsNotifier;
41         protected:
42             Tool(bool initiallyActive);
43         public:
44             virtual ~Tool();
45 
46             bool active() const;
47             bool activate();
48             bool deactivate();
49 
50             void refreshViews();
51 
52             void createPage(wxBookCtrlBase* book);
53             void showPage();
54 
55             wxBitmap icon() const;
56         private:
57             virtual bool doActivate();
58             virtual bool doDeactivate();
59 
60             virtual wxWindow* doCreatePage(wxWindow* parent);
61             virtual String doGetIconName() const;
62         };
63     }
64 }
65 
66 #endif /* defined(TrenchBroom_Tool) */
67