Added shell of new osgUI::TabWidget class

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14438 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-09-05 16:04:11 +00:00
parent 9e9fe9b9c9
commit 23b8131ae5
5 changed files with 245 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#include <osgUI/TabWidget>
#include <osg/ValueObject>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( Tab,
new osgUI::Tab,
osgUI::Tab,
"osg::Object osgUI::Tab" )
{
ADD_STRING_SERIALIZER(Text, "");
ADD_VEC4F_SERIALIZER(Color, osg::Vec4(1.0f,1.0f,1.0f,0.0f));
ADD_OBJECT_SERIALIZER(Widget, osgUI::Widget, NULL);
}

View File

@@ -0,0 +1,38 @@
#include <osgUI/TabWidget>
#include <osg/ValueObject>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
struct TabWidgetCurrentIndexChangedImplementation : public osgDB::MethodObject
{
virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
{
if (inputParameters.empty()) return false;
osg::Object* indexObject = inputParameters[0].get();
unsigned int index = 0;
osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);
if (dvo) index = static_cast<unsigned int>(dvo->getValue());
else
{
osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
if (uivo) index = uivo->getValue();
}
osgUI::TabWidget* cb = reinterpret_cast<osgUI::TabWidget*>(objectPtr);
cb->currentIndexChangedImplementation(index);
return true;
}
};
REGISTER_OBJECT_WRAPPER( TabWidget,
new osgUI::TabWidget,
osgUI::TabWidget,
"osg::Object osg::Node osg::Group osgUI::Widget osgUI::TabWidget" )
{
ADD_UINT_SERIALIZER(CurrentIndex, 0);
ADD_VECTOR_SERIALIZER( Tabs, osgUI::TabWidget::Tabs, osgDB::BaseSerializer::RW_OBJECT, 0 );
ADD_METHOD_OBJECT( "currentIndexChangedImplementation", TabWidgetCurrentIndexChangedImplementation );
}