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

FXColorWheel.h
Go to the documentation of this file.
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,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (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 GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXColorWheel.h,v 1.31 2006/01/22 17:57:59 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXCOLORWHEEL_H
25 #define FXCOLORWHEEL_H
26 
27 #ifndef FXFRAME_H
28 #include "FXFrame.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXImage;
35 
36 
37 /**
38 * A ColorWheel is a widget which controls the hue and saturation values of a
39 * color. It is most often used together with a Color Bar which controls the
40 * brighness.
41 */
42 class FXAPI FXColorWheel : public FXFrame {
44 protected:
45  FXImage *dial; // HSV dial image
46  FXfloat hsv[3]; // Hue, saturation, value
47  FXint dialx; // Dial x location
48  FXint dialy; // Dial Y location
49  FXint spotx; // Spot x location
50  FXint spoty; // Spot Y location
51  FXString tip; // Tooltip value
52  FXString help; // Help value
53 protected:
54  FXColorWheel();
55  void updatedial();
56  void movespot(FXint x,FXint y);
57  FXbool hstoxy(FXint& x,FXint& y,FXfloat h,FXfloat s) const;
58  FXbool xytohs(FXfloat& h,FXfloat& s,FXint x,FXint y) const;
59 private:
60  FXColorWheel(const FXColorWheel&);
61  FXColorWheel &operator=(const FXColorWheel&);
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 onMouseWheel(FXObject*,FXSelector,void*);
68  long onCmdSetHelp(FXObject*,FXSelector,void*);
69  long onCmdGetHelp(FXObject*,FXSelector,void*);
70  long onCmdSetTip(FXObject*,FXSelector,void*);
71  long onCmdGetTip(FXObject*,FXSelector,void*);
72  long onQueryHelp(FXObject*,FXSelector,void*);
73  long onQueryTip(FXObject*,FXSelector,void*);
74 public:
75 
76  /// Construct color wheel with initial color clr
78 
79  /// Create server-side resources
80  virtual void create();
81 
82  /// Detach server-side resources
83  virtual void detach();
84 
85  /// Perform layout
86  virtual void layout();
87 
88  /// Return default width
89  virtual FXint getDefaultWidth();
90 
91  /// Return default height
92  virtual FXint getDefaultHeight();
93 
94  /// Change hue
95  void setHue(FXfloat h);
96 
97  /// Return hue
98  FXfloat getHue() const { return hsv[0]; }
99 
100  /// Change saturation
101  void setSat(FXfloat s);
102 
103  /// Return saturation
104  FXfloat getSat() const { return hsv[1]; }
105 
106  /// Change value
107  void setVal(FXfloat v);
108 
109  /// Return value
110  FXfloat getVal() const { return hsv[2]; }
111 
112  /// Set hue, saturation, value
113  void setHueSatVal(FXfloat h,FXfloat s,FXfloat v);
114 
115  /// Set status line help text for this color well
116  void setHelpText(const FXString& text){ help=text; }
117 
118  /// Get status line help text for this color well
119  const FXString& getHelpText() const { return help; }
120 
121  /// Set tool tip message for this color well
122  void setTipText(const FXString& text){ tip=text; }
123 
124  /// Get tool tip message for this color well
125  const FXString& getTipText() const { return tip; }
126 
127  /// Save color well to a stream
128  virtual void save(FXStream& store) const;
129 
130  /// Load color well from a stream
131  virtual void load(FXStream& store);
132 
133  /// Destructor
134  virtual ~FXColorWheel();
135  };
136 
137 }
138 
139 #endif
The Frame widget provides borders around some contents.
Definition: FXFrame.h:73
unsigned int FXuint
Definition: fxdefs.h:389
Definition: FXFrame.h:56
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
FXuchar FXbool
Definition: fxdefs.h:386
A ColorWheel is a widget which controls the hue and saturation values of a color. ...
Definition: FXColorWheel.h:42
Base composite.
Definition: FXComposite.h:35
#define NULL
Definition: fxdefs.h:41
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
Regular raised/thick border.
Definition: FXWindow.h:82
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
float FXfloat
Definition: fxdefs.h:391
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp