HildonWindow

HildonWindow — Top-level window in the Hildon framework.

Synopsis

#define             HILDON_WINDOW_LONG_PRESS_TIME
enum                HildonWindowClipboardOperation;
                    HildonWindow;
GtkWidget*          hildon_window_new                   (void);
void                hildon_window_add_with_scrollbar    (HildonWindow *self,
                                                         GtkWidget *child);
void                hildon_window_set_main_menu         (HildonWindow *self,
                                                         GtkMenu *menu);
GtkMenu*            hildon_window_get_main_menu         (HildonWindow *self);
void                hildon_window_set_app_menu          (HildonWindow *self,
                                                         HildonAppMenu *menu);
HildonAppMenu*      hildon_window_get_app_menu          (HildonWindow *self);
void                hildon_window_set_menu              (HildonWindow *self,
                                                         GtkMenu *menu);
GtkMenu*            hildon_window_get_menu              (HildonWindow *self);
void                hildon_window_add_toolbar           (HildonWindow *self,
                                                         GtkToolbar *toolbar);
void                hildon_window_remove_toolbar        (HildonWindow *self,
                                                         GtkToolbar *toolbar);
void                hildon_window_set_edit_toolbar      (HildonWindow *self,
                                                         HildonEditToolbar *toolbar);
gboolean            hildon_window_get_is_topmost        (HildonWindow *self);
void                hildon_window_set_markup            (HildonWindow *window,
                                                         const gchar *markup);
const gchar*        hildon_window_get_markup            (HildonWindow *window);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkBin
                                 +----GtkWindow
                                       +----HildonWindow
                                             +----HildonStackableWindow

Implemented Interfaces

HildonWindow implements AtkImplementorIface and GtkBuildable.

Properties

  "is-topmost"               gboolean              : Read
  "markup"                   gchar*                : Read / Write

Style Properties

  "borders"                  GtkBorder*            : Read
  "toolbar-borders"          GtkBorder*            : Read

Signals

  "clipboard-operation"                            : Run First

Description

HildonWindow is a top-level window in the Hildon framework. It is derived from GtkWindow and provides additional commodities specific to the Hildon framework.

HildonWindows can have a menu attached, which is toggled with a hardware key or by tapping on the window frame. This menu can be either a GtkMenu or a HildonAppMenu (set with hildon_window_set_main_menu() and hildon_window_set_app_menu() respectively). Only one type of menu can be used at the same time. In Hildon 2.2, HildonAppMenu is the recommended menu to use.

Similarly, a HildonWindow can have several toolbars attached. These can be added with hildon_window_add_toolbar(). In addition to those, a HildonWindow can also have a HildonEditToolbar. To add it to the window use hildon_window_set_edit_toolbar().

Example 3. Creating a HildonWindow

HildonWindow *window;
GtkToolbar *toolbar;
HildonAppMenu *menu;
GdkPixbuf *icon_pixbuf;

window = HILDON_WINDOW (hildon_window_new());

toolbar = create_toolbar();

menu = create_menu();

icon_pixbuf = create_icon();

hildon_window_set_app_menu (window, menu);

hildon_window_add_toolbar (window, toolbar);

// Can be used to set the window fullscreen
gtk_window_fullscreen (GTK_WINDOW (window));

// Used to trigger the blinking of the window's icon in the task navigator
gtk_window_set_urgency_hint (GTK_WINDOW (window), TRUE);

// Change the window's icon in the task navigator
gtk_window_set_icon (GTK_WINDOW (window), icon_pixbuf);


Details

HILDON_WINDOW_LONG_PRESS_TIME

#define                                         HILDON_WINDOW_LONG_PRESS_TIME 800 /* in ms */


enum HildonWindowClipboardOperation

typedef enum
{
    HILDON_WINDOW_CO_COPY,
    HILDON_WINDOW_CO_CUT,
    HILDON_WINDOW_CO_PASTE
}                                               HildonWindowClipboardOperation;


HildonWindow

typedef struct _HildonWindow HildonWindow;


hildon_window_new ()

GtkWidget*          hildon_window_new                   (void);

Creates a new HildonWindow.

Returns : A HildonWindow.

hildon_window_add_with_scrollbar ()

void                hildon_window_add_with_scrollbar    (HildonWindow *self,
                                                         GtkWidget *child);

Adds child to the HildonWindow and creates a scrollbar for it. Similar to adding first a GtkScrolledWindow and then child to it.

self : A HildonWindow
child : A GtkWidget

hildon_window_set_main_menu ()

void                hildon_window_set_main_menu         (HildonWindow *self,
                                                         GtkMenu *menu);

Sets the menu to be used for this window. This menu overrides a program-wide menu that may have been set with hildon_program_set_common_menu(). Pass NULL to remove the current menu. HildonWindow takes ownership of the passed menu and you're not supposed to free it yourself anymore.

Note that if you're using a HildonAppMenu rather than a GtkMenu you should use hildon_window_set_app_menu() instead.

self : A HildonWindow
menu : The GtkMenu to be used for this HildonWindow

hildon_window_get_main_menu ()

GtkMenu*            hildon_window_get_main_menu         (HildonWindow *self);

Gets the GtkMenu assigned to the HildonWindow. Note that the window is still the owner of the menu.

Note that if you're using a HildonAppMenu rather than a GtkMenu you should use hildon_window_get_app_menu() instead.

