[][src]Derive Macro woab::Removable

#[derive(Removable)]
{
    // Attributes available to this derive:
    #[removable]
}

Make the actor remove itself and its widgets when it gets the woab::Remove message.

The mandatory attribute removable must be an expression that resolves to a GTK widget that has a parent. When the woab::Remove message is received, this actor will remove that widget from its parent and close itself.

#[derive(woab::Removable)]
#[removable(self.widgets.list_box_row)]
struct RowActor {
    widgets: RowWidgets,
}

fn create_the_row(factories: &Factories, list_box: &gtk::ListBox) -> actix::Addr<RowActor> {
    factories.list_box_row.build().actor(|_, widgets| {
        list_box.add(&widgets.list_box_row);
        RowActor {
            widgets,
        }
    }).unwrap()
}

fn remove_the_row(row: &actix::Addr<RowActor>) {
    row.do_send(woab::Remove);
}