Style 2.7 KB

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