CtkStack

CtkStack — A stacking container

Functions

Properties

gboolean hhomogeneous Read / Write
gboolean homogeneous Read / Write
gboolean interpolate-size Read / Write
guint transition-duration Read / Write
gboolean transition-running Read
CtkStackTransitionType transition-type Read / Write
gboolean vhomogeneous Read / Write
CtkWidget * visible-child Read / Write
char * visible-child-name Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── CtkWidget
            ╰── CtkContainer
                ╰── CtkStack

Implemented Interfaces

CtkStack implements AtkImplementorIface and CtkBuildable.

Includes

#include <ctk/ctk.h>

Description

The CtkStack widget is a container which only shows one of its children at a time. In contrast to CtkNotebook, CtkStack does not provide a means for users to change the visible child. Instead, the CtkStackSwitcher widget can be used with CtkStack to provide this functionality.

Transitions between pages can be animated as slides or fades. This can be controlled with ctk_stack_set_transition_type(). These animations respect the “ctk-enable-animations” setting.

The CtkStack widget was added in CTK+ 3.10.

CSS nodes

CtkStack has a single CSS node named stack.

Functions

ctk_stack_new ()

CtkWidget *
ctk_stack_new (void);

Creates a new CtkStack container.

Returns

a new CtkStack

Since: 3.10


ctk_stack_add_named ()

void
ctk_stack_add_named (CtkStack *stack,
                     CtkWidget *child,
                     const gchar *name);

Adds a child to stack . The child is identified by the name .

Parameters

stack

a CtkStack

 

child

the widget to add

 

name

the name for child

 

Since: 3.10


ctk_stack_add_titled ()

void
ctk_stack_add_titled (CtkStack *stack,
                      CtkWidget *child,
                      const gchar *name,
                      const gchar *title);

Adds a child to stack . The child is identified by the name . The title will be used by CtkStackSwitcher to represent child in a tab bar, so it should be short.

Parameters

stack

a CtkStack

 

child

the widget to add

 

name

the name for child

 

title

a human-readable title for child

 

Since: 3.10


ctk_stack_get_child_by_name ()

CtkWidget *
ctk_stack_get_child_by_name (CtkStack *stack,
                             const gchar *name);

Finds the child of the CtkStack with the name given as the argument. Returns NULL if there is no child with this name.

Parameters

stack

a CtkStack

 

name

the name of the child to find

 

Returns

the requested child of the CtkStack.

[transfer none][nullable]

Since: 3.12


ctk_stack_set_visible_child ()

void
ctk_stack_set_visible_child (CtkStack *stack,
                             CtkWidget *child);

Makes child the visible child of stack .

If child is different from the currently visible child, the transition between the two will be animated with the current transition type of stack .

Note that the child widget has to be visible itself (see ctk_widget_show()) in order to become the visible child of stack .

Parameters

stack

a CtkStack

 

child

a child of stack

 

Since: 3.10


ctk_stack_get_visible_child ()

CtkWidget *
ctk_stack_get_visible_child (CtkStack *stack);

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

Parameters

stack

a CtkStack

 

Returns

the visible child of the CtkStack.

[transfer none][nullable]

Since: 3.10


ctk_stack_set_visible_child_name ()

void
ctk_stack_set_visible_child_name (CtkStack *stack,
                                  const gchar *name);

Makes the child with the given name visible.

If child is different from the currently visible child, the transition between the two will be animated with the current transition type of stack .

Note that the child widget has to be visible itself (see ctk_widget_show()) in order to become the visible child of stack .

Parameters

stack

a CtkStack

 

name

the name of the child to make visible

 

Since: 3.10


ctk_stack_get_visible_child_name ()

const gchar *
ctk_stack_get_visible_child_name (CtkStack *stack);

Returns the name of the currently visible child of stack , or NULL if there is no visible child.

Parameters

stack

a CtkStack

 

Returns

the name of the visible child of the CtkStack.

[transfer none][nullable]

Since: 3.10


ctk_stack_set_visible_child_full ()

void
ctk_stack_set_visible_child_full (CtkStack *stack,
                                  const gchar *name,
                                  CtkStackTransitionType transition);

Makes the child with the given name visible.

Note that the child widget has to be visible itself (see ctk_widget_show()) in order to become the visible child of stack .

Parameters

stack

a CtkStack

 

name

the name of the child to make visible

 

transition

the transition type to use

 

Since: 3.10


