MxWindow

## MxWindow MxWindow — an object that represents a platform-specific window |

## Synopsis

    struct              MxWindow;
    struct              MxWindowClass;
    MxWindow *          mx_window_new                       (void);
    MxWindow *          mx_window_new_with_clutter_stage    (ClutterStage *stage);
    MxWindow *          mx_window_get_for_stage             (ClutterStage *stage);
    ClutterActor *      mx_window_get_child                 (MxWindow *window);
    void                mx_window_set_child                 (MxWindow *window,
                                                             ClutterActor *actor);
    MxToolbar *         mx_window_get_toolbar               (MxWindow *window);
    void                mx_window_set_toolbar               (MxWindow *window,
                                                             MxToolbar *toolbar);
    gboolean            mx_window_get_has_toolbar           (MxWindow *window);
    void                mx_window_set_has_toolbar           (MxWindow *window,
                                                             gboolean toolbar);
    gboolean            mx_window_get_small_screen          (MxWindow *window);
    void                mx_window_set_small_screen          (MxWindow *window,
                                                             gboolean small_screen);
    gboolean            mx_window_get_fullscreen            (MxWindow *window);
    void                mx_window_set_fullscreen            (MxWindow *window,
                                                             gboolean fullscreen);
    void                mx_window_set_title                 (MxWindow *window,
                                                             const gchar *title);
    const gchar *       mx_window_get_title                 (MxWindow *window);
    void                mx_window_set_icon_name             (MxWindow *window,
                                                             const gchar *icon_name);
    const gchar *       mx_window_get_icon_name             (MxWindow *window);
    void                mx_window_set_icon_from_cogl_texture
                                                            (MxWindow *window,
                                                             CoglHandle texture);
    ClutterStage *      mx_window_get_clutter_stage         (MxWindow *window);
    void                mx_window_get_window_position       (MxWindow *window,
                                                             gint *x,
                                                             gint *y);
    void                mx_window_set_window_position       (MxWindow *window,
                                                             gint x,
                                                             gint y);
    void                mx_window_get_window_size           (MxWindow *window,
                                                             gint *width,
                                                             gint *height);
    void                mx_window_set_window_size           (MxWindow *window,
                                                             gint width,
                                                             gint height);
    void                mx_window_present                   (MxWindow *window);
    void                mx_window_set_window_rotation       (MxWindow *window,
                                                             MxWindowRotation rotation);
    MxWindowRotation    mx_window_get_window_rotation       (MxWindow *window);
    void                mx_window_show                      (MxWindow *window);
    void                mx_window_hide                      (MxWindow *window);

## Object Hierarchy

      GObject
       +----MxWindow

## Properties

      "child"                    ClutterActor*         : Read / Write
      "clutter-stage"            ClutterStage*         : Read / Write / Construct Only
      "fullscreen"               gboolean              : Read / Write
      "has-toolbar"              gboolean              : Read / Write
      "icon-cogl-texture"        gchar*                : Read / Write
      "icon-name"                gchar*                : Read / Write
      "small-screen"             gboolean              : Read / Write
      "title"                    gchar*                : Read / Write
      "toolbar"                  MxToolbar*            : Read / Write
      "window-rotation"          MxWindowRotation      : Read / Write
      "window-rotation-angle"    gfloat                : Read
      "window-rotation-timeline" ClutterTimeline*      : Read

## Signals

      "destroy"                                        : Run Last

## Description

MxWindow is a platform-specific window, providing functions for moving, resizing, icons and rotation. Every window has an associated ClutterStage in which its children are kept. This ClutterStage can be used in the normal way, but to take advantage of automatic resizing and rotation, the MxWindow functions should be used.

When the MxWindow loses its last reference, its contents are destroyed.

## Details

### struct MxWindow

    struct MxWindow;

The contents of this structure is private and should only be accessed using the provided API.

### struct MxWindowClass

    struct MxWindowClass {
      GObjectClass parent_class;

      /* signals, not vfuncs */
      void (*destroy)             (MxWindow *window);

      /* padding for future expansion */
      void (*_padding_0) (void);
      void (*_padding_1) (void);
      void (*_padding_2) (void);
      void (*_padding_3) (void);
      void (*_padding_4) (void);
    };

### mx_window_new ()

    MxWindow *          mx_window_new                       (void);

Creates a new MxWindow.

Returns : | A MxWindow

### mx_window_new_with_clutter_stage ()

    MxWindow *          mx_window_new_with_clutter_stage    (ClutterStage *stage);

Creates a new MxWindow, using `stage` as the backing ClutterStage. This function is meant for use primarily for embedding a MxWindow into a foreign stage when using a Clutter toolkit integration library.

`stage` : | A ClutterStage
Returns : | A MxWindow

### mx_window_get_for_stage ()

    MxWindow *          mx_window_get_for_stage             (ClutterStage *stage);

