fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Color_Chooser.H
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Color chooser header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
22 // The color chooser object and the color chooser popup. The popup
23 // is just a window containing a single color chooser and some boxes
24 // to indicate the current and cancelled color.
25 
26 #ifndef Fl_Color_Chooser_H
27 #define Fl_Color_Chooser_H
28 
29 #include <FL/Fl_Group.H>
30 #include <FL/Fl_Box.H>
31 #include <FL/Fl_Return_Button.H>
32 #include <FL/Fl_Choice.H>
33 #include <FL/Fl_Value_Input.H>
34 
35 #ifndef FL_DOXYGEN
36 
39  int px, py;
40 protected:
41  void draw();
42  int handle_key(int);
43 public:
44  int handle(int);
45  Flcc_HueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
46  px = py = 0;}
47 };
48 
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 
63 public:
64  int format(char*);
65  Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {}
66 };
67 
68 #endif // !FL_DOXYGEN
69 
115  double hue_, saturation_, value_;
116  double r_, g_, b_;
117  void set_valuators();
118  static void rgb_cb(Fl_Widget*, void*);
119  static void mode_cb(Fl_Widget*, void*);
120 public:
121 
126  int mode() {return choice.value();}
127 
132  void mode(int newMode);
133 
140  double hue() const {return hue_;}
141 
146  double saturation() const {return saturation_;}
147 
152  double value() const {return value_;}
153 
158  double r() const {return r_;}
159 
164  double g() const {return g_;}
165 
170  double b() const {return b_;}
171 
172  int hsv(double H, double S, double V);
173 
174  int rgb(double R, double G, double B);
175 
176  static void hsv2rgb(double H, double S, double V, double& R, double& G, double& B);
177 
178  static void rgb2hsv(double R, double G, double B, double& H, double& S, double& V);
179 
180  Fl_Color_Chooser(int X, int Y, int W, int H, const char *L = 0);
181 };
182 
183 FL_EXPORT int fl_color_chooser(const char* name, double& r, double& g, double& b, int m=-1);
184 FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b, int m=-1);
185 
186 #endif
187 
188 //
189 // End of "$Id$".
190 //
Fl_Color_Chooser::hue
double hue() const
Definition: Fl_Color_Chooser.H:140
Fl_Choice
A button that is used to pop up a menu.
Definition: Fl_Choice.H:83
Fl_Color_Chooser::value_
double value_
Definition: Fl_Color_Chooser.H:115
Fl_Color_Chooser::r_
double r_
Definition: Fl_Color_Chooser.H:116
Fl_Return_Button.H
Fl_Color_Chooser::choice
Fl_Choice choice
Definition: Fl_Color_Chooser.H:110
Flcc_ValueBox::Flcc_ValueBox
Flcc_ValueBox(int X, int Y, int W, int H)
Definition: Fl_Color_Chooser.H:57
Flcc_HueBox::py
int py
Definition: Fl_Color_Chooser.H:39
Fl_Color_Chooser::bvalue
Flcc_Value_Input bvalue
Definition: Fl_Color_Chooser.H:113
Fl_Color_Chooser::fl_color_chooser
int fl_color_chooser(const char *name, double &r, double &g, double &b, int cmode)
Pops up a window to let the user pick an arbitrary RGB color.
Definition: Fl_Color_Chooser.cxx:564
Fl_Valuator::format
virtual int format(char *)
Definition: Fl_Valuator.cxx:170
Fl_Color_Chooser::saturation
double saturation() const
Definition: Fl_Color_Chooser.H:146
H
static int H
Definition: Fl_Tooltip.cxx:76
Flcc_HueBox::Flcc_HueBox
Flcc_HueBox(int X, int Y, int W, int H)
Definition: Fl_Color_Chooser.H:45
Fl_Color_Chooser
The Fl_Color_Chooser widget provides a standard RGB color chooser.
Definition: Fl_Color_Chooser.H:107
Flcc_Value_Input::Flcc_Value_Input
Flcc_Value_Input(int X, int Y, int W, int H)
Definition: Fl_Color_Chooser.H:65
b
long b
Definition: jpegint.h:397
Fl_Color_Chooser::resize_box
Fl_Box resize_box
Definition: Fl_Color_Chooser.H:114
FL_EXPORT
#define FL_EXPORT
Definition: Fl_Export.H:35
Fl_Color_Chooser::rvalue
Flcc_Value_Input rvalue
Definition: Fl_Color_Chooser.H:111
Fl_Color_Chooser::r
double r() const
Definition: Fl_Color_Chooser.H:158
Fl_Color_Chooser::b
double b() const
Definition: Fl_Color_Chooser.H:170
Flcc_ValueBox
Definition: Fl_Color_Chooser.H:50
Fl_Value_Input
Definition: Fl_Value_Input.H:56
Fl_Color_Chooser::value
double value() const
Definition: Fl_Color_Chooser.H:152
Fl_Choice.H
Fl_Box.H
Flcc_ValueBox::py
int py
Definition: Fl_Color_Chooser.H:51
Fl_Choice::value
int value() const
Definition: Fl_Choice.H:95
Fl_Color_Chooser::valuebox
Flcc_ValueBox valuebox
Definition: Fl_Color_Chooser.H:109
Fl_Color_Chooser::mode
int mode()
Definition: Fl_Color_Chooser.H:126
Flcc_Value_Input
Definition: Fl_Color_Chooser.H:62
Fl_Widget
Definition: Fl_Widget.H:101
Fl_Group
Definition: Fl_Group.H:41
Fl_Box
Definition: Fl_Box.H:34
Fl_Widget::handle
virtual int handle(int event)
Definition: Fl_Widget.cxx:112
Fl_Group.H
Fl_Widget::draw
virtual void draw()=0
Fl_Value_Input.H
V
#define V(i, a, b, c, d)
Definition: jaricom.c:29
Y
static int Y
Definition: Fl_Tooltip.cxx:76
Fl_Color_Chooser::g
double g() const
Definition: Fl_Color_Chooser.H:164
Fl_Color_Chooser::gvalue
Flcc_Value_Input gvalue
Definition: Fl_Color_Chooser.H:112
px
static int px
Definition: fl_overlay.cxx:32
uchar
unsigned char uchar
Definition: fl_types.h:30
py
static int py
Definition: fl_overlay.cxx:32
name
static const char * name
Definition: Fl_arg.cxx:53
Fl_Color_Chooser::huebox
Flcc_HueBox huebox
Definition: Fl_Color_Chooser.H:108
Flcc_HueBox
Definition: Fl_Color_Chooser.H:38