![]() |
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,2009 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 * $Id: FXColorSelector.h,v 1.38 2009/01/06 13:07:22 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FXCOLORSELECTOR_H 00024 #define FXCOLORSELECTOR_H 00025 00026 #ifndef FXPACKER_H 00027 #include "FXPacker.h" 00028 #endif 00029 00030 namespace FX { 00031 00032 00033 class FXTabBook; 00034 class FXColorBar; 00035 class FXColorWell; 00036 class FXColorWheel; 00037 class FXColorRing; 00038 class FXColorList; 00039 class FXList; 00040 class FXSlider; 00041 class FXTextField; 00042 class FXButton; 00043 class FXIcon; 00044 class FXLabel; 00045 00046 00047 /// Color selection widget 00048 class FXAPI FXColorSelector : public FXPacker { 00049 FXDECLARE(FXColorSelector) 00050 protected: 00051 FXTabBook *panels; // Color panes 00052 FXColorWell *well; // Main well 00053 FXColorList *list; // List of color names 00054 FXColorRing *wheel; // Color ring 00055 FXSlider *rgbaslider[4]; // RGBA sliders 00056 FXTextField *rgbatext[4]; // RGBA text fields 00057 FXSlider *hsvaslider[4]; // HSVA sliders 00058 FXTextField *hsvatext[4]; // HSVA text fields 00059 FXSlider *cmyslider[4]; // CMY sliders 00060 FXTextField *cmytext[4]; // CMY text fields 00061 FXColorWell *colorwells[24]; // Custom color wells 00062 FXIcon *eyedropicon; // Icon for eye dropper 00063 FXIcon *dialmodeicon; // Icon for dial mode 00064 FXIcon *rgbmodeicon; // Icon for RGB mode 00065 FXIcon *hsvmodeicon; // Icon for HSV mode 00066 FXIcon *cmymodeicon; // Icon for CMY mode 00067 FXIcon *txtmodeicon; // Icon for TEXT mode 00068 FXButton *accept; // Accept button 00069 FXButton *cancel; // Cancel button 00070 FXfloat rgba[4]; // Accurate RGBA color 00071 FXfloat hsva[4]; // Accurate HSVA color 00072 protected: 00073 static const FXchar *const wellname[24]; 00074 protected: 00075 FXColorSelector(){} 00076 void updateWell(); 00077 private: 00078 FXColorSelector(const FXColorSelector&); 00079 FXColorSelector &operator=(const FXColorSelector&); 00080 public: 00081 long onCmdWell(FXObject*,FXSelector,void*); 00082 long onChgWell(FXObject*,FXSelector,void*); 00083 long onCmdRGBSlider(FXObject*,FXSelector,void*); 00084 long onUpdRGBSlider(FXObject*,FXSelector,void*); 00085 long onCmdRGBText(FXObject*,FXSelector,void*); 00086 long onUpdRGBText(FXObject*,FXSelector,void*); 00087 long onCmdHSVSlider(FXObject*,FXSelector,void*); 00088 long onUpdHSVSlider(FXObject*,FXSelector,void*); 00089 long onCmdHSVText(FXObject*,FXSelector,void*); 00090 long onUpdHSVText(FXObject*,FXSelector,void*); 00091 long onCmdCMYSlider(FXObject*,FXSelector,void*); 00092 long onUpdCMYSlider(FXObject*,FXSelector,void*); 00093 long onCmdCMYText(FXObject*,FXSelector,void*); 00094 long onUpdCMYText(FXObject*,FXSelector,void*); 00095 long onCmdList(FXObject*,FXSelector,void*); 00096 long onCmdCustomWell(FXObject*,FXSelector,void*); 00097 long onChgCustomWell(FXObject*,FXSelector,void*); 00098 long onCmdSetValue(FXObject*,FXSelector,void*); 00099 long onCmdActivePane(FXObject*,FXSelector,void*); 00100 long onCmdAlphaSlider(FXObject*,FXSelector,void*); 00101 long onUpdAlphaSlider(FXObject*,FXSelector,void*); 00102 long onCmdAlphaText(FXObject*,FXSelector,void*); 00103 long onUpdAlphaText(FXObject*,FXSelector,void*); 00104 long onUpdAlphaLabel(FXObject*,FXSelector,void*); 00105 long onCmdWheel(FXObject*,FXSelector,void*); 00106 long onUpdWheel(FXObject*,FXSelector,void*); 00107 long onCmdColorPick(FXObject*,FXSelector,void*); 00108 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00109 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00110 public: 00111 enum { 00112 ID_CUSTOM_FIRST=FXPacker::ID_LAST, 00113 ID_CUSTOM_LAST=ID_CUSTOM_FIRST+24, 00114 ID_RGB_RED_SLIDER, 00115 ID_RGB_GREEN_SLIDER, 00116 ID_RGB_BLUE_SLIDER, 00117 ID_RGB_RED_TEXT, 00118 ID_RGB_GREEN_TEXT, 00119 ID_RGB_BLUE_TEXT, 00120 ID_HSV_HUE_SLIDER, 00121 ID_HSV_SATURATION_SLIDER, 00122 ID_HSV_VALUE_SLIDER, 00123 ID_HSV_HUE_TEXT, 00124 ID_HSV_SATURATION_TEXT, 00125 ID_HSV_VALUE_TEXT, 00126 ID_CMY_CYAN_SLIDER, 00127 ID_CMY_MAGENTA_SLIDER, 00128 ID_CMY_YELLOW_SLIDER, 00129 ID_CMY_CYAN_TEXT, 00130 ID_CMY_MAGENTA_TEXT, 00131 ID_CMY_YELLOW_TEXT, 00132 ID_DIAL_WHEEL, 00133 ID_COLOR_LIST, 00134 ID_WELL_CHANGED, 00135 ID_ACTIVEPANE, 00136 ID_ALPHA_SLIDER, 00137 ID_ALPHA_TEXT, 00138 ID_ALPHA_LABEL, 00139 ID_COLORPICK, 00140 ID_LAST 00141 }; 00142 public: 00143 00144 /// Construct a new ColorSelector 00145 FXColorSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00146 00147 /// Create the ColorSelector 00148 virtual void create(); 00149 00150 /// Return a pointer to the "Accept" button 00151 FXButton *acceptButton() const { return accept; } 00152 00153 /// Return a pointer to the "Cancel" button 00154 FXButton *cancelButton() const { return cancel; } 00155 00156 /// Set the selected color 00157 void setRGBA(FXColor clr); 00158 00159 /// Get the selected color 00160 FXColor getRGBA() const; 00161 00162 /// Return true if only opaque colors allowed 00163 FXbool isOpaqueOnly() const; 00164 00165 /// Change opaque only mode 00166 void setOpaqueOnly(FXbool opaque); 00167 00168 /// Save to a stream 00169 virtual void save(FXStream& store) const; 00170 00171 /// Load from a stream 00172 virtual void load(FXStream& store); 00173 00174 /// Destructor 00175 virtual ~FXColorSelector(); 00176 }; 00177 00178 } 00179 00180 #endif
![]() |