00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, *** 00017 *** MERIGNAC, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 #ifndef _SO_QT_COLOR_SLIDER_ 00025 #define _SO_QT_COLOR_SLIDER_ 00026 00027 #include <Inventor/Qt/OivQtCompat.h> 00028 #include <Inventor/Qt/SoQtSlider.h> 00029 00031 // Class: SoQtColorSlider 00032 // 00033 // This class defines the color slider which is a set of predefined 00034 // sliders (R, G, B, H, S, V,..) with special behaviors. 00035 00036 { 00037 Q_OBJECT 00038 00039 public: 00040 // list of color sliders types 00041 enum Type { 00042 RED_SLIDER, 00043 GREEN_SLIDER, 00044 BLUE_SLIDER, 00045 HUE_SLIDER, 00046 SATURATION_SLIDER, 00047 VALUE_SLIDER, 00048 INTENSITY_SLIDER // independent of the slider value 00049 }; 00050 00051 // Constructor/Destructor 00052 SoQtColorSlider(QWidget* parent = NULL, 00053 const char *name = NULL, 00054 SbBool buildInsideParent = TRUE, 00055 Type type = INTENSITY_SLIDER); 00056 00057 // Routine used to specify the slider value and also the top region 00058 // color (WYSIWYGmode in most cases). Users should call this routine 00059 // instead of the base class setValue() routine if they want the color 00060 // slider top region to correctly reflect the current color. 00061 // (code is optimized for WYSIWYGmode off) 00062 // 00063 // NOTE: routine expects 00064 // an rgb color for R, G or B slider type 00065 // an hsv color for H, S, or V slider type 00066 // an rgb color for Intensity slider type 00067 // 00068 // NOTE: if calling setBaseColor() changes the thumb position the 00069 // valueChanged callbacks will be called with the new value. 00070 void setBaseColor(const float rgbOrHsv[3]); 00071 const float *getBaseColor(); 00072 00073 // This routine sets the WYSIWYG (What You See Is What You Get) mode 00074 // to be true or false (default FALSE). Immediate mode. 00075 // This has no effect on monochrome sliders. 00076 void setWYSIWYG(SbBool trueOrFalse = TRUE); // default FALSE 00077 SbBool isWYSIWYG(); 00078 00079 // returns the type of the slider 00080 SoQtColorSlider::Type getType(); 00081 00082 private: 00083 // This constructor takes a boolean whether to build the widget now. 00084 // Subclasses can pass FALSE, then call SoQtSlider::buildWidget() 00085 // when they are ready for it to be built. 00086 SoEXTENDER SoQtColorSlider (QWidget* parent, 00087 const char *name, 00088 SbBool buildInsideParent, 00089 Type type, 00090 SbBool buildNow); 00091 00092 private: 00093 // local vars 00094 SoQtBasicSlider::Type type; 00095 void constructorCommon(SoQtColorSlider::Type type, SbBool buildNow); 00096 }; 00097 00098 00099 #endif /* _SO_QT_COLOR_SLIDER_ */ 00100 00101 00102