self : a HildonWindow
Returns : The GtkMenu assigned to this application view.

Since 2.2


hildon_window_set_app_menu ()

void                hildon_window_set_app_menu          (HildonWindow *self,
                                                         HildonAppMenu *menu);

Sets the menu to be used for this window. Pass NULL to remove the current menu. Any reference to a previous menu will be dropped. HildonWindow takes ownership of the passed menu and you're not supposed to free it yourself anymore.

Note that if you're using a GtkMenu rather than a HildonAppMenu you should use hildon_window_set_main_menu() instead.

self : a HildonWindow
menu : a HildonAppMenu to be used for this window

Since 2.2


hildon_window_get_app_menu ()

HildonAppMenu*      hildon_window_get_app_menu          (HildonWindow *self);

Returns the HildonAppMenu assigned to self, or NULL if it's unset. Note that the window is still the owner of the menu.

Note that if you're using a GtkMenu rather than a HildonAppMenu you should use hildon_window_get_main_menu() instead.

self : a HildonWindow
Returns : a HildonAppMenu

Since 2.2


hildon_window_set_menu ()

void                hildon_window_set_menu              (HildonWindow *self,
                                                         GtkMenu *menu);

Warning

hildon_window_set_menu is deprecated and should not be used in newly-written code. Hildon 2.2: use hildon_window_set_main_menu()

Sets the menu to be used for this window. This menu overrides a program-wide menu that may have been set with hildon_program_set_common_menu(). Pass NULL to remove the current menu. HildonWindow takes ownership of the passed menu and you're not supposed to free it yourself anymore.

Note: hildon_window_set_menu() calls gtk_widget_show_all() for the GtkMenu. To pass control about visibility to the application developer, hildon_window_set_main_menu() was introduced, which doesn't do this.

self : A HildonWindow
menu : The GtkMenu to be used for this HildonWindow

hildon_window_get_menu ()

GtkMenu*            hildon_window_get_menu              (HildonWindow *self);

Warning

hildon_window_get_menu is deprecated and should not be used in newly-written code. In Hildon 2.2 this function has been renamed to hildon_window_get_main_menu() for consistency

Gets the GtkMenu assigned to self

self : a HildonWindow
Returns : a GtkMenu

hildon_window_add_toolbar ()

void                hildon_window_add_toolbar           (HildonWindow *self,
                                                         GtkToolbar *toolbar);

Adds a toolbar to the window. Note that the toolbar is not automatically shown. You need to call gtk_widget_show_all() on it to make it visible. It's also possible to hide the toolbar (without removing it) by calling gtk_widget_hide()

self : A HildonWindow
toolbar : A GtkToolbar to add to the HildonWindow

hildon_window_remove_toolbar ()

void                hildon_window_remove_toolbar        (HildonWindow *self,
                                                         GtkToolbar *toolbar);

Removes a toolbar from the window. Note that this decreases the refference count on the widget. If you want to keep the toolbar alive call g_object_ref() before calling this function.

self : A HildonWindow
toolbar : A GtkToolbar to remove from the HildonWindow

hildon_window_set_edit_toolbar ()

void                hildon_window_set_edit_toolbar      (HildonWindow *self,
                                                         HildonEditToolbar *toolbar);

Adds a HildonEditToolbar to the window. Note that the toolbar is not automatically shown. You need to call gtk_widget_show() on it to make it visible. It's also possible to hide the toolbar (without removing it) by calling gtk_widget_hide().

A window can only have at most one edit toolbar at a time, so the previous toolbar (if any) is replaced after calling this function.

self : A HildonWindow
toolbar : A HildonEditToolbar, or NULL to remove the current one.

Since 2.2


hildon_window_get_is_topmost ()

gboolean            hildon_window_get_is_topmost        (HildonWindow *self);

Returns whether the HildonWindow is currenty activated by the window manager.

self : A HildonWindow
Returns : TRUE if self is currently activated, FALSE otherwise.

hildon_window_set_markup ()

void                hildon_window_set_markup            (HildonWindow *window,
                                                         const gchar *markup);

Sets the marked up title of window. The accepted format is the one used in Pango (see PangoMarkupFormat) with the exception of <span>.

Note that you need support from the window manager for this title to be used. See gtk_window_set_title() for the standard way of setting the title of a window.

window : a HildonWindow
markup : the marked up title of the window, or NULL to unset the current one

Since 2.2


hildon_window_get_markup ()

const gchar*        hildon_window_get_markup            (HildonWindow *window);

Gets the marked up title of the window title. See hildon_window_set_markup()

window : a HildonWindow
Returns : the marked up title of the window, or NULL if none has been set explicitely. The returned string is owned by the widget and must not be modified or freed.

Since 2.2

Property Details

The "is-topmost" property

  "is-topmost"               gboolean              : Read

Whether the window is currently activated by the window manager.

Default value: FALSE


The "markup" property

  "markup"                   gchar*                : Read / Write

Marked up text for the window title.

Default value: NULL

Style Property Details

The "borders" style property

  "borders"                  GtkBorder*            : Read

Size of graphical window borders.


The "toolbar-borders" style property

  "toolbar-borders"          GtkBorder*            : Read

Size of graphical toolbar borders.

Signal Details

The "clipboard-operation" signal

void                user_function                      (HildonWindow *hildonwindow,
                                                        gint          arg1,
                                                        gpointer      user_data)         : Run First

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

See Also

HildonProgram, HildonStackableWindow