![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * C o l o r B a r W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2001,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: FXColorBar.h,v 1.24 2009/01/06 13:07:22 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FXCOLORBAR_H 00024 #define FXCOLORBAR_H 00025 00026 #ifndef FXFRAME_H 00027 #include "FXFrame.h" 00028 #endif 00029 00030 namespace FX { 00031 00032 00033 /// Color bar orientation 00034 enum { 00035 COLORBAR_HORIZONTAL = 0, /// Color bar shown horizontally 00036 COLORBAR_VERTICAL = 0x00008000 /// Color bar shown vertically 00037 }; 00038 00039 00040 class FXImage; 00041 00042 00043 /** 00044 * A Color Bar is a widget which controls the brightness (value) of a 00045 * color by means of the hue, saturation, value specification system. 00046 * It is most useful when used together with the Color Wheel which controls 00047 * the hue and saturation. 00048 * The options COLORBAR_HORIZONTAL and COLORBAR_VERTICAL control the orientation 00049 * of the bar. 00050 */ 00051 class FXAPI FXColorBar : public FXFrame { 00052 FXDECLARE(FXColorBar) 00053 protected: 00054 FXImage *bar; // Intensity bar 00055 FXfloat hsv[3]; // Hue, saturation, value 00056 FXString tip; // Tooltip value 00057 FXString help; // Help value 00058 protected: 00059 FXColorBar(); 00060 void updatebar(); 00061 private: 00062 FXColorBar(const FXColorBar&); 00063 FXColorBar &operator=(const FXColorBar&); 00064 public: 00065 long onPaint(FXObject*,FXSelector,void*); 00066 long onLeftBtnPress(FXObject*,FXSelector,void*); 00067 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00068 long onMotion(FXObject*,FXSelector,void*); 00069 long onCmdSetHelp(FXObject*,FXSelector,void*); 00070 long onCmdGetHelp(FXObject*,FXSelector,void*); 00071 long onCmdSetTip(FXObject*,FXSelector,void*); 00072 long onCmdGetTip(FXObject*,FXSelector,void*); 00073 long onQueryHelp(FXObject*,FXSelector,void*); 00074 long onQueryTip(FXObject*,FXSelector,void*); 00075 public: 00076 00077 /// Construct color bar 00078 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); 00079 00080 /// Create server-side resources 00081 virtual void create(); 00082 00083 /// Detach server-side resources 00084 virtual void detach(); 00085 00086 /// Return default width 00087 virtual FXint getDefaultWidth(); 00088 00089 /// Return default height 00090 virtual FXint getDefaultHeight(); 00091 00092 /// Perform layout 00093 virtual void layout(); 00094 00095 /// Change hue 00096 void setHue(FXfloat h); 00097 00098 /// Return hue 00099 FXfloat getHue() const { return hsv[0]; } 00100 00101 /// Change saturation 00102 void setSat(FXfloat s); 00103 00104 /// Return saturation 00105 FXfloat getSat() const { return hsv[1]; } 00106 00107 /// Change value 00108 void setVal(FXfloat v); 00109 00110 /// Return value 00111 FXfloat getVal() const { return hsv[2]; } 00112 00113 /// Change the color bar style 00114 FXuint getBarStyle() const; 00115 00116 /// Get the color bar style 00117 void setBarStyle(FXuint style); 00118 00119 /// Set status line help text for this color bar 00120 void setHelpText(const FXString& text){ help=text; } 00121 00122 /// Get status line help text for this color bar 00123 const FXString& getHelpText() const { return help; } 00124 00125 /// Set tool tip message for this color bar 00126 void setTipText(const FXString& text){ tip=text; } 00127 00128 /// Get tool tip message for this color bar 00129 const FXString& getTipText() const { return tip; } 00130 00131 /// Save color bar to a stream 00132 virtual void save(FXStream& store) const; 00133 00134 /// Load color bar from a stream 00135 virtual void load(FXStream& store); 00136 00137 /// Destructor 00138 virtual ~FXColorBar(); 00139 }; 00140 00141 } 00142 00143 #endif
![]() |