GnuiFlow

GnuiFlow — A flow container

Stability Level

Unstable, unless otherwise indicated

Functions

Properties

int leading Read / Write
GtkTextDirection line-direction Read / Write
GtkJustification line-justify Read / Write
GtkTextDirection page-direction Read / Write
GtkJustification page-justify Read / Write
int spacing Read / Write

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── GnuiFlow

Implemented Interfaces

GnuiFlow implements GtkAccessible, GtkBuildable, GtkConstraintTarget and GtkOrientable.

Includes

#include <gnuisance/gnui-flow.h>

Description

GnuiFlow is a container widget that allocates its children widgets like words in a text.

Most of the machinery that allows GnuiFlow to behave the way it behaves is done by its layout manager, GnuiFlowLayout (in fact, widgets that adopt GnuiFlowLayout as their layout manager will behave like GnuiFlow). However GnuiFlow offers a rich set of convenience functions for populating its content.

GnuiFlow does not align its children widgets in columns like GtkFlowBox does. If you need that kind of table-like look, please refer to GtkFlowBox.

Functions

gnui_flow_new ()

GtkWidget *
gnui_flow_new (void);

Create a new flow container widget

Returns

The newly created flow container


gnui_flow_new_with_params ()

GtkWidget *
gnui_flow_new_with_params (const GtkOrientation orientation,
                           const gint spacing,
                           const gint leading);

Create a new flow container widget with parameters

Parameters

orientation

The flow container's orientation

 

spacing

The spacing between the children of the flow container in pixels (can be negative for overlapping widgets)

 

leading

The leading between the children of the flow container in pixels (can be negative for overlapping widgets)

 

Returns

The newly created flow container


gnui_flow_new_with_params_and_children ()

GtkWidget *
gnui_flow_new_with_params_and_children
                               (const GtkOrientation orientation,
                                const gint spacing,
                                const gint leading,
                                ...);

Create a new flow container widget with parameters and children

Example:

1
2
3
4
5
6
7
8
9
10
gnui_flow_new_with_params_and_children(
    GTK_ORIENTATION_HORIZONTAL,
    6,
    6,
    gtk_label_new("Child one"),
    gtk_label_new("Child two"),
    gtk_label_new("Child three"),
    gtk_label_new("etc."),
    NULL
)

Parameters

orientation

The flow container's orientation

 

spacing

The spacing between the children of the flow container in pixels (can be negative for overlapping widgets)

 

leading

The leading between the children of the flow container in pixels (can be negative for overlapping widgets)

 

...

Zero or more widgets to insert as children in the newly created flow container, followed by NULL

 

Returns

The newly created flow container


gnui_flow_append ()

void
gnui_flow_append (GnuiFlow * const self,
                  GtkWidget * const widget);

Append a widget as the last child of a flow container

Parameters

self

The flow container.

[not nullable]

widget

The child to append.

[not nullable]

gnui_flow_prepend ()

void
gnui_flow_prepend (GnuiFlow * const self,
                   GtkWidget * const widget);

Prepend a widget as the first child of a flow container

Parameters

self

The flow container.

[not nullable]

widget

The child to prepend.

[not nullable]

gnui_flow_remove ()

void
gnui_flow_remove (GnuiFlow * const self,
                  GtkWidget * const child);

Remove a child from a flow container

Parameters

self

The flow container.

[not nullable]

widget

The child to prepend.

[not nullable]

gnui_flow_insert ()

void
gnui_flow_insert (GnuiFlow * const self,
                  GtkWidget * const widget,
                  const gint at_index);

Insert a widget as the nth child of a flow container

Parameters

self

The flow container.

[not nullable]

widget

The child to insert at_index The index at which the widget must be inserted; if negative the counting will be from the end, with -1 representing the last child.

[not nullable]

gnui_flow_insert_child_before ()

void
gnui_flow_insert_child_before (GnuiFlow * const self,
                               GtkWidget * const widget,
                               GtkWidget * const next_sibling);

