#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>
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
};
*/
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
*
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);
_visible;
ODGauge _texture;
- GroupPtr _root_group;
+
+ GroupPtr _root_group;
+ LayoutRef _layout;
CullCallbackPtr _cull_callback;
bool _render_always; //<! Used to disable automatic lazy rendering (culling)