pub trait WidgetPlus {
    // Required methods
    fn set_margin_all(&self, margin: i32);
    fn set_class_active(&self, class: &str, active: bool);
    fn inline_css(&self, style_data: &[u8]);
    fn try_remove(&self, widget: &impl IsA<Widget>) -> bool;
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_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_data: &[u8])

Add inline CSS instructions to a widget.

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

fn try_remove(&self, widget: &impl IsA<Widget>) -> bool

Try to remove a widget from a widget.

Returns true if the removal is supported on the type of widget. This doesn’t mean that the widget was actually removed.