pub struct AsyncComponentBuilder<C: AsyncComponent> {
pub root: C::Root,
/* private fields */
}Expand description
A component that is ready for docking and launch.
Fields§
§root: C::RootThe root widget of the component.
Implementations§
Source§impl<C: AsyncComponent> AsyncComponentBuilder<C>
impl<C: AsyncComponent> AsyncComponentBuilder<C>
Sourcepub fn update_root<F: FnOnce(&mut C::Root)>(self, func: F) -> Self
pub fn update_root<F: FnOnce(&mut C::Root)>(self, func: F) -> Self
Configure the root widget before launching.
Sourcepub const fn widget(&self) -> &C::Root
pub const fn widget(&self) -> &C::Root
Access the root widget before the component is initialized.
Sourcepub fn priority(self, priority: Priority) -> Self
pub fn priority(self, priority: Priority) -> Self
Change the priority at which the messages of this component are handled.
- Use
glib::Priority::HIGHfor high priority event sources. - Use
glib::Priority::LOWfor very low priority background tasks. - Use
glib::Priority::DEFAULT_IDLEfor default priority idle functions. - Use
glib::Priority::HIGH_IDLEfor high priority idle functions.
Source§impl<C: AsyncComponent> AsyncComponentBuilder<C>
impl<C: AsyncComponent> AsyncComponentBuilder<C>
Sourcepub fn attach_to<T: RelmContainerExt<Child = Widget>>(
self,
container: &T,
) -> Self
pub fn attach_to<T: RelmContainerExt<Child = Widget>>( self, container: &T, ) -> Self
Attach the component’s root widget to a given container.
Source§impl<C: AsyncComponent> AsyncComponentBuilder<C>
impl<C: AsyncComponent> AsyncComponentBuilder<C>
Sourcepub fn transient_for(self, widget: impl AsRef<Widget>) -> Self
pub fn transient_for(self, widget: impl AsRef<Widget>) -> Self
Set the component’s root widget transient for a given window.
This function doesn’t require a gtk::Window as parameter,
but instead uses RelmWidgetExt::toplevel_window() to retrieve the toplevel
window of any gtk::Widget.
Therefore, you don’t have to pass a window to every component.
If the root widget is a native dialog, such as gtk::FileChooserNative,
you should use transient_for_native instead.
Source§impl<C: AsyncComponent> AsyncComponentBuilder<C>
impl<C: AsyncComponent> AsyncComponentBuilder<C>
Sourcepub fn transient_for_native(self, widget: impl AsRef<Widget>) -> Self
pub fn transient_for_native(self, widget: impl AsRef<Widget>) -> Self
Set the component’s root widget transient for a given window.
This function doesn’t require a gtk::Window as parameter,
but instead uses RelmWidgetExt::toplevel_window() to retrieve the toplevel
window of any gtk::Widget.
Therefore, you don’t have to pass a window to every component.
Applicable to native dialogs only, such as gtk::FileChooserNative.
If the root widget is a non-native dialog,
you should use transient_for instead.
Source§impl<C: AsyncComponent> AsyncComponentBuilder<C>
impl<C: AsyncComponent> AsyncComponentBuilder<C>
Sourcepub fn launch(self, payload: C::Init) -> AsyncConnector<C>
pub fn launch(self, payload: C::Init) -> AsyncConnector<C>
Starts the component, passing ownership to a future attached to a gtk::glib::MainContext.
Sourcepub fn launch_with_broker(
self,
payload: C::Init,
broker: &MessageBroker<C::Input>,
) -> AsyncConnector<C>
pub fn launch_with_broker( self, payload: C::Init, broker: &MessageBroker<C::Input>, ) -> AsyncConnector<C>
Similar to launch() but also initializes a MessageBroker.
§Panics
This method panics if the message broker was already initialized in another launch.