Tweaks to facilitate osgWrapper build

This commit is contained in:
Robert Osfield 2008-09-17 14:21:47 +00:00
parent 7ec5632bcc
commit 5c5ab84420
10 changed files with 13 additions and 26 deletions

View File

@ -30,7 +30,6 @@ class OSGWIDGET_EXPORT Box: public Window
}; };
META_Object (osgWidget, Box); META_Object (osgWidget, Box);
META_UIObject (Box);
Box (const std::string& = "", BOX_TYPE = HORIZONTAL, bool = false); Box (const std::string& = "", BOX_TYPE = HORIZONTAL, bool = false);
Box (const Box&, const osg::CopyOp&); Box (const Box&, const osg::CopyOp&);

View File

@ -25,7 +25,6 @@ class OSGWIDGET_EXPORT Canvas: public Window
{ {
public: public:
META_Object (osgWidget, Canvas); META_Object (osgWidget, Canvas);
META_UIObject (Canvas);
Canvas (const std::string& = ""); Canvas (const std::string& = "");
Canvas (const Canvas&, const osg::CopyOp&); Canvas (const Canvas&, const osg::CopyOp&);

View File

@ -206,6 +206,10 @@ class FunctionCallback: public CallbackInterface
class OSGWIDGET_EXPORT Callback class OSGWIDGET_EXPORT Callback
{ {
public: 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. // Creates a Callback that is bound to a member function.
template<typename T> template<typename T>
Callback(bool (T::*function)(Event&), T* obj, EventType type, void* data=0): Callback(bool (T::*function)(Event&), T* obj, EventType type, void* data=0):

View File

@ -48,7 +48,6 @@ class OSGWIDGET_EXPORT Frame: public Table
{ {
public: public:
META_Object (osgWidget, Corner); META_Object (osgWidget, Corner);
META_UIObject (Corner);
Corner (CORNER = CORNER_LOWER_LEFT, point_type = 0.0f, point_type = 0.0f); Corner (CORNER = CORNER_LOWER_LEFT, point_type = 0.0f, point_type = 0.0f);
Corner (const Corner&, const osg::CopyOp&); Corner (const Corner&, const osg::CopyOp&);
@ -76,7 +75,6 @@ class OSGWIDGET_EXPORT Frame: public Table
{ {
public: public:
META_Object (osgWidget, Border); META_Object (osgWidget, Border);
META_UIObject (Border);
Border (BORDER = BORDER_LEFT, point_type = 0.0f, point_type = 0.0f); Border (BORDER = BORDER_LEFT, point_type = 0.0f, point_type = 0.0f);
Border (const Border&, const osg::CopyOp&); Border (const Border&, const osg::CopyOp&);
@ -103,7 +101,6 @@ class OSGWIDGET_EXPORT Frame: public Table
}; };
META_Object (osgWidget, Frame); META_Object (osgWidget, Frame);
META_UIObject (Frame);
Frame (const std::string& = ""); Frame (const std::string& = "");
Frame (const Frame&, const osg::CopyOp&); Frame (const Frame&, const osg::CopyOp&);

View File

@ -28,7 +28,6 @@ class OSGWIDGET_EXPORT Label: public Widget
public: public:
META_Object (osgWidget, Label); META_Object (osgWidget, Label);
META_UIObject (Label);
Label (const std::string& = "", const std::string& = ""); Label (const std::string& = "", const std::string& = "");
Label (const Label&, const osg::CopyOp&); Label (const Label&, const osg::CopyOp&);

View File

@ -28,7 +28,6 @@ class OSGWIDGET_EXPORT Table: public Window
typedef std::vector<point_type> CellSizes; typedef std::vector<point_type> CellSizes;
META_Object (osgWidget, Table); META_Object (osgWidget, Table);
META_UIObject (Table);
Table (const std::string& = "", unsigned int = 0, unsigned int = 0); Table (const std::string& = "", unsigned int = 0, unsigned int = 0);
Table (const Table&, const osg::CopyOp&); Table (const Table&, const osg::CopyOp&);

View File

@ -17,17 +17,10 @@
#ifndef OSGWIDGET_UI_OBJECT_PARENT #ifndef OSGWIDGET_UI_OBJECT_PARENT
#define OSGWIDGET_UI_OBEJCT_PARENT #define OSGWIDGET_UI_OBEJCT_PARENT
namespace osgWidget { #include <osg/Object>
#include <osg/observer_ptr>
#define META_UIObject(name) \ namespace osgWidget {
name * cloneAs(\
const std::string& newName, \
const osg::CopyOp& co = osg::CopyOp::DEEP_COPY_ALL \
) const { \
name * obj = dynamic_cast<name *>(this->clone(co)); \
obj->setName(newName); \
return obj; \
}
template <typename T> template <typename T>
class UIObjectParent class UIObjectParent

View File

@ -40,6 +40,10 @@ class OSGWIDGET_EXPORT MouseHandler: public osgGA::GUIEventHandler
osg::NodeVisitor* osg::NodeVisitor*
); );
typedef bool (MouseHandler::*MouseAction)(float, float, int);
typedef bool (WindowManager::*MouseEvent)(float, float);
protected: protected:
osg::ref_ptr<WindowManager> _wm; osg::ref_ptr<WindowManager> _wm;
@ -51,9 +55,6 @@ class OSGWIDGET_EXPORT MouseHandler: public osgGA::GUIEventHandler
bool _handleMouseMove (float, float, int); bool _handleMouseMove (float, float, int);
bool _handleMouseScroll (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; MouseAction _isMouseEvent (osgGA::GUIEventAdapter::EventType) const;
bool _doMouseEvent (float, float, MouseEvent); bool _doMouseEvent (float, float, MouseEvent);

View File

@ -77,8 +77,6 @@ public:
Widget (const Widget&, const osg::CopyOp&); Widget (const Widget&, const osg::CopyOp&);
META_Object (osgWidget, Widget); META_Object (osgWidget, Widget);
META_UIObject (Widget);
virtual ~Widget() { virtual ~Widget() {
} }

View File

@ -63,7 +63,6 @@ class OSGWIDGET_EXPORT Window:
public: public:
META_Object (osgWidget::Window, EmbeddedWindow); META_Object (osgWidget::Window, EmbeddedWindow);
META_UIObject (EmbeddedWindow);
EmbeddedWindow (const std::string& = "", point_type = 0.0f, point_type = 0.0f); EmbeddedWindow (const std::string& = "", point_type = 0.0f, point_type = 0.0f);
EmbeddedWindow (const EmbeddedWindow&, const osg::CopyOp&); EmbeddedWindow (const EmbeddedWindow&, const osg::CopyOp&);
@ -123,8 +122,6 @@ class OSGWIDGET_EXPORT Window:
HA_RIGHT HA_RIGHT
}; };
META_UIObject(Window);
Window (const std::string& = ""); Window (const std::string& = "");
Window (const Window&, const osg::CopyOp&); Window (const Window&, const osg::CopyOp&);
@ -400,8 +397,9 @@ class OSGWIDGET_EXPORT Window:
addCallback(Callback(&callbackWindowTabFocus, EVENT_KEY_DOWN)); addCallback(Callback(&callbackWindowTabFocus, EVENT_KEY_DOWN));
} }
protected:
typedef point_type (Widget::*Getter)() const; typedef point_type (Widget::*Getter)() const;
protected:
typedef std::less<point_type> Less; typedef std::less<point_type> Less;
typedef std::greater<point_type> Greater; typedef std::greater<point_type> Greater;