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,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 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  FXColor hiliteColor; // Hightlight color
70  FXColor shadowColor; // Shadow color
71  FXColor borderColor; // Border color
72  FXColor arrowColor; // Arrow color
73  FXint dragpoint; // Point where grabbed
74  FXuchar mode; // Current mode of control
75 protected:
76  FXScrollBar();
77  void drawButton(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXbool down);
78  void drawThumb(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
79  void drawLeftArrow(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXbool down);
80  void drawRightArrow(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXbool down);
81  void drawUpArrow(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXbool down);
82  void drawDownArrow(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h,FXbool down);
83 protected:
84  enum {
85  MODE_NONE,
86  MODE_INC,
87  MODE_DEC,
88  MODE_PAGE_INC,
89  MODE_PAGE_DEC,
90  MODE_DRAG,
91  MODE_FINE_DRAG
92  };
93 private:
94  FXScrollBar(const FXScrollBar&);
95  FXScrollBar &operator=(const FXScrollBar&);
96 public:
97  long onPaint(FXObject*,FXSelector,void*);
98  long onMotion(FXObject*,FXSelector,void*);
99  long onMouseWheel(FXObject*,FXSelector,void*);
100  long onLeftBtnPress(FXObject*,FXSelector,void*);
101  long onLeftBtnRelease(FXObject*,FXSelector,void*);
102  long onMiddleBtnPress(FXObject*,FXSelector,void*);
103  long onMiddleBtnRelease(FXObject*,FXSelector,void*);
104  long onRightBtnPress(FXObject*,FXSelector,void*);
105  long onRightBtnRelease(FXObject*,FXSelector,void*);
106  long onUngrabbed(FXObject*,FXSelector,void*);
107  long onTimeWheel(FXObject*,FXSelector,void*);
108  long onAutoScroll(FXObject*,FXSelector,void*);
109  long onCmdSetValue(FXObject*,FXSelector,void*);
110  long onCmdSetIntValue(FXObject*,FXSelector,void*);
111  long onCmdGetIntValue(FXObject*,FXSelector,void*);
112  long onCmdSetLongValue(FXObject*,FXSelector,void*);
113  long onCmdGetLongValue(FXObject*,FXSelector,void*);
114  long onCmdSetIntRange(FXObject*,FXSelector,void*);
115  long onCmdGetIntRange(FXObject*,FXSelector,void*);
116 public:
117  enum{
118  ID_AUTOSCROLL=FXWindow::ID_LAST,
119  ID_TIMEWHEEL,
120  ID_LAST
121  };
122 public:
123 
125  FXScrollBar(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=SCROLLBAR_VERTICAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
126 
128  virtual FXint getDefaultWidth();
129 
131  virtual FXint getDefaultHeight();
132 
134  virtual void layout();
135 
140  void setRange(FXint r,FXbool notify=false);
141 
143  FXint getRange() const { return range; }
144 
149  void setPage(FXint p,FXbool notify=false);
150 
152  FXint getPage() const { return page; }
153 
159  void setPosition(FXint p,FXbool notify=false);
160 
162  FXint getPosition() const { return pos; }
163 
165  void setLine(FXint l);
166 
168  FXint getLine() const { return line; }
169 
171  void setHiliteColor(FXColor clr);
172 
174  FXColor getHiliteColor() const { return hiliteColor; }
175 
177  void setShadowColor(FXColor clr);
178 
180  FXColor getShadowColor() const { return shadowColor; }
181 
183  void setBorderColor(FXColor clr);
184 
186  FXColor getBorderColor() const { return borderColor; }
187 
189  void setArrowColor(FXColor clr);
190 
192  FXColor getArrowColor() const { return arrowColor; }
193 
195  void setScrollBarStyle(FXuint style);
196 
198  FXuint getScrollBarStyle() const;
199 
201  void setBarSize(FXint size);
202 
204  FXint getBarSize() const { return barsize; }
205 
207  virtual void save(FXStream& store) const;
208 
210  virtual void load(FXStream& store);
211 
213  virtual ~FXScrollBar();
214  };
215 
216 
218 class FXAPI FXScrollCorner : public FXWindow {
219  FXDECLARE(FXScrollCorner)
220 protected:
221  FXScrollCorner();
222 private:
224  FXScrollCorner &operator=(const FXScrollCorner&);
225 public:
226  long onPaint(FXObject*,FXSelector,void*);
227 public:
228 
231 
233  virtual void enable();
234 
236  virtual void disable();
237  };
238 
239 }
240 
241 #endif

Copyright © 1997-2016 Jeroen van der Zijp