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,2024 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=nullptr,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
void setHelpText(const FXString &text)
Set status line help text for this color bar.
Definition: FXColorBar.h:118
The Frame widget provides borders around some contents.
Definition: FXFrame.h:58
void setTipText(const FXString &text)
Set tool tip message for this color bar.
Definition: FXColorBar.h:124
const FXString & getTipText() const
Get tool tip message for this color bar.
Definition: FXColorBar.h:127
FXfloat getHue() const
Return hue.
Definition: FXColorBar.h:97
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
FXfloat getSat() const
Return saturation.
Definition: FXColorBar.h:103
Definition: FX4Splitter.h:28
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
A ColorBar is a widget which controls the brightness (value) of a color by means of the hue...
Definition: FXColorBar.h:49
FXfloat getVal() const
Return value.
Definition: FXColorBar.h:109
const FXString & getHelpText() const
Get status line help text for this color bar.
Definition: FXColorBar.h:121
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp