2
/******************************************************************************
3
* MODULE : scroll_widget.hpp
4
* DESCRIPTION: Scrollable widgets
5
* COPYRIGHT : (C) 1999 Joris van der Hoeven
6
*******************************************************************************
7
* This software falls under the GNU general public license and comes WITHOUT
8
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
9
* If you don't have this file, write to the Free Software Foundation, Inc.,
10
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11
******************************************************************************/
13
#ifndef SCROLL_WIDGET_H
14
#define SCROLL_WIDGET_H
15
#include "Widget/attribute_widget.hpp"
16
#include "Event/scroll_event.hpp"
18
/******************************************************************************
20
******************************************************************************/
22
class scroll_widget_rep: public attribute_widget_rep {
24
scroll_widget_rep (display dis, array<widget> a, gravity grav);
25
virtual void handle_scroll (scroll_event ev) = 0;
26
virtual bool handle (event ev);
29
/******************************************************************************
31
******************************************************************************/
33
class scrollable_widget_rep: public scroll_widget_rep {
34
SI scx, scy; // scroll x,y position
35
SI ex1, ey1; // extents of scrolled window lo-left
36
SI ex2, ey2; // extents of scrolled window hi-right
37
widget_rep* hor; // the horizontal scroll bar
38
widget_rep* ver; // the vertical scroll bar
39
gravity backup; // for a dirty bugfix
41
void scroll_to (SI scx, SI scy);
42
void set_extents (SI ex1, SI ey1, SI ex2, SI ey2);
43
void scroll_event_hor (SI& x, SI& before, SI& after);
44
void scroll_event_ver (SI& y, SI& before, SI& after);
47
scrollable_widget_rep (widget child, gravity grav);
50
void handle_get_size (get_size_event ev);
51
void handle_position (position_event ev);
52
void handle_set_widget (set_widget_event ev);
53
void handle_get_coord1 (get_coord1_event ev);
54
void handle_get_coord2 (get_coord2_event ev);
55
void handle_get_coord4 (get_coord4_event ev);
56
void handle_set_coord2 (set_coord2_event ev);
57
void handle_set_coord4 (set_coord4_event ev);
58
void handle_scroll (scroll_event ev);
61
/******************************************************************************
63
******************************************************************************/
65
class scrollbar_rep: public scroll_widget_rep {
68
SI sc_min, sc_max, sc_pos, before, after;
75
scrollbar_rep (widget ref);
77
void handle_set_coord1 (set_coord1_event ev);
78
void handle_set_coord2 (set_coord2_event ev);
81
/******************************************************************************
82
* Horizontal scrollbars
83
******************************************************************************/
85
class hor_scrollbar_widget_rep: public scrollbar_rep {
86
void decode_position (SI& x1, SI& x2);
87
SI encode_position (SI x);
90
hor_scrollbar_widget_rep (widget ref);
93
void handle_get_size (get_size_event ev);
94
void handle_repaint (repaint_event ev);
95
void handle_mouse (mouse_event ev);
96
void handle_scroll (scroll_event ev);
97
void handle_alarm (alarm_event ev);
100
/******************************************************************************
101
* Vertical scrollbars
102
******************************************************************************/
104
class ver_scrollbar_widget_rep: public scrollbar_rep {
105
void decode_position (SI& y1, SI& y2);
106
SI encode_position (SI y);
109
ver_scrollbar_widget_rep (widget ref);
112
void handle_get_size (get_size_event ev);
113
void handle_repaint (repaint_event ev);
114
void handle_mouse (mouse_event ev);
115
void handle_scroll (scroll_event ev);
116
void handle_alarm (alarm_event ev);
119
#endif // defined SCROLL_WIDGET_H