Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoXtColorSlider.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifdef SOQT
26#elif defined(_WIN32)
28#else // _WIN32
29
30#ifndef _SO_XT_COLOR_SLIDER_
31#define _SO_XT_COLOR_SLIDER_
32
33#include "SoXtSlider.h"
34
35class SbColor;
36class SbVec2f;
37
38
40//
41// Class: SoXtColorSlider
42//
43// This class defines the color slider which is a set of predefined
44// sliders (R, G, B, H, S, V,..) with special behaviors.
45//
47
48{
49
50 public:
51
52 //
53 // list of color sliders types
54 //
55 enum Type {
56 RED_SLIDER,
57 GREEN_SLIDER,
58 BLUE_SLIDER,
59 HUE_SLIDER,
60 SATURATION_SLIDER,
61 VALUE_SLIDER,
62 INTENSITY_SLIDER // independent of the slider value
63 };
64
65 // Constructor/Destructor
67 SoWidget parent = NULL,
68 const char *name = NULL,
69 SbBool buildInsideParent = TRUE,
70 Type type = INTENSITY_SLIDER);
72
73 //
74 // Routine used to specify the slider value and also the top region
75 // color (WYSIWYGmode in most cases). Users should call this routine
76 // instead of the base class setValue() routine if they want the color
77 // slider top region to correctly reflect the current color.
78 // (code is optimized for WYSIWYGmode off)
79 //
80 // NOTE: routine expects
81 // an rgb color for R, G or B slider type
82 // an hsv color for H, S, or V slider type
83 // an rgb color for Intensity slider type
84 //
85 // NOTE: if calling setBaseColor() changes the thumb position the
86 // valueChanged callbacks will be called with the new value.
87 //
88 void setBaseColor(const float rgbOrHsv[3]);
89 const float *getBaseColor() { return color; }
90
91 //
92 // This routine sets the WYSIWYG (What You See Is What You Get) mode
93 // to be true or false (default FALSE). Immediate mode.
94 // This has no effect on monochrome sliders.
95 //
96 void setWYSIWYG(SbBool trueOrFalse); // default FALSE
97 SbBool isWYSIWYG() { return WYSIWYGmode; }
98
99 // returns the type of the slider
100 SoXtColorSlider::Type getType() { return type; }
101
102 private:
103
104 // This constructor takes a boolean whether to build the widget now.
105 // Subclasses can pass FALSE, then call SoXtSlider::buildWidget()
106 // when they are ready for it to be built.
109 SoWidget parent,
110 const char *name,
111 SbBool buildInsideParent,
112 Type type,
113 SbBool buildNow);
114
115 // redefine this routine to cache slider top geometry
116 virtual void sizeChanged(const SbVec2s &newSize);
117
118 // redefine this routine to do the actual slider top region drawing.
119 // This routine is automatically called by the SoXtSlider::redraw() routine.
120 virtual void drawSliderTopRegion();
121
122 private:
123
124 // local vars
125 Boolean WYSIWYGmode;
126 Type type;
127 float color[3];
128 SbColor *defaultColors, *colors;
129 SbVec2f *geometry;
130
131 // routine that make the default and WYSIWYG colors
132 void makeDefaultColors();
133 void makeWYSIWYGcolors();
134
135 static void sliderChangedCB(void *, float val);
136
137 // this is called by both constructors
138 void constructorCommon(SoXtColorSlider::Type type, SbBool buildNow);
139};
140
141
142#endif /* _SO_XT_COLOR_SLIDER_ */
143
144#endif // _WIN32
#define SoEXTENDER
#define TRUE
Possible value of SbBool.
Definition SbBase.h:77
char Boolean
Definition SoQtDef.h:119
#define SoWidget
Definition SoQtDef.h:40
#define SoXtColorSlider
Definition SoXt2SoQt.h:175
const float * getBaseColor()
~SoXtColorSlider()
SoXtColorSlider::Type getType()
Returns the type of device.
SbBool isWYSIWYG()
void setBaseColor(const float rgbOrHsv[3])
void setWYSIWYG(SbBool trueOrFalse)
Color vector class.
Definition SbColor.h:82
2D vector class.
Definition SbVec.h:76
2D vector class.
Definition SbVec.h:700
int SbBool
Boolean type.
Definition SbBase.h:87