FLTK 1.3.5
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$"
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$".
190
//
© 1998-2016 by Bill Spitzak and others.