HildonPannableArea

HildonPannableArea — A scrolling widget designed for touch screens

Synopsis

enum                HildonPannableAreaMode;
enum                HildonMovementMode;
enum                HildonMovementDirection;
                    HildonPannableAreaPrivate;
                    HildonPannableArea;
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);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----HildonPannableArea

Implemented Interfaces

HildonPannableArea implements AtkImplementorIface and GtkBuildable.

Properties

  "deceleration"             gdouble               : Read / Write / Construct
  "enabled"                  gboolean              : Read / Write / Construct
  "hovershoot-max"           gint                  : Read / Write / Construct
  "hscrollbar-policy"        GtkPolicyType         : Read / Write / Construct
  "initial-hint"             gboolean              : Read / Write / Construct
  "mode"                     HildonPannableAreaMode  : Read / Write / Construct
  "mov-mode"                 HildonMovementMode    : Read / Write / Construct
  "scroll-time"              gdouble               : Read / Write / Construct
  "sps"                      guint                 : Read / Write / Construct
  "velocity-fast-factor"     gdouble               : Read / Write / Construct
  "velocity-max"             gdouble               : Read / Write / Construct
  "velocity-min"             gdouble               : Read / Write / Construct
  "vovershoot-max"           gint                  : Read / Write / Construct
  "vscrollbar-policy"        GtkPolicyType         : Read / Write / Construct

Style Properties

  "indicator-width"          guint                 : Read / Write

Signals

  "horizontal-movement"                            : Run Last / Action
  "vertical-movement"                              : Run Last / Action

Description

HildonPannableArea implements a scrolled window designed to be used with a touch screen interface. The user scrolls the child widget by activating the pointing device and dragging it over the widget.

Details

enum HildonPannableAreaMode

typedef enum {
  HILDON_PANNABLE_AREA_MODE_PUSH,
  HILDON_PANNABLE_AREA_MODE_ACCEL,
  HILDON_PANNABLE_AREA_MODE_AUTO
} HildonPannableAreaMode;

Used to change the behaviour of the pannable areaing

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.

enum HildonMovementMode

typedef enum {
  HILDON_MOVEMENT_MODE_HORIZ = 1 << 1,
  HILDON_MOVEMENT_MODE_VERT = 1 << 2,
  HILDON_MOVEMENT_MODE_BOTH = 0x000006
} HildonMovementMode;

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


enum HildonMovementDirection

typedef enum {
  HILDON_MOVEMENT_UP,
  HILDON_MOVEMENT_DOWN,
  HILDON_MOVEMENT_LEFT,
  HILDON_MOVEMENT_RIGHT
} HildonMovementDirection;

Used to point out the direction of the movement


HildonPannableAreaPrivate

typedef struct _HildonPannableAreaPrivate HildonPannableAreaPrivate;


HildonPannableArea

typedef struct _HildonPannableArea HildonPannableArea;

HildonPannableArea has no publicly accessible fields


hildon_pannable_area_new ()

GtkWidget*          hildon_pannable_area_new            (void);

Create a new pannable area widget

Returns : the newly created HildonPannableArea

hildon_pannable_area_new_full ()

GtkWidget*          hildon_pannable_area_new_full       (gint mode,
                                                         gboolean enabled,
                                                         gdouble vel_min,
                                                         gdouble vel_max,
                                                         gdouble decel,
                                                         guint sps);

Create a new HildonPannableArea widget and set various properties

mode : HildonPannableAreaMode
enabled : Value for the enabled property
vel_min : Value for the velocity-min property
vel_max : Value for the velocity-max property
decel : Value for the deceleration property
sps : Value for the sps property
Returns : the newly create HildonPannableArea

hildon_pannable_area_add_with_viewport ()

void                hildon_pannable_area_add_with_viewport
                                                        (HildonPannableArea *area,
                                                         GtkWidget *child);

Convenience function used to add a child to a GtkViewport, and add the viewport to the scrolled window.

area : A HildonPannableArea
child : Child widget to add to the viewport

