openscenegraph
osgUI/Style
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_STYLE
15#define OSGUI_STYLE
16
17#include <osg/Object>
18#include <osg/BoundingBox>
19#include <osg/Texture2D>
20#include <osg/Depth>
21#include <osg/ColorMask>
22#include <osg/Vec4>
23
24#include <osgUI/AlignmentSettings>
25#include <osgUI/FrameSettings>
26#include <osgUI/TextSettings>
27
28namespace osgUI
29{
30
31class OSGUI_EXPORT Style : public osg::Object
32{
33public:
34 Style();
35 Style(const Style& style, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
36 META_Object(osgUI, Style);
37
38 static osg::ref_ptr<Style>& instance();
39
40 void setBackgroundColor(const osg::Vec4& color) { _backgroundColor = color; }
41 const osg::Vec4& getBackgroundColor() const { return _backgroundColor; }
42
43 void setTextColor(const osg::Vec4& color) { _textColor = color; }
44 const osg::Vec4& getTextColor() const { return _textColor; }
45
46 void setDisabledTextColor(const osg::Vec4& color) { _disabledTextColor = color; }
47 const osg::Vec4& getDisabledTextColor() const { return _disabledTextColor; }
48
49 virtual osg::Node* createDepthSetPanel(const osg::BoundingBox& extents);
50 virtual osg::Node* createPanel(const osg::BoundingBox& extents, const osg::Vec4& colour);
51 virtual osg::Node* createFrame(const osg::BoundingBox& extents, const FrameSettings* frameSettings, const osg::Vec4& colour);
52 virtual osg::Node* createText(const osg::BoundingBox& extents, const AlignmentSettings* as, const TextSettings* textSettings, const std::string& text);
53 virtual osg::Node* createIcon(const osg::BoundingBox& extents, const std::string& filename, const osg::Vec4& colour);
54 virtual void setupDialogStateSet(osg::StateSet* stateset, int binNum);
55 virtual void setupPopupStateSet(osg::StateSet* stateset, int binNum);
56 virtual void setupClipStateSet(const osg::BoundingBox& extents, osg::StateSet* stateset);
57
58protected:
59 virtual ~Style() {}
60
61 osg::ref_ptr<osg::Depth> _disabledDepthWrite;
62 osg::ref_ptr<osg::Depth> _enabledDepthWrite;
63 osg::ref_ptr<osg::ColorMask> _disableColorWriteMask;
64 osg::ref_ptr<osg::Texture2D> _clipTexture;
65
66 osg::Vec4 _backgroundColor;
67 osg::Vec4 _textColor;
68 osg::Vec4 _disabledTextColor;
69};
70
71}
72
73#endif