diff --git a/include/osgUI/ColorPalette b/include/osgUI/ColorPalette new file mode 100644 index 000000000..f4c0c7a08 --- /dev/null +++ b/include/osgUI/ColorPalette @@ -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 +#include +#include + +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 Colors; + + void setColors(const Colors& colors) { _colors = colors; } + Colors& getColors() { return _colors; } + const Colors& getColors() const { return _colors; } + + typedef std::vector 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 diff --git a/src/osgUI/CMakeLists.txt b/src/osgUI/CMakeLists.txt index 53af1eed3..648788f83 100644 --- a/src/osgUI/CMakeLists.txt +++ b/src/osgUI/CMakeLists.txt @@ -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 diff --git a/src/osgUI/ColorPalette.cpp b/src/osgUI/ColorPalette.cpp new file mode 100644 index 000000000..4ffd66bfc --- /dev/null +++ b/src/osgUI/ColorPalette.cpp @@ -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 + +using namespace osgUI; + +ColorPalette::ColorPalette() +{ +} + +ColorPalette::ColorPalette(const ColorPalette& cp, const osg::CopyOp& copyop): + osg::Object(cp, copyop), + _colors(cp._colors) +{ +} diff --git a/src/osgWrappers/serializers/osgUI/ColorPalette.cpp b/src/osgWrappers/serializers/osgUI/ColorPalette.cpp new file mode 100644 index 000000000..6a681d693 --- /dev/null +++ b/src/osgWrappers/serializers/osgUI/ColorPalette.cpp @@ -0,0 +1,15 @@ +#include +#include +#include +#include +#include + + +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 ); +}