logo
pub trait WidgetPlus {
    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

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

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

Add inline CSS instructions to a widget.

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

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.

Implementors