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

FXRangeSlider.h
1 /********************************************************************************
2 * *
3 * S l i d e r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,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 FXRANGERANGESLIDER_H
22 #define FXRANGERANGESLIDER_H
23 
24 #ifndef FXFRAME_H
25 #include "FXFrame.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  RANGESLIDER_HORIZONTAL = 0,
34  RANGESLIDER_VERTICAL = 0x00008000,
35  RANGESLIDER_ARROW_UP = 0x00010000,
36  RANGESLIDER_ARROW_DOWN = 0x00020000,
37  RANGESLIDER_ARROW_LEFT = RANGESLIDER_ARROW_UP,
38  RANGESLIDER_ARROW_RIGHT = RANGESLIDER_ARROW_DOWN,
39  RANGESLIDER_INSIDE_BAR = 0x00040000,
40  RANGESLIDER_NORMAL = RANGESLIDER_HORIZONTAL
41  };
42 
43 
55 class FXAPI FXRangeSlider : public FXFrame {
56  FXDECLARE(FXRangeSlider)
57 protected:
58  FXint headPos[2]; // Head position
59  FXint headSize; // Head size
60  FXint slotSize; // Slot size
61  FXColor slotColor; // Color of slot the head moves in
62  FXint dragPoint; // Where the head is grabbed
63  FXint values[4]; // Slider values
64  FXint active; // Which head is being manipulated
65  FXint incr; // Increment when auto-sliding
66  FXString help; // Help string
67  FXString tip; // Tip string
68 protected:
69  FXRangeSlider();
70  void drawSliderHead(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
71 private:
73  FXRangeSlider &operator=(const FXRangeSlider&);
74 public:
75  long onPaint(FXObject*,FXSelector,void*);
76  long onMotion(FXObject*,FXSelector,void*);
77  long onMouseWheel(FXObject*,FXSelector,void*);
78  long onLeftBtnPress(FXObject*,FXSelector,void*);
79  long onLeftBtnRelease(FXObject*,FXSelector,void*);
80  long onMiddleBtnPress(FXObject*,FXSelector,void*);
81  long onMiddleBtnRelease(FXObject*,FXSelector,void*);
82  long onKeyPress(FXObject*,FXSelector,void*);
83  long onKeyRelease(FXObject*,FXSelector,void*);
84  long onUngrabbed(FXObject*,FXSelector,void*);
85  long onAutoSlide(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  enum{
98  ID_AUTOSLIDE=FXFrame::ID_LAST,
99  ID_LAST
100  };
101 public:
102 
104  FXRangeSlider(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=RANGESLIDER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=0,FXint pr=0,FXint pt=0,FXint pb=0);
105 
107  virtual FXint getDefaultWidth();
108 
110  virtual FXint getDefaultHeight();
111 
113  virtual FXbool canFocus() const;
114 
116  virtual void layout();
117 
119  virtual void enable();
120 
122  virtual void disable();
123 
125  void setValue(FXint head,FXint value,FXbool notify=false);
126 
128  FXint getValue(FXint head) const { return values[1+head]; }
129 
131  void setRange(FXint lo,FXint hi,FXbool notify=false);
132 
134  void getRange(FXint& lo,FXint& hi) const { lo=values[0]; hi=values[3]; }
135 
137  FXuint getSliderStyle() const;
138 
140  void setSliderStyle(FXuint style);
141 
143  FXint getHeadSize() const { return headSize; }
144 
146  void setHeadSize(FXint hs);
147 
149  FXint getSlotSize() const { return slotSize; }
150 
152  void setSlotSize(FXint bs);
153 
155  FXint getIncrement() const { return incr; }
156 
158  void setIncrement(FXint inc);
159 
161  void setSlotColor(FXColor clr);
162 
164  FXColor getSlotColor() const { return slotColor; }
165 
167  void setHelpText(const FXString& text){ help=text; }
168 
170  const FXString& getHelpText() const { return help; }
171 
173  void setTipText(const FXString& text){ tip=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 
185  virtual ~FXRangeSlider();
186  };
187 
188 }
189 
190 #endif

Copyright © 1997-2016 Jeroen van der Zijp