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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXColorWheel.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                        C o l o r W h e e l   W i d g e t                      *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2001,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 FXCOLORWHEEL_H
00022 #define FXCOLORWHEEL_H
00023 
00024 #ifndef FXFRAME_H
00025 #include "FXFrame.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00031 class FXImage;
00032 
00033 
00039 class FXAPI FXColorWheel : public FXFrame {
00040   FXDECLARE(FXColorWheel)
00041 protected:
00042   FXImage  *dial;         // HSV dial image
00043   FXfloat   hsv[3];       // Hue, saturation, value
00044   FXint     dialx;        // Dial x location
00045   FXint     dialy;        // Dial Y location
00046   FXint     spotx;        // Spot x location
00047   FXint     spoty;        // Spot Y location
00048   FXString  tip;          // Tooltip value
00049   FXString  help;         // Help value
00050 protected:
00051   FXColorWheel();
00052   void updatedial();
00053   void movespot(FXint x,FXint y);
00054   FXbool hstoxy(FXint& x,FXint& y,FXfloat h,FXfloat s) const;
00055   FXbool xytohs(FXfloat& h,FXfloat& s,FXint x,FXint y) const;
00056 private:
00057   FXColorWheel(const FXColorWheel&);
00058   FXColorWheel &operator=(const FXColorWheel&);
00059 public:
00060   long onPaint(FXObject*,FXSelector,void*);
00061   long onLeftBtnPress(FXObject*,FXSelector,void*);
00062   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00063   long onMotion(FXObject*,FXSelector,void*);
00064   long onMouseWheel(FXObject*,FXSelector,void*);
00065   long onCmdSetHelp(FXObject*,FXSelector,void*);
00066   long onCmdGetHelp(FXObject*,FXSelector,void*);
00067   long onCmdSetTip(FXObject*,FXSelector,void*);
00068   long onCmdGetTip(FXObject*,FXSelector,void*);
00069   long onQueryHelp(FXObject*,FXSelector,void*);
00070   long onQueryTip(FXObject*,FXSelector,void*);
00071 public:
00072 
00074   FXColorWheel(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=FRAME_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
00075 
00077   virtual void create();
00078 
00080   virtual void detach();
00081 
00083   virtual void layout();
00084 
00086   virtual FXint getDefaultWidth();
00087 
00089   virtual FXint getDefaultHeight();
00090 
00092   void setHue(FXfloat h);
00093 
00095   FXfloat getHue() const { return hsv[0]; }
00096 
00098   void setSat(FXfloat s);
00099 
00101   FXfloat getSat() const { return hsv[1]; }
00102 
00104   void setVal(FXfloat v);
00105 
00107   FXfloat getVal() const { return hsv[2]; }
00108 
00110   void setHueSatVal(FXfloat h,FXfloat s,FXfloat v);
00111 
00113   void setHelpText(const FXString& text){ help=text; }
00114 
00116   const FXString& getHelpText() const { return help; }
00117 
00119   void setTipText(const FXString& text){ tip=text; }
00120 
00122   const FXString& getTipText() const { return tip; }
00123 
00125   virtual void save(FXStream& store) const;
00126 
00128   virtual void load(FXStream& store);
00129 
00131   virtual ~FXColorWheel();
00132   };
00133 
00134 }
00135 
00136 #endif

Copyright © 1997-2011 Jeroen van der Zijp