]> git.mxchange.org Git - flightgear.git/blobdiff - src/Canvas/window.hxx
VoiceSynthesizer: add some test/debug properties
[flightgear.git] / src / Canvas / window.hxx
index 905b0e4c3382c69d29a9b5f650bde0d4fb1419ed..da99b60708db71d3fa216da3c5c285739afc7110 100644 (file)
 namespace canvas
 {
   class Window:
-    public simgear::PropertyBasedElement
+    public simgear::canvas::Image
   {
     public:
+      static const std::string TYPE_NAME;
 
       enum Resize
       {
@@ -45,39 +46,54 @@ 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);
-      virtual void childAdded(SGPropertyNode* parent, SGPropertyNode* child);
-      virtual void childRemoved(SGPropertyNode* parent, SGPropertyNode* child);
 
       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;
 
       simgear::canvas::CanvasPtr getCanvasDecoration();
 
-      bool isVisible() const;
       bool isResizable() const;
       bool isCapturingEvents() const;
 
-      bool handleMouseEvent(const simgear::canvas::MouseEventPtr& event);
+      /**
+       * 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 handleResize(uint8_t mode, const osg::Vec2f& delta = osg::Vec2f());
-
-      void doRaise(SGPropertyNode* node_raise = 0);
+      void handleResize( uint8_t mode,
+                         const osg::Vec2f& offset = osg::Vec2f() );
 
     protected:
 
       enum Attributes
       {
-        SHADOW = 1
+        DECORATION = 1
       };
 
       uint32_t  _attributes_dirty;
@@ -85,7 +101,6 @@ namespace canvas
       simgear::canvas::CanvasPtr        _canvas_decoration;
       simgear::canvas::CanvasWeakPtr    _canvas_content;
 
-      simgear::canvas::Image    _image;
       simgear::canvas::ImagePtr _image_content,
                                 _image_shadow;
 
@@ -101,6 +116,7 @@ namespace canvas
       simgear::CSSBorder    _decoration_border;
 
       void parseDecorationBorder(const std::string& str);
+      void updateDecoration();
   };
 } // namespace canvas