]> git.mxchange.org Git - flightgear.git/blob - src/Canvas/gui_mgr.hxx
Fix a Clang warning in Shiva.
[flightgear.git] / src / Canvas / gui_mgr.hxx
1 // Canvas gui/dialog manager
2 //
3 // Copyright (C) 2012  Thomas Geymayer <tomgey@gmail.com>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
19 #ifndef CANVAS_GUI_MGR_HXX_
20 #define CANVAS_GUI_MGR_HXX_
21
22 #include "property_based_mgr.hxx"
23 #include <Canvas/canvas_fwd.hpp>
24 #include <Canvas/placement.hxx>
25
26 #include <simgear/props/propertyObject.hxx>
27
28 #include <osg/ref_ptr>
29 #include <osg/Geode>
30 #include <osg/MatrixTransform>
31
32 namespace osgGA
33 {
34   class GUIEventAdapter;
35 }
36
37 class GUIEventHandler;
38 class GUIMgr:
39   public PropertyBasedMgr
40 {
41   public:
42     GUIMgr();
43
44     virtual void init();
45     virtual void shutdown();
46
47     virtual void elementCreated(PropertyBasedElementPtr element);
48
49     bool handleEvent(const osgGA::GUIEventAdapter& ea);
50
51   protected:
52     osg::ref_ptr<GUIEventHandler>       _event_handler;
53     osg::ref_ptr<osg::MatrixTransform>  _transform;
54
55     simgear::PropertyObject<int>        _width,
56                                         _height;
57
58     canvas::WindowWeakPtr _last_push;
59     float _last_x,
60           _last_y;
61
62     canvas::WindowPtr getWindow(size_t i);
63     canvas::Placements addPlacement( const SGPropertyNode*,
64                                      CanvasPtr canvas );
65
66     bool handleMouse(const osgGA::GUIEventAdapter& ea);
67     void handleResize(int x, int y, int width, int height);
68 };
69
70 #endif /* CANVAS_GUI_MGR_HXX_ */