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

FXScrollBar.h
1 /********************************************************************************
2 * *
3 * S c r o l l B a r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1997,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 FXSCROLLBAR_H
22 #define FXSCROLLBAR_H
23 
24 #ifndef FXWINDOW_H
25 #include "FXWindow.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  SCROLLBAR_VERTICAL = 0,
34  SCROLLBAR_HORIZONTAL = 0x00020000,
35  SCROLLBAR_WHEELJUMP = 0x00040000
36  };
37 
38 
39 
59 class FXAPI FXScrollBar : public FXWindow {
60  FXDECLARE(FXScrollBar)
61 protected:
62  FXint range; // Scrollable range
63  FXint page; // Page size
64  FXint line; // Line size
65  FXint pos; // Position
66  FXint barsize; // Bar size
67  FXint thumbsize; // Thumb size
68  FXint thumbpos; // Thumb position
69  FXint wheelLines; // Scroll wheel lines
70  FXColor hiliteColor; // Hightlight color
71  FXColor shadowColor; // Shadow color
72  FXColor borderColor; // Border color
73  FXColor arrowColor; // Arrow color
74  FXint dragpoint; // Point where grabbed
75  FXuchar mode; // Current mode of control
76 protected:
77  FXScrollBar();
78  void drawButton(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXbool down);
79  void drawThumb(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
80  void drawLeftArrow(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXbool down);
81  void drawRightArrow(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXbool down);
82  void drawUpArrow(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXbool down);
83  void drawDownArrow(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXbool down);
84 protected:
85  enum {
86  MODE_NONE,
87  MODE_INC,
88  MODE_DEC,
89  MODE_PAGE_INC,
90  MODE_PAGE_DEC,
91  MODE_DRAG,
92  MODE_FINE_DRAG
93  };
94 private:
95  FXScrollBar(const FXScrollBar&);
96  FXScrollBar &operator=(const FXScrollBar&);
97 public:
98  long onPaint(FXObject*,FXSelector,void*);
99  long onMotion(FXObject*,FXSelector,void*);
100  long onMouseWheel(FXObject*,FXSelector,void*);
101  long onLeftBtnPress(FXObject*,FXSelector,void*);
102  long onLeftBtnRelease(FXObject*,FXSelector,void*);
103  long onMiddleBtnPress(FXObject*,FXSelector,void*);
104  long onMiddleBtnRelease(FXObject*,FXSelector,void*);
105  long onRightBtnPress(FXObject*,FXSelector,void*);
106  long onRightBtnRelease(FXObject*,FXSelector,void*);
107  long onUngrabbed(FXObject*,FXSelector,void*);
108  long onTimeWheel(FXObject*,FXSelector,void*);
109  long onAutoScroll(FXObject*,FXSelector,void*);
110  long onCmdSetValue(FXObject*,FXSelector,void*);
111  long onCmdSetIntValue(FXObject*,FXSelector,void*);
112  long onCmdGetIntValue(FXObject*,FXSelector,void*);
113  long onCmdSetLongValue(FXObject*,FXSelector,void*);
114  long onCmdGetLongValue(FXObject*,FXSelector,void*);
115  long onCmdSetIntRange(FXObject*,FXSelector,void*);
116  long onCmdGetIntRange(FXObject*,FXSelector,void*);
117 public:
118  enum{
119  ID_AUTOSCROLL=FXWindow::ID_LAST,
120  ID_TIMEWHEEL,
121  ID_LAST
122  };
123 public:
124 
126  FXScrollBar(FXComposite* p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=SCROLLBAR_VERTICAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
127 
129  virtual FXint getDefaultWidth();
130 
132  virtual FXint getDefaultHeight();
133 
135  virtual void layout();
136 
141  void setRange(FXint r,FXbool notify=false);
142 
144  FXint getRange() const { return range; }
145 
150  void setPage(FXint p,FXbool notify=false);
151 
153  FXint getPage() const { return page; }
154 
160  void setPosition(FXint p,FXbool notify=false);
161 
163  FXint getPosition() const { return pos; }
164 
166  void setLine(FXint l);
167 
169  FXint getLine() const { return line; }
170 
172  void setWheelLines(FXint lines){ wheelLines=lines; }
173 
175  FXint getWheelLines() const { return wheelLines; }
176 
178  void setHiliteColor(FXColor clr);
179 
181  FXColor getHiliteColor() const { return hiliteColor; }
182 
184  void setShadowColor(FXColor clr);
185 
187  FXColor getShadowColor() const { return shadowColor; }
188 
190  void setBorderColor(FXColor clr);
191 
193  FXColor getBorderColor() const { return borderColor; }
194 
196  void setArrowColor(FXColor clr);
197 
199  FXColor getArrowColor() const { return arrowColor; }
200 
202  void setScrollBarStyle(FXuint style);
203 
205  FXuint getScrollBarStyle() const;
206 
208  void setBarSize(FXint size);
209 
211  FXint getBarSize() const { return barsize; }
212 
214  virtual void save(FXStream& store) const;
215 
217  virtual void load(FXStream& store);
218 
220  virtual ~FXScrollBar();
221  };
222 
223 
225 class FXAPI FXScrollCorner : public FXWindow {
226  FXDECLARE(FXScrollCorner)
227 protected:
228  FXScrollCorner();
229 private:
231  FXScrollCorner &operator=(const FXScrollCorner&);
232 public:
233  long onPaint(FXObject*,FXSelector,void*);
234 public:
235 
238 
240  virtual void enable();
241 
243  virtual void disable();
244  };
245 
246 }
247 
248 #endif
FXColor getHiliteColor() const
Return highlight color.
Definition: FXScrollBar.h:181
FXint getBarSize() const
Return the bar size.
Definition: FXScrollBar.h:211
FXint getRange() const
Return content size range.
Definition: FXScrollBar.h:144
Window is the base class for all widgets in FOX.
Definition: FXWindow.h:130
FXint getPage() const
Return viewable page size.
Definition: FXScrollBar.h:153
The scroll bar is used when a document has a larger content than may be made visible.
Definition: FXScrollBar.h:59
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Corner between scroll bars.
Definition: FXScrollBar.h:225
FXColor getShadowColor() const
Return the shadow color.
Definition: FXScrollBar.h:187
Definition: FX4Splitter.h:28
FXint getPosition() const
Return current scroll position.
Definition: FXScrollBar.h:163
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
Window Device Context.
Definition: FXDCWindow.h:48
FXColor getArrowColor() const
Return the arrow color.
Definition: FXScrollBar.h:199
void setWheelLines(FXint lines)
Change mouse wheel scroll lines.
Definition: FXScrollBar.h:172
FXint getWheelLines() const
Return current wheel lines.
Definition: FXScrollBar.h:175
FXint getLine() const
Return line increment.
Definition: FXScrollBar.h:169
FXColor getBorderColor() const
Return the border color.
Definition: FXScrollBar.h:193

Copyright © 1997-2022 Jeroen van der Zijp