HdySqueezer: Handy Reference Manual

## HdySqueezer HdySqueezer — A best fit container. |

## Functions

GtkWidget * | hdy_squeezer_new ()
gboolean | hdy_squeezer_get_homogeneous ()
void | hdy_squeezer_set_homogeneous ()
guint | hdy_squeezer_get_transition_duration ()
void | hdy_squeezer_set_transition_duration ()
HdySqueezerTransitionType | hdy_squeezer_get_transition_type ()
void | hdy_squeezer_set_transition_type ()
gboolean | hdy_squeezer_get_transition_running ()
gboolean | hdy_squeezer_get_interpolate_size ()
void | hdy_squeezer_set_interpolate_size ()
GtkWidget * | hdy_squeezer_get_visible_child ()
gboolean | hdy_squeezer_get_child_enabled ()
void | hdy_squeezer_set_child_enabled ()
gfloat | hdy_squeezer_get_xalign ()
void | hdy_squeezer_set_xalign ()
gfloat | hdy_squeezer_get_yalign ()
void | hdy_squeezer_set_yalign ()

## Properties

gboolean | homogeneous | Read / Write
gboolean | interpolate-size | Read / Write
guint | transition-duration | Read / Write
gboolean | transition-running | Read
HdySqueezerTransitionType | transition-type | Read / Write
GtkWidget * | visible-child | Read
float | xalign | Read / Write
float | yalign | Read / Write

## Types and Values

#define | HDY_TYPE_SQUEEZER
enum | HdySqueezerTransitionType
| HdySqueezer

## Object Hierarchy

        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()`.

### CSS nodes

HdySqueezer has a single CSS node with name squeezer.

## Functions

### hdy_squeezer_new ()

    GtkWidget *
    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 whether `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 |

### hdy_squeezer_get_xalign ()

    gfloat
    hdy_squeezer_get_xalign (HdySqueezer *self);

Gets the “xalign” property for `self` .

#### Parameters

self | a HdySqueezer |

#### Returns

the xalign property

Since: 1.0

### hdy_squeezer_set_xalign ()

    void
    hdy_squeezer_set_xalign (HdySqueezer *self,
                             gfloat xalign);

Sets the “xalign” property for `self` .

#### Parameters

self | a HdySqueezer |
xalign | the new xalign value, between 0 and 1 |

Since: 1.0

### hdy_squeezer_get_yalign ()

    gfloat
    hdy_squeezer_get_yalign (HdySqueezer *self);

Gets the “yalign” property for `self` .

#### Parameters

self | a HdySqueezer |

#### Returns

the yalign property

Since: 1.0

### hdy_squeezer_set_yalign ()

    void
    hdy_squeezer_set_yalign (HdySqueezer *self,
                             gfloat yalign);

Sets the “yalign” property for `self` .

#### Parameters

self | a HdySqueezer |
yalign | the new yalign value, between 0 and 1 |

Since: 1.0

## 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 |

### HdySqueezer

    typedef struct _HdySqueezer HdySqueezer;

## Property Details

### The `“homogeneous”` property

      “homogeneous”              gboolean

Homogeneous sizing.

Owner: HdySqueezer

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.

Owner: HdySqueezer

Flags: Read / Write

Default value: FALSE

### The `“transition-duration”` property

      “transition-duration”      guint

The animation duration, in milliseconds.

Owner: HdySqueezer

Flags: Read / Write

Default value: 200

### The `“transition-running”` property

      “transition-running”       gboolean

Whether or not the transition is currently running.

Owner: HdySqueezer

Flags: Read

Default value: FALSE

### The `“transition-type”` property

      “transition-type”          HdySqueezerTransitionType

The type of animation used to transition.

Owner: HdySqueezer

Flags: Read / Write

Default value: HDY_SQUEEZER_TRANSITION_TYPE_NONE

### The `“visible-child”` property

      “visible-child”            GtkWidget *

The widget currently visible in the squeezer.

Owner: HdySqueezer

Flags: Read

### The `“xalign”` property

      “xalign”                   float

The xalign property determines the horizontal aligment of the children inside the squeezer's size allocation. Compare this to “halign”, which determines how the squeezer's size allocation is positioned in the space available for the squeezer. The range goes from 0 (start) to 1 (end).

This will affect the position of children too wide to fit in the squeezer as they are fading out.

Owner: HdySqueezer

Flags: Read / Write

Allowed values: [0,1]

Default value: 0.5

Since: 1.0

### The `“yalign”` property

      “yalign”                   float

The yalign property determines the vertical aligment of the children inside the squeezer's size allocation. Compare this to “valign”, which determines how the squeezer's size allocation is positioned in the space available for the squeezer. The range goes from 0 (top) to 1 (bottom).

This will affect the position of children too tall to fit in the squeezer as they are fading out.

Owner: HdySqueezer

Flags: Read / Write

Allowed values: [0,1]

Default value: 0.5

Since: 1.0