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

FXColorSelector.h

00001 /******************************************************************************** 00002 * * 00003 * C o l o r S e l e c t o r * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2005 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.26 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXCOLORSELECTOR_H 00025 #define FXCOLORSELECTOR_H 00026 00027 #ifndef FXPACKER_H 00028 #include "FXPacker.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 class FXTabBook; 00035 class FXColorBar; 00036 class FXColorWell; 00037 class FXColorWheel; 00038 class FXList; 00039 class FXSlider; 00040 class FXTextField; 00041 class FXButton; 00042 class FXIcon; 00043 class FXLabel; 00044 00045 00046 /// Color selection widget 00047 class FXAPI FXColorSelector : public FXPacker { 00048 FXDECLARE(FXColorSelector) 00049 protected: 00050 FXTabBook *panels; // Color panes 00051 FXColorWell *well; // Main well 00052 FXList *list; // List of color names 00053 FXColorBar *bar; // Color bar 00054 FXColorWheel *wheel; // Color wheel 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* wellname[24]; // Well names 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 onCmdBar(FXObject*,FXSelector,void*); 00108 long onUpdBar(FXObject*,FXSelector,void*); 00109 long onCmdColorPick(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_BAR, 00134 ID_COLOR_LIST, 00135 ID_WELL_CHANGED, 00136 ID_ACTIVEPANE, 00137 ID_ALPHA_SLIDER, 00138 ID_ALPHA_TEXT, 00139 ID_ALPHA_LABEL, 00140 ID_COLORPICK, 00141 ID_LAST 00142 }; 00143 public: 00144 00145 /// Construct a new ColorSelector 00146 FXColorSelector(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00147 00148 /// Create the ColorSelector 00149 virtual void create(); 00150 00151 /// Return a pointer to the "Accept" button 00152 FXButton *acceptButton() const { return accept; } 00153 00154 /// Return a pointer to the "Cancel" button 00155 FXButton *cancelButton() const { return cancel; } 00156 00157 /// Set the selected color 00158 void setRGBA(FXColor clr); 00159 00160 /// Get the selected color 00161 FXColor getRGBA() const; 00162 00163 /// Return true if only opaque colors allowed 00164 FXbool isOpaqueOnly() const; 00165 00166 /// Change opaque only mode 00167 void setOpaqueOnly(FXbool opaque); 00168 00169 /// Save to a stream 00170 virtual void save(FXStream& store) const; 00171 00172 /// Load from a stream 00173 virtual void load(FXStream& store); 00174 00175 /// Destructor 00176 virtual ~FXColorSelector(); 00177 }; 00178 00179 } 00180 00181 #endif

Copyright © 1997-2005 Jeroen van der Zijp