Update the changelog
[opencv] / otherlibs / _fltk / include / FL / Fl_Color_Chooser.H
1 //
2 // "$Id: Fl_Color_Chooser.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
3 //
4 // Color chooser header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2002 by Bill Spitzak and others.
7 //
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.
12 //
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.
17 //
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
21 // USA.
22 //
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
24 //
25
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.
29
30 #ifndef Fl_Color_Chooser_H
31 #define Fl_Color_Chooser_H
32
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>
38
39 class FL_EXPORT Flcc_HueBox : public Fl_Widget {
40   int px, py;
41 protected:
42   void draw();
43   int handle_key(int);
44 public:
45   int handle(int);
46   Flcc_HueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
47   px = py = 0;}
48 };
49
50 class FL_EXPORT Flcc_ValueBox : public Fl_Widget {
51   int py;
52 protected:
53   void draw();
54   int handle_key(int);
55 public:
56   int handle(int);
57   Flcc_ValueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
58   py = 0;}
59 };
60
61 class FL_EXPORT Flcc_Value_Input : public Fl_Value_Input {
62 public:
63   int format(char*);
64   Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {}
65 };
66
67 class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
68   Flcc_HueBox huebox;
69   Flcc_ValueBox valuebox;
70   Fl_Choice choice;
71   Flcc_Value_Input rvalue;
72   Flcc_Value_Input gvalue;
73   Flcc_Value_Input bvalue;
74   Fl_Box resize_box;
75   double hue_, saturation_, value_;
76   double r_, g_, b_;
77   void set_valuators();
78   static void rgb_cb(Fl_Widget*, void*);
79   static void mode_cb(Fl_Widget*, void*);
80 public:
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);
93 };
94
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);
97
98 #endif
99
100 //
101 // End of "$Id: Fl_Color_Chooser.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".
102 //