CtkLayout

CtkLayout — Infinite scrollable area containing child widgets and/or custom drawing

Functions

Properties

guint height Read / Write
guint width Read / Write

Types and Values

struct CtkLayout

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── CtkWidget
            ╰── CtkContainer
                ╰── CtkLayout

Implemented Interfaces

CtkLayout implements AtkImplementorIface, CtkBuildable and CtkScrollable.

Includes

#include <ctk/ctk.h>

Description

CtkLayout is similar to CtkDrawingArea in that it’s a “blank slate” and doesn’t do anything except paint a blank background by default. It’s different in that it supports scrolling natively due to implementing CtkScrollable, and can contain child widgets since it’s a CtkContainer.

If you just want to draw, a CtkDrawingArea is a better choice since it has lower overhead. If you just need to position child widgets at specific points, then CtkFixed provides that functionality on its own.

When handling expose events on a CtkLayout, you must draw to the CdkWindow returned by ctk_layout_get_bin_window(), rather than to the one returned by ctk_widget_get_window() as you would for a CtkDrawingArea.

Functions

ctk_layout_new ()

CtkWidget *
ctk_layout_new (CtkAdjustment *hadjustment,
                CtkAdjustment *vadjustment);

Creates a new CtkLayout. Unless you have a specific adjustment you’d like the layout to use for scrolling, pass NULL for hadjustment and vadjustment .

Parameters

hadjustment

horizontal scroll adjustment, or NULL.

[allow-none]

vadjustment

vertical scroll adjustment, or NULL.

[allow-none]

Returns

a new CtkLayout


ctk_layout_put ()

void
ctk_layout_put (CtkLayout *layout,
                CtkWidget *child_widget,
                gint x,
                gint y);

Adds child_widget to layout , at position (x ,y ). layout becomes the new parent container of child_widget .

Parameters

layout

a CtkLayout

 

child_widget

child widget

 

x

X position of child widget

 

y

Y position of child widget

 

ctk_layout_move ()

void
ctk_layout_move (CtkLayout *layout,
                 CtkWidget *child_widget,
                 gint x,
                 gint y);

Moves a current child of layout to a new position.

Parameters

layout

a CtkLayout

 

child_widget

a current child of layout

 

x

X position to move to

 

y

Y position to move to

 

ctk_layout_set_size ()

void
ctk_layout_set_size (CtkLayout *layout,
                     guint width,
                     guint height);

Sets the size of the scrollable area of the layout.

Parameters

layout

a CtkLayout

 

width

width of entire scrollable area

 

height

height of entire scrollable area

 

ctk_layout_get_size ()

void
ctk_layout_get_size (CtkLayout *layout,
                     guint *width,
                     guint *height);

Gets the size that has been set on the layout, and that determines the total extents of the layout’s scrollbar area. See ctk_layout_set_size().

Parameters

layout

a CtkLayout

 

width

location to store the width set on layout , or NULL.

[out][allow-none]

height

location to store the height set on layout , or NULL.

[out][allow-none]

ctk_layout_get_hadjustment ()

CtkAdjustment *
ctk_layout_get_hadjustment (CtkLayout *layout);

ctk_layout_get_hadjustment has been deprecated since version 3.0 and should not be used in newly-written code.

Use ctk_scrollable_get_hadjustment()

This function should only be called after the layout has been placed in a CtkScrolledWindow or otherwise configured for scrolling. It returns the CtkAdjustment used for communication between the horizontal scrollbar and layout .

See CtkScrolledWindow, CtkScrollbar, CtkAdjustment for details.

Parameters

layout

a CtkLayout

 

Returns

horizontal scroll adjustment.

[transfer none]


ctk_layout_get_vadjustment ()

CtkAdjustment *
ctk_layout_get_vadjustment (CtkLayout *layout);

ctk_layout_get_vadjustment has been deprecated since version 3.0 and should not be used in newly-written code.

Use ctk_scrollable_get_vadjustment()

This function should only be called after the layout has been placed in a CtkScrolledWindow or otherwise configured for scrolling. It returns the CtkAdjustment used for communication between the vertical scrollbar and layout .

See CtkScrolledWindow, CtkScrollbar, CtkAdjustment for details.

Parameters

layout

a CtkLayout

 

Returns

vertical scroll adjustment.

[transfer none]


ctk_layout_set_hadjustment ()

void
ctk_layout_set_hadjustment (CtkLayout *layout,
                            CtkAdjustment *adjustment);

ctk_layout_set_hadjustment has been deprecated since version 3.0 and should not be used in newly-written code.

Use ctk_scrollable_set_hadjustment()

Sets the horizontal scroll adjustment for the layout.

See CtkScrolledWindow, CtkScrollbar, CtkAdjustment for details.

Parameters

layout

a CtkLayout

 

adjustment

new scroll adjustment.

[allow-none]

ctk_layout_set_vadjustment ()

void
ctk_layout_set_vadjustment (CtkLayout *layout,
                            CtkAdjustment *adjustment);

ctk_layout_set_vadjustment has been deprecated since version 3.0 and should not be used in newly-written code.

Use ctk_scrollable_set_vadjustment()

Sets the vertical scroll adjustment for the layout.

See CtkScrolledWindow, CtkScrollbar, CtkAdjustment for details.

Parameters

layout

a CtkLayout

 

adjustment

new scroll adjustment.

[allow-none]

ctk_layout_get_bin_window ()

CdkWindow *
ctk_layout_get_bin_window (CtkLayout *layout);

Retrieve the bin window of the layout used for drawing operations.

Parameters

layout

a CtkLayout

 

Returns

a CdkWindow.

[transfer none]

Since: 2.14

Types and Values

struct CtkLayout

struct CtkLayout;

Property Details

The “height” property

  “height”                   guint

The height of the layout.

Owner: CtkLayout

Flags: Read / Write

Allowed values: <= G_MAXINT

Default value: 100


The “width” property

  “width”                    guint

The width of the layout.

Owner: CtkLayout

Flags: Read / Write

Allowed values: <= G_MAXINT

Default value: 100

See Also

CtkDrawingArea, CtkFixed