Insert a widget as the nth child of a flow container

Parameters

self

The flow container.

[not nullable]

widget

The child to insert.

[not nullable]

next_sibling

The flow child before which the widget must be inserted; if NULL the widget will be appended as the last child.

[nullable]

gnui_flow_insert_child_after ()

void
gnui_flow_insert_child_after (GnuiFlow * const self,
                              GtkWidget * const widget,
                              GtkWidget * const previous_sibling);

Insert a widget in a flow container after an existing child

Parameters

self

The flow container.

[not nullable]

widget

The child to insert.

[not nullable]

previous_sibling

The flow child after which the widget must be inserted; if NULL the widget will be prepended as the first child.

[nullable]

gnui_flow_populate_before ()

void
gnui_flow_populate_before (GnuiFlow * const self,
                           GtkWidget * const next_sibling,
                           GtkWidget * const widget_1,
                           ...);

Insert a group of widgets in a flow container before an existing child

Parameters

self

The flow container.

[not nullable]

widget

The child to insert.

[not nullable]

next_sibling

The flow child before which the widgets must be inserted; if NULL the widgets will be appended as the last children.

[nullable]

...

Zero or more widgets to insert after widget_1 but before next_sibling , followed by NULL

 

gnui_flow_populate_after ()

void
gnui_flow_populate_after (GnuiFlow * const self,
                          GtkWidget * const previous_sibling,
                          GtkWidget * const widget_1,
                          ...);

Insert a group of widgets in a flow container after an existing child

Parameters

self

The flow container.

[not nullable]

widget

The child to insert.

[not nullable]

previous_sibling

The flow child after which the widgets must be inserted; if NULL the widgets will be prepended as the first children.

[nullable]

...

Zero or more widgets to insert after widget_1 , followed by NULL

 

gnui_flow_clear ()

void
gnui_flow_clear (GnuiFlow * const self);

Remove all the children nested inside a flow container

Parameters

self

The flow container.

[not nullable]

gnui_flow_get_spacing ()

gint
gnui_flow_get_spacing (GnuiFlow * const self);

Get the spacing between the children of a flow container in pixels

[get-property spacing]

Parameters

self

The flow container.

[not nullable]

Returns

The spacing between the children of the flow container in pixels (can be negative for overlapping widgets)


gnui_flow_set_spacing ()

void
gnui_flow_set_spacing (GnuiFlow * const self,
                       const gint spacing);

Set the spacing between the children of a flow container in pixels

[set-property spacing]

Parameters

self

The flow container.

[not nullable]

spacing

The spacing between the children of the flow container in pixels (can be negative for overlapping widgets)

 

gnui_flow_get_leading ()

gint
gnui_flow_get_leading (GnuiFlow * const self);

Get the leading between the children of a flow container in pixels

[get-property leading]

Parameters

self

The flow container.

[not nullable]

Returns

The leading between the children of the flow container in pixels (can be negative for overlapping widgets)


gnui_flow_set_leading ()

void
gnui_flow_set_leading (GnuiFlow * const self,
                       const gint leading);

Set the leading between the children of the flow container in pixels

[set-property leading]

Parameters

self

The flow container.

[not nullable]

leading

The leading between the children of the flow container in pixels (can be negative for overlapping widgets)

 

gnui_flow_get_page_direction ()

GtkTextDirection
gnui_flow_get_page_direction (GnuiFlow * const self);

Get the flow container's page direction

[get-property page-direction]

Parameters

self

The flow container.

[not nullable]

Returns

The flow container's page direction


gnui_flow_set_page_direction ()

void
gnui_flow_set_page_direction (GnuiFlow * const self,
                              const GtkTextDirection direction);

Set the flow container's page direction

[set-property page-direction]

Parameters

self

The flow container.

[not nullable]

direction

The flow container's page direction

 

gnui_flow_get_page_justify ()

