Component that lets you edit a color interactively. More...
#include <Inventor/Xt/SoXtColorEditor.h>
Public Types | |
enum | Sliders { NONE, INTENSITY, RGB, HSV, RGB_V, RGB_HSV } |
enum | UpdateFrequency { CONTINUOUS, AFTER_ACCEPT } |
Public Member Functions | |
SoXtColorEditor (SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE) | |
~SoXtColorEditor () | |
void | attach (SoSFColor *color, SoBase *node) |
void | attach (SoMFColor *color, int index, SoBase *node) |
void | attach (SoMFUInt32 *color, int index, SoBase *node) |
void | detach () |
SbBool | isAttached () |
void | addColorChangedCallback (SoXtColorEditorCB *f, void *userData=NULL) |
void | removeColorChangedCallback (SoXtColorEditorCB *f, void *userData=NULL) |
void | setColor (const SbColor &color) |
const SbColor & | getColor () |
void | setWYSIWYG (SbBool trueOrFalse) |
SbBool | isWYSIWYG () |
void | setCurrentSliders (SoXtColorEditor::Sliders whichSliders) |
SoXtColorEditor::Sliders | getCurrentSliders () |
void | setUpdateFrequency (SoXtColorEditor::UpdateFrequency freq) |
SoXtColorEditor::UpdateFrequency | getUpdateFrequency () |
Component that lets you edit a color interactively.
The SoXtColorEditor class lets you interactively edit colors using color sliders and a color wheel. You can either use it directly to edit a color field in the database by using the attach()/detach() routines, or use it by registering a callback routine which will get called whenever the color changes (passing an SbColor to that routine).
The editor can currently be attached to only one color at a time. Attaching two different colors will automatically detach the first one before attaching the second.
list of possible slider combinations, which is used to specify which sliders should be displayed at any time.
SoXtColorEditor::SoXtColorEditor | ( | SoWidget | parent = NULL , |
|
const char * | name = NULL , |
|||
SbBool | buildInsideParent = TRUE | |||
) |
Constructor.
SoXtColorEditor::~SoXtColorEditor | ( | ) |
Destructor.
void SoXtColorEditor::addColorChangedCallback | ( | SoXtColorEditorCB * | f, | |
void * | userData = NULL | |||
) | [inline] |
Additional way of using the color editor, by registering a callback which will be called whenever the color changes (check the UpdateFrequency to find when the callbacks will be called).
void SoXtColorEditor::attach | ( | SoMFUInt32 * | color, | |
int | index, | |||
SoBase * | node | |||
) |
Attaches the editor to a color node and edits the color of the given index.
See attach() for details.
Attaches the editor to a color node and edits the color of the given index.
See attach() for details.
Attaches the editor to a color node and edits the specified color.
Attaching to the color node increments the reference count of the color node.
The color editor uses a sensor on the color field to automatically update itself when the color is changed externally.
NOTE: The node containing the field needs to also be passed to attach the sensor to it (since field sensors are not yet suported).
NOTE: The color editor can only be attached to either a single field or a multiple field at any given time. Even when attached to a multiple field, only a single color from that field is edited, as specified by index .
void SoXtColorEditor::detach | ( | ) |
Detaches the editor from a color node.
Detaching from the color node decrements the reference count of the color node.
const SbColor& SoXtColorEditor::getColor | ( | ) | [inline] |
Gets the current color value.
SoXtColorEditor::Sliders SoXtColorEditor::getCurrentSliders | ( | ) | [inline] |
Gets which slider(s) should be displayed.
SoXtColorEditor::UpdateFrequency SoXtColorEditor::getUpdateFrequency | ( | ) | [inline] |
Gets the update frequency.
SbBool SoXtColorEditor::isAttached | ( | ) | [inline] |
Returns TRUE if the editor is attached.
SbBool SoXtColorEditor::isWYSIWYG | ( | ) | [inline] |
Gets the WYSIWYG mode.
void SoXtColorEditor::removeColorChangedCallback | ( | SoXtColorEditorCB * | f, | |
void * | userData = NULL | |||
) | [inline] |
Removes colorChanged callback.
void SoXtColorEditor::setColor | ( | const SbColor & | color | ) |
Sets a new color value.
NOTE: setColor() will call colorChanged callbacks if the color differs.
void SoXtColorEditor::setCurrentSliders | ( | SoXtColorEditor::Sliders | whichSliders | ) |
Sets which slider(s) should be displayed.
void SoXtColorEditor::setUpdateFrequency | ( | SoXtColorEditor::UpdateFrequency | freq | ) |
Sets the update frequency.
See the UpdateFrequency enum declaration.
void SoXtColorEditor::setWYSIWYG | ( | SbBool | trueOrFalse | ) |
Sets the WYSIWYG (what-you-see-is-what-you-get) mode on/off for the colored backgrounds of the sliders.
In WYSIWYG mode, the color shown on the slider background beneath the slider pointer is what you get. For example, if R,G,B sliders in WYSIWYG mode are set to (0,1,1), the color beneath each slider pointer will be cyan because (0,1,1) corresponds to cyan.
In non-WYSIWYG mode, the color shown on the slider background reflects only the value of the parameter that the slider controls. For example, the colored background of the red slider will display only red values, the green slider will display only green values, and so forth.