FLTK 1.3.0
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 7981 2010-12-08 23:53:04Z 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; 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 on the following page:
24
//
25
// http://www.fltk.org/str.php
26
//
27
31
// The color chooser object and the color chooser popup. The popup
32
// is just a window containing a single color chooser and some boxes
33
// to indicate the current and cancelled color.
34
35
#ifndef Fl_Color_Chooser_H
36
#define Fl_Color_Chooser_H
37
38
#include <FL/Fl_Group.H>
39
#include <FL/Fl_Box.H>
40
#include <FL/Fl_Return_Button.H>
41
#include <FL/Fl_Choice.H>
42
#include <FL/Fl_Value_Input.H>
43
44
#ifndef FL_DOXYGEN
45
47
class
FL_EXPORT Flcc_HueBox :
public
Fl_Widget
{
48
int
px, py;
49
protected
:
50
void
draw
();
51
int
handle_key(
int
);
52
public
:
53
int
handle
(
int
);
54
Flcc_HueBox(
int
X,
int
Y,
int
W,
int
H) :
Fl_Widget
(X,Y,W,H) {
55
px = py = 0;}
56
};
57
59
class
FL_EXPORT Flcc_ValueBox :
public
Fl_Widget
{
60
int
py;
61
protected
:
62
void
draw
();
63
int
handle_key(
int
);
64
public
:
65
int
handle
(
int
);
66
Flcc_ValueBox(
int
X,
int
Y,
int
W,
int
H) :
Fl_Widget
(X,Y,W,H) {
67
py = 0;}
68
};
69
71
class
FL_EXPORT Flcc_Value_Input :
public
Fl_Value_Input
{
72
public
:
73
int
format
(
char
*);
74
Flcc_Value_Input(
int
X,
int
Y,
int
W,
int
H) :
Fl_Value_Input
(X,Y,W,H) {}
75
};
76
77
#endif // !FL_DOXYGEN
78
116
class
FL_EXPORT
Fl_Color_Chooser
:
public
Fl_Group
{
117
Flcc_HueBox huebox;
118
Flcc_ValueBox valuebox;
119
Fl_Choice
choice;
120
Flcc_Value_Input rvalue;
121
Flcc_Value_Input gvalue;
122
Flcc_Value_Input bvalue;
123
Fl_Box
resize_box;
124
double
hue_, saturation_, value_;
125
double
r_, g_, b_;
126
void
set_valuators();
127
static
void
rgb_cb(
Fl_Widget
*,
void
*);
128
static
void
mode_cb(
Fl_Widget
*,
void
*);
129
public
:
130
135
int
mode
() {
return
choice.value();}
136
141
void
mode(
int
newMode);
142
149
double
hue
()
const
{
return
hue_;}
150
155
double
saturation
()
const
{
return
saturation_;}
156
161
double
value
()
const
{
return
value_;}
162
167
double
r
()
const
{
return
r_;}
168
173
double
g
()
const
{
return
g_;}
174
179
double
b
()
const
{
return
b_;}
180
181
int
hsv(
double
H,
double
S,
double
V);
182
183
int
rgb(
double
R,
double
G,
double
B);
184
185
static
void
hsv2rgb(
double
H,
double
S,
double
V,
double
& R,
double
& G,
double
& B);
186
187
static
void
rgb2hsv(
double
R,
double
G,
double
B,
double
& H,
double
& S,
double
& V);
188
189
Fl_Color_Chooser
(
int
X,
int
Y,
int
W,
int
H,
const
char
*L = 0);
190
};
191
192
FL_EXPORT
int
fl_color_chooser
(
const
char
* name,
double
& r,
double
& g,
double
& b,
int
m=-1);
193
FL_EXPORT
int
fl_color_chooser
(
const
char
* name,
uchar
& r,
uchar
& g,
uchar
& b,
int
m=-1);
194
195
#endif
196
197
//
198
// End of "$Id: Fl_Color_Chooser.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
199
//
© 1998-2011 by Bill Spitzak and others.
© 1998-2011 by Bill Spitzak and others. Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.