gtk4::prelude

Trait FlowBoxChildExt

source
pub trait FlowBoxChildExt:
    IsA<FlowBoxChild>
    + Sealed
    + 'static {
    // Provided methods
    fn changed(&self) { ... }
    fn child(&self) -> Option<Widget> { ... }
    fn index(&self) -> i32 { ... }
    fn is_selected(&self) -> bool { ... }
    fn set_child(&self, child: Option<&impl IsA<Widget>>) { ... }
    fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
    fn emit_activate(&self) { ... }
    fn connect_child_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all FlowBoxChild methods.

§Implementors

FlowBoxChild

Provided Methods§

source

fn changed(&self)

Marks @self 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 FlowBox::invalidate_sort() on any model change, but that is more expensive.

source

fn child(&self) -> Option<Widget>

Gets the child widget of @self.

§Returns

the child widget of @self

source

fn index(&self) -> i32

Gets the current index of the @self in its FlowBox container.

§Returns

the index of the @self, or -1 if the @self is not in a flow box

source

fn is_selected(&self) -> bool

Returns whether the @self is currently selected in its FlowBox container.

§Returns

true if @self is selected

source

fn set_child(&self, child: Option<&impl IsA<Widget>>)

Sets the child widget of @self.

§child

the child widget

source

fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Emitted when the user activates a child widget in a FlowBox.

This can happen either by clicking or double-clicking, or via a keybinding.

This is a keybinding signal, but it can be used by applications for their own purposes.

The default bindings are Space and Enter.

source

fn emit_activate(&self)

source

fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

Object Safety§

This trait is not object safe.

Implementors§