]> git.mxchange.org Git - simgear.git/blobdiff - simgear/canvas/Canvas.hxx
canvas::Text: add heightForWidth method.
[simgear.git] / simgear / canvas / Canvas.hxx
index 10872f22d7f0574e35066cb9ec96257ebb7d2955..2c817f61bcbf98fe17805b505847204df1d41f7f 100644 (file)
 #include "ODGauge.hxx"
 
 #include <simgear/canvas/elements/CanvasGroup.hxx>
+#include <simgear/canvas/layout/Layout.hxx>
 #include <simgear/math/SGRect.hxx>
+#include <simgear/nasal/cppbind/NasalObject.hxx>
 #include <simgear/props/PropertyBasedElement.hxx>
 #include <simgear/props/propertyObject.hxx>
+
 #include <osg/NodeCallback>
 #include <osg/observer_ptr>
 
@@ -41,16 +44,19 @@ namespace canvas
   class MouseEvent;
 
   class Canvas:
-    public PropertyBasedElement
+    public PropertyBasedElement,
+    public nasal::Object
   {
     public:
 
       enum StatusFlags
       {
         STATUS_OK,
-        STATUS_DIRTY     = 1,
-        MISSING_SIZE_X = STATUS_DIRTY << 1,
+        STATUS_DIRTY   = 1,
+        LAYOUT_DIRTY   = STATUS_DIRTY << 1,
+        MISSING_SIZE_X = LAYOUT_DIRTY << 1,
         MISSING_SIZE_Y = MISSING_SIZE_X << 1,
+        MISSING_SIZE   = MISSING_SIZE_X | MISSING_SIZE_Y,
         CREATE_FAILED  = MISSING_SIZE_Y << 1
       };
 
@@ -121,6 +127,12 @@ namespace canvas
        */
       GroupPtr getRootGroup();
 
+      /**
+       * Set the layout of the canvas (the layout will automatically update with
+       * the viewport size of the canvas)
+       */
+      void setLayout(const LayoutRef& layout);
+
       /**
        * Enable rendering for the next frame
        *
@@ -195,7 +207,9 @@ namespace canvas
            _visible;
 
       ODGauge _texture;
-      GroupPtr _root_group;
+
+      GroupPtr  _root_group;
+      LayoutRef _layout;
 
       CullCallbackPtr _cull_callback;
       bool _render_always; //<! Used to disable automatic lazy rendering (culling)