FLTK 1.3.2

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

- File List
- File Members

Fl_Color_Chooser.H
Go to the documentation of this file.

    00001 //
    00002 // "$Id: Fl_Color_Chooser.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
    00003 //
    00004 // Color chooser header file for the Fast Light Tool Kit (FLTK).
    00005 //
    00006 // Copyright 1998-2010 by Bill Spitzak and others.
    00007 //
    00008 // This library is free software. Distribution and use rights are outlined in
    00009 // the file "COPYING" which should have been included with this file.  If this
    00010 // file is missing or damaged, see the license at:
    00011 //
    00012 //     http://www.fltk.org/COPYING.php
    00013 //
    00014 // Please report all bugs and problems on the following page:
    00015 //
    00016 //     http://www.fltk.org/str.php
    00017 //
    00018
    00022 // The color chooser object and the color chooser popup.  The popup
    00023 // is just a window containing a single color chooser and some boxes
    00024 // to indicate the current and cancelled color.
    00025
    00026 #ifndef Fl_Color_Chooser_H
    00027 #define Fl_Color_Chooser_H
    00028
    00029 #include <FL/Fl_Group.H>
    00030 #include <FL/Fl_Box.H>
    00031 #include <FL/Fl_Return_Button.H>
    00032 #include <FL/Fl_Choice.H>
    00033 #include <FL/Fl_Value_Input.H>
    00034
    00035 #ifndef FL_DOXYGEN
    00036
    00038 class FL_EXPORT Flcc_HueBox : public Fl_Widget {
    00039   int px, py;
    00040 protected:
    00041   void draw();
    00042   int handle_key(int);
    00043 public:
    00044   int handle(int);
    00045   Flcc_HueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
    00046   px = py = 0;}
    00047 };
    00048
    00050 class FL_EXPORT Flcc_ValueBox : public Fl_Widget {
    00051   int py;
    00052 protected:
    00053   void draw();
    00054   int handle_key(int);
    00055 public:
    00056   int handle(int);
    00057   Flcc_ValueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
    00058   py = 0;}
    00059 };
    00060
    00062 class FL_EXPORT Flcc_Value_Input : public Fl_Value_Input {
    00063 public:
    00064   int format(char*);
    00065   Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {}
    00066 };
    00067
    00068 #endif // !FL_DOXYGEN
    00069
    00107 class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
    00108   Flcc_HueBox huebox;
    00109   Flcc_ValueBox valuebox;
    00110   Fl_Choice choice;
    00111   Flcc_Value_Input rvalue;
    00112   Flcc_Value_Input gvalue;
    00113   Flcc_Value_Input bvalue;
    00114   Fl_Box resize_box;
    00115   double hue_, saturation_, value_;
    00116   double r_, g_, b_;
    00117   void set_valuators();
    00118   static void rgb_cb(Fl_Widget*, void*);
    00119   static void mode_cb(Fl_Widget*, void*);
    00120 public:
    00121
    00126   int mode() {return choice.value();}
    00127
    00132   void mode(int newMode);
    00133
    00140   double hue() const {return hue_;}
    00141
    00146   double saturation() const {return saturation_;}
    00147
    00152   double value() const {return value_;}
    00153
    00158   double r() const {return r_;}
    00159
    00164   double g() const {return g_;}
    00165
    00170   double b() const {return b_;}
    00171
    00172   int hsv(double H, double S, double V);
    00173
    00174   int rgb(double R, double G, double B);
    00175
    00176   static void hsv2rgb(double H, double S, double V, double& R, double& G, double& B);
    00177
    00178   static void rgb2hsv(double R, double G, double B, double& H, double& S, double& V);
    00179
    00180   Fl_Color_Chooser(int X, int Y, int W, int H, const char *L = 0);
    00181 };
    00182
    00183 FL_EXPORT int fl_color_chooser(const char* name, double& r, double& g, double& b, int m=-1);
    00184 FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b, int m=-1);
    00185
    00186 #endif
    00187
    00188 //
    00189 // End of "$Id: Fl_Color_Chooser.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
    00190 //