Additions to GTK+

Additions to GTK+ — Additional functions for Gtk widgets

Synopsis


#include <hildon/hildon.h>

enum                HildonPortraitFlags;
GtkWidget*          hildon_gtk_menu_new                 (void);
GtkWidget*          hildon_gtk_button_new               (HildonSizeType size);
GtkWidget*          hildon_gtk_toggle_button_new        (HildonSizeType size);
GtkWidget*          hildon_gtk_radio_button_new         (HildonSizeType size,
                                                         GSList *group);
GtkWidget*          hildon_gtk_radio_button_new_from_widget
                                                        (HildonSizeType size,
                                                         GtkRadioButton *radio_group_member);
GtkWidget*          hildon_gtk_tree_view_new            (HildonUIMode mode);
GtkWidget*          hildon_gtk_tree_view_new_with_model (HildonUIMode mode,
                                                         GtkTreeModel *model);
void                hildon_gtk_tree_view_set_ui_mode    (GtkTreeView *treeview,
                                                         HildonUIMode mode);
GtkWidget*          hildon_gtk_icon_view_new            (HildonUIMode mode);
GtkWidget*          hildon_gtk_icon_view_new_with_model (HildonUIMode mode,
                                                         GtkTreeModel *model);
void                hildon_gtk_icon_view_set_ui_mode    (GtkIconView *iconview,
                                                         HildonUIMode mode);
void                hildon_gtk_window_set_do_not_disturb
                                                        (GtkWindow *window,
                                                         gboolean dndflag);
void                hildon_gtk_window_set_progress_indicator
                                                        (GtkWindow *window,
                                                         guint state);
void                hildon_gtk_window_take_screenshot   (GtkWindow *window,
                                                         gboolean take);
void                hildon_gtk_window_take_screenshot_sync
                                                        (GtkWindow *window,
                                                         gboolean take);
void                hildon_gtk_window_set_portrait_flags
                                                        (GtkWindow *window,
                                                         HildonPortraitFlags portrait_flags);
void                hildon_gtk_window_enable_zoom_keys  (GtkWindow *window,
                                                         gboolean enable);
GtkWidget*          hildon_gtk_hscale_new               (void);
GtkWidget*          hildon_gtk_vscale_new               (void);

Description

Hildon provides some functions to extend the functionality of existing Gtk widgets. This also includes convenience functions to easily perform frequent tasks.

Details

enum HildonPortraitFlags

typedef enum {
    HILDON_PORTRAIT_MODE_REQUEST = 1 << 0,
    HILDON_PORTRAIT_MODE_SUPPORT = 1 << 1
} HildonPortraitFlags;

These flags are used to tell the window manager whether the current window needs to be in portrait or landscape mode.

If no flags are set then the window is meant to be used in landscape mode only.

If HILDON_PORTRAIT_MODE_REQUEST is set then the window is meant to be used in portrait mode only.

If only HILDON_PORTRAIT_MODE_SUPPORT is set then the current orientation will be kept, no matter if it's portrait or landscape.

It is important to note that, while these flags can be used to change between portrait and landscape according to the physical orientation of the display, Hildon does not provide any method to obtain this information.


hildon_gtk_menu_new ()

GtkWidget*          hildon_gtk_menu_new                 (void);

This is a convenience function to create a GtkMenu setting its widget name to allow Hildon specific styling.

Returns : A newly created GtkMenu widget.

Since 2.2


hildon_gtk_button_new ()

GtkWidget*          hildon_gtk_button_new               (HildonSizeType size);

This is a convenience function to create a GtkButton setting its size to one of the pre-defined Hildon sizes.

Buttons created with this function also override "gtk-button-images". Images set using gtk_button_set_image() are always shown.

Buttons created using this function have "focus-on-click" set to FALSE by default.

size : Flags indicating the size of the new button
Returns : A newly created GtkButton widget.

Since 2.2


hildon_gtk_toggle_button_new ()

GtkWidget*          hildon_gtk_toggle_button_new        (HildonSizeType size);

This is a convenience function to create a GtkToggleButton setting its size to one of the pre-defined Hildon sizes.

Buttons created with this function also override "gtk-button-images". Images set using gtk_button_set_image() are always shown.

Buttons created using this function have "focus-on-click" set to FALSE by default.

size : Flags indicating the size of the new button
Returns : A newly created GtkToggleButton widget.

Since 2.2


hildon_gtk_radio_button_new ()

GtkWidget*          hildon_gtk_radio_button_new         (HildonSizeType size,
                                                         GSList *group);

This is a convenience function to create a GtkRadioButton setting its size to one of the pre-defined Hildon sizes.

Buttons created with this function also override "gtk-button-images". Images set using gtk_button_set_image() are always shown.

Buttons created using this function have "focus-on-click" set to FALSE by default.

size : Flags indicating the size of the new button
group : An existing radio button group, or NULL if you are creating a new group
Returns : A newly created GtkRadioButton widget.

Since 2.2


hildon_gtk_radio_button_new_from_widget ()

GtkWidget*          hildon_gtk_radio_button_new_from_widget
                                                        (HildonSizeType size,
                                                         GtkRadioButton *radio_group_member);

This is a convenience function to create a GtkRadioButton setting its size to one of the pre-defined Hildon sizes.

Buttons created with this function also override "gtk-button-images". Images set using gtk_button_set_image() are always shown.

Buttons created using this function have "focus-on-click" set to FALSE by default.

size : Flags indicating the size of the new button
radio_group_member : widget to get radio group from or NULL
Returns : A newly created GtkRadioButton widget.

Since 2.2


hildon_gtk_tree_view_new ()

GtkWidget*          hildon_gtk_tree_view_new            (HildonUIMode mode);

