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

FXScrollArea.h
1 /********************************************************************************
2 * *
3 * S c r o l l A r e a 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 FXSCROLLAREA_H
22 #define FXSCROLLAREA_H
23 
24 #ifndef FXCOMPOSITE_H
25 #include "FXComposite.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  SCROLLERS_NORMAL = 0,
34  HSCROLLER_ALWAYS = 0x00008000,
35  HSCROLLER_NEVER = 0x00010000,
36  VSCROLLER_ALWAYS = 0x00020000,
37  VSCROLLER_NEVER = 0x00040000,
38  HSCROLLING_ON = 0,
39  HSCROLLING_OFF = HSCROLLER_NEVER|HSCROLLER_ALWAYS,
40  VSCROLLING_ON = 0,
41  VSCROLLING_OFF = VSCROLLER_NEVER|VSCROLLER_ALWAYS,
42  SCROLLERS_TRACK = 0,
43  SCROLLERS_DONT_TRACK = 0x00080000
44  };
45 
46 
47 class FXScrollBar;
48 class FXScrollCorner;
49 
50 
65 class FXAPI FXScrollArea : public FXComposite {
66  FXDECLARE(FXScrollArea)
67 protected:
68  FXScrollBar *horizontal; // Horizontal scroll bar
69  FXScrollBar *vertical; // Vertical scroll bar
70  FXScrollCorner *corner; // Scroll corner
71  FXint pos_x; // X scroll position (pos_x<=0)
72  FXint pos_y; // Y scroll position (pos_y<=0)
73 protected:
74  FXScrollArea();
75  FXScrollArea(FXComposite* p,FXuint opts,FXint x,FXint y,FXint w,FXint h);
76  virtual void moveContents(FXint x,FXint y);
77  FXbool startAutoScroll(FXEvent *event,FXbool onlywheninside=false);
78  void stopAutoScroll();
79  void placeScrollBars(FXint vw,FXint vh);
80 private:
81  FXScrollArea(const FXScrollArea&);
82  FXScrollArea &operator=(const FXScrollArea&);
83 public:
84  long onHMouseWheel(FXObject*,FXSelector,void*);
85  long onVMouseWheel(FXObject*,FXSelector,void*);
86  long onHScrollerChanged(FXObject*,FXSelector,void*);
87  long onVScrollerChanged(FXObject*,FXSelector,void*);
88  long onHScrollerDragged(FXObject*,FXSelector,void*);
89  long onVScrollerDragged(FXObject*,FXSelector,void*);
90  long onAutoScroll(FXObject*,FXSelector,void*);
91 public:
92  enum {
93  ID_AUTOSCROLL=FXComposite::ID_LAST,
94  ID_VSCROLLED,
95  ID_HSCROLLED,
96  ID_LAST
97  };
98 public:
99 
101  void setPosition(FXint x,FXint y);
102 
104  void getPosition(FXint& x,FXint& y) const { x=pos_x; y=pos_y; }
105 
107  FXint getContentX() const { return pos_x; }
108 
110  FXint getContentY() const { return pos_y; }
111 
113  virtual FXint getContentWidth();
114 
116  virtual FXint getContentHeight();
117 
119  virtual FXint getVisibleX() const;
120 
122  virtual FXint getVisibleY() const;
123 
125  virtual FXint getVisibleWidth() const;
126 
128  virtual FXint getVisibleHeight() const;
129 
131  virtual FXint getDefaultWidth();
132 
134  virtual FXint getDefaultHeight();
135 
137  virtual void layout();
138 
140  FXbool isHorizontalScrollable() const;
141 
143  FXbool isVerticalScrollable() const;
144 
146  void setScrollStyle(FXuint style);
147 
149  FXuint getScrollStyle() const;
150 
152  FXScrollBar* horizontalScrollBar() const { return horizontal; }
153 
155  FXScrollBar* verticalScrollBar() const { return vertical; }
156 
158  virtual void save(FXStream& store) const;
159 
161  virtual void load(FXStream& store);
162 
164  virtual ~FXScrollArea();
165  };
166 
167 }
168 
169 #endif

Copyright © 1997-2016 Jeroen van der Zijp