Gets the MxWindow parent of the ClutterStage, if it exists.

`stage` : | A ClutterStage
Returns : | A MxWindow, or `NULL`. [transfer none]

### mx_window_get_child ()

    ClutterActor *      mx_window_get_child                 (MxWindow *window);

Get the primary child of the window. See `mx_window_set_child()`.

`window` : | A MxWindow
Returns : | A ClutterActor, or `NULL`. [transfer none]

### mx_window_set_child ()

    void                mx_window_set_child                 (MxWindow *window,
                                                             ClutterActor *actor);

Adds `actor` to the window and sets it as the primary child. When the stage managed in the window changes size, the child will be resized to match it.

`window` : | A MxWindow
`actor` : | A ClutterActor

### mx_window_get_toolbar ()

    MxToolbar *         mx_window_get_toolbar               (MxWindow *window);

Retrieves the toolbar associated with the window.

`window` : | A MxWindow
Returns : | A MxToolbar. [transfer none]

### mx_window_set_toolbar ()

    void                mx_window_set_toolbar               (MxWindow *window,
                                                             MxToolbar *toolbar);

Sets the toolbar associated with the window.

`window` : | A MxWindow. [allow-none]

Since 1.2

### mx_window_get_has_toolbar ()

    gboolean            mx_window_get_has_toolbar           (MxWindow *window);

Determines whether the window has a toolbar or not. See `mx_window_set_has_toolbar()`.

`window` : | A MxWindow
Returns : | `TRUE` if the window has a toolbar, otherwise `FALSE`

### mx_window_set_has_toolbar ()

    void                mx_window_set_has_toolbar           (MxWindow *window,
                                                             gboolean toolbar);

Sets whether the window has a toolbar or not. If the window has a toolbar, client-side window decorations will be enabled.

`window` : | A MxWindow
`toolbar` : | `TRUE` if the toolbar should be displayed

### mx_window_get_small_screen ()

    gboolean            mx_window_get_small_screen          (MxWindow *window);

Determines if the window is in small-screen mode. See `mx_window_set_small_screen()`.

`window` : | A MxWindow
Returns : | `TRUE` if the window is in small-screen mode, otherwise `FALSE`

### mx_window_set_small_screen ()

    void                mx_window_set_small_screen          (MxWindow *window,
                                                             gboolean small_screen);

Enables or disables small-screen mode. This mode is meant primarily for platforms with limited screen-space, such as netbooks. When enabled, the window will take up all available room and will disable moving and resizing.

`window` : | A MxWindow
`small_screen` : | `TRUE` if small-screen mode should be enabled

### mx_window_get_fullscreen ()

    gboolean            mx_window_get_fullscreen            (MxWindow *window);

Determines if the window has been set to be in fullscreen mode.

`window` : | A MxWindow
Returns : | `TRUE` if the window has been set to be in fullscreen mode, otherwise `FALSE`

Since 1.2

### mx_window_set_fullscreen ()

    void                mx_window_set_fullscreen            (MxWindow *window,
                                                             gboolean fullscreen);

Set the window to be in fullscreen mode or windowed mode.

### Note

Setting fullscreen mode doesn't necessarily mean the window is actually fullscreen. Setting this property is only a request to the underlying window system.

`window` : | A MxWindow
`fullscreen` : | `TRUE` to request fullscreen mode, `FALSE` to disable

Since 1.2

### mx_window_set_title ()

    void                mx_window_set_title                 (MxWindow *window,
                                                             const gchar *title);

Sets the title used for the window, the results of which are window-system specific.

`window` : | A MxWindow
`title` : | A string to use for the window title name

Since 1.2

### mx_window_get_title ()

    const gchar *       mx_window_get_title                 (MxWindow *window);

Retrieves the title used for the window.

`window` : | A MxWindow
Returns : | The title used for the window

Since 1.2

### mx_window_set_icon_name ()

    void                mx_window_set_icon_name             (MxWindow *window,
                                                             const gchar *icon_name);

Set an icon-name to use for the window icon. The icon will be looked up from the default theme.

`window` : | A MxWindow
`icon_name` : | An icon name, or `NULL`. [allow-none]

### mx_window_get_icon_name ()

    const gchar *       mx_window_get_icon_name             (MxWindow *window);

Gets the currently set window icon name. This will be `NULL` if there is none set, or the icon was set with `mx_window_set_icon_from_cogl_texture()`.

`window` : | A MxWindow
Returns : | The window icon name, or `NULL`

### mx_window_set_icon_from_cogl_texture ()

    void                mx_window_set_icon_from_cogl_texture
                                                            (MxWindow *window,
                                                             CoglHandle texture);

Sets the window icon from a texture. This will take precedence over any currently set icon-name.

`window` : | A MxWindow
`texture` : | A CoglHandle for a texture

