]> git.mxchange.org Git - simgear.git/blobdiff - simgear/canvas/elements/CanvasPath.hxx
Canvas: Respect clipping while event handling.
[simgear.git] / simgear / canvas / elements / CanvasPath.hxx
index 3ef722a4ca02b31f15cd895dc9b3733dd299a552..9cd3aef589e48385d4e53c7c3bf8dd16ad5a5f14 100644 (file)
@@ -20,6 +20,7 @@
 #define CANVAS_PATH_HXX_
 
 #include "CanvasElement.hxx"
+#include <boost/preprocessor/iteration/iterate.hpp>
 
 namespace simgear
 {
@@ -29,13 +30,43 @@ namespace canvas
     public Element
   {
     public:
+      static const std::string TYPE_NAME;
+      static void staticInit();
+
       Path( const CanvasWeakPtr& canvas,
             const SGPropertyNode_ptr& node,
-            const Style& parent_style );
+            const Style& parent_style,
+            Element* parent = 0 );
       virtual ~Path();
 
       virtual void update(double dt);
 
+      virtual osg::BoundingBox getTransformedBounds(const osg::Matrix& m) const;
+
+#define BOOST_PP_ITERATION_LIMITS (0, 6)
+#define BOOST_PP_FILENAME_1 \
+        <simgear/canvas/elements/detail/add_segment_variadic.hxx>
+#include BOOST_PP_ITERATE()
+
+      /** Move path cursor */
+      Path& moveTo(float x_abs, float y_abs);
+      Path& move(float x_rel, float y_rel);
+
+      /** Add a line */
+      Path& lineTo(float x_abs, float y_abs);
+      Path& line(float x_rel, float y_rel);
+
+      /** Add a horizontal line */
+      Path& horizTo(float x_abs);
+      Path& horiz(float x_rel);
+
+      /** Add a vertical line */
+      Path& vertTo(float y_abs);
+      Path& vert(float y_rel);
+
+      /** Close the path (implicit lineTo to first point of path) */
+      Path& close();
+
     protected:
 
       enum PathAttributes
@@ -45,7 +76,8 @@ namespace canvas
       };
 
       class PathDrawable;
-      osg::ref_ptr<PathDrawable> _path;
+      typedef osg::ref_ptr<PathDrawable> PathDrawableRef;
+      PathDrawableRef _path;
 
       virtual void childRemoved(SGPropertyNode * child);
       virtual void childChanged(SGPropertyNode * child);