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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/*
* This file is a part of hildon
*
* Copyright (C) 2008 Nokia Corporation, all rights reserved.
*
* Contact: Rodrigo Novo <rodrigo.novo@nokia.com>
*
* This widget is based on MokoFingerScroll from libmokoui
* OpenMoko Application Framework UI Library
* Authored by Chris Lord <chris@openedhand.com>
* Copyright (C) 2006-2007 OpenMoko Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser Public License as published by
* the Free Software Foundation; version 2 of the license.
*
* This program 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 Public License for more details.
*
*/
#ifndef _HILDON_PANNABLE_AREA
#define _HILDON_PANNABLE_AREA
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define HILDON_TYPE_PANNABLE_AREA \
hildon_pannable_area_get_type()
#define HILDON_PANNABLE_AREA(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
HILDON_TYPE_PANNABLE_AREA, HildonPannableArea))
#define HILDON_PANNABLE_AREA_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
HILDON_TYPE_PANNABLE_AREA, HildonPannableAreaClass))
#define HILDON_IS_PANNABLE_AREA(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), HILDON_TYPE_PANNABLE_AREA))
#define HILDON_IS_PANNABLE_AREA_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_PANNABLE_AREA))
#define HILDON_PANNABLE_AREA_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
HILDON_TYPE_PANNABLE_AREA, HildonPannableAreaClass))
/**
* HildonPannableAreaMode:
* @HILDON_PANNABLE_AREA_MODE_PUSH: Areaing follows pointer
* @HILDON_PANNABLE_AREA_MODE_ACCEL: Areaing uses physics to "spin" the widget
* @HILDON_PANNABLE_AREA_MODE_AUTO: Automatically chooses between push and accel
* modes, depending on input.
*
* Used to change the behaviour of the pannable areaing
*/
typedef enum {
HILDON_PANNABLE_AREA_MODE_PUSH,
HILDON_PANNABLE_AREA_MODE_ACCEL,
HILDON_PANNABLE_AREA_MODE_AUTO
} HildonPannableAreaMode;
/**
* HildonMovementMode:
* @HILDON_MOVEMENT_MODE_HORIZ:
* @HILDON_MOVEMENT_MODE_VERT:
* @HILDON_MOVEMENT_MODE_BOTH:
*
* Used to control the movement of the pannable, we can allow or
* disallow horizontal or vertical movement. This way the applications
* can control the movement using scroll_to and jump_to functions
*/
typedef enum {
HILDON_MOVEMENT_MODE_HORIZ = 1 << 1,
HILDON_MOVEMENT_MODE_VERT = 1 << 2,
HILDON_MOVEMENT_MODE_BOTH = 0x000006
} HildonMovementMode;
/**
* HildonMovementDirection:
* @HILDON_MOVEMENT_UP:
* @HILDON_MOVEMENT_DOWN:
* @HILDON_MOVEMENT_LEFT:
* @HILDON_MOVEMENT_RIGHT:
*
* Used to point out the direction of the movement
*/
typedef enum {
HILDON_MOVEMENT_UP,
HILDON_MOVEMENT_DOWN,
HILDON_MOVEMENT_LEFT,
HILDON_MOVEMENT_RIGHT
} HildonMovementDirection;
/**
* HildonSizeRequestPolicy:
* @HILDON_SIZE_REQUEST_MINIMUM: The minimum size the widget could use
* to paint itself
* @HILDON_SIZE_REQUEST_CHILDREN: The minimum size of the children of
* the widget
*
* Used to control the size request policy of the widget
*
* Deprecated: This define and the policy request is deprecated, DO
* NOT use it in future code. Check
* #hildon_pannable_area_set_size_request_policy documentation for
* more information.
*/
#ifndef HILDON_DISABLE_DEPRECATED
typedef enum {
HILDON_SIZE_REQUEST_MINIMUM,
HILDON_SIZE_REQUEST_CHILDREN
} HildonSizeRequestPolicy;
#endif
/**
* HildonPannableArea:
*
* HildonPannableArea has no publicly accessible fields
*/
typedef struct _HildonPannableArea HildonPannableArea;
typedef struct _HildonPannableAreaClass HildonPannableAreaClass;
typedef struct _HildonPannableAreaPrivate HildonPannableAreaPrivate;
struct _HildonPannableArea
{
GtkBin parent;
/* private */
HildonPannableAreaPrivate *priv;
};
struct _HildonPannableAreaClass
{
GtkBinClass parent_class;
void (* horizontal_movement) (HildonPannableArea *area,
HildonMovementDirection direction,
gdouble x, gdouble y);
void (* vertical_movement) (HildonPannableArea *area,
HildonMovementDirection direction,
gdouble x, gdouble y);
};
GType hildon_pannable_area_get_type (void);
GtkWidget* hildon_pannable_area_new (void);
GtkWidget* hildon_pannable_area_new_full (gint mode, gboolean enabled,
gdouble vel_min, gdouble vel_max,
gdouble decel, guint sps);
void hildon_pannable_area_add_with_viewport (HildonPannableArea *area,
GtkWidget *child);
void hildon_pannable_area_scroll_to (HildonPannableArea *area,
const gint x, const gint y);
void hildon_pannable_area_jump_to (HildonPannableArea *area,
const gint x, const gint y);
void hildon_pannable_area_scroll_to_child (HildonPannableArea *area,
GtkWidget *child);
void hildon_pannable_area_jump_to_child (HildonPannableArea *area,
GtkWidget *child);
GtkWidget* hildon_pannable_get_child_widget_at (HildonPannableArea *area,
gdouble x, gdouble y);
#ifndef HILDON_DISABLE_DEPRECATED
HildonSizeRequestPolicy hildon_pannable_area_get_size_request_policy (HildonPannableArea *area);
void hildon_pannable_area_set_size_request_policy (HildonPannableArea *area,
HildonSizeRequestPolicy size_request_policy);
#endif
GtkAdjustment* hildon_pannable_area_get_hadjustment (HildonPannableArea *area);
GtkAdjustment* hildon_pannable_area_get_vadjustment (HildonPannableArea *area);
gboolean hildon_pannable_area_get_center_on_child_focus (HildonPannableArea *area);
void hildon_pannable_area_set_center_on_child_focus (HildonPannableArea *area,
gboolean value);
G_END_DECLS
#endif /* _HILDON_PANNABLE_AREA */
|