Added osgUI::ColorPalette class

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14259 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2014-06-13 17:17:09 +00:00
parent 3a18699074
commit 9195a0000b
4 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1,56 @@
/* -*-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_COLORPALETTE
#define OSGUI_COLORPALETTE
#include <osg/Object>
#include <osg/Vec4>
#include <osgUI/Export>
namespace osgUI
{
class OSGUI_EXPORT ColorPalette : public osg::Object
{
public:
ColorPalette();
ColorPalette(const ColorPalette& cp, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgUI, ColorPalette);
typedef std::vector<osg::Vec4f> Colors;
void setColors(const Colors& colors) { _colors = colors; }
Colors& getColors() { return _colors; }
const Colors& getColors() const { return _colors; }
typedef std::vector<std::string> Names;
void setNames(const Names& names) { _names = names; }
Names& getNames() { return _names; }
const Names& getNames() const { return _names; }
protected:
virtual ~ColorPalette() {}
Colors _colors;
Names _names;
};
}
#endif

View File

@ -9,6 +9,7 @@ SET(LIB_NAME osgUI)
SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME})
SET(TARGET_H
${HEADER_PATH}/Export
${HEADER_PATH}/ColorPalette
${HEADER_PATH}/Widget
${HEADER_PATH}/Label
${HEADER_PATH}/LineEdit
@ -24,6 +25,7 @@ SET(TARGET_H
SET(TARGET_SRC
Widget.cpp
ColorPalette.cpp
Label.cpp
LineEdit.cpp
Dialog.cpp

View File

@ -0,0 +1,26 @@
/* -*-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.
*/
#include <osgUI/ColorPalette>
using namespace osgUI;
ColorPalette::ColorPalette()
{
}
ColorPalette::ColorPalette(const ColorPalette& cp, const osg::CopyOp& copyop):
osg::Object(cp, copyop),
_colors(cp._colors)
{
}

View File

@ -0,0 +1,15 @@
#include <osgUI/ColorPalette>
#include <osg/ValueObject>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( ColorPalette,
new osgUI::ColorPalette,
osgUI::ColorPalette,
"osg::Object osgUI::ColorPalette" )
{
ADD_VECTOR_SERIALIZER( Colors, osgUI::ColorPalette::Colors, osgDB::BaseSerializer::RW_VEC4F, 4 );
ADD_VECTOR_SERIALIZER( Names, osgUI::ColorPalette::Names, osgDB::BaseSerializer::RW_STRING, 1 );
}