X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fcanvas%2FCanvas.hxx;h=2c817f61bcbf98fe17805b505847204df1d41f7f;hb=23413b47818b042620eeeaf306ffe6d1ae81852d;hp=335b297d99f283b47f398b67ccd435bffe273ada;hpb=36ae8cdce355c88f0e6b2521e1d680df93b809f1;p=simgear.git diff --git a/simgear/canvas/Canvas.hxx b/simgear/canvas/Canvas.hxx index 335b297d..2c817f61 100644 --- a/simgear/canvas/Canvas.hxx +++ b/simgear/canvas/Canvas.hxx @@ -23,9 +23,12 @@ #include "ODGauge.hxx" #include +#include #include +#include #include #include + #include #include @@ -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 * @@ -132,6 +144,7 @@ namespace canvas void update(double delta_time_sec); bool addEventListener(const std::string& type, const EventListener& cb); + bool dispatchEvent(const EventPtr& event); void setSizeX(int sx); void setSizeY(int sy); @@ -194,7 +207,9 @@ namespace canvas _visible; ODGauge _texture; - GroupPtr _root_group; + + GroupPtr _root_group; + LayoutRef _layout; CullCallbackPtr _cull_callback; bool _render_always; //