Trait relm4::RelmWidgetExt

source ·
pub trait RelmWidgetExt {
    // Required methods
    fn set_size_group(&self, size_group: &SizeGroup);
    fn toplevel_window(&self) -> Option<Window>;
    fn set_margin_all(&self, margin: i32);
    fn set_class_active(&self, class: &str, active: bool);
    fn inline_css(&self, style: &str);
Expand description

Trait that extends gtk::prelude::WidgetExt.

This trait’s main goal is to reduce redundant code and to provide helpful methods for the widgets macro of relm4-macros.

Required Methods§


fn set_size_group(&self, size_group: &SizeGroup)

Attach widget to a gtk::SizeGroup.


fn toplevel_window(&self) -> Option<Window>

Locate the top level window this widget is attached to.

Equivalent to widget.ancestor(gtk::Window::static_type()), then casting.


fn set_margin_all(&self, margin: i32)

Set margin at start, end, top and bottom all at once.


fn set_class_active(&self, class: &str, active: bool)

Add class name if active is true and remove class name if active is false


fn inline_css(&self, style: &str)

Add inline CSS instructions to a widget.

widget.inline_css("border: 1px solid red");