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
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;
68 * HildonPannableAreaMovDirection:
69 * @HILDON_PANNABLE_AREA_MOV_MODE_HORIZ:
70 * @HILDON_PANNABLE_AREA_MOV_MODE_VERT:
72 * Used to control the movement of the pannable, we can allow or
73 * disallow horizontal or vertical movement. This way the applications
74 * can control the movement using scroll_to and jump_to functions
77 HILDON_PANNABLE_AREA_MOV_MODE_HORI = 1 << 1,
78 HILDON_PANNABLE_AREA_MOV_MODE_VERT = 1 << 2,
79 HILDON_PANNABLE_AREA_MOV_MODE_BOTH = 0x000006
80 } HildonPannableAreaMovMode;
83 * HildonPannableAreaMovDirection:
84 * @HILDON_PANNABLE_AREA_MOV_UP:
85 * @HILDON_PANNABLE_AREA_MOV_DOWN:
86 * @HILDON_PANNABLE_AREA_MOV_LEFT:
87 * @HILDON_PANNABLE_AREA_MOV_RIGHT:
89 * Used to point out the direction of the movement
92 HILDON_PANNABLE_AREA_MOV_UP,
93 HILDON_PANNABLE_AREA_MOV_DOWN,
94 HILDON_PANNABLE_AREA_MOV_LEFT,
95 HILDON_PANNABLE_AREA_MOV_RIGHT
96 } HildonPannableAreaMovDirection;
99 HILDON_PANNABLE_AREA_INDICATOR_MODE_AUTO,
100 HILDON_PANNABLE_AREA_INDICATOR_MODE_SHOW,
101 HILDON_PANNABLE_AREA_INDICATOR_MODE_HIDE
102 } HildonPannableAreaIndicatorMode;
105 * HildonPannableArea:
107 * HildonPannableArea has no publicly accessible fields
109 typedef struct _HildonPannableArea HildonPannableArea;
110 typedef struct _HildonPannableAreaClass HildonPannableAreaClass;
112 struct _HildonPannableArea
117 struct _HildonPannableAreaClass
119 GtkBinClass parent_class;
121 void (* horizontal_movement) (HildonPannableArea *area,
122 HildonPannableAreaIndicatorMode direction,
123 gdouble x, gdouble y);
124 void (* vertical_movement) (HildonPannableArea *area,
125 HildonPannableAreaIndicatorMode direction,
126 gdouble x, gdouble y);
129 GType hildon_pannable_area_get_type (void);
131 GtkWidget* hildon_pannable_area_new (void);
132 GtkWidget* hildon_pannable_area_new_full (gint mode, gboolean enabled,
133 gdouble vel_min, gdouble vel_max,
134 gdouble decel, guint sps);
135 void hildon_pannable_area_add_with_viewport (HildonPannableArea *area,
137 void hildon_pannable_area_scroll_to (HildonPannableArea *area,
138 const gint x, const gint y);
139 void hildon_pannable_area_jump_to (HildonPannableArea *area,
140 const gint x, const gint y);
141 void hildon_pannable_area_scroll_to_child (HildonPannableArea *area,
143 void hildon_pannable_area_jump_to_child (HildonPannableArea *area,
145 GtkWidget* hildon_pannable_get_child_widget_at (HildonPannableArea *area,
146 gdouble x, gdouble y);
150 #endif /* _HILDON_PANNABLE_AREA */