FLTK 1.3.3: Fl_Color_Chooser.H Source File

FLTK 1.3.3

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Fl_Color_Chooser.H
Go to the documentation of this file.
1 //
2 // "$Id: Fl_Color_Chooser.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
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
38 class FL_EXPORT Flcc_HueBox : public Fl_Widget {
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
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
62 class FL_EXPORT Flcc_Value_Input : public Fl_Value_Input {
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
107 class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
108 Flcc_HueBox huebox;
109 Flcc_ValueBox valuebox;
110 Fl_Choice choice;
111 Flcc_Value_Input rvalue;
112 Flcc_Value_Input gvalue;
113 Flcc_Value_Input bvalue;
114 Fl_Box resize_box;
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: Fl_Color_Chooser.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
190 //
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
Fl_Value_Input
The Fl_Value_Input widget displays a numeric value.
Definition: Fl_Value_Input.H:56
Fl_Widget::handle
virtual int handle(int event)
Handles the specified event.
Definition: Fl_Widget.cxx:97
Fl_Color_Chooser
The Fl_Color_Chooser widget provides a standard RGB color chooser.
Definition: Fl_Color_Chooser.H:107
Fl_Widget::draw
virtual void draw()=0
Draws the widget.
Fl_Box
This widget simply draws its box, and possibly its label.
Definition: Fl_Box.H:34
Fl_Color_Chooser::g
double g() const
Returns the current green value.
Definition: Fl_Color_Chooser.H:164
Fl_Valuator::format
virtual int format(char *)
Uses internal rules to format the fields numerical value into the character array pointed to by the p...
Definition: Fl_Valuator.cxx:159
Fl_Group
The Fl_Group class is the FLTK container widget.
Definition: Fl_Group.H:41
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_Choice::value
int value() const
Gets the index of the last item chosen by the user.
Definition: Fl_Choice.H:88
Fl_Color_Chooser::mode
int mode()
Returns which Fl_Color_Chooser variant is currently active.
Definition: Fl_Color_Chooser.H:126
Fl_Color_Chooser::hue
double hue() const
Returns the current hue.
Definition: Fl_Color_Chooser.H:140
Fl_Choice
A button that is used to pop up a menu.
Definition: Fl_Choice.H:76
Fl_Color_Chooser::saturation
double saturation() const
Returns the saturation.
Definition: Fl_Color_Chooser.H:146
Fl_Color_Chooser::value
double value() const
Returns the value/brightness.
Definition: Fl_Color_Chooser.H:152
Fl_Color_Chooser::r
double r() const
Returns the current red value.
Definition: Fl_Color_Chooser.H:158
Fl_Color_Chooser::b
double b() const
Returns the current blue value.
Definition: Fl_Color_Chooser.H:170
uchar
unsigned char uchar
unsigned char
Definition: fl_types.h:30
- © 1998-2014 by Bill Spitzak and others.