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

FXDial.h
1 /********************************************************************************
2 * *
3 * D i a l W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,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 FXDIAL_H
22 #define FXDIAL_H
23 
24 #ifndef FXFRAME_H
25 #include "FXFrame.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 // Dial style options
32 enum {
33  DIAL_VERTICAL = 0, // Vertically oriented
34  DIAL_HORIZONTAL = 0x00008000, // Horizontal oriented
35  DIAL_CYCLIC = 0x00010000, // Value wraps around
36  DIAL_HAS_NOTCH = 0x00020000, // Dial has a Center Notch
37  DIAL_NORMAL = DIAL_VERTICAL
38  };
39 
40 
51 class FXAPI FXDial : public FXFrame {
52  FXDECLARE(FXDial)
53 protected:
54  FXint notchAngle; // Angle of main notch
55  FXint notchSpacing; // Angle between notches
56  FXint notchOffset; // Notch offset
57  FXColor notchColor; // Main notch color
58  FXint dragPoint; // Place where clicked
59  FXint dragPos; // Value where clicked
60  FXint range[2]; // Reported data range
61  FXint incr; // Rate of change/revolution
62  FXint pos; // Reported data position
63  FXString help; // Help string
64  FXString tip; // Tip string
65 protected:
66  FXDial();
67 private:
68  FXDial(const FXDial&);
69  FXDial &operator=(const FXDial&);
70 public:
71  long onPaint(FXObject*,FXSelector,void*);
72  long onMotion(FXObject*,FXSelector,void*);
73  long onMouseWheel(FXObject*,FXSelector,void*);
74  long onLeftBtnPress(FXObject*,FXSelector,void* );
75  long onLeftBtnRelease(FXObject*,FXSelector,void*);
76  long onKeyPress(FXObject*,FXSelector,void*);
77  long onKeyRelease(FXObject*,FXSelector,void*);
78  long onUngrabbed(FXObject*,FXSelector,void*);
79  long onCmdSetValue(FXObject*,FXSelector,void*);
80  long onCmdSetIntValue(FXObject*,FXSelector,void*);
81  long onCmdGetIntValue(FXObject*,FXSelector,void*);
82  long onCmdSetLongValue(FXObject*,FXSelector,void*);
83  long onCmdGetLongValue(FXObject*,FXSelector,void*);
84  long onCmdSetRealValue(FXObject*,FXSelector,void*);
85  long onCmdGetRealValue(FXObject*,FXSelector,void*);
86  long onCmdSetIntRange(FXObject*,FXSelector,void*);
87  long onCmdGetIntRange(FXObject*,FXSelector,void*);
88  long onCmdSetRealRange(FXObject*,FXSelector,void*);
89  long onCmdGetRealRange(FXObject*,FXSelector,void*);
90  long onCmdSetHelp(FXObject*,FXSelector,void*);
91  long onCmdGetHelp(FXObject*,FXSelector,void*);
92  long onCmdSetTip(FXObject*,FXSelector,void*);
93  long onCmdGetTip(FXObject*,FXSelector,void*);
94  long onQueryHelp(FXObject*,FXSelector,void*);
95  long onQueryTip(FXObject*,FXSelector,void*);
96 public:
97 
99  FXDial(FXComposite *p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=DIAL_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);
100 
102  virtual FXint getDefaultWidth();
103 
105  virtual FXint getDefaultHeight();
106 
108  virtual FXbool canFocus() const;
109 
111  void setValue(FXint value,FXbool notify=false);
112 
114  FXint getValue() const { return pos; }
115 
117  void setRange(FXint lo,FXint hi,FXbool notify=false);
118 
120  void getRange(FXint& lo,FXint& hi) const { lo=range[0]; hi=range[1]; }
121 
129  void setRevolutionIncrement(FXint i);
130 
132  FXint getRevolutionIncrement() const { return incr; }
133 
139  void setNotchSpacing(FXint spacing);
140 
142  FXint getNotchSpacing() const { return notchSpacing; }
143 
149  void setNotchOffset(FXint offset);
150 
152  FXint getNotchOffset() const { return notchOffset; }
153 
155  void setDialStyle(FXuint opts);
156 
158  FXuint getDialStyle() const;
159 
161  void setNotchColor(FXColor clr);
162 
164  FXColor getNotchColor() const { return notchColor; }
165 
167  void setHelpText(const FXString& text);
168 
170  const FXString& getHelpText() const { return help; }
171 
173  void setTipText(const FXString& text);
174 
176  const FXString& getTipText() const { return tip; }
177 
179  virtual void save(FXStream& store) const;
180 
182  virtual void load(FXStream& store);
183  };
184 
185 }
186 
187 #endif
const FXString & getHelpText() const
Get the current help text.
Definition: FXDial.h:170
FXint getNotchOffset() const
Get the current center notch offset.
Definition: FXDial.h:152
The Frame widget provides borders around some contents.
Definition: FXFrame.h:58
FXint getNotchSpacing() const
Get the current notch spacing.
Definition: FXDial.h:142
The Dial widget is a valuator widget which is able to provide a cyclic value range when the DIAL_CYCL...
Definition: FXDial.h:51
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
const FXString & getTipText() const
Get the current tooltip text value.
Definition: FXDial.h:176
void getRange(FXint &lo, FXint &hi) const
Obtain the current range of the dial.
Definition: FXDial.h:120
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
FXColor getNotchColor() const
Get the current center notch color.
Definition: FXDial.h:164
FXint getValue() const
Return the dial value.
Definition: FXDial.h:114
FXint getRevolutionIncrement() const
Get the current value of the revolution increment.
Definition: FXDial.h:132
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp