OpenSceneGraph 3.6.5
Validator
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGUI_VALIDATOR
15#define OSGUI_VALIDATOR
16
17#include <osg/Object>
18#include <osgUI/Export>
19
20namespace osgUI
21{
22
24{
25public:
27 Validator(const Validator& validator, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
29
36
41 virtual State validate(std::string& /*str*/, int& cursorpos) const;
42
44 virtual State validateImplementation(std::string& /*str*/, int& /*cursorpos*/) const;
45
49 virtual void fixup(std::string& /*str*/) const;
50
52 virtual void fixupImplementation(std::string& /*str*/) const;
53
54protected:
55 virtual ~Validator() {}
56};
57
59{
60public:
64
66 void setBottom(int bottom) { _bottom = bottom; }
67 int getBottom() const { return _bottom; }
68
70 void setTop(int top) { _top = top; }
71 int getTop() const { return _top; }
72
74 virtual State validateImplementation(std::string& str, int& cursorpos) const;
76 virtual void fixupImplementation(std::string& str) const;
77
78protected:
79 virtual ~IntValidator() {}
81 int _top;
82};
83
85{
86public:
90
93 void setDecimals(int numDecimals) { _decimals = numDecimals; }
94 int getDecimals() const { return _decimals; }
95
97 void setBottom(double bottom) { _bottom = bottom; }
98 double getBottom() const { return _bottom; }
99
101 void setTop(double top) { _top = top; }
102 double getTop() const { return _top; }
103
105 virtual State validateImplementation(std::string& str, int& cursorpos) const;
107 virtual void fixupImplementation(std::string& str) const;
108
109protected:
110 virtual ~DoubleValidator() {}
112 double _bottom;
113 double _top;
114};
115
116}
117
118#endif
Definition AlignmentSettings:23
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Validator(const Validator &validator, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
virtual void fixupImplementation(std::string &) const
override in subclass to provide the fixup implementation.
State
Definition Validator:31
@ INVALID
Definition Validator:32
@ ACCEPTABLE
Definition Validator:34
@ INTERMEDIATE
Definition Validator:33
virtual State validateImplementation(std::string &, int &) const
override in subclasses to proviude the validate implementation.
META_Object(osgUI, Validator)
virtual ~Validator()
Definition Validator:55
virtual State validate(std::string &, int &cursorpos) const
entry point to validate(..) method, checks for "validate" CallbackObject and calls it if present,...
virtual void fixup(std::string &) const
entry point to fixup, checks for "validate" Callbac Object and calls it if present,...
int getTop() const
Definition Validator:71
int _bottom
Definition Validator:80
int _top
Definition Validator:81
void setBottom(int bottom)
set the bottom value that is accepted as valid, default -INT_MAX
Definition Validator:66
virtual State validateImplementation(std::string &str, int &cursorpos) const
override validate implementation.
virtual ~IntValidator()
Definition Validator:79
META_Object(osgUI, IntValidator)
virtual void fixupImplementation(std::string &str) const
override validate implementation.
IntValidator(const IntValidator &widget, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
int getBottom() const
Definition Validator:67
void setTop(int top)
set the top value that is accepted as valid, default INT_MAX
Definition Validator:70
double _top
Definition Validator:113
double getBottom() const
Definition Validator:98
void setTop(double top)
set the top value that is accepted as valid, default DBL_MAX
Definition Validator:101
DoubleValidator(const DoubleValidator &widget, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
double _bottom
Definition Validator:112
virtual State validateImplementation(std::string &str, int &cursorpos) const
override validate implementation.
META_Object(osgUI, DoubleValidator)
void setDecimals(int numDecimals)
set the number of decimal places to accept, default is -1, all negative values disable validation aga...
Definition Validator:93
void setBottom(double bottom)
set the bottom value that is accepted as valid, default -DBL_MAX
Definition Validator:97
double getTop() const
Definition Validator:102
int _decimals
Definition Validator:111
virtual ~DoubleValidator()
Definition Validator:110
virtual void fixupImplementation(std::string &str) const
override validate implementation.
int getDecimals() const
Definition Validator:94
#define OSGUI_EXPORT
Definition Export:40

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.