2 * This file is a part of hildon
4 * Copyright (C) 2008 Nokia Corporation, all rights reserved.
6 * Contact: Karl Lattimer <karl.lattimer@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
27 #include <glib-object.h>
32 #define HILDON_TYPE_PANNABLE_AREA \
33 hildon_pannable_area_get_type()
35 #define HILDON_PANNABLE_AREA(obj) \
36 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
37 HILDON_TYPE_PANNABLE_AREA, HildonPannableArea))
39 #define HILDON_PANNABLE_AREA_CLASS(klass) \
40 (G_TYPE_CHECK_CLASS_CAST ((klass), \
41 HILDON_TYPE_PANNABLE_AREA, HildonPannableAreaClass))
43 #define HILDON_IS_PANNABLE_AREA(obj) \
44 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HILDON_TYPE_PANNABLE_AREA))
46 #define HILDON_IS_PANNABLE_AREA_CLASS(klass) \
47 (G_TYPE_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_PANNABLE_AREA))
49 #define HILDON_PANNABLE_AREA_GET_CLASS(obj) \
50 (G_TYPE_INSTANCE_GET_CLASS ((obj), \
51 HILDON_TYPE_PANNABLE_AREA, HildonPannableAreaClass))
54 * HildonPannableAreaMode:
55 * @HILDON_PANNABLE_AREA_MODE_PUSH: Areaing follows pointer
56 * @HILDON_PANNABLE_AREA_MODE_ACCEL: Areaing uses physics to "spin" the widget
57 * @HILDON_PANNABLE_AREA_MODE_AUTO: Automatically chooses between push and accel
58 * modes, depending on input.
60 * Used to change the behaviour of the pannable areaing
63 HILDON_PANNABLE_AREA_MODE_PUSH,
64 HILDON_PANNABLE_AREA_MODE_ACCEL,
65 HILDON_PANNABLE_AREA_MODE_AUTO
66 } HildonPannableAreaMode;
69 * HildonPannableAreaMovDirection:
70 * @HILDON_PANNABLE_AREA_MOV_MODE_HORIZ:
71 * @HILDON_PANNABLE_AREA_MOV_MODE_VERT:
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_PANNABLE_AREA_MOV_MODE_HORI = 1 << 1,
79 HILDON_PANNABLE_AREA_MOV_MODE_VERT = 1 << 2,
80 HILDON_PANNABLE_AREA_MOV_MODE_BOTH = 0x000006
81 } HildonPannableAreaMovMode;
84 * HildonPannableAreaMovDirection:
85 * @HILDON_PANNABLE_AREA_MOV_UP:
86 * @HILDON_PANNABLE_AREA_MOV_DOWN:
87 * @HILDON_PANNABLE_AREA_MOV_LEFT:
88 * @HILDON_PANNABLE_AREA_MOV_RIGHT:
90 * Used to point out the direction of the movement
93 HILDON_PANNABLE_AREA_MOV_UP,
94 HILDON_PANNABLE_AREA_MOV_DOWN,
95 HILDON_PANNABLE_AREA_MOV_LEFT,
96 HILDON_PANNABLE_AREA_MOV_RIGHT
97 } HildonPannableAreaMovDirection;
100 HILDON_PANNABLE_AREA_INDICATOR_MODE_AUTO,
101 HILDON_PANNABLE_AREA_INDICATOR_MODE_SHOW,
102 HILDON_PANNABLE_AREA_INDICATOR_MODE_HIDE
103 } HildonPannableAreaIndicatorMode;
106 * HildonPannableArea:
108 * HildonPannableArea has no publicly accessible fields
110 typedef struct _HildonPannableArea HildonPannableArea;
111 typedef struct _HildonPannableAreaClass HildonPannableAreaClass;
113 struct _HildonPannableArea
118 struct _HildonPannableAreaClass
120 GtkBinClass parent_class;
122 void (* horizontal_movement) (HildonPannableArea *area,
123 HildonPannableAreaIndicatorMode direction,
124 gdouble x, gdouble y);
125 void (* vertical_movement) (HildonPannableArea *area,
126 HildonPannableAreaIndicatorMode direction,
127 gdouble x, gdouble y);
130 GType hildon_pannable_area_get_type (void);
132 GtkWidget* hildon_pannable_area_new (void);
133 GtkWidget* hildon_pannable_area_new_full (gint mode, gboolean enabled,
134 gdouble vel_min, gdouble vel_max,
135 gdouble decel, guint sps);
136 void hildon_pannable_area_add_with_viewport (HildonPannableArea *area,
138 void hildon_pannable_area_scroll_to (HildonPannableArea *area,
139 const gint x, const gint y);
140 void hildon_pannable_area_jump_to (HildonPannableArea *area,
141 const gint x, const gint y);
142 void hildon_pannable_area_scroll_to_child (HildonPannableArea *area,
144 void hildon_pannable_area_jump_to_child (HildonPannableArea *area,
146 GtkWidget* hildon_pannable_get_child_widget_at (HildonPannableArea *area,
147 gdouble x, gdouble y);
151 #endif /* _HILDON_PANNABLE_AREA */