osgUI/Validator
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGUI_VALIDATOR
#define OSGUI_VALIDATOR
#include <osg/Object>
#include <osgUI/Export>
namespace osgUI
{
class OSGUI_EXPORT Validator : public osg::Object
{
public:
Validator();
Validator(const Validator& validator, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgUI, Validator);
enum State
{
INVALID,
INTERMEDIATE,
ACCEPTABLE
};
virtual State validate(std::string& /*str*/, int& cursorpos) const;
virtual State validateImplementation(std::string& /*str*/, int& /*cursorpos*/) const;
virtual void fixup(std::string& /*str*/) const;
virtual void fixupImplementation(std::string& /*str*/) const;
protected:
virtual ~Validator() {}
};
class OSGUI_EXPORT IntValidator : public Validator
{
public:
IntValidator();
IntValidator(const IntValidator& widget, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgUI, IntValidator);
void setBottom(int bottom) { _bottom = bottom; }
int getBottom() const { return _bottom; }
void setTop(int top) { _top = top; }
int getTop() const { return _top; }
virtual State validateImplementation(std::string& str, int& cursorpos) const;
virtual void fixupImplementation(std::string& str) const;
protected:
virtual ~IntValidator() {}
int _bottom;
int _top;
};
class OSGUI_EXPORT DoubleValidator : public Validator
{
public:
DoubleValidator();
DoubleValidator(const DoubleValidator& widget, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgUI, DoubleValidator);
void setDecimals(int numDecimals) { _decimals = numDecimals; }
int getDecimals() const { return _decimals; }
void setBottom(double bottom) { _bottom = bottom; }
double getBottom() const { return _bottom; }
void setTop(double top) { _top = top; }
double getTop() const { return _top; }
virtual State validateImplementation(std::string& str, int& cursorpos) const;
virtual void fixupImplementation(std::string& str) const;
protected:
virtual ~DoubleValidator() {}
int _decimals;
double _bottom;
double _top;
};
}
#endif
Object
osgUI::DoubleValidator::_top
double _top
Definition osgUI/Validator:113
osgUI::DoubleValidator::getBottom
double getBottom() const
Definition osgUI/Validator:98
osgUI::DoubleValidator::setTop
void setTop(double top)
set the top value that is accepted as valid, default DBL_MAX
Definition osgUI/Validator:101
osgUI::DoubleValidator::DoubleValidator
DoubleValidator(const DoubleValidator &widget, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgUI::DoubleValidator::_bottom
double _bottom
Definition osgUI/Validator:112
osgUI::DoubleValidator::validateImplementation
virtual State validateImplementation(std::string &str, int &cursorpos) const
override validate implementation.
osgUI::DoubleValidator::META_Object
META_Object(osgUI, DoubleValidator)
osgUI::DoubleValidator::setDecimals
void setDecimals(int numDecimals)
Definition osgUI/Validator:93
osgUI::DoubleValidator::setBottom
void setBottom(double bottom)
set the bottom value that is accepted as valid, default -DBL_MAX
Definition osgUI/Validator:97
osgUI::DoubleValidator::DoubleValidator
DoubleValidator()
osgUI::DoubleValidator::getTop
double getTop() const
Definition osgUI/Validator:102
osgUI::DoubleValidator::_decimals
int _decimals
Definition osgUI/Validator:111
osgUI::DoubleValidator::~DoubleValidator
virtual ~DoubleValidator()
Definition osgUI/Validator:110
osgUI::DoubleValidator::fixupImplementation
virtual void fixupImplementation(std::string &str) const
override validate implementation.
osgUI::DoubleValidator::getDecimals
int getDecimals() const
Definition osgUI/Validator:94
osgUI::IntValidator::getTop
int getTop() const
Definition osgUI/Validator:71
osgUI::IntValidator::IntValidator
IntValidator()
osgUI::IntValidator::_bottom
int _bottom
Definition osgUI/Validator:80
osgUI::IntValidator::_top
int _top
Definition osgUI/Validator:81
osgUI::IntValidator::setBottom
void setBottom(int bottom)
set the bottom value that is accepted as valid, default -INT_MAX
Definition osgUI/Validator:66
osgUI::IntValidator::validateImplementation
virtual State validateImplementation(std::string &str, int &cursorpos) const
override validate implementation.
osgUI::IntValidator::~IntValidator
virtual ~IntValidator()
Definition osgUI/Validator:79
osgUI::IntValidator::META_Object
META_Object(osgUI, IntValidator)
osgUI::IntValidator::fixupImplementation
virtual void fixupImplementation(std::string &str) const
override validate implementation.
osgUI::IntValidator::IntValidator
IntValidator(const IntValidator &widget, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgUI::IntValidator::getBottom
int getBottom() const
Definition osgUI/Validator:67
osgUI::IntValidator::setTop
void setTop(int top)
set the top value that is accepted as valid, default INT_MAX
Definition osgUI/Validator:70
osgUI::Validator::Validator
Validator(const Validator &validator, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgUI::Validator::fixupImplementation
virtual void fixupImplementation(std::string &) const
override in subclass to provide the fixup implementation.
osgUI::Validator::State
State
Definition osgUI/Validator:31
osgUI::Validator::INVALID
@ INVALID
Definition osgUI/Validator:32
osgUI::Validator::ACCEPTABLE
@ ACCEPTABLE
Definition osgUI/Validator:34
osgUI::Validator::INTERMEDIATE
@ INTERMEDIATE
Definition osgUI/Validator:33
osgUI::Validator::validateImplementation
virtual State validateImplementation(std::string &, int &) const
override in subclasses to proviude the validate implementation.
osgUI::Validator::META_Object
META_Object(osgUI, Validator)
osgUI::Validator::Validator
Validator()
osgUI::Validator::~Validator
virtual ~Validator()
Definition osgUI/Validator:55
osgUI::Validator::validate
virtual State validate(std::string &, int &cursorpos) const
osgUI::Validator::fixup
virtual void fixup(std::string &) const
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Object
Definition Object:61
osgUI
Definition AlignmentSettings:23
Export
OSGUI_EXPORT
#define OSGUI_EXPORT
Definition osgUI/Export:40