FXColorBar.h

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

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:19 2009 for TnFOX by doxygen v1.4.7