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

FXColorBar.h
1 /********************************************************************************
2 * *
3 * C o l o r B a r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2001,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXCOLORBAR_H
22 #define FXCOLORBAR_H
23 
24 #ifndef FXFRAME_H
25 #include "FXFrame.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  COLORBAR_HORIZONTAL = 0,
34  COLORBAR_VERTICAL = 0x00008000
35  };
36 
37 
38 class FXImage;
39 
40 
49 class FXAPI FXColorBar : public FXFrame {
50  FXDECLARE(FXColorBar)
51 protected:
52  FXImage *bar; // Intensity bar
53  FXfloat hsv[3]; // Hue, saturation, value
54  FXString tip; // Tooltip value
55  FXString help; // Help value
56 protected:
57  FXColorBar();
58  void updatebar();
59 private:
60  FXColorBar(const FXColorBar&);
61  FXColorBar &operator=(const FXColorBar&);
62 public:
63  long onPaint(FXObject*,FXSelector,void*);
64  long onLeftBtnPress(FXObject*,FXSelector,void*);
65  long onLeftBtnRelease(FXObject*,FXSelector,void*);
66  long onMotion(FXObject*,FXSelector,void*);
67  long onCmdSetHelp(FXObject*,FXSelector,void*);
68  long onCmdGetHelp(FXObject*,FXSelector,void*);
69  long onCmdSetTip(FXObject*,FXSelector,void*);
70  long onCmdGetTip(FXObject*,FXSelector,void*);
71  long onQueryHelp(FXObject*,FXSelector,void*);
72  long onQueryTip(FXObject*,FXSelector,void*);
73 public:
74 
76  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);
77 
79  virtual void create();
80 
82  virtual void detach();
83 
85  virtual FXint getDefaultWidth();
86 
88  virtual FXint getDefaultHeight();
89 
91  virtual void layout();
92 
94  void setHue(FXfloat h);
95 
97  FXfloat getHue() const { return hsv[0]; }
98 
100  void setSat(FXfloat s);
101 
103  FXfloat getSat() const { return hsv[1]; }
104 
106  void setVal(FXfloat v);
107 
109  FXfloat getVal() const { return hsv[2]; }
110 
112  FXuint getBarStyle() const;
113 
115  void setBarStyle(FXuint style);
116 
118  void setHelpText(const FXString& text){ help=text; }
119 
121  const FXString& getHelpText() const { return help; }
122 
124  void setTipText(const FXString& text){ tip=text; }
125 
127  const FXString& getTipText() const { return tip; }
128 
130  virtual void save(FXStream& store) const;
131 
133  virtual void load(FXStream& store);
134 
136  virtual ~FXColorBar();
137  };
138 
139 }
140 
141 #endif

Copyright © 1997-2016 Jeroen van der Zijp