![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * C o l o r S e l e c t o r * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2002 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (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 GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXColorSelector.h,v 1.20 2002/01/18 22:42:51 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXCOLORSELECTOR_H 00025 #define FXCOLORSELECTOR_H 00026 00027 #ifndef FXPACKER_H 00028 #include "FXPacker.h" 00029 #endif 00030 00031 00032 00033 class FXTabBook; 00034 class FXColorBar; 00035 class FXColorWell; 00036 class FXColorWheel; 00037 class FXList; 00038 class FXSlider; 00039 class FXTextField; 00040 class FXButton; 00041 class FXIcon; 00042 class FXLabel; 00043 00044 00045 /// Color selection widget 00046 class FXAPI FXColorSelector : public FXPacker { 00047 FXDECLARE(FXColorSelector) 00048 protected: 00049 FXTabBook *panels; // Color panes 00050 FXColorWell *well; // Main well 00051 FXList *list; // List of color names 00052 FXColorBar *bar; // Color bar 00053 FXColorWheel *wheel; // Color wheel 00054 FXSlider *rgbaslider[4]; // RGBA sliders 00055 FXTextField *rgbatext[4]; // RGBA text fields 00056 FXSlider *hsvaslider[4]; // HSVA sliders 00057 FXTextField *hsvatext[4]; // HSVA text fields 00058 FXSlider *cmyslider[4]; // CMY sliders 00059 FXTextField *cmytext[4]; // CMY text fields 00060 FXColorWell *colorwells[24]; // Custom color wells 00061 FXIcon *eyedropicon; // Icon for eye dropper 00062 FXIcon *dialmodeicon; // Icon for dial mode 00063 FXIcon *rgbmodeicon; // Icon for RGB mode 00064 FXIcon *hsvmodeicon; // Icon for HSV mode 00065 FXIcon *cmymodeicon; // Icon for CMY mode 00066 FXIcon *txtmodeicon; // Icon for TEXT mode 00067 FXButton *accept; // Accept button 00068 FXButton *cancel; // Cancel button 00069 FXfloat rgba[4]; // Accurate RGBA color 00070 FXfloat hsva[4]; // Accurate HSVA color 00071 protected: 00072 static const FXchar* wellname[24]; // Well names 00073 protected: 00074 FXColorSelector(){} 00075 void updateWell(); 00076 private: 00077 FXColorSelector(const FXColorSelector&); 00078 FXColorSelector &operator=(const FXColorSelector&); 00079 public: 00080 long onCmdColor(FXObject*,FXSelector,void*); 00081 long onChgColor(FXObject*,FXSelector,void*); 00082 long onCmdWell(FXObject*,FXSelector,void*); 00083 long onChgWell(FXObject*,FXSelector,void*); 00084 long onCmdRGBSlider(FXObject*,FXSelector,void*); 00085 long onUpdRGBSlider(FXObject*,FXSelector,void*); 00086 long onCmdRGBText(FXObject*,FXSelector,void*); 00087 long onUpdRGBText(FXObject*,FXSelector,void*); 00088 long onCmdHSVSlider(FXObject*,FXSelector,void*); 00089 long onUpdHSVSlider(FXObject*,FXSelector,void*); 00090 long onCmdHSVText(FXObject*,FXSelector,void*); 00091 long onUpdHSVText(FXObject*,FXSelector,void*); 00092 long onCmdCMYSlider(FXObject*,FXSelector,void*); 00093 long onUpdCMYSlider(FXObject*,FXSelector,void*); 00094 long onCmdCMYText(FXObject*,FXSelector,void*); 00095 long onUpdCMYText(FXObject*,FXSelector,void*); 00096 long onCmdList(FXObject*,FXSelector,void*); 00097 long onCmdCustomWell(FXObject*,FXSelector,void*); 00098 long onChgCustomWell(FXObject*,FXSelector,void*); 00099 long onCmdSetValue(FXObject*,FXSelector,void*); 00100 long onCmdActivePane(FXObject*,FXSelector,void*); 00101 long onCmdAlphaSlider(FXObject*,FXSelector,void*); 00102 long onUpdAlphaSlider(FXObject*,FXSelector,void*); 00103 long onCmdAlphaText(FXObject*,FXSelector,void*); 00104 long onUpdAlphaText(FXObject*,FXSelector,void*); 00105 long onUpdAlphaLabel(FXObject*,FXSelector,void*); 00106 long onCmdWheel(FXObject*,FXSelector,void*); 00107 long onUpdWheel(FXObject*,FXSelector,void*); 00108 long onCmdBar(FXObject*,FXSelector,void*); 00109 long onUpdBar(FXObject*,FXSelector,void*); 00110 long onCmdColorPick(FXObject*,FXSelector,void*); 00111 public: 00112 enum { 00113 ID_CUSTOM_FIRST=FXPacker::ID_LAST, 00114 ID_CUSTOM_LAST=ID_CUSTOM_FIRST+24, 00115 ID_RGB_RED_SLIDER, 00116 ID_RGB_GREEN_SLIDER, 00117 ID_RGB_BLUE_SLIDER, 00118 ID_RGB_RED_TEXT, 00119 ID_RGB_GREEN_TEXT, 00120 ID_RGB_BLUE_TEXT, 00121 ID_HSV_HUE_SLIDER, 00122 ID_HSV_SATURATION_SLIDER, 00123 ID_HSV_VALUE_SLIDER, 00124 ID_HSV_HUE_TEXT, 00125 ID_HSV_SATURATION_TEXT, 00126 ID_HSV_VALUE_TEXT, 00127 ID_CMY_CYAN_SLIDER, 00128 ID_CMY_MAGENTA_SLIDER, 00129 ID_CMY_YELLOW_SLIDER, 00130 ID_CMY_CYAN_TEXT, 00131 ID_CMY_MAGENTA_TEXT, 00132 ID_CMY_YELLOW_TEXT, 00133 ID_DIAL_WHEEL, 00134 ID_COLOR_BAR, 00135 ID_COLOR_LIST, 00136 ID_WELL_CHANGED, 00137 ID_COLOR, 00138 ID_ACTIVEPANE, 00139 ID_ALPHA_SLIDER, 00140 ID_ALPHA_TEXT, 00141 ID_ALPHA_LABEL, 00142 ID_COLORPICK, 00143 ID_LAST 00144 }; 00145 public: 00146 00147 /// Construct a new ColorSelector 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 00150 /// Create the ColorSelector 00151 virtual void create(); 00152 00153 /// Return a pointer to the "Accept" button 00154 FXButton *acceptButton() const { return accept; } 00155 00156 /// Return a pointer to the "Cancel" button 00157 FXButton *cancelButton() const { return cancel; } 00158 00159 /// Set the selected color 00160 void setRGBA(FXColor clr); 00161 00162 /// Get the selected color 00163 FXColor getRGBA() const; 00164 00165 /// Return true if only opaque colors allowed 00166 FXbool isOpaqueOnly() const; 00167 00168 /// Change opaque only mode 00169 void setOpaqueOnly(FXbool opaque); 00170 00171 /// Save to a stream 00172 virtual void save(FXStream& store) const; 00173 00174 /// Load from a stream 00175 virtual void load(FXStream& store); 00176 00177 /// Destructor 00178 virtual ~FXColorSelector(); 00179 }; 00180 00181 00182 #endif