hildon_pannable_area_scroll_to ()

void                hildon_pannable_area_scroll_to      (HildonPannableArea *area,
                                                         const gint x,
                                                         const gint y);

Smoothly scrolls area to ensure that (x, y) is a visible point on the widget. To move in only one coordinate, you must set the other one to -1. Notice that, in HILDON_PANNABLE_AREA_MODE_PUSH mode, this function works just like hildon_pannable_area_jump_to().

This function is useful if you need to present the user with a particular element inside a scrollable widget, like GtkTreeView. For instance, the following example shows how to scroll inside a GtkTreeView to make visible an item, indicated by the GtkTreeIter iter.

Example 14. 

 GtkTreePath *path;
 GdkRectangle *rect;
 
 path = gtk_tree_model_get_path (model, &iter);
 gtk_tree_view_get_background_area (GTK_TREE_VIEW (treeview),
                                    path, NULL, &rect);
 gtk_tree_view_convert_bin_window_to_tree_coords (GTK_TREE_VIEW (treeview),
                                                  0, rect.y, NULL, &y);
 hildon_pannable_area_scroll_to (panarea, -1, y);
 gtk_tree_path_free (path);


If you want to present a child widget in simpler scenarios, use hildon_pannable_area_scroll_to_child() instead.

There is a precondition to this function: the widget must be already realized. Check the hildon_pannable_area_jump_to_child() for more tips regarding how to call this function during initialization.

area : A HildonPannableArea.
x : The x coordinate of the destination point or -1 to ignore this axis.
y : The y coordinate of the destination point or -1 to ignore this axis.

hildon_pannable_area_jump_to ()

void                hildon_pannable_area_jump_to        (HildonPannableArea *area,
                                                         const gint x,
                                                         const gint y);

Jumps the position of area to ensure that (x, y) is a visible point in the widget. In order to move in only one coordinate, you must set the other one to -1. See hildon_pannable_area_scroll_to() function for an example of how to calculate the position of children in scrollable widgets like GtkTreeview.

There is a precondition to this function: the widget must be already realized. Check the hildon_pannable_area_jump_to_child() for more tips regarding how to call this function during initialization.

area : A HildonPannableArea.
x : The x coordinate of the destination point or -1 to ignore this axis.
y : The y coordinate of the destination point or -1 to ignore this axis.

hildon_pannable_area_scroll_to_child ()

void                hildon_pannable_area_scroll_to_child
                                                        (HildonPannableArea *area,
                                                         GtkWidget *child);

Smoothly scrolls until child is visible inside area. child must be a descendant of area. If you need to scroll inside a scrollable widget, e.g., GtkTreeview, see hildon_pannable_area_scroll_to().

There is a precondition to this function: the widget must be already realized. Check the hildon_pannable_area_jump_to_child() for more tips regarding how to call this function during initialization.

area : A HildonPannableArea.
child : A GtkWidget, descendant of area.

hildon_pannable_area_jump_to_child ()

void                hildon_pannable_area_jump_to_child  (HildonPannableArea *area,
                                                         GtkWidget *child);

Jumps to make sure child is visible inside area. child must be a descendant of area. If you want to move inside a scrollable widget, like, GtkTreeview, see hildon_pannable_area_scroll_to().

There is a precondition to this function: the widget must be already realized. You can control if the widget is ready with the GTK_WIDGET_REALIZED macro. If you want to call this function during the initialization process of the widget do it inside a callback to the ::realize signal, using g_signal_connect_after() function.

area : A HildonPannableArea.
child : A GtkWidget, descendant of area.

hildon_pannable_get_child_widget_at ()

GtkWidget*          hildon_pannable_get_child_widget_at (HildonPannableArea *area,
                                                         gdouble x,
                                                         gdouble y);

Get the widget at the point (x, y) inside the pannable area. In case no widget found it returns NULL.

area : A HildonPannableArea.
x : horizontal coordinate of the point
y : vertical coordinate of the point
Returns : the GtkWidget if we find a widget, NULL in any other case

