Page Manager

Page Manager — Controlling the flow of your application

Functions

Child Properties

gchar * background-position Read / Write
gboolean background-repeats Read / Write
gchar * background-size Read / Write
gchar * background-uri Read / Write
GtkWidget * center-topbar-widget Read / Write
GtkWidget * left-topbar-widget Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkStack
                    ╰── EosPageManager

Implemented Interfaces

EosPageManager implements AtkImplementorIface and GtkBuildable.

Description

Your users experience your application as a series of pages — screens that present a small amount of information or show one feature before moving on to the next page or a previous page.

The page manager controls how these pages relate to each other. There are several different page managers available, each representing a different user interaction. The default page manager, described in this section of the manual, lets you add any number of pages and switch between them however you like, but there are also other, more specialized ones: for example, the EosSplashPageManager displays a splash screen and later turns control over to a different page or page manager when you signal it to; and the EosTabbedPageManager creates a tabbed interface in your window, much like the one in your browser.

Each window has a page manager; one is created by default when you create the window, but you can replace it by a different one. You can also nest page managers, one inside the other, in order to create more complex application flows.

A page can be any widget, most likely a container widget with other widgets inside it. To add a page to a page manager, call

1
gtk_container_add (GTK_CONTAINER (page_manager), page);

If the added page is the only page, then the page manager will display it immediately. If the page manager was already displaying another page, then adding a new page will not change which page is displayed.

To get information about how to display the pages, for example the background image to use, the page manager reads the page's child properties. These are like regular properties, but instead of modifying the page, they modify the relationship between the page and the page manager that contains it. Most pages have at least a name and a background image as child properties. You can add a page with child properties as follows:

1
2
3
4
gtk_container_add_with_properties (GTK_CONTAINER (page_manager), page,
                                   "name", "front-page",
                                   "background_uri", "image.jpg",
                                   NULL);

In Javascript, this has been simplified to use JSON:

1
2
3
4
page_manager.add(page, {
    name: 'front-page',
    background_uri: 'image.jpg'
});

To remove a page, use gtk_container_remove() or eos_page_manager_remove_page_by_name(). If the removed page was the only page, then the page manager will display nothing. If there are multiple pages still in the page manager, you should never remove the visible-child. Always set a new visible child before removing the current one. A critical warning will be emitted if you remove the visible- page when there are still other pages in the page manager.

In general, it is convenient to refer to a page by its name when dealing with the page manager, so you should make a point of giving all your pages names.

Functions

eos_page_manager_new ()

GtkWidget *
eos_page_manager_new (void);

Creates a new default page manager.

Returns

the new page manager.


eos_page_manager_get_page_left_topbar_widget ()

GtkWidget *
eos_page_manager_get_page_left_topbar_widget
                               (EosPageManager *self,
                                GtkWidget *page);

Retrieves page 's left topbar widget, if it has one. See “left-topbar-widget” for more information.

Parameters

self

the page manager

 

page

the page to be queried

 

Returns

the left topbar GtkWidget of page , or NULL if there is none.

[transfer none]


eos_page_manager_set_page_left_topbar_widget ()

void
eos_page_manager_set_page_left_topbar_widget
                               (EosPageManager *self,
                                GtkWidget *page,
                                GtkWidget *left_topbar_widget);

Sets the left topbar widget to be displayed for this page . See “left-topbar-widget” for more information.

Parameters

self

the page manager

 

page

the page

 

left_topbar_widget

left topbar widget for page .

[allow-none]

eos_page_manager_get_page_center_topbar_widget ()

GtkWidget *
eos_page_manager_get_page_center_topbar_widget
                               (EosPageManager *self,
                                GtkWidget *page);

Retrieves page 's center topbar widget, if it has one. See “center-topbar-widget” for more information.

Parameters

self

the page manager

 

page

the page to be queried

 

Returns

the center topbar GtkWidget of page , or NULL if there is none.

[transfer none]


eos_page_manager_set_page_center_topbar_widget ()

void
eos_page_manager_set_page_center_topbar_widget
                               (EosPageManager *self,
                                GtkWidget *page,
                                GtkWidget *center_topbar_widget);

Sets the center topbar widget to be displayed for this page . See “center-topbar-widget” for more information.

Parameters

self

the page manager

 

page

the page

 

center_topbar_widget

center topbar widget for page .

[allow-none]

eos_page_manager_get_page_background_uri ()

const gchar *
eos_page_manager_get_page_background_uri
                               (EosPageManager *self,
                                GtkWidget *page);

Gets the URI for the background image of page , which must previously have been added to the page manager. See “background-uri” for more information.

Parameters

self

the page manager

 

page

the page to be queried

 

Returns

the background of page , or the NULL if page does not have a background.


eos_page_manager_set_page_background_uri ()

