Window

Window — A window for your application

Functions

Properties

EosApplication * application Read / Write / Construct Only
gboolean font-scaling-active Read / Write / Construct
double font-scaling-calculated-font-size Read
int font-scaling-default-size Read / Write / Construct
int font-scaling-default-window-size Read / Write / Construct
int font-scaling-min-font-size Read / Write / Construct
EosPageManager * page-manager Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkBin
                    ╰── GtkWindow
                        ╰── GtkApplicationWindow
                            ╰── EosWindow

Implemented Interfaces

EosWindow implements AtkImplementorIface, GtkBuildable, GActionGroup and GActionMap.

Description

The EosWindow class is where you put your application's user interface. You should create a class that extends EosWindow.

Create the interface in your window class's _init() function, like this:

1
2
3
4
5
6
7
8
9
10
const SmokeGrinderWindow = new Lang.Class({
    Name: 'SmokeGrinderWindow',
    Extends: Endless.Window,

    _init(): function (props) {
        this.parent(props);
        this._button = Gtk.Button({label: 'Push me'});
        this.add(this._button);
    },
});

We will use an application-configurable base font size for application- configurable resolution and scale up/down from there for different screen sizes.

Font scaling can be enabled by setting “font-scaling-active” to true. Font scaling is turned off and the property is false by default.

The default font size by which font scaling will occur can be set by “font-scaling-default-size”.

The default window resolution height by which font scaling will occur can be set by “font-scaling-default-window-size”.

The default minimum font size under which a font will never scale can be set by “font-scaling-min-font-size”.

The calculated minimum font size by which children widgets will scale and can be retrieved by “font-scaling-calculated-font-size”. This property is only readable and is only set by EosWindow internally.

For instance, supose we have a default font size of 12px, a default window size of 720px, and a window allocation of 360px. The calculated font pixel size will be 12px * (360px / 720px) = 6px. A corresponding CSS font-size of 1em will be equivalent to 6 px. A CSS font-size of 0.5em will be equivalent to 3px. If the window is resized to a height of 720px, then the calculated pixel size will be 12px, and the CSS font-size of 1em will be equivalent to 12px. A CSS font-size of 0.5em will be equivalent to 6px. If the minimum font size is set to 12px, then the font-size will be forced to 12px, ignoring the calculated font size of 6px.

Functions

eos_window_new ()

GtkWidget *
eos_window_new (EosApplication *application);

Create a window. It is invisible by default.

Parameters

application

the EosApplication that the window belongs to.

 

Returns

a pointer to the window.


eos_window_get_page_manager ()

EosPageManager *
eos_window_get_page_manager (EosWindow *self);

Stub

Parameters

self

the window

 

Returns

a pointer to the current page manager, or NULL if there is no page manager set.

[transfer none][allow-none]


eos_window_set_page_manager ()

void
eos_window_set_page_manager (EosWindow *self,
                             EosPageManager *page_manager);

Stub

Parameters

self

the window

 

page_manager

the page manager

 

eos_window_get_font_scaling_active ()

gboolean
eos_window_get_font_scaling_active (EosWindow *self);

See “font-scaling-active” for details.

Parameters

self

the window

 

Returns

whether or not the font will automatically scale.


eos_window_set_font_scaling_active ()

void
eos_window_set_font_scaling_active (EosWindow *self,
                                    gboolean is_scaling);

Sets whether or not the font will automatically scale. See “font-scaling-active” for details.

Parameters

self

the window

 

is_scaling

true for enabling font scaling and false for disabling font scaling

 

eos_window_get_font_scaling_default_size ()

gint
eos_window_get_font_scaling_default_size
                               (EosWindow *self);

See “font-scaling-default-size” for details.

Parameters

self

the window

 

Returns

the default font size by which the font size of children widgets will scale.


eos_window_set_font_scaling_default_size ()

void
eos_window_set_font_scaling_default_size
                               (EosWindow *self,
                                gint new_default_font_size);

Sets the default font size by which the font size of children widgets will scale. See “font-scaling-default-size” for details.

Parameters

self

the window

 

new_default_font_size

the new default font size

 

eos_window_get_font_scaling_default_window_size ()

gint
eos_window_get_font_scaling_default_window_size
                               (EosWindow *self);

See “font-scaling-default-window-size” for details.

Parameters

self

the window

 

Returns

the default window size by which font scaling will occur.


eos_window_set_font_scaling_default_window_size ()

void
eos_window_set_font_scaling_default_window_size
                               (EosWindow *self,
                                gint new_default_window_size);

Sets the default window size by which the font size of children widgets will scale. See “font-scaling-default-window-size” for details.

Parameters

self

the window

 

new_default_window_size

the new default window size

 

eos_window_get_font_scaling_min_font_size ()

gint
eos_window_get_font_scaling_min_font_size
                               (EosWindow *self);

See “font-scaling-min-font-size” for details.

Parameters

self

the window

 

Returns

the minimum font size below which font scaling won't occur.


eos_window_set_font_scaling_min_font_size ()

void
eos_window_set_font_scaling_min_font_size
                               (EosWindow *self,
                                gint new_min_font_size);

Sets the min font size by which the font size of children widgets will scale. See “font-scaling-min-font-size” for details.

Parameters

self

the window

 

new_min_font_size

the new min font size

 

eos_window_get_font_scaling_calculated_font_size ()

gdouble
eos_window_get_font_scaling_calculated_font_size
                               (EosWindow *self);

See “font-scaling-calculated-font-size” for details.

Parameters

self

the window

 

Returns

the calculated font size by which the font size of children widgets will scale.

Types and Values

struct EosWindow

struct EosWindow;

This class structure contains no public members.


EOS_STYLE_CLASS_COMPOSITE

#define EOS_STYLE_CLASS_COMPOSITE "composite"

A CSS class to match a window on a composite TV.

This is added to EosWindow when it is detected to be on a composite TV screen.

Since: 0.6

Property Details

The “application” property

  “application”              EosApplication *

The EosApplication that this window is associated with. See also “application”; the difference is that “application” cannot be NULL and must be an EosApplication.

Owner: EosWindow

Flags: Read / Write / Construct Only


The “font-scaling-active” property

  “font-scaling-active”      gboolean

The scaling flag that determines if the windows scale or not.

Owner: EosWindow

Flags: Read / Write / Construct

Default value: FALSE


The “font-scaling-calculated-font-size” property

  “font-scaling-calculated-font-size” double

The calculated font-size by which children widgets scale. Units are in pixels.

Owner: EosWindow

Flags: Read

Allowed values: >= 1

Default value: 16


The “font-scaling-default-size” property

  “font-scaling-default-size” int

The default font-size by which font scaling will occur. Units are in pixels.

Owner: EosWindow

Flags: Read / Write / Construct

Allowed values: >= 1

Default value: 16


The “font-scaling-default-window-size” property

  “font-scaling-default-window-size” int

The base resolution by which font scaling will occur. Units are in pixels.

Owner: EosWindow

Flags: Read / Write / Construct

Allowed values: >= 1

Default value: 1080


The “font-scaling-min-font-size” property

  “font-scaling-min-font-size” int

The minimum font-size under which font scaling won't occur. Units are in pixels.

Owner: EosWindow

Flags: Read / Write / Construct

Allowed values: >= 1

Default value: 10


The “page-manager” property

  “page-manager”             EosPageManager *

The EosPageManager that controls the flow of this window's application.

Owner: EosWindow

Flags: Read / Write