Trait cosmic::app::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, Command<Message<Self::Message>>); fn view(&self) -> Element<'_, Self::Message>; // Provided methods fn context_drawer(&self) -> Option<Element<'_, Self::Message>> { ... } fn dialog(&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 main_window_id(&self) -> Id { ... } 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) { ... } fn on_close_requested(&self, id: Id) -> Option<Self::Message> { ... } fn on_context_drawer(&mut self) -> Command<Message<Self::Message>> { ... } fn on_escape(&mut self) -> Command<Message<Self::Message>> { ... } fn on_nav_select(&mut self, id: Id) -> Command<Message<Self::Message>> { ... } fn on_nav_context(&mut self, id: Id) -> Command<Message<Self::Message>> { ... } fn on_search(&mut self) -> Command<Message<Self::Message>> { ... } fn on_window_resize(&mut self, id: Id, width: u32, height: u32) { ... } fn subscription(&self) -> Subscription<Self::Message> { ... } fn update( &mut self, message: Self::Message ) -> Command<Message<Self::Message>> { ... } fn system_theme_update( &mut self, keys: &[&'static str], new_theme: &Theme ) -> Command<Message<Self::Message>> { ... } fn system_theme_mode_update( &mut self, keys: &[&'static str], new_theme: &ThemeMode ) -> Command<Message<Self::Message>> { ... } fn view_window(&self, id: Id) -> Element<'_, Self::Message> { ... } fn style(&self) -> Option<<Theme as StyleSheet>::Style> { ... }
}
Expand description

An interactive cross-platform COSMIC application.

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 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 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, Command<Message<Self::Message>>)

Creates the application, and optionally emits command on initialize.

source

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

Constructs the view for the main window.

Provided Methods§

source

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

Displays a context drawer on the side of the application window when Some.

source

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

Displays a dialog in the center 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 main_window_id(&self) -> Id

Get the main window::Id, which is window::Id::MAIN by default

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)

Called before closing the application.

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) -> Command<Message<Self::Message>>

source

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

Called when the escape key is pressed.

source

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

Called when a navigation item is selected.

source

fn on_nav_context(&mut self, id: Id) -> Command<Message<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: u32, height: u32)

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) -> Command<Message<Self::Message>>

Respond to an application-specific message.

source

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

Respond to a system theme change

source

fn system_theme_mode_update( &mut self, keys: &[&'static str], new_theme: &ThemeMode ) -> Command<Message<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<<Theme as StyleSheet>::Style>

Overrides the default style for applications

Object Safety§

This trait is not object safe.

Implementors§