ctk_stack_set_homogeneous ()

void
ctk_stack_set_homogeneous (CtkStack *stack,
                           gboolean homogeneous);

Sets the CtkStack to be homogeneous or not. If it is homogeneous, the CtkStack will request the same size for all its children. If it isn't, the stack may change size when a different child becomes visible.

Since 3.16, homogeneity can be controlled separately for horizontal and vertical size, with the “hhomogeneous” and “vhomogeneous”.

Parameters

stack

a CtkStack

 

homogeneous

TRUE to make stack homogeneous

 

Since: 3.10


ctk_stack_get_homogeneous ()

gboolean
ctk_stack_get_homogeneous (CtkStack *stack);

Gets whether stack is homogeneous. See ctk_stack_set_homogeneous().

Parameters

stack

a CtkStack

 

Returns

whether stack is homogeneous.

Since: 3.10


ctk_stack_set_hhomogeneous ()

void
ctk_stack_set_hhomogeneous (CtkStack *stack,
                            gboolean hhomogeneous);

Sets the CtkStack to be horizontally homogeneous or not. If it is homogeneous, the CtkStack will request the same width for all its children. If it isn't, the stack may change width when a different child becomes visible.

Parameters

stack

a CtkStack

 

hhomogeneous

TRUE to make stack horizontally homogeneous

 

Since: 3.16


ctk_stack_get_hhomogeneous ()

gboolean
ctk_stack_get_hhomogeneous (CtkStack *stack);

Gets whether stack is horizontally homogeneous. See ctk_stack_set_hhomogeneous().

Parameters

stack

a CtkStack

 

Returns

whether stack is horizontally homogeneous.

Since: 3.16


ctk_stack_set_vhomogeneous ()

void
ctk_stack_set_vhomogeneous (CtkStack *stack,
                            gboolean vhomogeneous);

Sets the CtkStack to be vertically homogeneous or not. If it is homogeneous, the CtkStack will request the same height for all its children. If it isn't, the stack may change height when a different child becomes visible.

Parameters

stack

a CtkStack

 

vhomogeneous

TRUE to make stack vertically homogeneous

 

Since: 3.16


ctk_stack_get_vhomogeneous ()

gboolean
ctk_stack_get_vhomogeneous (CtkStack *stack);

Gets whether stack is vertically homogeneous. See ctk_stack_set_vhomogeneous().

Parameters

stack

a CtkStack

 

Returns

whether stack is vertically homogeneous.

Since: 3.16


ctk_stack_set_transition_duration ()

void
ctk_stack_set_transition_duration (CtkStack *stack,
                                   guint duration);

Sets the duration that transitions between pages in stack will take.

Parameters

stack

a CtkStack

 

duration

the new duration, in milliseconds

 

Since: 3.10


ctk_stack_get_transition_duration ()

guint
ctk_stack_get_transition_duration (CtkStack *stack);

Returns the amount of time (in milliseconds) that transitions between pages in stack will take.

Parameters

stack

a CtkStack

 

Returns

the transition duration

Since: 3.10


ctk_stack_set_transition_type ()

void
ctk_stack_set_transition_type (CtkStack *stack,
                               CtkStackTransitionType transition);

Sets the type of animation that will be used for transitions between pages in stack . 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 page that is about to become current.

Parameters

stack

a CtkStack

 

transition

the new transition type

 

Since: 3.10


ctk_stack_get_transition_type ()

CtkStackTransitionType
ctk_stack_get_transition_type (CtkStack *stack);

Gets the type of animation that will be used for transitions between pages in stack .

Parameters

stack

a CtkStack

 

Returns

the current transition type of stack

Since: 3.10


ctk_stack_get_transition_running ()

gboolean
ctk_stack_get_transition_running (CtkStack *stack);

Returns whether the stack is currently in a transition from one page to another.

Parameters

stack

a CtkStack

 

Returns

TRUE if the transition is currently running, FALSE otherwise.

Since: 3.12


ctk_stack_get_interpolate_size ()

gboolean
ctk_stack_get_interpolate_size (CtkStack *stack);

Returns wether the CtkStack is set up to interpolate between the sizes of children on page switch.

Parameters

stack

A CtkStack

 

Returns

TRUE if child sizes are interpolated

Since: 3.18


ctk_stack_set_interpolate_size ()

void
ctk_stack_set_interpolate_size (CtkStack *stack,
                                gboolean interpolate_size);

