1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
/* Copyright 2006, 2007, 2008, Soren Sandmann <sandmann@daimi.au.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SCROLLAREA_H__
#define __SCROLLAREA_H__
#include <cairo.h>
#include <gtk/gtk.h>
#define FOO_TYPE_SCROLL_AREA (foo_scroll_area_get_type ())
#define FOO_SCROLL_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FOO_TYPE_SCROLL_AREA, FooScrollArea))
#define FOO_SCROLL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FOO_TYPE_SCROLL_AREA, FooScrollAreaClass))
#define FOO_IS_SCROLL_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FOO_TYPE_SCROLL_AREA))
#define FOO_IS_SCROLL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FOO_TYPE_SCROLL_AREA))
#define FOO_SCROLL_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FOO_TYPE_SCROLL_AREA, FooScrollAreaClass))
typedef struct FooScrollArea FooScrollArea;
typedef struct FooScrollAreaClass FooScrollAreaClass;
typedef struct FooScrollAreaPrivate FooScrollAreaPrivate;
typedef struct FooScrollAreaEvent FooScrollAreaEvent;
typedef enum
{
FOO_BUTTON_PRESS,
FOO_BUTTON_RELEASE,
FOO_MOTION
} FooScrollAreaEventType;
struct FooScrollAreaEvent
{
FooScrollAreaEventType type;
int x;
int y;
};
typedef void (* FooScrollAreaEventFunc) (FooScrollArea *area,
FooScrollAreaEvent *event,
gpointer data);
struct FooScrollArea
{
GtkContainer parent_instance;
FooScrollAreaPrivate *priv;
};
struct FooScrollAreaClass
{
GtkContainerClass parent_class;
void (*set_scroll_adjustments) (FooScrollArea *scroll_area,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment);
void (*viewport_changed) (FooScrollArea *scroll_area,
GdkRectangle *old_viewport,
GdkRectangle *new_viewport);
void (*paint) (FooScrollArea *scroll_area,
cairo_t *cr,
GdkRectangle *extents,
cairo_region_t *region);
};
GType foo_scroll_area_get_type (void);
FooScrollArea *foo_scroll_area_new (void);
/* Set the requisition for the widget. */
void foo_scroll_area_set_min_size (FooScrollArea *scroll_area,
int min_width,
int min_height);
/* Set how much of the canvas can be scrolled into view */
void foo_scroll_area_set_size (FooScrollArea *scroll_area,
int width,
int height);
void foo_scroll_area_set_size_fixed_y (FooScrollArea *scroll_area,
int width,
int height,
int old_y,
int new_y);
void foo_scroll_area_set_viewport_pos (FooScrollArea *scroll_area,
int x,
int y);
void foo_scroll_area_get_viewport (FooScrollArea *scroll_area,
GdkRectangle *viewport);
void foo_scroll_area_add_input_from_stroke (FooScrollArea *scroll_area,
cairo_t *cr,
FooScrollAreaEventFunc func,
gpointer data);
void foo_scroll_area_add_input_from_fill (FooScrollArea *scroll_area,
cairo_t *cr,
FooScrollAreaEventFunc func,
gpointer data);
void foo_scroll_area_invalidate_region (FooScrollArea *area,
cairo_region_t *region);
void foo_scroll_area_invalidate (FooScrollArea *scroll_area);
void foo_scroll_area_invalidate_rect (FooScrollArea *scroll_area,
int x,
int y,
int width,
int height);
void foo_scroll_area_begin_grab (FooScrollArea *scroll_area,
FooScrollAreaEventFunc func,
gpointer input_data);
void foo_scroll_area_end_grab (FooScrollArea *scroll_area);
gboolean foo_scroll_area_is_grabbed (FooScrollArea *scroll_area);
void foo_scroll_area_begin_auto_scroll (FooScrollArea *scroll_area);
void foo_scroll_area_auto_scroll (FooScrollArea *scroll_area,
FooScrollAreaEvent *event);
void foo_scroll_area_end_auto_scroll (FooScrollArea *scroll_area);
#endif /* __SCROLLAREA_H__ */
|