]> git.mxchange.org Git - flightgear.git/blobdiff - src/Canvas/window.hxx
VoiceSynthesizer: add some test/debug properties
[flightgear.git] / src / Canvas / window.hxx
index 46fb48ee2c43a2f1b2cf88202e73613f2e3ae3f5..da99b60708db71d3fa216da3c5c285739afc7110 100644 (file)
@@ -23,6 +23,7 @@
 #include <simgear/canvas/MouseEvent.hxx>
 #include <simgear/props/PropertyBasedElement.hxx>
 #include <simgear/props/propertyObject.hxx>
+#include <simgear/misc/CSSBorder.hxx>
 
 #include <osg/Geode>
 #include <osg/Geometry>
 namespace canvas
 {
   class Window:
-    public simgear::PropertyBasedElement
+    public simgear::canvas::Image
   {
     public:
+      static const std::string TYPE_NAME;
 
       enum Resize
       {
@@ -44,30 +46,66 @@ namespace canvas
         INIT    = BOTTOM << 1
       };
 
-      Window(SGPropertyNode* node);
+      typedef simgear::canvas::Style Style;
+
+      /**
+       * @param node    Property node containing settings for this window:
+       *                  capture-events    Disable/Enable event capturing
+       *                  content-size[0-1] Size of content area (excluding
+       *                                    decoration border)
+       *                  decoration-border Size of decoration border
+       *                  resize            Enable resize cursor and properties
+       *                  shadow-inset      Inset of shadow image
+       *                  shadow-radius     Radius/outset of shadow image
+       */
+      Window( const simgear::canvas::CanvasWeakPtr& canvas,
+              const SGPropertyNode_ptr& node,
+              const Style& parent_style = Style(),
+              Element* parent = 0 );
       virtual ~Window();
 
       virtual void update(double delta_time_sec);
       virtual void valueChanged(SGPropertyNode* node);
 
       osg::Group* getGroup();
-      const SGRect<float>& getRegion() const;
+      const SGVec2<float> getPosition() const;
+      const SGRect<float>  getScreenRegion() const;
 
-      void setCanvas(simgear::canvas::CanvasPtr canvas);
-      simgear::canvas::CanvasWeakPtr getCanvas() const;
+      void setCanvasContent(simgear::canvas::CanvasPtr canvas);
+      simgear::canvas::CanvasWeakPtr getCanvasContent() const;
 
-      bool isResizable() const;
+      simgear::canvas::CanvasPtr getCanvasDecoration();
 
-      bool handleMouseEvent(const simgear::canvas::MouseEventPtr& event);
+      bool isResizable() const;
+      bool isCapturingEvents() const;
 
-      void handleResize(uint8_t mode, const osg::Vec2f& delta = osg::Vec2f());
+      /**
+       * Moves window on top of all other windows with the same z-index.
+       *
+       * @note If no z-index is set it defaults to 0.
+       */
+      void raise();
 
-      void doRaise(SGPropertyNode* node_raise = 0);
+      void handleResize( uint8_t mode,
+                         const osg::Vec2f& offset = osg::Vec2f() );
 
     protected:
 
-      simgear::canvas::Image _image;
-      bool _resizable;
+      enum Attributes
+      {
+        DECORATION = 1
+      };
+
+      uint32_t  _attributes_dirty;
+
+      simgear::canvas::CanvasPtr        _canvas_decoration;
+      simgear::canvas::CanvasWeakPtr    _canvas_content;
+
+      simgear::canvas::ImagePtr _image_content,
+                                _image_shadow;
+
+      bool _resizable,
+           _capture_events;
 
       simgear::PropertyObject<int> _resize_top,
                                    _resize_right,
@@ -75,6 +113,10 @@ namespace canvas
                                    _resize_left,
                                    _resize_status;
 
+      simgear::CSSBorder    _decoration_border;
+
+      void parseDecorationBorder(const std::string& str);
+      void updateDecoration();
   };
 } // namespace canvas