Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals | ![]() |
![]() |
![]() |
![]() |
#include <gtk/gtk.h> struct GtkFlowBox; GtkWidget * gtk_flow_box_new (void
); void gtk_flow_box_insert (GtkFlowBox *box
,GtkWidget *widget
,gint position
); GtkFlowBoxChild * gtk_flow_box_get_child_at_index (GtkFlowBox *box
,gint idx
); void gtk_flow_box_set_hadjustment (GtkFlowBox *box
,GtkAdjustment *adjustment
); void gtk_flow_box_set_vadjustment (GtkFlowBox *box
,GtkAdjustment *adjustment
); void gtk_flow_box_set_homogeneous (GtkFlowBox *box
,gboolean homogeneous
); gboolean gtk_flow_box_get_homogeneous (GtkFlowBox *box
); void gtk_flow_box_set_row_spacing (GtkFlowBox *box
,guint spacing
); guint gtk_flow_box_get_row_spacing (GtkFlowBox *box
); void gtk_flow_box_set_column_spacing (GtkFlowBox *box
,guint spacing
); guint gtk_flow_box_get_column_spacing (GtkFlowBox *box
); void gtk_flow_box_set_min_children_per_line (GtkFlowBox *box
,guint n_children
); guint gtk_flow_box_get_min_children_per_line (GtkFlowBox *box
); void gtk_flow_box_set_max_children_per_line (GtkFlowBox *box
,guint n_children
); guint gtk_flow_box_get_max_children_per_line (GtkFlowBox *box
); void gtk_flow_box_set_activate_on_single_click (GtkFlowBox *box
,gboolean single
); gboolean gtk_flow_box_get_activate_on_single_click (GtkFlowBox *box
); void (*GtkFlowBoxForeachFunc) (GtkFlowBox *box
,GtkFlowBoxChild *child
,gpointer user_data
); void gtk_flow_box_selected_foreach (GtkFlowBox *box
,GtkFlowBoxForeachFunc func
,gpointer data
); GList * gtk_flow_box_get_selected_children (GtkFlowBox *box
); void gtk_flow_box_select_child (GtkFlowBox *box
,GtkFlowBoxChild *child
); void gtk_flow_box_unselect_child (GtkFlowBox *box
,GtkFlowBoxChild *child
); void gtk_flow_box_select_all (GtkFlowBox *box
); void gtk_flow_box_unselect_all (GtkFlowBox *box
); void gtk_flow_box_set_selection_mode (GtkFlowBox *box
,GtkSelectionMode mode
); GtkSelectionMode gtk_flow_box_get_selection_mode (GtkFlowBox *box
); gboolean (*GtkFlowBoxFilterFunc) (GtkFlowBoxChild *child
,gpointer user_data
); void gtk_flow_box_set_filter_func (GtkFlowBox *box
,GtkFlowBoxFilterFunc filter_func
,gpointer user_data
,GDestroyNotify destroy
); void gtk_flow_box_invalidate_filter (GtkFlowBox *box
); gint (*GtkFlowBoxSortFunc) (GtkFlowBoxChild *child1
,GtkFlowBoxChild *child2
,gpointer user_data
); void gtk_flow_box_set_sort_func (GtkFlowBox *box
,GtkFlowBoxSortFunc sort_func
,gpointer user_data
,GDestroyNotify destroy
); void gtk_flow_box_invalidate_sort (GtkFlowBox *box
); struct GtkFlowBoxChild; GtkWidget * gtk_flow_box_child_new (void
); gint gtk_flow_box_child_get_index (GtkFlowBoxChild *child
); gboolean gtk_flow_box_child_is_selected (GtkFlowBoxChild *child
); void gtk_flow_box_child_changed (GtkFlowBoxChild *child
);
GObject +----GInitiallyUnowned +----GtkWidget +----GtkContainer +----GtkFlowBox
GObject +----GInitiallyUnowned +----GtkWidget +----GtkContainer +----GtkBin +----GtkFlowBoxChild
GtkFlowBox implements AtkImplementorIface, GtkBuildable and GtkOrientable.
GtkFlowBoxChild implements AtkImplementorIface and GtkBuildable.
"activate-on-single-click" gboolean : Read / Write "column-spacing" guint : Read / Write "homogeneous" gboolean : Read / Write "max-children-per-line" guint : Read / Write "min-children-per-line" guint : Read / Write "row-spacing" guint : Read / Write "selection-mode" GtkSelectionMode : Read / Write
"activate-cursor-child" :Action
"child-activated" :Run Last
"move-cursor" :Action
"select-all" :Action
"selected-children-changed" :Run First
"toggle-cursor-child" :Action
"unselect-all" :Action
"activate" :Action
A GtkFlowBox positions child widgets in sequence according to its orientation.
For instance, with the horizontal orientation, the widgets will be arranged from left to right, starting a new row under the previous row when necessary. Reducing the width in this case will require more rows, so a larger height will be requested.
Likewise, with the vertical orientation, the widgets will be arranged from top to bottom, starting a new column to the right when necessary. Reducing the height will require more columns, so a larger width will be requested.
The children of a GtkFlowBox can be dynamically sorted and filtered.
Although a GtkFlowBox must have only GtkFlowBoxChild children,
you can add any kind of widget to it via gtk_container_add()
, and
a GtkFlowBoxChild widget will automatically be inserted between
the box and the widget.
Also see GtkListBox.
GtkFlowBox was added in GTK+ 3.12.
GtkWidget * gtk_flow_box_new (void
);
Creates a GtkFlowBox.
Returns : |
a new GtkFlowBox container |
Since 3.12
void gtk_flow_box_insert (GtkFlowBox *box
,GtkWidget *widget
,gint position
);
Inserts the widget
into box
at position
.
If a sort function is set, the widget will actually be inserted
at the calculated position and this function has the same effect
as gtk_container_add()
.
If position
is -1, or larger than the total number of children
in the box
, then the widget
will be appended to the end.
|
a GtkFlowBox |
|
the GtkWidget to add |
|
the position to insert child in |
Since 3.12
GtkFlowBoxChild * gtk_flow_box_get_child_at_index (GtkFlowBox *box
,gint idx
);
Gets the nth child in the box
.
|
a GtkFlowBox |
|
the position of the child |
Returns : |
the child widget, which will always be a GtkFlowBoxChild. [transfer none] |
Since 3.12
void gtk_flow_box_set_hadjustment (GtkFlowBox *box
,GtkAdjustment *adjustment
);
Hooks up an adjustment to focus handling in box
.
The adjustment is also used for autoscrolling during
rubberband selection. See gtk_scrolled_window_get_hadjustment()
for a typical way of obtaining the adjustment, and
gtk_flow_box_set_vadjustment()
for setting the vertical
adjustment.
The adjustments have to be in pixel units and in the same coordinate system as the allocation for immediate children of the box.
|
a GtkFlowBox |
|
an adjustment which should be adjusted
when the focus is moved among the descendents of container
|
Since 3.12
void gtk_flow_box_set_vadjustment (GtkFlowBox *box
,GtkAdjustment *adjustment
);
Hooks up an adjustment to focus handling in box
.
The adjustment is also used for autoscrolling during
rubberband selection. See gtk_scrolled_window_get_vadjustment()
for a typical way of obtaining the adjustment, and
gtk_flow_box_set_hadjustment()
for setting the horizontal
adjustment.
The adjustments have to be in pixel units and in the same coordinate system as the allocation for immediate children of the box.
|
a GtkFlowBox |
|
an adjustment which should be adjusted
when the focus is moved among the descendents of container
|
Since 3.12
void gtk_flow_box_set_homogeneous (GtkFlowBox *box
,gboolean homogeneous
);
Sets the "homogeneous" property of box
, controlling
whether or not all children of box
are given equal space
in the box.
|
a GtkFlowBox |
|
TRUE to create equal allotments,
FALSE for variable allotments |
Since 3.12
gboolean gtk_flow_box_get_homogeneous (GtkFlowBox *box
);
Returns whether the box is homogeneous (all children are the
same size). See gtk_box_set_homogeneous()
.
|
a GtkFlowBox |
Returns : |
TRUE if the box is homogeneous. |
Since 3.12
void gtk_flow_box_set_row_spacing (GtkFlowBox *box
,guint spacing
);
Sets the vertical space to add between children. See the "row-spacing" property.
|
a GtkFlowBox |
|
the spacing to use |
Since 3.12
guint gtk_flow_box_get_row_spacing (GtkFlowBox *box
);
Gets the vertical spacing.
|
a GtkFlowBox |
Returns : |
the vertical spacing |
Since 3.12
void gtk_flow_box_set_column_spacing (GtkFlowBox *box
,guint spacing
);
Sets the horizontal space to add between children. See the "column-spacing" property.
|
a GtkFlowBox |
|
the spacing to use |
Since 3.12
guint gtk_flow_box_get_column_spacing (GtkFlowBox *box
);
Gets the horizontal spacing.
|
a GtkFlowBox |
Returns : |
the horizontal spacing |
Since 3.12
void gtk_flow_box_set_min_children_per_line (GtkFlowBox *box
,guint n_children
);
Sets the minimum number of children to line up
in box
's orientation before flowing.
|
a GtkFlowBox |
|
the minimum number of children per line |
Since 3.12
guint gtk_flow_box_get_min_children_per_line
(GtkFlowBox *box
);
Gets the minimum number of children per line.
|
a GtkFlowBox |
Returns : |
the minimum number of children per line |
Since 3.12
void gtk_flow_box_set_max_children_per_line (GtkFlowBox *box
,guint n_children
);
Sets the maximum number of children to request and
allocate space for in box
's orientation.
Setting the maximum number of children per line
limits the overall natural size request to be no more
than n_children
children long in the given orientation.
|
a GtkFlowBox |
|
the maximum number of children per line |
Since 3.12
guint gtk_flow_box_get_max_children_per_line
(GtkFlowBox *box
);
Gets the maximum number of children per line.
|
a GtkFlowBox |
Returns : |
the maximum number of children per line |
Since 3.12
void gtk_flow_box_set_activate_on_single_click (GtkFlowBox *box
,gboolean single
);
If single
is TRUE
, children will be activated when you click
on them, otherwise you need to double-click.
|
a GtkFlowBox |
|
TRUE to emit child-activated on a single click |
Since 3.12
gboolean gtk_flow_box_get_activate_on_single_click
(GtkFlowBox *box
);
Returns whether children activate on single clicks.
|
a GtkFlowBox |
Returns : |
TRUE if children are activated on single click,
FALSE otherwise |
Since 3.12
void (*GtkFlowBoxForeachFunc) (GtkFlowBox *box
,GtkFlowBoxChild *child
,gpointer user_data
);
A function used by gtk_flow_box_selected_foreach()
.
It will be called on every selected child of tht box
.
|
a GtkFlowBox |
|
a GtkFlowBoxChild |
|
user data. [closure] |
Since 3.12
void gtk_flow_box_selected_foreach (GtkFlowBox *box
,GtkFlowBoxForeachFunc func
,gpointer data
);
Calls a function for each selected child.
Note that the selection cannot be modified from within this function.
|
a GtkFlowBox |
|
the function to call for each selected child. [scope call] |
|
user data to pass to the function |
Since 3.12
GList * gtk_flow_box_get_selected_children (GtkFlowBox *box
);
Creates a list of all selected children.
|
a GtkFlowBox |
Returns : |
A GList containing the GtkWidget for each selected child.
Free with g_list_free() when done. [element-type GtkFlowBoxChild][transfer container]
|
Since 3.12
void gtk_flow_box_select_child (GtkFlowBox *box
,GtkFlowBoxChild *child
);
Selects a single child of box
, if the selection
mode allows it.
|
a GtkFlowBox |
|
a child of box
|
Since 3.12
void gtk_flow_box_unselect_child (GtkFlowBox *box
,GtkFlowBoxChild *child
);
Unselects a single child of box
, if the selection
mode allows it.
|
a GtkFlowBox |
|
a child of box
|
Since 3.12
void gtk_flow_box_select_all (GtkFlowBox *box
);
Select all children of box
, if the selection
mode allows it.
|
a GtkFlowBox |
Since 3.12
void gtk_flow_box_unselect_all (GtkFlowBox *box
);
Unselect all children of box
, if the selection
mode allows it.
|
a GtkFlowBox |
Since 3.12
void gtk_flow_box_set_selection_mode (GtkFlowBox *box
,GtkSelectionMode mode
);
Sets how selection works in box
.
See GtkSelectionMode for details.
|
a GtkFlowBox |
|
the new selection mode |
Since 3.12
GtkSelectionMode gtk_flow_box_get_selection_mode (GtkFlowBox *box
);
Gets the selection mode of box
.
|
a GtkFlowBox |
Returns : |
the GtkSelectionMode |
Since 3.12
gboolean (*GtkFlowBoxFilterFunc) (GtkFlowBoxChild *child
,gpointer user_data
);
A function that will be called whenrever a child changes or is added. It lets you control if the child should be visible or not.
|
a GtkFlowBoxChild that may be filtered |
|
user data. [closure] |
Returns : |
TRUE if the row should be visible, FALSE otherwise |
Since 3.12
void gtk_flow_box_set_filter_func (GtkFlowBox *box
,GtkFlowBoxFilterFunc filter_func
,gpointer user_data
,GDestroyNotify destroy
);
By setting a filter function on the box
one can decide dynamically
which of the children to show. For instance, to implement a search
function that only shows the children matching the search terms.
The filter_func
will be called for ach child after the call, and
it will continue to be called each time a child changes (via
gtk_flow_box_child_changed()
) or when gtk_flow_box_invalidate_filter()
is called.
|
a GtkFlowBox |
|
callback that lets you filter which children to show. [closure user_data][allow-none] |
|
user data passed to filter_func
|
|
destroy notifier for user_data
|
Since 3.12
void gtk_flow_box_invalidate_filter (GtkFlowBox *box
);
Updates the filtering for all children.
Call this function when the result of the filter
function on the box
is changed due ot an external
factor. For instance, this would be used if the
filter function just looked for a specific search
term, and the entry with the string has changed.
|
a GtkFlowBox |
Since 3.12
gint (*GtkFlowBoxSortFunc) (GtkFlowBoxChild *child1
,GtkFlowBoxChild *child2
,gpointer user_data
);
A function to compare two children to determine which should come first.
|
the first child |
|
the second child |
|
user data. [closure] |
Returns : |
< 0 if child1 should be before child2 , 0 if
the are equal, and > 0 otherwise |
Since 3.12
void gtk_flow_box_set_sort_func (GtkFlowBox *box
,GtkFlowBoxSortFunc sort_func
,gpointer user_data
,GDestroyNotify destroy
);
By setting a sort function on the box
, one can dynamically
reorder the children of the box, based on the contents of
the children.
The sort_func
will be called for each child after the call,
and will continue to be called each time a child changes (via
gtk_flow_box_child_changed()
) and when gtk_flow_box_invalidate_sort()
is called.
|
a GtkFlowBox |
|
the sort function. [closure user_data][allow-none] |
|
user data passed to sort_func
|
|
destroy notifier for user_data
|
Since 3.12
void gtk_flow_box_invalidate_sort (GtkFlowBox *box
);
Updates the sorting for all children.
Call this when the result of the sort function on
box
is changed due to an external factor.
|
a GtkFlowBox |
Since 3.12
GtkWidget * gtk_flow_box_child_new (void
);
Creates a new GtkFlowBoxChild, to be used as a child of a GtkFlowBox.
Returns : |
a new GtkFlowBoxChild |
Since 3.12
gint gtk_flow_box_child_get_index (GtkFlowBoxChild *child
);
Gets the current index of the child
in its GtkFlowBox container.
|
a GtkFlowBoxChild |
Returns : |
the index of the child , or -1 if the child is not
in a flow box. |
Since 3.12
gboolean gtk_flow_box_child_is_selected (GtkFlowBoxChild *child
);
Returns whether the child
is currently selected in its
GtkFlowBox container.
|
a GtkFlowBoxChild |
Returns : |
TRUE if child is selected |
Since 3.12
void gtk_flow_box_child_changed (GtkFlowBoxChild *child
);
Marks child
as changed, causing any state that depends on this
to be updated. This affects sorting and filtering.
Note that calls to this method must be in sync with the data
used for the sorting and filtering functions. For instance, if
the list is mirroring some external data set, and *two* children
changed in the external data set when you call
gtk_flow_box_child_changed()
on the first child, the sort function
must only read the new data for the first of the two changed
children, otherwise the resorting of the children will be wrong.
This generally means that if you don't fully control the data
model, you have to duplicate the data that affects the sorting
and filtering functions into the widgets themselves. Another
alternative is to call gtk_flow_box_invalidate_sort()
on any
model change, but that is more expensive.
|
a GtkFlowBoxChild |
Since 3.12
"activate-on-single-click"
property"activate-on-single-click" gboolean : Read / Write
Determines whether children can be activated with a single click, or require a double-click.
Default value: TRUE
"column-spacing"
property"column-spacing" guint : Read / Write
The amount of horizontal space between two children.
Default value: 0
"homogeneous"
property"homogeneous" gboolean : Read / Write
Determines whether all children should be allocated the same size.
Default value: FALSE
"max-children-per-line"
property"max-children-per-line" guint : Read / Write
The maximum amount of children to request space for consecutively in the given orientation.
Default value: 7
"min-children-per-line"
property"min-children-per-line" guint : Read / Write
The minimum number of children to allocate consecutively in the given orientation.
Setting the minimum children per line ensures that a reasonably small height will be requested for the overall minimum width of the box.
Default value: 0
"row-spacing"
property"row-spacing" guint : Read / Write
The amount of vertical space between two children.
Default value: 0
"selection-mode"
property"selection-mode" GtkSelectionMode : Read / Write
The selection mode used by the flow box.
Default value: GTK_SELECTION_SINGLE
"activate-cursor-child"
signalvoid user_function (GtkFlowBox *box,
gpointer user_data) : Action
The ::activate-cursor-child signal is a
keybinding signal
which gets emitted when the user activates the box
.
|
the GtkFlowBox on which the signal is emitted |
|
user data set when the signal handler was connected. |
"child-activated"
signalvoid user_function (GtkFlowBox *box,
GtkWidget *child,
gpointer user_data) : Run Last
The ::child-activated signal is emitted when a child has been activated by the user.
|
the GtkFlowBox on which the signal is emitted |
|
the child that is activated |
|
user data set when the signal handler was connected. |
"move-cursor"
signalvoid user_function (GtkFlowBox *box,
GtkMovementStep step,
gint count,
gpointer user_data) : Action
The ::move-cursor signal is a
keybinding signal
which gets emitted when the user initiates a cursor movement.
If the cursor is not visible in text_view
, this signal causes
the viewport to be moved instead.
Applications should not connect to it, but may emit it with
g_signal_emit_by_name()
if they need to control the cursor
programmatically.
The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here.
|
the GtkFlowBox on which the signal is emitted |
|
the granularity fo the move, as a GtkMovementStep |
|
the number of step units to move |
|
user data set when the signal handler was connected. |
"select-all"
signalvoid user_function (GtkFlowBox *box,
gpointer user_data) : Action
The ::select-all signal is a keybinding signal which gets emitted to select all children of the box, if the selection mode permits it.
The default bindings for this signal is Ctrl-a.
|
the GtkFlowBox on which the signal is emitted |
|
user data set when the signal handler was connected. |
"selected-children-changed"
signalvoid user_function (GtkFlowBox *box,
gpointer user_data) : Run First
The ::selected-children-changed signal is emitted when the set of selected children changes.
Use gtk_flow_box_selected_foreach()
or
gtk_flow_box_get_selected_children()
to obtain the
selected children.
|
the GtkFlowBox on wich the signal is emitted |
|
user data set when the signal handler was connected. |
"toggle-cursor-child"
signalvoid user_function (GtkFlowBox *box,
gpointer user_data) : Action
The ::toggle-cursor-child signal is a keybinding signal which toggles the selection of the child that has the focus.
The default binding for this signal is Ctrl-Space.
|
the GtkFlowBox on which the signal is emitted |
|
user data set when the signal handler was connected. |
"unselect-all"
signalvoid user_function (GtkFlowBox *box,
gpointer user_data) : Action
The ::unselect-all signal is a keybinding signal which gets emitted to unselect all children of the box, if the selection mode permits it.
The default bindings for this signal is Ctrl-Shift-a.
|
the GtkFlowBox on which the signal is emitted |
|
user data set when the signal handler was connected. |
"activate"
signalvoid user_function (GtkFlowBoxChild *child,
gpointer user_data) : Action
The ::activate signal is emitted when the user activates a child widget in a GtkFlowBox, either by clicking or double-clicking, or by using the Space or Enter key.
While this signal is used as a keybinding signal, it can be used by applications for their own purposes.
|
The child on which the signal is emitted |
|
user data set when the signal handler was connected. |