]> git.mxchange.org Git - flightgear.git/blobdiff - src/Canvas/window.hxx
VoiceSynthesizer: add some test/debug properties
[flightgear.git] / src / Canvas / window.hxx
index 3a94f4c8e1dacf5b01a6d2e14c05c134f73809fd..da99b60708db71d3fa216da3c5c285739afc7110 100644 (file)
 #ifndef CANVAS_WINDOW_HXX_
 #define CANVAS_WINDOW_HXX_
 
-#include "property_based_element.hxx"
-#include <Canvas/elements/CanvasImage.hxx>
-#include <Canvas/MouseEvent.hxx>
-
+#include <simgear/canvas/elements/CanvasImage.hxx>
+#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 PropertyBasedElement
+    public simgear::canvas::Image
   {
     public:
-      Window(SGPropertyNode* node);
+      static const std::string TYPE_NAME;
+
+      enum Resize
+      {
+        NONE    = 0,
+        LEFT    = 1,
+        RIGHT   = LEFT << 1,
+        TOP     = RIGHT << 1,
+        BOTTOM  = TOP << 1,
+        INIT    = BOTTOM << 1
+      };
+
+      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 valueChanged(SGPropertyNode* node);
 
       osg::Group* getGroup();
-      const Rect<float>& getRegion() const;
+      const SGVec2<float> getPosition() const;
+      const SGRect<float>  getScreenRegion() const;
+
+      void setCanvasContent(simgear::canvas::CanvasPtr canvas);
+      simgear::canvas::CanvasWeakPtr getCanvasContent() const;
+
+      simgear::canvas::CanvasPtr getCanvasDecoration();
+
+      bool isResizable() const;
+      bool isCapturingEvents() const;
 
-      void setCanvas(CanvasPtr canvas);
-      CanvasWeakPtr getCanvas() const;
+      /**
+       * 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();
 
-      bool handleMouseEvent(const MouseEvent& event);
+      void handleResize( uint8_t mode,
+                         const osg::Vec2f& offset = osg::Vec2f() );
 
     protected:
 
-      Image _image;
+      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,
+                                   _resize_bottom,
+                                   _resize_left,
+                                   _resize_status;
+
+      simgear::CSSBorder    _decoration_border;
+
+      void parseDecorationBorder(const std::string& str);
+      void updateDecoration();
   };
 } // namespace canvas