Property Details

The "deceleration" property

  "deceleration"             gdouble               : Read / Write / Construct

The multiplier used when decelerating when in acceleration scrolling mode.

Allowed values: [0,1]

Default value: 0.9


The "enabled" property

  "enabled"                  gboolean              : Read / Write / Construct

Enable or disable finger-scroll.

Default value: TRUE


The "hovershoot-max" property

  "hovershoot-max"           gint                  : Read / Write / Construct

Space we allow the widget to pass over its horizontal limits when hitting the edges, set 0 in order to deactivate overshooting.

Allowed values: >= 0

Default value: 150


The "hscrollbar-policy" property

  "hscrollbar-policy"        GtkPolicyType         : Read / Write / Construct

Visual policy of the horizontal scrollbar.

Default value: GTK_POLICY_AUTOMATIC


The "initial-hint" property

  "initial-hint"             gboolean              : Read / Write / Construct

Whether to hint the user about the pannability of the container.

Default value: FALSE


The "mode" property

  "mode"                     HildonPannableAreaMode  : Read / Write / Construct

Change the finger-scrolling mode.

Default value: HILDON_PANNABLE_AREA_MODE_AUTO


The "mov-mode" property

  "mov-mode"                 HildonMovementMode    : Read / Write / Construct

Controls if the widget can scroll vertically, horizontally or both.

Default value: HILDON_MOVEMENT_MODE_VERT


The "scroll-time" property

  "scroll-time"              gdouble               : Read / Write / Construct

The time to scroll to a position when calling the hildon_pannable_scroll_to functionacceleration scrolling mode.

Allowed values: [1,20]

Default value: 10


The "sps" property

  "sps"                      guint                 : Read / Write / Construct

Amount of scroll events to generate per second.

Default value: 25


The "velocity-fast-factor" property

  "velocity-fast-factor"     gdouble               : Read / Write / Construct

Minimum velocity that is considered 'fast': children widgets won't receive button presses. Expressed as a fraction of the maximum velocity.

Allowed values: [0,1]

Default value: 0.02


The "velocity-max" property

  "velocity-max"             gdouble               : Read / Write / Construct

Maximum distance the child widget should scroll per 'frame', in pixels.

Allowed values: >= 0

Default value: 60


The "velocity-min" property

  "velocity-min"             gdouble               : Read / Write / Construct

Minimum distance the child widget should scroll per 'frame', in pixels.

Allowed values: >= 0

Default value: 0


The "vovershoot-max" property

  "vovershoot-max"           gint                  : Read / Write / Construct

Space we allow the widget to pass over its vertical limits when hitting the edges, set 0 in order to deactivate overshooting.

Allowed values: >= 0

Default value: 150


The "vscrollbar-policy" property

  "vscrollbar-policy"        GtkPolicyType         : Read / Write / Construct

Visual policy of the vertical scrollbar.

Default value: GTK_POLICY_AUTOMATIC

Style Property Details

The "indicator-width" style property

  "indicator-width"          guint                 : Read / Write

Pixel width used to draw the scroll indicators.

Default value: 8

Signal Details

The "horizontal-movement" signal

void                user_function                      (HildonPannableArea *hildonpannablearea,
                                                        gint                arg1,
                                                        gdouble             arg2,
                                                        gdouble             arg3,
                                                        gpointer            user_data)               : Run Last / Action

hildonpannablearea : the object which received the signal.
arg1 :
arg2 :
arg3 :
user_data : user data set when the signal handler was connected.

The "vertical-movement" signal

void                user_function                      (HildonPannableArea *hildonpannablearea,
                                                        gint                arg1,
                                                        gdouble             arg2,
                                                        gdouble             arg3,
                                                        gpointer            user_data)               : Run Last / Action

hildonpannablearea : the object which received the signal.
arg1 :
arg2 :
arg3 :
user_data : user data set when the signal handler was connected.

See Also

GtkScrolledWindow