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:
17
src/osgWrappers/serializers/osgUI/DoubleValidator.cpp
Normal file
17
src/osgWrappers/serializers/osgUI/DoubleValidator.cpp
Normal 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);
|
||||
}
|
||||
16
src/osgWrappers/serializers/osgUI/IntValidator.cpp
Normal file
16
src/osgWrappers/serializers/osgUI/IntValidator.cpp
Normal 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);
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
13
src/osgWrappers/serializers/osgUI/Validator.cpp
Normal file
13
src/osgWrappers/serializers/osgUI/Validator.cpp
Normal 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" )
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user