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,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 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 
69 class FXAPI FXScrollArea : public FXComposite {
70  FXDECLARE(FXScrollArea)
71 protected:
72  FXScrollBar *horizontal; // Horizontal scroll bar
73  FXScrollBar *vertical; // Vertical scroll bar
74  FXScrollCorner *corner; // Scroll corner
75  FXint pos_x; // X scroll position (pos_x<=0)
76  FXint pos_y; // Y scroll position (pos_y<=0)
77 protected:
78  FXScrollArea();
79  FXScrollArea(FXComposite* p,FXuint opts,FXint x,FXint y,FXint w,FXint h);
80  virtual void moveContents(FXint x,FXint y);
81  FXbool startAutoScroll(FXEvent *event,FXbool onlywheninside=false);
82  void stopAutoScroll();
83  void placeScrollBars(FXint vw,FXint vh);
84 private:
85  FXScrollArea(const FXScrollArea&);
86  FXScrollArea &operator=(const FXScrollArea&);
87 public:
88  long onMouseWheel(FXObject*,FXSelector,void*);
89  long onHScrollerChanged(FXObject*,FXSelector,void*);
90  long onVScrollerChanged(FXObject*,FXSelector,void*);
91  long onHScrollerDragged(FXObject*,FXSelector,void*);
92  long onVScrollerDragged(FXObject*,FXSelector,void*);
93  long onAutoScroll(FXObject*,FXSelector,void*);
94 public:
95  enum {
96  ID_AUTOSCROLL=FXComposite::ID_LAST,
97  ID_VSCROLLED,
98  ID_HSCROLLED,
99  ID_LAST
100  };
101 public:
102 
104  void setPosition(FXint x,FXint y);
105 
107  void getPosition(FXint& x,FXint& y) const { x=pos_x; y=pos_y; }
108 
110  FXint getContentX() const { return pos_x; }
111 
113  FXint getContentY() const { return pos_y; }
114 
116  virtual FXint getContentWidth();
117 
119  virtual FXint getContentHeight();
120 
122  virtual FXint getVisibleX() const;
123 
125  virtual FXint getVisibleY() const;
126 
128  virtual FXint getVisibleWidth() const;
129 
131  virtual FXint getVisibleHeight() const;
132 
134  virtual FXint getDefaultWidth();
135 
137  virtual FXint getDefaultHeight();
138 
140  virtual void layout();
141 
143  FXbool isHorizontalScrollable() const;
144 
146  FXbool isVerticalScrollable() const;
147 
149  void setScrollStyle(FXuint style);
150 
152  FXuint getScrollStyle() const;
153 
155  FXScrollBar* horizontalScrollBar() const { return horizontal; }
156 
158  FXScrollBar* verticalScrollBar() const { return vertical; }
159 
161  virtual void save(FXStream& store) const;
162 
164  virtual void load(FXStream& store);
165 
167  virtual ~FXScrollArea();
168  };
169 
170 }
171 
172 #endif
void getPosition(FXint &x, FXint &y) const
Get the current position.
Definition: FXScrollArea.h:107
FXint getContentX() const
Return content area x position.
Definition: FXScrollArea.h:110
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
FXScrollBar * horizontalScrollBar() const
Return a pointer to the horizontal scrollbar.
Definition: FXScrollArea.h:155
Corner between scroll bars.
Definition: FXScrollBar.h:225
Definition: FX4Splitter.h:28
FOX Event.
Definition: FXEvent.h:165
FXint getContentY() const
Return content area y position.
Definition: FXScrollArea.h:113
The scroll area widget manages a content area and a viewport area through which the content is viewed...
Definition: FXScrollArea.h:69
FXScrollBar * verticalScrollBar() const
Return a pointer to the vertical scrollbar.
Definition: FXScrollArea.h:158
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134

Copyright © 1997-2022 Jeroen van der Zijp