Implemented osgUI::Validator, IntValidator and DoubleValidator classes that manage validation/specialization of LineEdit widgets to work with just integer or double values.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14398 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-08-05 18:32:45 +00:00
parent 0335e9c63a
commit fdd9efe45a
10 changed files with 491 additions and 35 deletions

View File

@@ -0,0 +1,17 @@
#include <osgUI/Validator>
#include <osg/ValueObject>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
#include <limits.h>
REGISTER_OBJECT_WRAPPER( DoubleValidator,
new osgUI::DoubleValidator,
osgUI::DoubleValidator,
"osg::Object osgUI::Validator osgUI::DoubleValidator" )
{
ADD_INT_SERIALIZER(Decimals, -1);
ADD_DOUBLE_SERIALIZER(Bottom, -DBL_MAX);
ADD_DOUBLE_SERIALIZER(Top, DBL_MAX);
}

View File

@@ -0,0 +1,16 @@
#include <osgUI/Validator>
#include <osg/ValueObject>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
#include <limits.h>
REGISTER_OBJECT_WRAPPER( IntValidator,
new osgUI::IntValidator,
osgUI::IntValidator,
"osg::Object osgUI::Validator osgUI::IntValidator" )
{
ADD_INT_SERIALIZER(Bottom, -INT_MAX);
ADD_INT_SERIALIZER(Top, INT_MAX);
}

View File

@@ -10,5 +10,6 @@ REGISTER_OBJECT_WRAPPER( LineEdit,
osgUI::LineEdit,
"osg::Object osg::Node osg::Group osgUI::Widget osgUI::LineEdit" )
{
ADD_OBJECT_SERIALIZER( Validator, osgUI::Validator, NULL);
ADD_STRING_SERIALIZER( Text, std::string());
}

View File

@@ -0,0 +1,13 @@
#include <osgUI/Validator>
#include <osg/ValueObject>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( Validator,
new osgUI::Validator,
osgUI::Validator,
"osg::Object osgUI::Validator" )
{
}