public:
typedef boost::function<void (nasal::Me, const SGRecti&)> SetGeometryFunc;
+ typedef boost::function<int (nasal::Me, int)> HeightForWidthFunc;
/**
*
*/
NasalWidget(naRef impl);
+ ~NasalWidget();
+
+ virtual void invalidate();
virtual void setGeometry(const SGRecti& geom);
+ virtual void onRemove();
void setSetGeometryFunc(const SetGeometryFunc& func);
+ void setHeightForWidthFunc(const HeightForWidthFunc& func);
+ void setMinimumHeightForWidthFunc(const HeightForWidthFunc& func);
+ /** Set size hint.
+ *
+ * Overrides default size hint. Set to (0, 0) to fall back to default size
+ * hint.
+ */
void setSizeHint(const SGVec2i& s);
+
+ /** Set minimum size.
+ *
+ * Overrides default minimum size. Set to (0, 0) to fall back to default
+ * minimum size.
+ */
void setMinimumSize(const SGVec2i& s);
+
+ /** Set maximum size.
+ *
+ * Overrides default maximum size hint. Set to LayoutItem::MAX_SIZE to
+ * fall back to default maximum size.
+ */
void setMaximumSize(const SGVec2i& s);
+ void setLayoutSizeHint(const SGVec2i& s);
+ void setLayoutMinimumSize(const SGVec2i& s);
+ void setLayoutMaximumSize(const SGVec2i& s);
+
+ virtual bool hasHeightForWidth() const;
+ virtual int heightForWidth(int w) const;
+ virtual int minimumHeightForWidth(int w) const;
+
/**
* @param ns Namespace to register the class interface
*/
static void setupGhost(nasal::Hash& ns);
protected:
+ enum WidgetFlags
+ {
+ LAYOUT_DIRTY = LayoutItem::LAST_FLAG << 1,
+ LAST_FLAG = LAYOUT_DIRTY
+ };
+
SetGeometryFunc _set_geometry;
+ HeightForWidthFunc _height_for_width,
+ _min_height_for_width;
+
+ SGVec2i _layout_size_hint,
+ _layout_min_size,
+ _layout_max_size,
+ _user_size_hint,
+ _user_min_size,
+ _user_max_size;
+
+ int callHeightForWidthFunc( const HeightForWidthFunc& hfw,
+ int w ) const;
virtual SGVec2i sizeHintImpl() const;
virtual SGVec2i minimumSizeImpl() const;