[−][src]Trait gtk::FlowBoxExt
Required methods
fn bind_model<P: IsA<ListModel>, Q: Fn(&Object) -> Widget + 'static>(
&self,
model: Option<&P>,
create_widget_func: Q
)
&self,
model: Option<&P>,
create_widget_func: Q
)
Binds model
to self
.
If self
was already bound to a model, that previous binding is
destroyed.
The contents of self
are cleared and then filled with widgets that
represent items from model
. self
is updated whenever model
changes.
If model
is None
, self
is left empty.
It is undefined to add or remove widgets directly (for example, with
FlowBoxExt::insert
or ContainerExt::add
) while self
is bound to a
model.
Note that using a model is incompatible with the filtering and sorting
functionality in FlowBox
. When using a model, filtering and sorting
should be implemented by the model.
Feature: v3_18
model
the gio::ListModel
to be bound to self
create_widget_func
a function that creates widgets for items
user_data
user data passed to create_widget_func
user_data_free_func
function for freeing user_data
fn get_activate_on_single_click(&self) -> bool
Returns whether children activate on single clicks.
Returns
true
if children are activated on single click,
false
otherwise
fn get_child_at_index(&self, idx: i32) -> Option<FlowBoxChild>
Gets the nth child in the self
.
idx
the position of the child
Returns
the child widget, which will
always be a FlowBoxChild
or None
in case no child widget
with the given index exists.
fn get_child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>
Gets the child in the (x
, y
) position.
Feature: v3_22_6
x
the x coordinate of the child
y
the y coordinate of the child
Returns
the child widget, which will
always be a FlowBoxChild
or None
in case no child widget
exists for the given x and y coordinates.
fn get_column_spacing(&self) -> u32
fn get_homogeneous(&self) -> bool
Returns whether the box is homogeneous (all children are the
same size). See BoxExt::set_homogeneous
.
Returns
true
if the box is homogeneous.
fn get_max_children_per_line(&self) -> u32
fn get_min_children_per_line(&self) -> u32
fn get_row_spacing(&self) -> u32
fn get_selected_children(&self) -> Vec<FlowBoxChild>
Creates a list of all selected children.
Returns
A glib::List
containing the Widget
for each selected child.
Free with glib::List::free
when done.
fn get_selection_mode(&self) -> SelectionMode
fn insert<P: IsA<Widget>>(&self, widget: &P, position: i32)
Inserts the widget
into self
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 ContainerExt::add
.
If position
is -1, or larger than the total number of children
in the self
, then the widget
will be appended to the end.
widget
the Widget
to add
position
the position to insert child
in
fn invalidate_filter(&self)
Updates the filtering for all children.
Call this function when the result of the filter
function on the self
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.
fn invalidate_sort(&self)
Updates the sorting for all children.
Call this when the result of the sort function on
self
is changed due to an external factor.
fn select_all(&self)
Select all children of self
, if the selection
mode allows it.
fn select_child<P: IsA<FlowBoxChild>>(&self, child: &P)
fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P)
Calls a function for each selected child.
Note that the selection cannot be modified from within this function.
func
the function to call for each selected child
data
user data to pass to the function
fn set_activate_on_single_click(&self, single: bool)
If single
is true
, children will be activated when you click
on them, otherwise you need to double-click.
single
true
to emit child-activated on a single click
fn set_column_spacing(&self, spacing: u32)
Sets the horizontal space to add between children.
See the FlowBox:column-spacing
property.
spacing
the spacing to use
fn set_filter_func(
&self,
filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>
)
&self,
filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>
)
By setting a filter function on the self
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
FlowBoxChildExt::changed
) or when FlowBoxExt::invalidate_filter
is called.
Note that using a filter function is incompatible with using a model
(see FlowBoxExt::bind_model
).
filter_func
callback that lets you filter which children to show
user_data
user data passed to filter_func
destroy
destroy notifier for user_data
fn set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)
Hooks up an adjustment to focus handling in self
.
The adjustment is also used for autoscrolling during
rubberband selection. See ScrolledWindowExt::get_hadjustment
for a typical way of obtaining the adjustment, and
FlowBoxExt::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.
adjustment
an adjustment which should be adjusted
when the focus is moved among the descendents of container
fn set_homogeneous(&self, homogeneous: bool)
Sets the FlowBox:homogeneous
property of self
, controlling
whether or not all children of self
are given equal space
in the box.
homogeneous
true
to create equal allotments,
false
for variable allotments
fn set_max_children_per_line(&self, n_children: u32)
Sets the maximum number of children to request and
allocate space for in self
’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.
n_children
the maximum number of children per line
fn set_min_children_per_line(&self, n_children: u32)
Sets the minimum number of children to line up
in self
’s orientation before flowing.
n_children
the minimum number of children per line
fn set_row_spacing(&self, spacing: u32)
Sets the vertical space to add between children.
See the FlowBox:row-spacing
property.
spacing
the spacing to use
fn set_selection_mode(&self, mode: SelectionMode)
fn set_sort_func(
&self,
sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>
)
&self,
sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>
)
By setting a sort function on the self
, 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
FlowBoxChildExt::changed
) and when FlowBoxExt::invalidate_sort
is called.
Note that using a sort function is incompatible with using a model
(see FlowBoxExt::bind_model
).
sort_func
the sort function
user_data
user data passed to sort_func
destroy
destroy notifier for user_data
fn set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)
Hooks up an adjustment to focus handling in self
.
The adjustment is also used for autoscrolling during
rubberband selection. See ScrolledWindowExt::get_vadjustment
for a typical way of obtaining the adjustment, and
FlowBoxExt::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.
adjustment
an adjustment which should be adjusted
when the focus is moved among the descendents of container
fn unselect_all(&self)
Unselect all children of self
, if the selection
mode allows it.
fn unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P)
fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::activate-cursor-child signal is a
[keybinding signal][BindingSignal
]
which gets emitted when the user activates the box_
.
fn emit_activate_cursor_child(&self)
fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::child-activated signal is emitted when a child has been activated by the user.
child
the child that is activated
fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::move-cursor signal is a
[keybinding signal][BindingSignal
]
which gets emitted when the user initiates a cursor movement.
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.
- Arrow keys move by individual children
- Home/End keys move to the ends of the box
- PageUp/PageDown keys move vertically by pages
step
the granularity fo the move, as a MovementStep
count
the number of step
units to move
Returns
true
to stop other handlers from being invoked for the event.
false
to propagate the event further.
fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool
fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
The ::select-all signal is a
[keybinding signal][BindingSignal
]
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.
fn emit_select_all(&self)
fn connect_selected_children_changed<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::selected-children-changed signal is emitted when the set of selected children changes.
Use FlowBoxExt::selected_foreach
or
FlowBoxExt::get_selected_children
to obtain the
selected children.
fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
The ::toggle-cursor-child signal is a
[keybinding signal][BindingSignal
]
which toggles the selection of the child that has the focus.
The default binding for this signal is Ctrl-Space.
fn emit_toggle_cursor_child(&self)
fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
The ::unselect-all signal is a
[keybinding signal][BindingSignal
]
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.
fn emit_unselect_all(&self)
fn connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
fn connect_property_column_spacing_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
fn connect_property_homogeneous_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
fn connect_property_max_children_per_line_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
fn connect_property_min_children_per_line_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
fn connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
fn connect_property_selection_mode_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
&self,
f: F
) -> SignalHandlerId
Implementors
impl<O: IsA<FlowBox>> FlowBoxExt for O
[src]
fn bind_model<P: IsA<ListModel>, Q: Fn(&Object) -> Widget + 'static>(
&self,
model: Option<&P>,
create_widget_func: Q
)
[src]
&self,
model: Option<&P>,
create_widget_func: Q
)
fn get_activate_on_single_click(&self) -> bool
[src]
fn get_child_at_index(&self, idx: i32) -> Option<FlowBoxChild>
[src]
fn get_child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild>
[src]
fn get_column_spacing(&self) -> u32
[src]
fn get_homogeneous(&self) -> bool
[src]
fn get_max_children_per_line(&self) -> u32
[src]
fn get_min_children_per_line(&self) -> u32
[src]
fn get_row_spacing(&self) -> u32
[src]
fn get_selected_children(&self) -> Vec<FlowBoxChild>
[src]
fn get_selection_mode(&self) -> SelectionMode
[src]
fn insert<P: IsA<Widget>>(&self, widget: &P, position: i32)
[src]
fn invalidate_filter(&self)
[src]
fn invalidate_sort(&self)
[src]
fn select_all(&self)
[src]
fn select_child<P: IsA<FlowBoxChild>>(&self, child: &P)
[src]
fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P)
[src]
fn set_activate_on_single_click(&self, single: bool)
[src]
fn set_column_spacing(&self, spacing: u32)
[src]
fn set_filter_func(
&self,
filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>
)
[src]
&self,
filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>
)
fn set_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)
[src]
fn set_homogeneous(&self, homogeneous: bool)
[src]
fn set_max_children_per_line(&self, n_children: u32)
[src]
fn set_min_children_per_line(&self, n_children: u32)
[src]
fn set_row_spacing(&self, spacing: u32)
[src]
fn set_selection_mode(&self, mode: SelectionMode)
[src]
fn set_sort_func(
&self,
sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>
)
[src]
&self,
sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>
)
fn set_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)
[src]
fn unselect_all(&self)
[src]
fn unselect_child<P: IsA<FlowBoxChild>>(&self, child: &P)
[src]
fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn emit_activate_cursor_child(&self)
[src]
fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool
[src]
fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
[src]
fn emit_select_all(&self)
[src]
fn connect_selected_children_changed<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn emit_toggle_cursor_child(&self)
[src]
fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
[src]
fn emit_unselect_all(&self)
[src]
fn connect_property_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_column_spacing_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_homogeneous_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_max_children_per_line_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_min_children_per_line_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_row_spacing_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId
fn connect_property_selection_mode_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
[src]
&self,
f: F
) -> SignalHandlerId