### mx_window_get_clutter_stage ()

    ClutterStage *      mx_window_get_clutter_stage         (MxWindow *window);

Gets the ClutterStage managed by the window.

`window` : | A MxWindow
Returns : | A ClutterStage. [transfer none]

### mx_window_get_window_position ()

    void                mx_window_get_window_position       (MxWindow *window,
                                                             gint *x,
                                                             gint *y);

Retrieves the absolute position of the window on the screen.

`window` : | an MxWindow
`x` : | A pointer for the x-coordinate. [out]
`y` : | A pointer for the y-coordinate. [out]

### mx_window_set_window_position ()

    void                mx_window_set_window_position       (MxWindow *window,
                                                             gint x,
                                                             gint y);

Sets the absolute position of the window on the screen.

`window` : | A MxWindow
`x` : | An x-coordinate
`y` : | A y-coordinate

### mx_window_get_window_size ()

    void                mx_window_get_window_size           (MxWindow *window,
                                                             gint *width,
                                                             gint *height);

Retrieves the size of the display area of the window, taking into account any window border. This includes the area occupied by the window's toolbar, if it's enabled.

`window` : | A MxWindow
`width` : | A gint pointer for the window's width. [out]
`height` : | A gint pointer for the window's height. [out]

Since 1.2

### mx_window_set_window_size ()

    void                mx_window_set_window_size           (MxWindow *window,
                                                             gint width,
                                                             gint height);

Sets the size of the window, taking into account any window border. This corresponds to the window's available area for its child, minus the area occupied by the window's toolbar, if it's enabled.

### Note

Setting the window size may involve a request to the underlying windowing system, and may not immediately be reflected.

`window` : | A MxWindow
`width` : | A width, in pixels
`height` : | A height, in pixels

Since 1.2

### mx_window_present ()

    void                mx_window_present                   (MxWindow *window);

Present the window. The actual behaviour is specific to the window system.

`window` : | A MxWindow

Since 1.2

### mx_window_set_window_rotation ()

    void                mx_window_set_window_rotation       (MxWindow *window,
                                                             MxWindowRotation rotation);

Set the rotation of the window.

`window` : | A MxWindow
`rotation` : | The MxWindowRotation

Since 1.2

### mx_window_get_window_rotation ()

    MxWindowRotation    mx_window_get_window_rotation       (MxWindow *window);

Retrieve the rotation of the window.

`window` : | A MxWindow
Returns : | An MxWindowRotation

Since 1.2

### mx_window_show ()

    void                mx_window_show                      (MxWindow *window);

Show the window

`window` : | A MxWindow

Since 1.2

### mx_window_hide ()

    void                mx_window_hide                      (MxWindow *window);

Hide the window

`window` : | A MxWindow

Since 1.2

## Property Details

### The `"child"` property

      "child"                    ClutterActor*         : Read / Write

ClutterActor used as the window child.

### The `"clutter-stage"` property

      "clutter-stage"            ClutterStage*         : Read / Write / Construct Only

ClutterStage to use as the window.

### The `"fullscreen"` property

      "fullscreen"               gboolean              : Read / Write

Window should be set to full-screen mode.

Default value: FALSE

### The `"has-toolbar"` property

      "has-toolbar"              gboolean              : Read / Write

Window should have a toolbar.

Default value: TRUE

### The `"icon-cogl-texture"` property

      "icon-cogl-texture"        gchar*                : Read / Write

CoglTexture to use for the window icon.

Default value: NULL

### The `"icon-name"` property

      "icon-name"                gchar*                : Read / Write

Icon name to use for the window icon.

Default value: NULL

### The `"small-screen"` property

      "small-screen"             gboolean              : Read / Write

Window should occupy the entire screen contents, without explicitly setting itself fullscreen.

Default value: FALSE

### The `"title"` property

      "title"                    gchar*                : Read / Write

Title to use for the window.

Default value: NULL

### The `"toolbar"` property

      "toolbar"                  MxToolbar*            : Read / Write

The MxToolbar associated with the window.

### The `"window-rotation"` property

      "window-rotation"          MxWindowRotation      : Read / Write

The window's rotation.

Default value: MX_WINDOW_ROTATION_0

### The `"window-rotation-angle"` property

      "window-rotation-angle"    gfloat                : Read

The current angle of rotation about the z-axis for the window.

Allowed values: [0,360]

Default value: 0

### The `"window-rotation-timeline"` property

      "window-rotation-timeline" ClutterTimeline*      : Read

The timeline used for the window rotation transition animation.

## Signal Details

### The `"destroy"` signal

    void                user_function                      (MxWindow *window,
                                                            gpointer  user_data)      : Run Last

Emitted when the stage managed by the window is destroyed.

`window` : | the object that received the signal
`user_data` : | user data set when the signal handler was connected.