1 // Canvas gui/dialog manager
3 // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
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.
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.
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.
19 #ifndef CANVAS_GUI_MGR_HXX_
20 #define CANVAS_GUI_MGR_HXX_
22 #include <simgear/canvas/canvas_fwd.hxx>
23 #include <simgear/canvas/elements/CanvasGroup.hxx>
24 #include <simgear/props/PropertyBasedMgr.hxx>
25 #include <simgear/props/propertyObject.hxx>
27 #include <osg/ref_ptr>
29 #include <osg/MatrixTransform>
33 class GUIEventAdapter;
36 class GUIEventHandler;
43 simgear::canvas::WindowPtr createWindow(const std::string& name = "");
46 virtual void shutdown();
48 virtual void update(double dt);
51 * Get simgear::canvas::Group containing all windows
53 simgear::canvas::GroupPtr getDesktop();
56 * Set the input (keyboard) focus to the given window.
58 void setInputFocus(const simgear::canvas::WindowPtr& window);
61 * Grabs the pointer so that all events are passed to this @a window until
62 * the pointer is ungrabbed with ungrabPointer().
64 bool grabPointer(const simgear::canvas::WindowPtr& window);
67 * Releases the grab acquired for this @a window with grabPointer().
69 void ungrabPointer(const simgear::canvas::WindowPtr& window);
73 simgear::canvas::GroupPtr _desktop;
74 osg::ref_ptr<GUIEventHandler> _event_handler;
76 simgear::canvas::Placements
77 addWindowPlacement( SGPropertyNode* placement,
78 simgear::canvas::CanvasPtr canvas );
81 #endif /* CANVAS_GUI_MGR_HXX_ */