Creates a new GtkTreeView widget with the Hildon UI mode set to mode

mode : the Hildon UI mode
Returns : A newly created GtkTreeView widget.

Since 2.2


hildon_gtk_tree_view_new_with_model ()

GtkWidget*          hildon_gtk_tree_view_new_with_model (HildonUIMode mode,
                                                         GtkTreeModel *model);

Creates a new GtkTreeView widget with the Hildon UI mode set to mode and the model initialized to model.

mode : the Hildon UI mode
model : the model.
Returns : A newly created GtkTreeView widget.

Since 2.2


hildon_gtk_tree_view_set_ui_mode ()

void                hildon_gtk_tree_view_set_ui_mode    (GtkTreeView *treeview,
                                                         HildonUIMode mode);

Sets the UI mode of treeview to mode.

treeview : A GtkTreeView
mode : The new HildonUIMode

Since 2.2


hildon_gtk_icon_view_new ()

GtkWidget*          hildon_gtk_icon_view_new            (HildonUIMode mode);

Creates a new GtkIconView widget with the Hildon UI mode set to mode

mode : the Hildon UI mode
Returns : A newly created GtkIconView widget

Since 2.2


hildon_gtk_icon_view_new_with_model ()

GtkWidget*          hildon_gtk_icon_view_new_with_model (HildonUIMode mode,
                                                         GtkTreeModel *model);

Creates a new GtkIconView widget with the Hildon UI mode set to mode and the model intitialized to model.

mode : the Hildon UI mode
model : The model.
Returns : A newly created GtkIconView widget.

Since 2.2


hildon_gtk_icon_view_set_ui_mode ()

void                hildon_gtk_icon_view_set_ui_mode    (GtkIconView *iconview,
                                                         HildonUIMode mode);

Sets the UI mode of iconview to mode.

iconview : A GtkIconView
mode : The new HildonUIMode

Since 2.2


hildon_gtk_window_set_do_not_disturb ()

void                hildon_gtk_window_set_do_not_disturb
                                                        (GtkWindow *window,
                                                         gboolean dndflag);

This function tells the window manager to set (or clear) the "do-not-disturb" flag on window.

window : a GtkWindow
dndflag : TRUE to set the "do-not-disturb" flag, FALSE to clear it

Since 2.2


hildon_gtk_window_set_progress_indicator ()

void                hildon_gtk_window_set_progress_indicator
                                                        (GtkWindow *window,
                                                         guint state);

This functions tells the window manager to show/hide a progress indicator in the window title. It applies to HildonDialog and HildonWindow (including subclasses).

window : a GtkWindow.
state : The state we want to set: 1 -> show progress indicator, 0 -> hide progress indicator.

Since 2.2


hildon_gtk_window_take_screenshot ()

void                hildon_gtk_window_take_screenshot   (GtkWindow *window,
                                                         gboolean take);

Tells the window manager to create a screenshot of window and save it, or to destroy the existing one. If take is TRUE but the screenshot is already available, the window manager will not create it again.

You should only call this method when window is already mapped.

In Maemo 5 this screenshot, if existent, will be used by the window manager in subsequent launches of the application that created it. The window manager will remove this screenshot automatically whenever the theme, locale, or the time changes; also when a backup is restored. If your application changes its appearance between runs and you want to force the existent screenshot to be removed, set take to FALSE.

window : a GtkWindow
take : TRUE to take a screenshot, FALSE to destroy the existing one.

Since 2.2


hildon_gtk_window_take_screenshot_sync ()

void                hildon_gtk_window_take_screenshot_sync
                                                        (GtkWindow *window,
                                                         gboolean take);

Like hildon_gtk_window_take_screenshot() but blocks until the operation is complete.

window : a GtkWindow
take : TRUE to take a screenshot, FALSE to destroy the existing one.

Since 2.2.9


hildon_gtk_window_set_portrait_flags ()

void                hildon_gtk_window_set_portrait_flags
                                                        (GtkWindow *window,
                                                         HildonPortraitFlags portrait_flags);

Sets the portrait flags for window.

window : a GtkWindow
portrait_flags : a combination of HildonPortraitFlags

Since 2.2


hildon_gtk_window_enable_zoom_keys ()

void                hildon_gtk_window_enable_zoom_keys  (GtkWindow *window,
                                                         gboolean enable);

Use this function with enable set to TRUE to make the window receive events from the zoom keys (HILDON_HARDKEY_DECREASE and HILDON_HARDKEY_INCREASE).

If set to FALSE, those keys will be reserved for the system to control things such as the volume level.

window : a GtkWindow
enable : TRUE to let the window use the zoom keys

Since 2.2.2


hildon_gtk_hscale_new ()

GtkWidget*          hildon_gtk_hscale_new               (void);

Creates a new horizontal scale widget that lets the user select a value. The value is technically a double between 0.0 and 1.0. See gtk_adjustment_configure() for reconfiguring the adjustment.

The scale is hildonized, which means that a click or tap immediately jumps to the desired position, see gtk_range_set_jump_to_position(). Further more the value is not displayed, see gtk_scale_set_draw_value().

Returns : a new hildonized GtkHScale

Since 2.2


hildon_gtk_vscale_new ()

GtkWidget*          hildon_gtk_vscale_new               (void);

Creates a new vertical scale widget that lets the user select a value. The value is technically a double between 0.0 and 1.0. See gtk_adjustment_configure() for reconfiguring the adjustment.

The scale is hildonized, which means that a click or tap immediately jumps to the desired position, see gtk_range_set_jump_to_position(). Further more the value is not displayed, see gtk_scale_set_draw_value().

Returns : a new hildonized GtkVScale

Since 2.2

See Also

HildonButton, HildonCheckButton