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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXColorBar.h
00001 /********************************************************************************
00002 *                                                                               *
00003 *                         C o l o r B a r   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 FXCOLORBAR_H
00022 #define FXCOLORBAR_H
00023 
00024 #ifndef FXFRAME_H
00025 #include "FXFrame.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00032 enum {
00033   COLORBAR_HORIZONTAL = 0,            
00034   COLORBAR_VERTICAL   = 0x00008000    
00035   };
00036 
00037 
00038 class FXImage;
00039 
00040 
00049 class FXAPI FXColorBar : public FXFrame {
00050   FXDECLARE(FXColorBar)
00051 protected:
00052   FXImage  *bar;          // Intensity bar
00053   FXfloat   hsv[3];       // Hue, saturation, value
00054   FXString  tip;          // Tooltip value
00055   FXString  help;         // Help value
00056 protected:
00057   FXColorBar();
00058   void updatebar();
00059 private:
00060   FXColorBar(const FXColorBar&);
00061   FXColorBar &operator=(const FXColorBar&);
00062 public:
00063   long onPaint(FXObject*,FXSelector,void*);
00064   long onLeftBtnPress(FXObject*,FXSelector,void*);
00065   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00066   long onMotion(FXObject*,FXSelector,void*);
00067   long onCmdSetHelp(FXObject*,FXSelector,void*);
00068   long onCmdGetHelp(FXObject*,FXSelector,void*);
00069   long onCmdSetTip(FXObject*,FXSelector,void*);
00070   long onCmdGetTip(FXObject*,FXSelector,void*);
00071   long onQueryHelp(FXObject*,FXSelector,void*);
00072   long onQueryTip(FXObject*,FXSelector,void*);
00073 public:
00074 
00076   FXColorBar(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);
00077 
00079   virtual void create();
00080 
00082   virtual void detach();
00083 
00085   virtual FXint getDefaultWidth();
00086 
00088   virtual FXint getDefaultHeight();
00089 
00091   virtual void layout();
00092 
00094   void setHue(FXfloat h);
00095 
00097   FXfloat getHue() const { return hsv[0]; }
00098 
00100   void setSat(FXfloat s);
00101 
00103   FXfloat getSat() const { return hsv[1]; }
00104 
00106   void setVal(FXfloat v);
00107 
00109   FXfloat getVal() const { return hsv[2]; }
00110 
00112   FXuint getBarStyle() const;
00113 
00115   void setBarStyle(FXuint style);
00116 
00118   void setHelpText(const FXString& text){ help=text; }
00119 
00121   const FXString& getHelpText() const { return help; }
00122 
00124   void setTipText(const FXString& text){ tip=text; }
00125 
00127   const FXString& getTipText() const { return tip; }
00128 
00130   virtual void save(FXStream& store) const;
00131 
00133   virtual void load(FXStream& store);
00134 
00136   virtual ~FXColorBar();
00137   };
00138 
00139 }
00140 
00141 #endif

Copyright © 1997-2011 Jeroen van der Zijp