hildon-scroll-area

hildon-scroll-area — A helper to create Maemo specific views, which are using scrollable area

Synopsis




GtkWidget*  hildon_scroll_area_new          (GtkWidget *sw,
                                             GtkWidget *child);

Description

GtkScrollArea combines a large widget that needs scrolling (like a text editor or a tree view) and other widgets that wouldn't fit one the screen normally without scrolling (like entries, toolbars etc.) into one scrollable area.

/*
Following code is not a working copy,
it's only giving an example of possible situation
*/

window = gtk_window_new();
box = gtk_box_new();
buttonA = gtk_button_new();
buttonB = gtk_button_new();
treeview = gtk_tree_view_new();
swindow = gtk_scrolled_window_new();

scrollarea = gtk_scroll_area_new (swindow, treeview);

/*
Pack the buttons to the box, the box to the scrolled window
and the scrolled window to the window.
*/

gtk_box_pack (box, scrollarea);

/*
You can trye following situation without scroll area and
notice that the treeview is not working as well as it should
*/

Details

hildon_scroll_area_new ()

GtkWidget*  hildon_scroll_area_new          (GtkWidget *sw,
                                             GtkWidget *child);

This is not a widget. It's a helper function to create hildon-specific scrolling methods. A common situation where the scroll area should be used might be following. A view containing GtkTreeView based widget, (or any similar widget which has built-in GtkScrolledWindow support) and eg. couple buttons. Normaly GtkScrolledWindow can not handle the situation so that the GtkTreeView built-in support would work. The scroll area is connecting this built-in system to the scrolled window and also noticing the buttons. To use, one should create a box to which pack the buttons and the scroll area. The scroll area then contains the problematic widget eg. the GtkTreeView. Then the box should be placed in the GtkScrolledWindow. The function is currently assuming that the newly created scroll area hierarchy is not modified in anyway. Or if it is, it may lead to unwanted problems. Also assumed, that the child will be packed to the sw.

sw : GtkWidget - GtkScrolledWindow
child : GtkWidget - child to be place inside the sw
Returns : a GtkFixed