#include <simgear/nasal/cppbind/from_nasal.hxx>
#include <simgear/nasal/cppbind/NasalHash.hxx>
+#include <simgear/nasal/cppbind/NasalObject.hxx>
namespace simgear
{
* Baseclass/ghost to create widgets with Nasal.
*/
class NasalWidget:
- public LayoutItem
+ public LayoutItem,
+ public nasal::Object
{
public:
typedef boost::function<void (nasal::Me, const SGRecti&)> SetGeometryFunc;
+ typedef boost::function<int (nasal::Me, int)> HeightForWidthFunc;
/**
*
virtual void setGeometry(const SGRecti& geom);
void setSetGeometryFunc(const SetGeometryFunc& func);
-
- void setImpl(naRef obj);
- naRef getImpl() const;
+ void setHeightForWidthFunc(const HeightForWidthFunc& func);
+ void setMinimumHeightForWidthFunc(const HeightForWidthFunc& func);
void setSizeHint(const SGVec2i& s);
void setMinimumSize(const SGVec2i& s);
void setMaximumSize(const SGVec2i& s);
- bool _set(naContext c, const std::string& key, naRef val);
+ virtual bool hasHeightForWidth() const;
+ virtual int heightForWidth(int w) const;
+ virtual int minimumHeightForWidth(int w) const;
/**
* @param ns Namespace to register the class interface
protected:
SetGeometryFunc _set_geometry;
- nasal::ObjectHolder<> _nasal_impl;
+ HeightForWidthFunc _height_for_width,
+ _min_height_for_width;
- static naRef getParents(NasalWidget&, naContext);
+ int callHeightForWidthFunc( const HeightForWidthFunc& hfw,
+ int w ) const;
virtual SGVec2i sizeHintImpl() const;
virtual SGVec2i minimumSizeImpl() const;