Sets whether or not stack will interpolate its size when changing the visible child. If the “interpolate-size” property is set to TRUE, stack will interpolate its size between the current one and the one it'll take after changing the visible child, according to the set transition duration.

Parameters

stack

A CtkStack

 

interpolate_size

the new value

 

Since: 3.18

Types and Values

struct CtkStack

struct CtkStack;

enum CtkStackTransitionType

These enumeration values describe the possible transitions between pages in a CtkStack widget.

New values may be added to this enumeration over time.

Members

CTK_STACK_TRANSITION_TYPE_NONE

No transition

 

CTK_STACK_TRANSITION_TYPE_CROSSFADE

A cross-fade

 

CTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT

Slide from left to right

 

CTK_STACK_TRANSITION_TYPE_SLIDE_LEFT

Slide from right to left

 

CTK_STACK_TRANSITION_TYPE_SLIDE_UP

Slide from bottom up

 

CTK_STACK_TRANSITION_TYPE_SLIDE_DOWN

Slide from top down

 

CTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT

Slide from left or right according to the children order

 

CTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN

Slide from top down or bottom up according to the order

 

CTK_STACK_TRANSITION_TYPE_OVER_UP

Cover the old page by sliding up. Since 3.12

 

CTK_STACK_TRANSITION_TYPE_OVER_DOWN

Cover the old page by sliding down. Since: 3.12

 

CTK_STACK_TRANSITION_TYPE_OVER_LEFT

Cover the old page by sliding to the left. Since: 3.12

 

CTK_STACK_TRANSITION_TYPE_OVER_RIGHT

Cover the old page by sliding to the right. Since: 3.12

 

CTK_STACK_TRANSITION_TYPE_UNDER_UP

Uncover the new page by sliding up. Since 3.12

 

CTK_STACK_TRANSITION_TYPE_UNDER_DOWN

Uncover the new page by sliding down. Since: 3.12

 

CTK_STACK_TRANSITION_TYPE_UNDER_LEFT

Uncover the new page by sliding to the left. Since: 3.12

 

CTK_STACK_TRANSITION_TYPE_UNDER_RIGHT

Uncover the new page by sliding to the right. Since: 3.12

 

CTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN

Cover the old page sliding up or uncover the new page sliding down, according to order. Since: 3.12

 

CTK_STACK_TRANSITION_TYPE_OVER_DOWN_UP

Cover the old page sliding down or uncover the new page sliding up, according to order. Since: 3.14

 

CTK_STACK_TRANSITION_TYPE_OVER_LEFT_RIGHT

Cover the old page sliding left or uncover the new page sliding right, according to order. Since: 3.14

 

CTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT

Cover the old page sliding right or uncover the new page sliding left, according to order. Since: 3.14

 

Property Details

The “hhomogeneous” property

  “hhomogeneous”             gboolean

TRUE if the stack allocates the same width for all children.

Owner: CtkStack

Flags: Read / Write

Default value: TRUE

Since: 3.16


The “homogeneous” property

  “homogeneous”              gboolean

Homogeneous sizing.

Owner: CtkStack

Flags: Read / Write

Default value: TRUE


The “interpolate-size” property

  “interpolate-size”         gboolean

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

Owner: CtkStack

Flags: Read / Write

Default value: FALSE


The “transition-duration” property

  “transition-duration”      guint

The animation duration, in milliseconds.

Owner: CtkStack

Flags: Read / Write

Default value: 200


The “transition-running” property

  “transition-running”       gboolean

Whether or not the transition is currently running.

Owner: CtkStack

Flags: Read

Default value: FALSE


The “transition-type” property

  “transition-type”          CtkStackTransitionType

The type of animation used to transition.

Owner: CtkStack

Flags: Read / Write

Default value: CTK_STACK_TRANSITION_TYPE_NONE


The “vhomogeneous” property

  “vhomogeneous”             gboolean

TRUE if the stack allocates the same height for all children.

Owner: CtkStack

Flags: Read / Write

Default value: TRUE

Since: 3.16


The “visible-child” property

  “visible-child”            CtkWidget *

The widget currently visible in the stack.

Owner: CtkStack

Flags: Read / Write


The “visible-child-name” property

  “visible-child-name”       char *

The name of the widget currently visible in the stack.

Owner: CtkStack

Flags: Read / Write

Default value: NULL

See Also

CtkNotebook, CtkStackSwitcher