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 } |
list of possible slider combinations, which is used to specify which sliders should be displayed at any time. More... | |
enum | UpdateFrequency { CONTINUOUS , AFTER_ACCEPT } |
UpdateFrequency is how often new values should be sent to the node or the callback routine. More... | |
typedef void | SoXtColorEditorCB(void *userData, const SbColor *color) |
Public Types inherited from SoXtComponent | |
typedef void | SoXtComponentCB(void *data, SoXtComponent *v) |
Public Member Functions | |
SoXtColorEditor (SoWidget parent=NULL, const char *name=NULL, SbBool buildInsideParent=TRUE) | |
Constructor. | |
~SoXtColorEditor () | |
Destructor. | |
void | attach (SoSFColor *color, SoBase *node) |
Attaches the editor to a color node and edits the specified color. | |
void | attach (SoMFColor *color, int index, SoBase *node) |
Attaches the editor to a color node and edits the color of the given index. | |
void | attach (SoMFUInt32 *color, int index, SoBase *node) |
Attaches the editor to a color node and edits the color of the given index. | |
void | detach () |
Detaches the editor from a color node. | |
SbBool | isAttached () |
Returns TRUE if the editor is attached. | |
void | addColorChangedCallback (SoXtColorEditorCB *f, void *userData=NULL) |
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 | removeColorChangedCallback (SoXtColorEditorCB *f, void *userData=NULL) |
Removes colorChanged callback. | |
void | setColor (const SbColor &color) |
Sets a new color value. | |
const SbColor & | getColor () |
Gets the current color value. | |
void | setWYSIWYG (SbBool trueOrFalse) |
Sets the WYSIWYG (what-you-see-is-what-you-get) mode on/off for the colored backgrounds of the sliders. | |
SbBool | isWYSIWYG () |
Gets the WYSIWYG mode. | |
void | setCurrentSliders (SoXtColorEditor::Sliders whichSliders) |
Sets which slider(s) should be displayed. | |
SoXtColorEditor::Sliders | getCurrentSliders () |
Gets which slider(s) should be displayed. | |
void | setUpdateFrequency (SoXtColorEditor::UpdateFrequency freq) |
Sets the update frequency. | |
SoXtColorEditor::UpdateFrequency | getUpdateFrequency () |
Gets the update frequency. | |
Public Member Functions inherited from SoXtComponent | |
virtual void | show () |
This shows the component. | |
virtual void | hide () |
This hides the component. | |
SbBool | isVisible () |
Returns TRUE if this component is mapped onto the screen. | |
SoWidget | getWidget () const |
This returns the base widget for this component. | |
SbBool | isTopLevelShell () const |
Returns TRUE if this component is a top level shell component (has its own window). | |
SoWidget | getShellWidget () const |
Returns the shell widget (NULL if the shell hasn't been created by this component). | |
SoWidget | getParentWidget () const |
Returns the parent widget, be it a shell or not. | |
void | setSize (const SbVec2s &size) |
Convenience routine on the widget. | |
SbVec2s | getSize () |
Convenience routine on the widget. | |
SbBool | setFullScreen (const SbBool enable) |
Switches the viewer into (or out of) fullscreen mode. | |
SbBool | isFullScreen (void) const |
Queries if the viewer is in fullscreen mode. | |
void | setFullScreenEnable (const SbBool enable) |
Enables/disables fullscreen mode. | |
SbBool | isFullScreenEnable () const |
Queries if it is possible to put the viewer in fullscreen mode. | |
Display * | getDisplay () |
Returns the X display associated with this components widget. | |
SoNONUNICODE void | setTitle (const char *newTitle) |
Sets window title. | |
void | setTitle (const SbString &newTitle) |
Sets window title. | |
SbString | getTitle () const |
Gets window title. | |
SoNONUNICODE void | setIconTitle (const char *newIconTitle) |
Sets icon title. | |
void | setIconTitle (const SbString &newIconTitle) |
Sets icon title. | |
SbString | getIconTitle () const |
Gets icon title. | |
void | setWindowCloseCallback (SoXtComponentCB *func, void *data=NULL) |
Sets which callback to call when the user closes this component (double click in the upper left corner) - by default hide() is called on this component, unless a callback is set to something other than NULL. | |
SbString | getWidgetName () const |
Returns the widget name. | |
SbString | getClassName () const |
Returns the class name. | |
Additional Inherited Members | |
Static Public Member Functions inherited from SoXtComponent | |
static void | displayHelp (const char *filename, UINT contextID) |
Static method to display the specified topic of the specified help file. | |
static SoXtComponent * | getComponent (SoWidget w) |
This returns the SoXtComponent for this widget. | |
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.
Definition at line 86 of file SoXtColorEditor.h.
typedef void SoXtColorEditorCB(void *userData, const SbColor *color) |
Definition at line 55 of file SoXtColorEditor.h.
enum SoXtColorEditor::Sliders |
list of possible slider combinations, which is used to specify which sliders should be displayed at any time.
Definition at line 94 of file SoXtColorEditor.h.
enum SoXtColorEditor::UpdateFrequency |
UpdateFrequency is how often new values should be sent to the node or the callback routine.
Enumerator | |
---|---|
CONTINUOUS | Send updates with every mouse motion. |
AFTER_ACCEPT | Only send updates after user hits accept button. |
Definition at line 125 of file SoXtColorEditor.h.
SoXtColorEditor::SoXtColorEditor | ( | SoWidget | parent = NULL , |
const char * | name = NULL , |
||
SbBool | buildInsideParent = TRUE |
||
) |
Constructor.
SoXtColorEditor::~SoXtColorEditor | ( | ) |
Destructor.
|
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).
Definition at line 340 of file SoXtColorEditor.h.
Attaches the editor to a color node and edits the color of the given index.
See attach() for details.
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 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.
|
inline |
Gets the current color value.
Definition at line 203 of file SoXtColorEditor.h.
|
inline |
Gets which slider(s) should be displayed.
Definition at line 232 of file SoXtColorEditor.h.
|
inline |
Gets the update frequency.
Definition at line 241 of file SoXtColorEditor.h.
|
inline |
Returns TRUE if the editor is attached.
Definition at line 182 of file SoXtColorEditor.h.
|
inline |
Gets the WYSIWYG mode.
Definition at line 223 of file SoXtColorEditor.h.
|
inline |
Removes colorChanged callback.
Definition at line 346 of file SoXtColorEditor.h.
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.