Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

/home/jeroen/FOX/fox/fox-1.7.33/include/FXColorSelector.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                          C o l o r   S e l e c t o r                          *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXCOLORSELECTOR_H
00022 #define FXCOLORSELECTOR_H
00023 
00024 #ifndef FXPACKER_H
00025 #include "FXPacker.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00031 class FXTabBook;
00032 class FXColorBar;
00033 class FXColorWell;
00034 class FXColorWheel;
00035 class FXColorRing;
00036 class FXColorList;
00037 class FXList;
00038 class FXSlider;
00039 class FXTextField;
00040 class FXButton;
00041 class FXIcon;
00042 class FXLabel;
00043 
00044 
00045 // Color panel tabs
00046 enum {
00047   COLORTAB_COLOR_RING,
00048   COLORTAB_RED_GREEN_BLUE,
00049   COLORTAB_HUE_SATURATION_VALUE,
00050   COLORTAB_CYAN_MAGENTA_YELLOW,
00051   COLORTAB_COLOR_LIST
00052   };
00053 
00054 
00056 class FXAPI FXColorSelector : public FXPacker {
00057   FXDECLARE(FXColorSelector)
00058 protected:
00059   FXTabBook    *panels;               // Color panes
00060   FXColorWell  *well;                 // Main well
00061   FXColorList  *list;                 // List of color names
00062   FXColorRing  *wheel;                // Color ring
00063   FXSlider     *rgbaslider[4];        // RGBA sliders
00064   FXTextField  *rgbatext[4];          // RGBA text fields
00065   FXSlider     *hsvaslider[4];        // HSVA sliders
00066   FXTextField  *hsvatext[4];          // HSVA text fields
00067   FXSlider     *cmyslider[4];         // CMY sliders
00068   FXTextField  *cmytext[4];           // CMY text fields
00069   FXColorWell  *colorwells[24];       // Custom color wells
00070   FXIcon       *eyedropicon;          // Icon for eye dropper
00071   FXIcon       *dialmodeicon;         // Icon for dial mode
00072   FXIcon       *rgbmodeicon;          // Icon for RGB mode
00073   FXIcon       *hsvmodeicon;          // Icon for HSV mode
00074   FXIcon       *cmymodeicon;          // Icon for CMY mode
00075   FXIcon       *txtmodeicon;          // Icon for TEXT mode
00076   FXButton     *accept;               // Accept button
00077   FXButton     *cancel;               // Cancel button
00078   FXfloat       rgba[4];              // Accurate RGBA color
00079   FXfloat       hsva[4];              // Accurate HSVA color
00080 protected:
00081   FXColorSelector(){}
00082   void updateWell();
00083 private:
00084   FXColorSelector(const FXColorSelector&);
00085   FXColorSelector &operator=(const FXColorSelector&);
00086 public:
00087   long onCmdWell(FXObject*,FXSelector,void*);
00088   long onChgWell(FXObject*,FXSelector,void*);
00089   long onCmdRGBSlider(FXObject*,FXSelector,void*);
00090   long onUpdRGBSlider(FXObject*,FXSelector,void*);
00091   long onCmdRGBText(FXObject*,FXSelector,void*);
00092   long onUpdRGBText(FXObject*,FXSelector,void*);
00093   long onCmdHSVSlider(FXObject*,FXSelector,void*);
00094   long onUpdHSVSlider(FXObject*,FXSelector,void*);
00095   long onCmdHSVText(FXObject*,FXSelector,void*);
00096   long onUpdHSVText(FXObject*,FXSelector,void*);
00097   long onCmdCMYSlider(FXObject*,FXSelector,void*);
00098   long onUpdCMYSlider(FXObject*,FXSelector,void*);
00099   long onCmdCMYText(FXObject*,FXSelector,void*);
00100   long onUpdCMYText(FXObject*,FXSelector,void*);
00101   long onCmdList(FXObject*,FXSelector,void*);
00102   long onCmdCustomWell(FXObject*,FXSelector,void*);
00103   long onCmdSetValue(FXObject*,FXSelector,void*);
00104   long onCmdAlphaSlider(FXObject*,FXSelector,void*);
00105   long onUpdAlphaSlider(FXObject*,FXSelector,void*);
00106   long onCmdAlphaText(FXObject*,FXSelector,void*);
00107   long onUpdAlphaText(FXObject*,FXSelector,void*);
00108   long onUpdAlphaLabel(FXObject*,FXSelector,void*);
00109   long onCmdWheel(FXObject*,FXSelector,void*);
00110   long onUpdWheel(FXObject*,FXSelector,void*);
00111   long onCmdColorPick(FXObject*,FXSelector,void*);
00112   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00113   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00114 public:
00115   enum {
00116     ID_CUSTOM_FIRST=FXPacker::ID_LAST,
00117     ID_CUSTOM_LAST=ID_CUSTOM_FIRST+24,
00118     ID_RGB_RED_SLIDER,
00119     ID_RGB_GREEN_SLIDER,
00120     ID_RGB_BLUE_SLIDER,
00121     ID_RGB_RED_TEXT,
00122     ID_RGB_GREEN_TEXT,
00123     ID_RGB_BLUE_TEXT,
00124     ID_HSV_HUE_SLIDER,
00125     ID_HSV_SATURATION_SLIDER,
00126     ID_HSV_VALUE_SLIDER,
00127     ID_HSV_HUE_TEXT,
00128     ID_HSV_SATURATION_TEXT,
00129     ID_HSV_VALUE_TEXT,
00130     ID_CMY_CYAN_SLIDER,
00131     ID_CMY_MAGENTA_SLIDER,
00132     ID_CMY_YELLOW_SLIDER,
00133     ID_CMY_CYAN_TEXT,
00134     ID_CMY_MAGENTA_TEXT,
00135     ID_CMY_YELLOW_TEXT,
00136     ID_DIAL_WHEEL,
00137     ID_COLOR_LIST,
00138     ID_WELL_CHANGED,
00139     ID_ALPHA_SLIDER,
00140     ID_ALPHA_TEXT,
00141     ID_ALPHA_LABEL,
00142     ID_COLORPICK,
00143     ID_LAST
00144     };
00145 public:
00146 
00148   FXColorSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00149 
00151   FXButton *acceptButton() const { return accept; }
00152 
00154   FXButton *cancelButton() const { return cancel; }
00155 
00157   void setRGBA(FXColor color,FXbool notify=false);
00158 
00160   FXColor getRGBA() const;
00161 
00163   void setActivePanel(FXint pnl=COLORTAB_COLOR_RING);
00164 
00166   FXint getActivePanel() const;
00167 
00169   void setWellColor(FXint w,FXColor clr);
00170 
00172   FXColor getWellColor(FXint w) const;
00173 
00175   void setOpaqueOnly(FXbool opaque);
00176 
00178   FXbool isOpaqueOnly() const;
00179 
00181   virtual void save(FXStream& store) const;
00182 
00184   virtual void load(FXStream& store);
00185 
00187   virtual ~FXColorSelector();
00188   };
00189 
00190 }
00191 
00192 #endif

Copyright © 1997-2011 Jeroen van der Zijp