1 // Window for placing a Canvas onto it (for dialogs, menus, etc.)
3 // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Library General Public
7 // License as published by the Free Software Foundation; either
8 // version 2 of the License, or (at your option) any later version.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Library General Public License for more details.
15 // You should have received a copy of the GNU Library General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef CANVAS_WINDOW_HXX_
20 #define CANVAS_WINDOW_HXX_
22 #include <simgear/canvas/elements/CanvasImage.hxx>
23 #include <simgear/canvas/events/MouseEvent.hxx>
24 #include <simgear/props/PropertyBasedElement.hxx>
25 #include <simgear/props/propertyObject.hxx>
26 #include <simgear/misc/CSSBorder.hxx>
29 #include <osg/Geometry>
40 static const std::string TYPE_NAME;
53 * @param node Property node containing settings for this window:
54 * capture-events Disable/Enable event capturing
55 * content-size[0-1] Size of content area (excluding
57 * decoration-border Size of decoration border
58 * resize Enable resize cursor and properties
59 * shadow-inset Inset of shadow image
60 * shadow-radius Radius/outset of shadow image
62 Window( const CanvasWeakPtr& canvas,
63 const SGPropertyNode_ptr& node,
64 const Style& parent_style = Style(),
65 Element* parent = 0 );
68 virtual void update(double delta_time_sec);
69 virtual void valueChanged(SGPropertyNode* node);
71 osg::Group* getGroup();
72 const SGVec2<float> getPosition() const;
73 const SGRect<float> getScreenRegion() const;
75 void setCanvasContent(CanvasPtr canvas);
76 simgear::canvas::CanvasWeakPtr getCanvasContent() const;
78 CanvasPtr getCanvasDecoration() const;
80 bool isResizable() const;
81 bool isCapturingEvents() const;
84 * Moves window on top of all other windows with the same z-index.
86 * @note If no z-index is set it defaults to 0.
90 void handleResize( uint8_t mode,
91 const osg::Vec2f& offset = osg::Vec2f() );
100 uint32_t _attributes_dirty;
102 CanvasPtr _canvas_decoration;
103 CanvasWeakPtr _canvas_content;
105 ImagePtr _image_content,
111 PropertyObject<int> _resize_top,
117 CSSBorder _decoration_border;
119 void parseDecorationBorder(const std::string& str);
120 void updateDecoration();
123 } // namespace canvas
124 } // namespace simgear
126 #endif /* CANVAS_WINDOW_HXX_ */