1#ifndef COIN_SO@GUI@COLOREDITOR_H 2#define COIN_SO@GUI@COLOREDITOR_H 3 4// @configure_input@ 5 6/**************************************************************************\ 7 * Copyright (c) Kongsberg Oil & Gas Technologies AS 8 * All rights reserved. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions are 12 * met: 13 * 14 * Redistributions of source code must retain the above copyright notice, 15 * this list of conditions and the following disclaimer. 16 * 17 * Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 21 * Neither the name of the copyright holder nor the names of its 22 * contributors may be used to endorse or promote products derived from 23 * this software without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36\**************************************************************************/ 37 38#include <Inventor/@Gui@/nodes/SoGuiColorEditor.h> 39#include <Inventor/@Gui@/So@Gui@RenderArea.h> 40 41typedef void So@Gui@ColorEditorCB(void * closure, const SbColor * color); 42 43class SbColor; 44class SoSFColor; 45class SoMFColor; 46class SoMFUInt32; 47 48class So@Gui@ColorEditor : public So@Gui@RenderArea { 49 SO@GUI@_OBJECT_HEADER(So@Gui@ColorEditor, So@Gui@RenderArea); 50 51public: 52 So@Gui@ColorEditor(@WIDGET@ parent = NULL, const char * name = NULL, SbBool embed = TRUE); 53 ~So@Gui@ColorEditor(void); 54 55 enum Sliders { 56 NONE = SoGuiColorEditor::NONE, 57 INTENSITY = SoGuiColorEditor::INTENSITY, 58 RGB = SoGuiColorEditor::RGB, 59 HSV = SoGuiColorEditor::HSV, 60 RGB_V = SoGuiColorEditor::RGB_V, 61 RGB_HSV = SoGuiColorEditor::RGB_HSV 62 }; 63 64 enum UpdateFrequency { 65 CONTINUOUS = SoGuiColorEditor::CONTINUOUS, 66 AFTER_ACCEPT = SoGuiColorEditor::AFTER_ACCEPT 67 }; 68 69 void attach(SoSFColor * color, SoBase * node = NULL); 70 void attach(SoMFColor * color, int idx = 0, SoBase * node = NULL); 71 void attach(SoMFUInt32 * color, int idx = 0, SoBase * node = NULL); 72 void detach(void); 73 SbBool isAttached(void) const; 74 75 void addColorChangedCallback(So@Gui@ColorEditorCB * cb, void * closure = NULL); 76 void removeColorChangedCallback(So@Gui@ColorEditorCB * cb, void * closure = NULL); 77 78 void setColor(const SbColor & color); 79 const SbColor & getColor(void) const; 80 81 void setWYSIWYG(SbBool enable); 82 SbBool isWYSIWYG(void) const; 83 84 void setCurrentSliders(Sliders which); 85 Sliders getCurrentSliders(void) const; 86 87 void setUpdateFrequency(UpdateFrequency freq); 88 UpdateFrequency getUpdateFrequency(void) const; 89 90 SoGuiColorEditor * getEditor(void) const; 91 92protected: 93 virtual const char * getDefaultWidgetName(void) const; 94 virtual const char * getDefaultTitle(void) const; 95 virtual const char * getDefaultIconTitle(void) const; 96 97private: 98 void * internals; 99 100}; 101 102#endif // !COIN_SO@GUI@COLOREDITOR_H 103