cosmic::app

Trait Application

Source
pub trait Application
where Self: Sized + 'static,
{ type Executor: Executor; type Flags; type Message: Clone + Debug + Send + 'static; const APP_ID: &'static str;
Show 27 methods // Required methods fn core(&self) -> &Core; fn core_mut(&mut self) -> &mut Core; fn init(core: Core, flags: Self::Flags) -> (Self, Task<Self::Message>); fn view(&self) -> Element<'_, Self::Message>; // Provided methods fn context_drawer(&self) -> Option<ContextDrawer<'_, Self::Message>> { ... } fn dialog(&self) -> Option<Element<'_, Self::Message>> { ... } fn footer(&self) -> Option<Element<'_, Self::Message>> { ... } fn header_start(&self) -> Vec<Element<'_, Self::Message>> { ... } fn header_center(&self) -> Vec<Element<'_, Self::Message>> { ... } fn header_end(&self) -> Vec<Element<'_, Self::Message>> { ... } fn nav_bar(&self) -> Option<Element<'_, Message<Self::Message>>> { ... } fn nav_context_menu( &self, id: Id, ) -> Option<Vec<Tree<'_, Message<Self::Message>>>> { ... } fn nav_model(&self) -> Option<&Model> { ... } fn on_app_exit(&mut self) -> Option<Self::Message> { ... } fn on_close_requested(&self, id: Id) -> Option<Self::Message> { ... } fn on_context_drawer(&mut self) -> Task<Self::Message> { ... } fn on_escape(&mut self) -> Task<Self::Message> { ... } fn on_nav_select(&mut self, id: Id) -> Task<Self::Message> { ... } fn on_nav_context(&mut self, id: Id) -> Task<Self::Message> { ... } fn on_search(&mut self) -> Task<Self::Message> { ... } fn on_window_resize(&mut self, id: Id, width: f32, height: f32) { ... } fn subscription(&self) -> Subscription<Self::Message> { ... } fn update(&mut self, message: Self::Message) -> Task<Self::Message> { ... } fn system_theme_update( &mut self, keys: &[&'static str], new_theme: &Theme, ) -> Task<Self::Message> { ... } fn system_theme_mode_update( &mut self, keys: &[&'static str], new_theme: &ThemeMode, ) -> Task<Self::Message> { ... } fn view_window(&self, id: Id) -> Element<'_, Self::Message> { ... } fn style(&self) -> Option<Appearance> { ... }
}
Expand description

An interactive cross-platform COSMIC application.

Required Associated Constants§

Source

const APP_ID: &'static str

An ID that uniquely identifies the application. The standard is to pick an ID based on a reverse-domain name notation. IE: com.system76.Settings

Required Associated Types§

Source

type Executor: Executor

Default async executor to use with the app.

Source

type Flags

Argument received [Application::new].

Source

type Message: Clone + Debug + Send + 'static

Message type specific to our app.

Required Methods§

Source

fn core(&self) -> &Core

Grants access to the COSMIC Core.

Source

fn core_mut(&mut self) -> &mut Core

Grants access to the COSMIC Core.

Source

fn init(core: Core, flags: Self::Flags) -> (Self, Task<Self::Message>)

Creates the application, and optionally emits task on initialize.

Source

fn view(&self) -> Element<'_, Self::Message>

Constructs the view for the main window.

Provided Methods§

Source

fn context_drawer(&self) -> Option<ContextDrawer<'_, Self::Message>>

Displays a context drawer on the side of the application window when Some. Use the ApplicationExt::set_show_context function for this to take effect.

Source

fn dialog(&self) -> Option<Element<'_, Self::Message>>

Displays a dialog in the center of the application window when Some.

Source

fn footer(&self) -> Option<Element<'_, Self::Message>>

Displays a footer at the bottom of the application window when Some.

Source

fn header_start(&self) -> Vec<Element<'_, Self::Message>>

Attaches elements to the start section of the header.

Source

fn header_center(&self) -> Vec<Element<'_, Self::Message>>

Attaches elements to the center of the header.

Source

fn header_end(&self) -> Vec<Element<'_, Self::Message>>

Attaches elements to the end section of the header.

Source

fn nav_bar(&self) -> Option<Element<'_, Message<Self::Message>>>

Allows overriding the default nav bar widget.

Source

fn nav_context_menu( &self, id: Id, ) -> Option<Vec<Tree<'_, Message<Self::Message>>>>

Shows a context menu for the active nav bar item.

Source

fn nav_model(&self) -> Option<&Model>

Allows COSMIC to integrate with your application’s nav_bar::Model.

Source

fn on_app_exit(&mut self) -> Option<Self::Message>

Called before closing the application. Returning a message will override closing windows.

Source

fn on_close_requested(&self, id: Id) -> Option<Self::Message>

Called when a window requests to be closed.

Source

fn on_context_drawer(&mut self) -> Task<Self::Message>

Source

fn on_escape(&mut self) -> Task<Self::Message>

Called when the escape key is pressed.

Source

fn on_nav_select(&mut self, id: Id) -> Task<Self::Message>

Called when a navigation item is selected.

Source

fn on_nav_context(&mut self, id: Id) -> Task<Self::Message>

Called when a context menu is requested for a navigation item.

Called when the search function is requested.

Source

fn on_window_resize(&mut self, id: Id, width: f32, height: f32)

Called when a window is resized.

Source

fn subscription(&self) -> Subscription<Self::Message>

Event sources that are to be listened to.

Source

fn update(&mut self, message: Self::Message) -> Task<Self::Message>

Respond to an application-specific message.

Source

fn system_theme_update( &mut self, keys: &[&'static str], new_theme: &Theme, ) -> Task<Self::Message>

Respond to a system theme change

Source

fn system_theme_mode_update( &mut self, keys: &[&'static str], new_theme: &ThemeMode, ) -> Task<Self::Message>

Respond to a system theme mode change

Source

fn view_window(&self, id: Id) -> Element<'_, Self::Message>

Constructs views for other windows.

Source

fn style(&self) -> Option<Appearance>

Overrides the default style for applications

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§