2 * This file is a part of hildon
4 * Copyright (C) 2008 Nokia Corporation, all rights reserved.
6 * Contact: Rodrigo Novo <rodrigo.novo@nokia.com>
8 * This widget is based on MokoFingerScroll from libmokoui
9 * OpenMoko Application Framework UI Library
10 * Authored by Chris Lord <chris@openedhand.com>
11 * Copyright (C) 2006-2007 OpenMoko Inc.
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU Lesser Public License as published by
15 * the Free Software Foundation; version 2 of the license.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser Public License for more details.
24 #ifndef _HILDON_PANNABLE_AREA
25 #define _HILDON_PANNABLE_AREA
31 #define HILDON_TYPE_PANNABLE_AREA \
32 hildon_pannable_area_get_type()
34 #define HILDON_PANNABLE_AREA(obj) \
35 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
36 HILDON_TYPE_PANNABLE_AREA, HildonPannableArea))
38 #define HILDON_PANNABLE_AREA_CLASS(klass) \
39 (G_TYPE_CHECK_CLASS_CAST ((klass), \
40 HILDON_TYPE_PANNABLE_AREA, HildonPannableAreaClass))
42 #define HILDON_IS_PANNABLE_AREA(obj) \
43 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HILDON_TYPE_PANNABLE_AREA))
45 #define HILDON_IS_PANNABLE_AREA_CLASS(klass) \
46 (G_TYPE_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_PANNABLE_AREA))
48 #define HILDON_PANNABLE_AREA_GET_CLASS(obj) \
49 (G_TYPE_INSTANCE_GET_CLASS ((obj), \
50 HILDON_TYPE_PANNABLE_AREA, HildonPannableAreaClass))
53 * HildonPannableAreaMode:
54 * @HILDON_PANNABLE_AREA_MODE_PUSH: Areaing follows pointer
55 * @HILDON_PANNABLE_AREA_MODE_ACCEL: Areaing uses physics to "spin" the widget
56 * @HILDON_PANNABLE_AREA_MODE_AUTO: Automatically chooses between push and accel
57 * modes, depending on input.
59 * Used to change the behaviour of the pannable areaing
62 HILDON_PANNABLE_AREA_MODE_PUSH,
63 HILDON_PANNABLE_AREA_MODE_ACCEL,
64 HILDON_PANNABLE_AREA_MODE_AUTO
65 } HildonPannableAreaMode;
69 * @HILDON_MOVEMENT_MODE_HORIZ:
70 * @HILDON_MOVEMENT_MODE_VERT:
71 * @HILDON_MOVEMENT_MODE_BOTH:
73 * Used to control the movement of the pannable, we can allow or
74 * disallow horizontal or vertical movement. This way the applications
75 * can control the movement using scroll_to and jump_to functions
78 HILDON_MOVEMENT_MODE_HORIZ = 1 << 1,
79 HILDON_MOVEMENT_MODE_VERT = 1 << 2,
80 HILDON_MOVEMENT_MODE_BOTH = 0x000006
84 * HildonMovementDirection:
85 * @HILDON_MOVEMENT_UP:
86 * @HILDON_MOVEMENT_DOWN:
87 * @HILDON_MOVEMENT_LEFT:
88 * @HILDON_MOVEMENT_RIGHT:
90 * Used to point out the direction of the movement
97 } HildonMovementDirection;
100 * HildonSizeRequestPolicy:
101 * @HILDON_SIZE_REQUEST_MINIMUM: The minimum size the widget could use
103 * @HILDON_SIZE_REQUEST_CHILDREN: The minimum size of the children of
106 * Used to control the size request policy of the widget
108 * Deprecated: This define and the policy request is deprecated, DO
109 * NOT use it in future code. Check
110 * #hildon_pannable_area_set_size_request_policy documentation for
113 #ifndef HILDON_DISABLE_DEPRECATED
115 HILDON_SIZE_REQUEST_MINIMUM,
116 HILDON_SIZE_REQUEST_CHILDREN
117 } HildonSizeRequestPolicy;
121 * HildonPannableArea:
123 * HildonPannableArea has no publicly accessible fields
125 typedef struct _HildonPannableArea HildonPannableArea;
126 typedef struct _HildonPannableAreaClass HildonPannableAreaClass;
127 typedef struct _HildonPannableAreaPrivate HildonPannableAreaPrivate;
129 struct _HildonPannableArea
134 HildonPannableAreaPrivate *priv;
137 struct _HildonPannableAreaClass
139 GtkBinClass parent_class;
141 void (* horizontal_movement) (HildonPannableArea *area,
142 HildonMovementDirection direction,
143 gdouble x, gdouble y);
144 void (* vertical_movement) (HildonPannableArea *area,
145 HildonMovementDirection direction,
146 gdouble x, gdouble y);
149 GType hildon_pannable_area_get_type (void);
151 GtkWidget* hildon_pannable_area_new (void);
152 GtkWidget* hildon_pannable_area_new_full (gint mode, gboolean enabled,
153 gdouble vel_min, gdouble vel_max,
154 gdouble decel, guint sps);
155 void hildon_pannable_area_add_with_viewport (HildonPannableArea *area,
157 void hildon_pannable_area_scroll_to (HildonPannableArea *area,
158 const gint x, const gint y);
159 void hildon_pannable_area_jump_to (HildonPannableArea *area,
160 const gint x, const gint y);
161 void hildon_pannable_area_scroll_to_child (HildonPannableArea *area,
163 void hildon_pannable_area_jump_to_child (HildonPannableArea *area,
165 GtkWidget* hildon_pannable_get_child_widget_at (HildonPannableArea *area,
166 gdouble x, gdouble y);
167 #ifndef HILDON_DISABLE_DEPRECATED
168 HildonSizeRequestPolicy hildon_pannable_area_get_size_request_policy (HildonPannableArea *area);
169 void hildon_pannable_area_set_size_request_policy (HildonPannableArea *area,
170 HildonSizeRequestPolicy size_request_policy);
172 GtkAdjustment* hildon_pannable_area_get_hadjustment (HildonPannableArea *area);
173 GtkAdjustment* hildon_pannable_area_get_vadjustment (HildonPannableArea *area);
177 #endif /* _HILDON_PANNABLE_AREA */