Skip to content

Commit

Permalink
feat: prepair for open new window
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers committed Aug 5, 2024
1 parent bd8c467 commit a9daa28
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions iced_examples/counter_muti/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ impl MultiApplication for Counter {
type Flags = ();
type Theme = Theme;
type Executor = iced::executor::Default;
type WindowInfo = ();

fn new(_flags: ()) -> (Self, Command<Message>) {
(
Expand Down
11 changes: 11 additions & 0 deletions iced_layershell/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ pub trait MultiApplication: Sized {
/// The data needed to initialize your [`Application`].
type Flags;

type WindowInfo;

type Theme: Default + StyleSheet;

/// Initializes the [`Application`] with the flags provided to
Expand All @@ -238,6 +240,9 @@ pub trait MultiApplication: Sized {
/// title of your window when necessary.
fn namespace(&self) -> String;

fn id_info(&self, _id: iced_core::window::Id) -> Option<Self::WindowInfo> {
None
}
/// Handles a __message__ and updates the state of the [`Application`].
///
/// This is where you define your __update logic__. All the __messages__,
Expand Down Expand Up @@ -356,6 +361,8 @@ where
{
type Flags = A::Flags;

type WindowInfo = A::WindowInfo;

fn new(flags: Self::Flags) -> (Self, Command<A::Message>) {
let (app, command) = A::new(flags);

Expand All @@ -381,4 +388,8 @@ where
fn scale_factor(&self, window: iced::window::Id) -> f64 {
self.0.scale_factor(window)
}

fn id_info(&self, id: iced_core::window::Id) -> Option<Self::WindowInfo> {
self.0.id_info(id)
}
}
4 changes: 4 additions & 0 deletions iced_layershell/src/multi_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ where
/// The data needed to initialize your [`Application`].
type Flags;

type WindowInfo;

/// Initializes the [`Application`] with the flags provided to
/// [`run`] as part of the [`Settings`].
///
Expand All @@ -76,6 +78,8 @@ where
self.namespace()
}

fn id_info(&self, _id: iced_core::window::Id) -> Option<Self::WindowInfo>;

/// Returns the current [`Theme`] of the [`Application`].
fn theme(&self) -> Self::Theme;

Expand Down

0 comments on commit a9daa28

Please sign in to comment.