2 // "$Id: Fl_Color_Chooser.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
4 // Color chooser header file for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2002 by Bill Spitzak and others.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
26 // The color chooser object and the color chooser popup. The popup
27 // is just a window containing a single color chooser and some boxes
28 // to indicate the current and cancelled color.
30 #ifndef Fl_Color_Chooser_H
31 #define Fl_Color_Chooser_H
33 #include <FL/Fl_Group.H>
34 #include <FL/Fl_Box.H>
35 #include <FL/Fl_Return_Button.H>
36 #include <FL/Fl_Choice.H>
37 #include <FL/Fl_Value_Input.H>
39 class FL_EXPORT Flcc_HueBox : public Fl_Widget {
46 Flcc_HueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
50 class FL_EXPORT Flcc_ValueBox : public Fl_Widget {
57 Flcc_ValueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
61 class FL_EXPORT Flcc_Value_Input : public Fl_Value_Input {
64 Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {}
67 class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
69 Flcc_ValueBox valuebox;
71 Flcc_Value_Input rvalue;
72 Flcc_Value_Input gvalue;
73 Flcc_Value_Input bvalue;
75 double hue_, saturation_, value_;
78 static void rgb_cb(Fl_Widget*, void*);
79 static void mode_cb(Fl_Widget*, void*);
81 int mode() {return choice.value();}
82 double hue() const {return hue_;}
83 double saturation() const {return saturation_;}
84 double value() const {return value_;}
85 double r() const {return r_;}
86 double g() const {return g_;}
87 double b() const {return b_;}
88 int hsv(double,double,double);
89 int rgb(double,double,double);
90 static void hsv2rgb(double, double, double,double&,double&,double&);
91 static void rgb2hsv(double, double, double,double&,double&,double&);
92 Fl_Color_Chooser(int,int,int,int,const char* = 0);
95 FL_EXPORT int fl_color_chooser(const char* name, double& r, double& g, double& b);
96 FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b);
101 // End of "$Id: Fl_Color_Chooser.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".