Class: Gtk::FlowBox

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#activate_on_single_clickTrueClass

Returns whether children activate on single clicks.

Returns:

  • (TrueClass)

    true if children are activated on single click, false otherwise

#activate_on_single_click=(activate_on_single_click) ⇒ TrueClass

Determines whether children can be activated with a single click, or require a double-click.

Parameters:

  • activate_on_single_click (TrueClass)

Returns:

  • (TrueClass)

    activate-on-single-click

  • (TrueClass)

    activate-on-single-click

#activate_on_single_click?TrueClass

Determines whether children can be activated with a single click, or require a double-click.

Returns:

  • (TrueClass)

    activate-on-single-click

#bind_model(model, create_widget_func, user_data, user_data_free_func) ⇒ nil

Binds model to box.

If box was already bound to a model, that previous binding is destroyed.

The contents of box are cleared and then filled with widgets that represent items from model. box is updated whenever model changes. If model is nil, box is left empty.

It is undefined to add or remove widgets directly (for example, with gtk_flow_box_insert() or gtk_container_add()) while box is bound to a model.

Note that using a model is incompatible with the filtering and sorting functionality in GtkFlowBox. When using a model, filtering and sorting should be implemented by the model.

Parameters:

  • model (Gio::ListModel)

    the GList::Model to be bound to box

  • create_widget_func (Gtk::FlowBoxCreateWidgetFunc)

    a function that creates widgets for items

  • user_data (GObject)

    user data passed to create_widget_func

  • user_data_free_func (GLib::DestroyNotify)

    function for freeing user_data

Returns:

  • (nil)

#column_spacingInteger

The amount of horizontal space between two children.

Returns:

  • (Integer)

    column-spacing

#column_spacing=(column_spacing) ⇒ Integer

The amount of horizontal space between two children.

Parameters:

  • column_spacing (Integer)

Returns:

  • (Integer)

    column-spacing

  • (Integer)

    column-spacing

#get_child_at_index(idx) ⇒ Gtk::FlowBoxChild

Gets the nth child in the box.

Parameters:

  • idx (Integer)

    the position of the child

Returns:

  • (Gtk::FlowBoxChild)

    the child widget, which will always be a Gtk::FlowBoxChild or nil in case no child widget with the given index exists.

#get_child_at_pos(x, y) ⇒ Gtk::FlowBoxChild

Gets the child in the (x, y) position.

Parameters:

  • x (Integer)

    the x coordinate of the child

  • y (Integer)

    the y coordinate of the child

Returns:

  • (Gtk::FlowBoxChild)

    the child widget, which will always be a Gtk::FlowBoxChild or nil in case no child widget exists for the given x and y coordinates.

#hadjustment=(adjustment) ⇒ nil

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.

Parameters:

  • adjustment (Gtk::Adjustment)

    an adjustment which should be adjusted when the focus is moved among the descendents of container

Returns:

  • (nil)

#homogeneousTrueClass

Returns whether the box is homogeneous (all children are the same size). See gtk_box_set_homogeneous().

Returns:

  • (TrueClass)

    true if the box is homogeneous.

#homogeneous=(homogeneous) ⇒ TrueClass

Determines whether all children should be allocated the same size.

Parameters:

  • homogeneous (TrueClass)

Returns:

  • (TrueClass)

    homogeneous

  • (TrueClass)

    homogeneous

#homogeneous?TrueClass

Determines whether all children should be allocated the same size.

Returns:

  • (TrueClass)

    homogeneous

#insert(widget, position) ⇒ nil

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.

Parameters:

  • widget (Gtk::Widget)

    the Gtk::Widget to add

  • position (Integer)

    the position to insert child in

Returns:

  • (nil)

#invalidate_filternil

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.

Returns:

  • (nil)

#invalidate_sortnil

Updates the sorting for all children.

Call this when the result of the sort function on box is changed due to an external factor.

Returns:

  • (nil)

#max_children_per_lineInteger

The maximum amount of children to request space for consecutively in the given orientation.

Returns:

  • (Integer)

    max-children-per-line

#max_children_per_line=(max_children_per_line) ⇒ Integer

The maximum amount of children to request space for consecutively in the given orientation.

Parameters:

  • max_children_per_line (Integer)

Returns:

  • (Integer)

    max-children-per-line

  • (Integer)

    max-children-per-line

#min_children_per_lineInteger

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.

Returns:

  • (Integer)

    min-children-per-line

#min_children_per_line=(min_children_per_line) ⇒ Integer

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.

Parameters:

  • min_children_per_line (Integer)

Returns:

  • (Integer)

    min-children-per-line

  • (Integer)

    min-children-per-line

#newGtk::Widget

Creates a GtkFlowBox.

Returns:

#row_spacingInteger

The amount of vertical space between two children.

Returns:

  • (Integer)

    row-spacing

#row_spacing=(row_spacing) ⇒ Integer

The amount of vertical space between two children.

Parameters:

  • row_spacing (Integer)

Returns:

  • (Integer)

    row-spacing

  • (Integer)

    row-spacing

#select_allnil

Select all children of box, if the selection mode allows it.

Returns:

  • (nil)

#select_child(child) ⇒ nil

Selects a single child of box, if the selection mode allows it.

Parameters:

Returns:

  • (nil)

#selected_childrenGLib::List

Creates a list of all selected children.

Returns:

  • (GLib::List)

    A #GList containing the Gtk::Widget for each selected child. Free with g_list_free() when done.

#selected_foreach(func, data) ⇒ nil

Calls a function for each selected child.

Note that the selection cannot be modified from within this function.

Parameters:

  • func (Gtk::FlowBoxForeachFunc)

    the function to call for each selected child

  • data (GObject)

    user data to pass to the function

Returns:

  • (nil)

#selection_modeGtk::SelectionMode

The selection mode used by the flow box.

Returns:

#selection_mode=(selection_mode) ⇒ Gtk::SelectionMode

The selection mode used by the flow box.

Parameters:

Returns:

#set_filter_func(filter_func, user_data, destroy) ⇒ nil

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 each 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.

Note that using a filter function is incompatible with using a model (see gtk_flow_box_bind_model()).

Parameters:

  • filter_func (Gtk::FlowBoxFilterFunc)

    callback that lets you filter which children to show

  • user_data (GObject)

    user data passed to filter_func

  • destroy (GLib::DestroyNotify)

    destroy notifier for user_data

Returns:

  • (nil)

#set_sort_func(sort_func, user_data, destroy) ⇒ nil

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.

Note that using a sort function is incompatible with using a model (see gtk_flow_box_bind_model()).

Parameters:

  • sort_func (Gtk::FlowBoxSortFunc)

    the sort function

  • user_data (GObject)

    user data passed to sort_func

  • destroy (GLib::DestroyNotify)

    destroy notifier for user_data

Returns:

  • (nil)

#unselect_allnil

Unselect all children of box, if the selection mode allows it.

Returns:

  • (nil)

#unselect_child(child) ⇒ nil

Unselects a single child of box, if the selection mode allows it.

Parameters:

Returns:

  • (nil)

#vadjustment=(adjustment) ⇒ nil

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.

Parameters:

  • adjustment (Gtk::Adjustment)

    an adjustment which should be adjusted when the focus is moved among the descendents of container

Returns:

  • (nil)