From 5c5ab84420bf8d6831e7007e04a30d3339800e14 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 17 Sep 2008 14:21:47 +0000 Subject: [PATCH] Tweaks to facilitate osgWrapper build --- include/osgWidget/Box | 1 - include/osgWidget/Canvas | 1 - include/osgWidget/EventInterface | 4 ++++ include/osgWidget/Frame | 3 --- include/osgWidget/Label | 1 - include/osgWidget/Table | 1 - include/osgWidget/UIObjectParent | 13 +++---------- include/osgWidget/ViewerEventHandlers | 7 ++++--- include/osgWidget/Widget | 2 -- include/osgWidget/Window | 6 ++---- 10 files changed, 13 insertions(+), 26 deletions(-) diff --git a/include/osgWidget/Box b/include/osgWidget/Box index 50890005c..be6146f7b 100644 --- a/include/osgWidget/Box +++ b/include/osgWidget/Box @@ -30,7 +30,6 @@ class OSGWIDGET_EXPORT Box: public Window }; META_Object (osgWidget, Box); - META_UIObject (Box); Box (const std::string& = "", BOX_TYPE = HORIZONTAL, bool = false); Box (const Box&, const osg::CopyOp&); diff --git a/include/osgWidget/Canvas b/include/osgWidget/Canvas index 273ae8b39..dd11f7c2c 100644 --- a/include/osgWidget/Canvas +++ b/include/osgWidget/Canvas @@ -25,7 +25,6 @@ class OSGWIDGET_EXPORT Canvas: public Window { public: META_Object (osgWidget, Canvas); - META_UIObject (Canvas); Canvas (const std::string& = ""); Canvas (const Canvas&, const osg::CopyOp&); diff --git a/include/osgWidget/EventInterface b/include/osgWidget/EventInterface index c0a7f66b6..f5af4b019 100644 --- a/include/osgWidget/EventInterface +++ b/include/osgWidget/EventInterface @@ -206,6 +206,10 @@ class FunctionCallback: public CallbackInterface class OSGWIDGET_EXPORT Callback { public: + + Callback():_type(EVENT_NONE),_data(0) {} + Callback(const Callback& rhs):_type(rhs._type),_data(rhs._data),_callback(rhs._callback) {} + // Creates a Callback that is bound to a member function. template Callback(bool (T::*function)(Event&), T* obj, EventType type, void* data=0): diff --git a/include/osgWidget/Frame b/include/osgWidget/Frame index 5ced4d775..91b2cfb2c 100644 --- a/include/osgWidget/Frame +++ b/include/osgWidget/Frame @@ -48,7 +48,6 @@ class OSGWIDGET_EXPORT Frame: public Table { public: META_Object (osgWidget, Corner); - META_UIObject (Corner); Corner (CORNER = CORNER_LOWER_LEFT, point_type = 0.0f, point_type = 0.0f); Corner (const Corner&, const osg::CopyOp&); @@ -76,7 +75,6 @@ class OSGWIDGET_EXPORT Frame: public Table { public: META_Object (osgWidget, Border); - META_UIObject (Border); Border (BORDER = BORDER_LEFT, point_type = 0.0f, point_type = 0.0f); Border (const Border&, const osg::CopyOp&); @@ -103,7 +101,6 @@ class OSGWIDGET_EXPORT Frame: public Table }; META_Object (osgWidget, Frame); - META_UIObject (Frame); Frame (const std::string& = ""); Frame (const Frame&, const osg::CopyOp&); diff --git a/include/osgWidget/Label b/include/osgWidget/Label index c86e6c0e6..0305c8845 100644 --- a/include/osgWidget/Label +++ b/include/osgWidget/Label @@ -28,7 +28,6 @@ class OSGWIDGET_EXPORT Label: public Widget public: META_Object (osgWidget, Label); - META_UIObject (Label); Label (const std::string& = "", const std::string& = ""); Label (const Label&, const osg::CopyOp&); diff --git a/include/osgWidget/Table b/include/osgWidget/Table index 021e21faf..0985071f2 100644 --- a/include/osgWidget/Table +++ b/include/osgWidget/Table @@ -28,7 +28,6 @@ class OSGWIDGET_EXPORT Table: public Window typedef std::vector CellSizes; META_Object (osgWidget, Table); - META_UIObject (Table); Table (const std::string& = "", unsigned int = 0, unsigned int = 0); Table (const Table&, const osg::CopyOp&); diff --git a/include/osgWidget/UIObjectParent b/include/osgWidget/UIObjectParent index 4e687f782..e27fbbf65 100644 --- a/include/osgWidget/UIObjectParent +++ b/include/osgWidget/UIObjectParent @@ -17,17 +17,10 @@ #ifndef OSGWIDGET_UI_OBJECT_PARENT #define OSGWIDGET_UI_OBEJCT_PARENT -namespace osgWidget { +#include +#include -#define META_UIObject(name) \ - name * cloneAs(\ - const std::string& newName, \ - const osg::CopyOp& co = osg::CopyOp::DEEP_COPY_ALL \ - ) const { \ - name * obj = dynamic_cast(this->clone(co)); \ - obj->setName(newName); \ - return obj; \ - } +namespace osgWidget { template class UIObjectParent diff --git a/include/osgWidget/ViewerEventHandlers b/include/osgWidget/ViewerEventHandlers index 5e10f13b9..cd37ceb1f 100644 --- a/include/osgWidget/ViewerEventHandlers +++ b/include/osgWidget/ViewerEventHandlers @@ -40,6 +40,10 @@ class OSGWIDGET_EXPORT MouseHandler: public osgGA::GUIEventHandler osg::NodeVisitor* ); + + typedef bool (MouseHandler::*MouseAction)(float, float, int); + typedef bool (WindowManager::*MouseEvent)(float, float); + protected: osg::ref_ptr _wm; @@ -51,9 +55,6 @@ class OSGWIDGET_EXPORT MouseHandler: public osgGA::GUIEventHandler bool _handleMouseMove (float, float, int); bool _handleMouseScroll (float, float, int); - typedef bool (MouseHandler::*MouseAction)(float, float, int); - typedef bool (WindowManager::*MouseEvent)(float, float); - MouseAction _isMouseEvent (osgGA::GUIEventAdapter::EventType) const; bool _doMouseEvent (float, float, MouseEvent); diff --git a/include/osgWidget/Widget b/include/osgWidget/Widget index 04e307361..a2c196043 100644 --- a/include/osgWidget/Widget +++ b/include/osgWidget/Widget @@ -77,8 +77,6 @@ public: Widget (const Widget&, const osg::CopyOp&); META_Object (osgWidget, Widget); - META_UIObject (Widget); - virtual ~Widget() { } diff --git a/include/osgWidget/Window b/include/osgWidget/Window index 18f7306c8..7f5754017 100644 --- a/include/osgWidget/Window +++ b/include/osgWidget/Window @@ -63,7 +63,6 @@ class OSGWIDGET_EXPORT Window: public: META_Object (osgWidget::Window, EmbeddedWindow); - META_UIObject (EmbeddedWindow); EmbeddedWindow (const std::string& = "", point_type = 0.0f, point_type = 0.0f); EmbeddedWindow (const EmbeddedWindow&, const osg::CopyOp&); @@ -123,8 +122,6 @@ class OSGWIDGET_EXPORT Window: HA_RIGHT }; - META_UIObject(Window); - Window (const std::string& = ""); Window (const Window&, const osg::CopyOp&); @@ -400,8 +397,9 @@ class OSGWIDGET_EXPORT Window: addCallback(Callback(&callbackWindowTabFocus, EVENT_KEY_DOWN)); } - protected: typedef point_type (Widget::*Getter)() const; + + protected: typedef std::less Less; typedef std::greater Greater;