void
eos_page_manager_set_page_background_uri
                               (EosPageManager *self,
                                GtkWidget *page,
                                const gchar *background);

Changes the background of page , which must previously have been added to the page manager. Setting NULL removes the background, using the window's default background. See “background-uri” for more information.

Parameters

self

the page manager

 

page

the page to be modified

 

background

the URI for the background image of this page.

[allow-none]

eos_page_manager_get_page_background_size ()

const gchar *
eos_page_manager_get_page_background_size
                               (EosPageManager *self,
                                GtkWidget *page);

Gets the size of the background image of page , which must previously have been added to the page manager. See “background-size” for more information.

Parameters

self

the page manager

 

page

the page to be queried

 

Returns

the size of page , as an EosSizePercentage.


eos_page_manager_set_page_background_size ()

void
eos_page_manager_set_page_background_size
                               (EosPageManager *self,
                                GtkWidget *page,
                                const gchar *size);

Changes the size of the background of page , which must previously have been added to the page manager. See “background-size” for more information.

Parameters

self

the page manager

 

page

the page to be modified

 

size

the desired size of the background image of this page.

 

eos_page_manager_get_page_background_position ()

const gchar *
eos_page_manager_get_page_background_position
                               (EosPageManager *self,
                                GtkWidget *page);

Gets the position of the background image of page , which must previously have been added to the page manager. See “background-position” for more information.

Parameters

self

the page manager

 

page

the page to be queried

 

Returns

the position of page , as an EosSizePercentage.


eos_page_manager_set_page_background_position ()

void
eos_page_manager_set_page_background_position
                               (EosPageManager *self,
                                GtkWidget *page,
                                const gchar *position);

Changes the position of the background of page , which must previously have been added to the page manager. See “background-position” for more information.

Parameters

self

the page manager

 

page

the page to be modified

 

position

the desired position of the background image of this page.

 

eos_page_manager_get_page_background_repeats ()

gboolean
eos_page_manager_get_page_background_repeats
                               (EosPageManager *self,
                                GtkWidget *page);

Gets whether or not the background image of page will tile when drawn. page must previously have been added to the page manager. See “background-repeats” for more information.

Parameters

self

the page manager

 

page

the page to be queried

 

Returns

True if the background of page will repeat.


eos_page_manager_set_page_background_repeats ()

void
eos_page_manager_set_page_background_repeats
                               (EosPageManager *self,
                                GtkWidget *page,
                                gboolean repeats);

Sets whether or not the background image of page will tile when drawn. page must previously have been added to the page manager. See “background-repeats” for more information.

Parameters

self

the page manager

 

page

the page to be modified

 

repeats

True if the background of page will repeat.

 

eos_page_manager_remove_page_by_name ()

void
eos_page_manager_remove_page_by_name (EosPageManager *self,
                                      const gchar *name);

Removes the page called name from the page manager. If that page was the only page, then the page manager will display nothing. If that page was currently displaying but was not the only page, then the page manager will display another page; which page is undefined.

To remove a page without looking it up by name, use gtk_container_remove().

Parameters

self

the page manager

 

name

the name of the page to remove

 

Types and Values

struct EosPageManager

struct EosPageManager;

This structure contains no public members.

Child Property Details

The “background-position” child property

  “background-position”      gchar *

The position of the page background, given as a css snippet string. This string can be set to any valid css position value. See https://developer.mozilla.org/en-US/docs/Web/CSS/position_value

Owner: EosPageManager

Flags: Read / Write

Default value: "0% 0%"


The “background-repeats” child property

  “background-repeats”       gboolean

This child property controls whether or not the background of the page will tile when drawn. Defaults to TRUE.

Owner: EosPageManager

Flags: Read / Write

Default value: TRUE


The “background-size” child property

  “background-size”          gchar *

The size of the page background, given as a css snippet string. This string can be set to any valid css value for the background-size property. See https://developer.mozilla.org/en-US/docs/Web/CSS/background-size

Owner: EosPageManager

Flags: Read / Write

Default value: "100% 100%"


The “background-uri” child property

  “background-uri”           gchar *

The URI for the image file for the background of this page. Setting this to NULL indicates that the window's default background should be used.

Owner: EosPageManager

Flags: Read / Write

Default value: NULL


The “center-topbar-widget” child property

  “center-topbar-widget”     GtkWidget *

The center topbar widget belonging to this page, to be displayed on the middle portion of the top bar when the page is displaying. Setting this to NULL indicates that there should be no center topbar widget.

Owner: EosPageManager

Flags: Read / Write


The “left-topbar-widget” child property

  “left-topbar-widget”       GtkWidget *

The left topbar widget belonging to this page, to be displayed on the left portion of the top bar when the page is displaying. Setting this to NULL indicates that there should be no left topbar widget.

Owner: EosPageManager

Flags: Read / Write