HdyClamp

HdyClamp — A container constraining its child to a given size.

Functions

Properties

gint maximum-size Read / Write
gint tightening-threshold Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GtkContainer
                ╰── GtkBin
                    ╰── HdyClamp

Implemented Interfaces

HdyClamp implements AtkImplementorIface, GtkBuildable and GtkOrientable.

Description

The HdyClamp widget constraints the size of the widget it contains to a given maximum size. It will constrain the width if it is horizontal, or the height if it is vertical. The expansion of the child from its minimum to its maximum size is eased out for a smooth transition.

If the child requires more than the requested maximum size, it will be allocated the minimum size it can fit in instead.

CSS nodes

HdyClamp has a single CSS node with name clamp. The node will get the style classes .large when its child reached its maximum size, .small when the clamp allocates its full size to its child, .medium in-between, or none if it didn't compute its size yet.

Functions

hdy_clamp_new ()

GtkWidget *
hdy_clamp_new (void);

Creates a new HdyClamp.

Returns

a new HdyClamp

Since: 1.0


hdy_clamp_get_maximum_size ()

gint
hdy_clamp_get_maximum_size (HdyClamp *self);

Gets the maximum size to allocate to the contained child. It is the width if self is horizontal, or the height if it is vertical.

Parameters

self

a HdyClamp

 

Returns

the maximum width to allocate to the contained child.

Since: 1.0


hdy_clamp_set_maximum_size ()

void
hdy_clamp_set_maximum_size (HdyClamp *self,
                            gint maximum_size);

Sets the maximum size to allocate to the contained child. It is the width if self is horizontal, or the height if it is vertical.

Parameters

self

a HdyClamp

 

maximum_size

the maximum size

 

Since: 1.0


hdy_clamp_get_tightening_threshold ()

gint
hdy_clamp_get_tightening_threshold (HdyClamp *self);

Gets the size starting from which the clamp will tighten its grip on the child.

Parameters

self

a HdyClamp

 

Returns

the size starting from which the clamp will tighten its grip on the child.

Since: 1.0


hdy_clamp_set_tightening_threshold ()

void
hdy_clamp_set_tightening_threshold (HdyClamp *self,
                                    gint tightening_threshold);

Sets the size starting from which the clamp will tighten its grip on the child.

Parameters

self

a HdyClamp

 

tightening_threshold

the tightening threshold

 

Since: 1.0

Types and Values

HDY_TYPE_CLAMP

#define HDY_TYPE_CLAMP (hdy_clamp_get_type())

HdyClamp

typedef struct _HdyClamp HdyClamp;

Property Details

The “maximum-size” property

  “maximum-size”             gint

The maximum size to allocate to the child. It is the width if the clamp is horizontal, or the height if it is vertical.

Flags: Read / Write

Allowed values: >= 0

Default value: 600

Since: 1.0


The “tightening-threshold” property

  “tightening-threshold”     gint

The size starting from which the clamp will tighten its grip on the child, slowly allocating less and less of the available size up to the maximum allocated size. Below that threshold and below the maximum width, the child will be allocated all the available size.

If the threshold is greater than the maximum size to allocate to the child, the child will be allocated all the width up to the maximum. If the threshold is lower than the minimum size to allocate to the child, that size will be used as the tightening threshold.

Effectively, tightening the grip on the child before it reaches its maximum size makes transitions to and from the maximum size smoother when resizing.

Flags: Read / Write

Allowed values: >= 0

Default value: 400

Since: 1.0