GtkCustomLayout

GtkCustomLayout — A convenience layout manager

Types and Values

Object Hierarchy

    GObject
    ╰── GtkLayoutManager
        ╰── GtkCustomLayout

Includes

#include <gtk/gtk.h>

Description

GtkCustomLayout is a convenience type meant to be used as a transition mechanism between GtkWidgets implementing a layout policy, and GtkLayoutManager classes.

A GtkCustomLayout uses closures matching to the old GtkWidget virtual functions for size negotiation, as a convenience API to ease the porting towards the corresponding GtkLayoutManager virtual functions.

Functions

GtkCustomRequestModeFunc ()

GtkSizeRequestMode
(*GtkCustomRequestModeFunc) (GtkWidget *widget);

Queries a widget for its preferred size request mode.

Parameters

widget

the widget to be queried

 

Returns

the size request mode


GtkCustomMeasureFunc ()

void
(*GtkCustomMeasureFunc) (GtkWidget *widget,
                         GtkOrientation orientation,
                         int for_size,
                         int *minimum,
                         int *natural,
                         int *minimum_baseline,
                         int *natural_baseline);

A function to be used by GtkCustomLayout to measure a widget.

Parameters

widget

the widget to be measured

 

orientation

the direction to be measured

 

for_size

the size to be measured for

 

minimum

the measured minimum size of the widget.

[out]

natural

the measured natural size of the widget.

[out]

minimum_baseline

the measured minimum baseline of the widget.

[out]

natural_baseline

the measured natural baseline of the widget.

[out]

GtkCustomAllocateFunc ()

void
(*GtkCustomAllocateFunc) (GtkWidget *widget,
                          int width,
                          int height,
                          int baseline);

A function to be used by GtkCustomLayout to allocate a widget.

Parameters

widget

the widget to allocate

 

width

the new width of the widget

 

height

the new height of the widget

 

baseline

the new baseline of the widget, or -1

 

gtk_custom_layout_new ()

GtkLayoutManager *
gtk_custom_layout_new (GtkCustomRequestModeFunc request_mode,
                       GtkCustomMeasureFunc measure,
                       GtkCustomAllocateFunc allocate);

Creates a new legacy layout manager.

Legacy layout managers map to the old GtkWidget size negotiation virtual functions, and are meant to be used during the transition from layout containers to layout manager delegates.

Parameters

request_mode

a function to retrieve the GtkSizeRequestMode of the widget using the layout; the default request mode is GTK_SIZE_REQUEST_CONSTANT_SIZE.

[nullable][scope call]

measure

a function to measure the widget using the layout manager.

[not nullable][scope call]

allocate

a function to allocate the children of the widget using the layout manager.

[not nullable][scope call]

Returns

the newly created GtkCustomLayout.

[transfer full]

Types and Values

GtkCustomLayout

typedef struct _GtkCustomLayout GtkCustomLayout;