HdySqueezer

HdySqueezer — A best fit container.

Functions

Properties

Types and Values

Object Hierarchy

    GEnum
    ╰── HdySqueezerTransitionType
    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── HdySqueezer

Implemented Interfaces

HdySqueezer implements AtkImplementorIface, GtkBuildable and GtkOrientable.

Description

The HdySqueezer widget is a container which only shows the first of its children that fits in the available size. It is convenient to offer different widgets to represent the same data with different levels of detail, making the widget seem to squeeze itself to fit in the available space.

Transitions between children can be animated as fades. This can be controlled with hdy_squeezer_set_transition_type().

Functions

hdy_squeezer_new ()

HdySqueezer *
hdy_squeezer_new (void);

Creates a new HdySqueezer container.

Returns

a new HdySqueezer


hdy_squeezer_get_homogeneous ()

gboolean
hdy_squeezer_get_homogeneous (HdySqueezer *self);

Gets whether self is homogeneous.

See hdy_squeezer_set_homogeneous().

Parameters

self

a HdySqueezer

 

Returns

TRUE if self is homogeneous, FALSE is not

Since: 0.0.10


hdy_squeezer_set_homogeneous ()

void
hdy_squeezer_set_homogeneous (HdySqueezer *self,
                              gboolean homogeneous);

Sets self to be homogeneous or not. If it is homogeneous, self will request the same size for all its children for its opposite orientation, e.g. if self is oriented horizontally and is homogeneous, it will request the same height for all its children. If it isn't, self may change size when a different child becomes visible.

Parameters

self

a HdySqueezer

 

homogeneous

TRUE to make self homogeneous

 

Since: 0.0.10


hdy_squeezer_get_transition_duration ()

guint
hdy_squeezer_get_transition_duration (HdySqueezer *self);

Gets the amount of time (in milliseconds) that transitions between children in self will take.

Parameters

self

a HdySqueezer

 

Returns

the transition duration


hdy_squeezer_set_transition_duration ()

void
hdy_squeezer_set_transition_duration (HdySqueezer *self,
                                      guint duration);

Sets the duration that transitions between children in self will take.

Parameters

self

a HdySqueezer

 

duration

the new duration, in milliseconds

 

hdy_squeezer_get_transition_type ()

HdySqueezerTransitionType
hdy_squeezer_get_transition_type (HdySqueezer *self);

Gets the type of animation that will be used for transitions between children in self .

Parameters

self

a HdySqueezer

 

Returns

the current transition type of self


hdy_squeezer_set_transition_type ()

void
hdy_squeezer_set_transition_type (HdySqueezer *self,
                                  HdySqueezerTransitionType transition);

Sets the type of animation that will be used for transitions between children in self . Available types include various kinds of fades and slides.

The transition type can be changed without problems at runtime, so it is possible to change the animation based on the child that is about to become current.

Parameters

self

a HdySqueezer

 

transition

the new transition type

 

hdy_squeezer_get_transition_running ()

gboolean
hdy_squeezer_get_transition_running (HdySqueezer *self);

Gets whether self is currently in a transition from one child to another.

Parameters

self

a HdySqueezer

 

Returns

TRUE if the transition is currently running, FALSE otherwise.


hdy_squeezer_get_interpolate_size ()

gboolean
hdy_squeezer_get_interpolate_size (HdySqueezer *self);

Gets wether self should interpolate its size on visible child change.

See hdy_squeezer_set_interpolate_size().

Parameters

self

A HdySqueezer

 

Returns

TRUE if self interpolates its size on visible child change, FALSE if not

Since: 0.0.10


hdy_squeezer_set_interpolate_size ()

void
hdy_squeezer_set_interpolate_size (HdySqueezer *self,
                                   gboolean interpolate_size);

Sets whether or not self will interpolate the size of its opposing orientation when changing the visible child. If TRUE, self will interpolate its size between the one of the previous visible child and the one of the new visible child, according to the set transition duration and the orientation, e.g. if self is horizontal, it will interpolate the its height.

Parameters

self

A HdySqueezer

 

interpolate_size

TRUE to interpolate the size

 

Since: 0.0.10


hdy_squeezer_get_visible_child ()

GtkWidget *
hdy_squeezer_get_visible_child (HdySqueezer *self);

Gets the currently visible child of self , or NULL if there are no visible children.

Parameters

self

a HdySqueezer

 

Returns

the visible child of the HdySqueezer.

[transfer none][nullable]


hdy_squeezer_get_child_enabled ()

gboolean
hdy_squeezer_get_child_enabled (HdySqueezer *self,
                                GtkWidget *child);

Gets whether child is enabled.

See hdy_squeezer_set_child_enabled().

Parameters

self

a HdySqueezer

 

child

a child of self

 

Returns

TRUE if child is enabled, FALSE otherwise.


hdy_squeezer_set_child_enabled ()

void
hdy_squeezer_set_child_enabled (HdySqueezer *self,
                                GtkWidget *child,
                                gboolean enabled);

Make self enable or disable child . If a child is disabled, it will be ignored when looking for the child fitting the available size best. This allows to programmatically and prematurely hide a child of self even if it fits in the available space.

This can be used e.g. to ensure a certain child is hidden below a certain window width, or any other constraint you find suitable.

Parameters

self

a HdySqueezer

 

child

a child of self

 

enabled

TRUE to enable the child, FALSE to disable it

 

Types and Values

HDY_TYPE_SQUEEZER

#define HDY_TYPE_SQUEEZER (hdy_squeezer_get_type ())

enum HdySqueezerTransitionType

These enumeration values describe the possible transitions between children in a HdySqueezer widget.

Members

HDY_SQUEEZER_TRANSITION_TYPE_NONE

No transition

 

HDY_SQUEEZER_TRANSITION_TYPE_CROSSFADE

A cross-fade

 

struct HdySqueezerClass

struct HdySqueezerClass {
  GtkContainerClass parent_class;
};

Members


HdySqueezer

typedef struct _HdySqueezer HdySqueezer;

Property Details

The “homogeneous” property

  “homogeneous”              gboolean

Homogeneous sizing.

Flags: Read / Write

Default value: FALSE


The “interpolate-size” property

  “interpolate-size”         gboolean

Whether or not the size should smoothly change when changing between differently sized children.

Flags: Read / Write

Default value: FALSE


The “transition-duration” property

  “transition-duration”      guint

The animation duration, in milliseconds.

Flags: Read / Write

Default value: 200


The “transition-running” property

  “transition-running”       gboolean

Whether or not the transition is currently running.

Flags: Read

Default value: FALSE


The “transition-type” property

  “transition-type”          HdySqueezerTransitionType

The type of animation used to transition.

Flags: Read / Write

Default value: HDY_SQUEEZER_TRANSITION_TYPE_NONE


The “visible-child” property

  “visible-child”            GtkWidget *

The widget currently visible in the squeezer.

Flags: Read