GtkJustification
gnui_flow_get_page_justify (GnuiFlow * const self);

Get the flow container's page justification

[get-property page-justify]

Parameters

self

The flow container.

[not nullable]

Returns

The flow container's page justification


gnui_flow_set_page_justify ()

void
gnui_flow_set_page_justify (GnuiFlow * const self,
                            const GtkJustification justification);

Set the flow container's page justification

[set-property page-justify]

Parameters

self

The flow container.

[not nullable]

justification

The flow container's page justification

 

gnui_flow_get_orientation ()

GtkOrientation
gnui_flow_get_orientation (GnuiFlow * const self);

Get the flow container's orientation

[get-property orientation]

Parameters

self

The flow container.

[not nullable]

Returns

The flow container's orientation


gnui_flow_set_orientation ()

void
gnui_flow_set_orientation (GnuiFlow * const self,
                           const GtkOrientation orientation);

Set the flow container's orientation

[set-property orientation]

Parameters

self

The flow container.

[not nullable]

orientation

The flow container's justification

 

gnui_flow_get_line_direction ()

GtkTextDirection
gnui_flow_get_line_direction (GnuiFlow * const self);

Get the flow container's line direction

[get-property line-direction]

Parameters

self

The flow container.

[not nullable]

Returns

The flow container's line direction


gnui_flow_set_line_direction ()

void
gnui_flow_set_line_direction (GnuiFlow * const self,
                              const GtkTextDirection direction);

Set the flow container's line direction

[set-property line-direction]

Parameters

self

The flow container.

[not nullable]

direction

The flow container's line direction

 

gnui_flow_get_line_justify ()

GtkJustification
gnui_flow_get_line_justify (GnuiFlow * const self);

Get the flow container's line justification

[get-property line-justify]

Parameters

self

The flow container.

[not nullable]

Returns

The flow container's line justification


gnui_flow_set_line_justify ()

void
gnui_flow_set_line_justify (GnuiFlow * const self,
                            const GtkJustification justification);

Set the flow container's line justification

[set-property line-justify]

Parameters

self

The flow container.

[not nullable]

justification

The flow container's line justification

 

Types and Values

GNUI_TYPE_FLOW

#define GNUI_TYPE_FLOW (gnui_flow_get_type())

The GType of GnuiFlow


struct GnuiFlowClass

struct GnuiFlowClass {
    GtkWidgetClass parent_class;
};

The flow widget's class


GnuiFlow

typedef struct _GnuiFlow GnuiFlow;

The GnuiFlow widget

Property Details

The “leading” property

  “leading”                  int

Space between rows of children perpendicularly to the “orientation” axis.

Owner: GnuiFlow

Flags: Read / Write

Default value: 0


The “line-direction” property

  “line-direction”           GtkTextDirection

The direction of child placement within the given “orientation” axis.

Owner: GnuiFlow

Flags: Read / Write

Default value: GTK_TEXT_DIR_LTR


The “line-justify” property

  “line-justify”             GtkJustification

The alignment of the children relative to each other within each line; this does not affect the alignment of the flow widget within its allocation – see “halign” and “valign” for that.

Owner: GnuiFlow

Flags: Read / Write

Default value: GTK_JUSTIFY_LEFT


The “page-direction” property

  “page-direction”           GtkTextDirection

The direction of child placement perpendicularly to the “orientation” axis.

Owner: GnuiFlow

Flags: Read / Write

Default value: GTK_TEXT_DIR_LTR


The “page-justify” property

  “page-justify”             GtkJustification

The alignment of the lines of children widgets relative to each other; this does not affect the alignment of the flow widget within its allocation – see “halign” and “valign” for that.

Owner: GnuiFlow

Flags: Read / Write

Default value: GTK_JUSTIFY_LEFT


The “spacing” property

  “spacing”                  int

Space between children along the “orientation” axis.

Owner: GnuiFlow

Flags: Read / Write

Default value: 0

See Also

GnuiFlowLayout