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

FXColorWheel.h
1 /********************************************************************************
2 * *
3 * C o l o r W h e e l 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 FXCOLORWHEEL_H
22 #define FXCOLORWHEEL_H
23 
24 #ifndef FXFRAME_H
25 #include "FXFrame.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXImage;
32 
33 
41 class FXAPI FXColorWheel : public FXFrame {
42  FXDECLARE(FXColorWheel)
43 protected:
44  FXImage *dial; // HSV dial image
45  FXfloat hsv[3]; // Hue, saturation, value
46  FXint dialx; // Dial x location
47  FXint dialy; // Dial Y location
48  FXint spotx; // Spot x location
49  FXint spoty; // Spot Y location
50  FXString tip; // Tooltip value
51  FXString help; // Help value
52 protected:
53  FXColorWheel();
54  void updatedial();
55  void movespot(FXint x,FXint y);
56  FXbool hstoxy(FXint& x,FXint& y,FXfloat h,FXfloat s) const;
57  FXbool xytohs(FXfloat& h,FXfloat& s,FXint x,FXint y) const;
58 private:
59  FXColorWheel(const FXColorWheel&);
60  FXColorWheel &operator=(const FXColorWheel&);
61 public:
62  long onPaint(FXObject*,FXSelector,void*);
63  long onLeftBtnPress(FXObject*,FXSelector,void*);
64  long onLeftBtnRelease(FXObject*,FXSelector,void*);
65  long onMotion(FXObject*,FXSelector,void*);
66  long onMouseWheel(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  FXColorWheel(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 void layout();
86 
88  virtual FXint getDefaultWidth();
89 
91  virtual FXint getDefaultHeight();
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  void setHueSatVal(FXfloat h,FXfloat s,FXfloat v);
113 
115  void setJustify(FXuint style);
116 
118  FXuint getJustify() const;
119 
121  void setHelpText(const FXString& text){ help=text; }
122 
124  const FXString& getHelpText() const { return help; }
125 
127  void setTipText(const FXString& text){ tip=text; }
128 
130  const FXString& getTipText() const { return tip; }
131 
133  virtual void save(FXStream& store) const;
134 
136  virtual void load(FXStream& store);
137 
139  virtual ~FXColorWheel();
140  };
141 
142 }
143 
144 #endif
The Frame widget provides borders around some contents.
Definition: FXFrame.h:58
A ColorWheel is a widget which controls the hue and saturation values of a color. ...
Definition: FXColorWheel.h:41
Base composite.
Definition: FXComposite.h:32
const FXString & getTipText() const
Get tool tip message for this color well.
Definition: FXColorWheel.h:130
const FXString & getHelpText() const
Get status line help text for this color well.
Definition: FXColorWheel.h:124
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Definition: FX4Splitter.h:28
FXfloat getVal() const
Return value.
Definition: FXColorWheel.h:109
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
FXfloat getHue() const
Return hue.
Definition: FXColorWheel.h:97
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
void setHelpText(const FXString &text)
Set status line help text for this color well.
Definition: FXColorWheel.h:121
FXfloat getSat() const
Return saturation.
Definition: FXColorWheel.h:103
void setTipText(const FXString &text)
Set tool tip message for this color well.
Definition: FXColorWheel.h:127
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp