merged in iced master

This commit is contained in:
bungoboingo 2023-01-02 10:58:07 -08:00
parent 5e4e410b18
commit 942f1c91af
5 changed files with 45 additions and 5 deletions

View file

@ -268,7 +268,7 @@ impl Application for Example {
.spacing(5)
.align_items(Alignment::Center);
let pane_grid = PaneGrid::new(&window.panes, |id, pane| {
let pane_grid = PaneGrid::new(&window.panes, |id, pane, _| {
let is_focused = focus == Some(id);
let pin_button = button(

View file

@ -887,6 +887,10 @@ pub fn run_command<A, E>(
.send_event(Event::CloseWindow(id))
.expect("Send message to event loop");
}
window::Action::Drag => {
let window = windows.get(&id).expect("No window found");
let _res = window.drag_window();
}
window::Action::Resize { width, height } => {
let window = windows.get(&id).expect("No window found");
window.set_inner_size(winit::dpi::LogicalSize {
@ -921,6 +925,22 @@ pub fn run_command<A, E>(
.send_event(Event::Application(tag(mode)))
.expect("Send message to event loop");
}
window::Action::Maximize(value) => {
let window = windows.get(&id).expect("No window found!");
window.set_maximized(value);
}
window::Action::Minimize(value) => {
let window = windows.get(&id).expect("No window found!");
window.set_minimized(value);
}
window::Action::ToggleMaximize => {
let window = windows.get(&id).expect("No window found!");
window.set_maximized(!window.is_maximized());
}
window::Action::ToggleDecorations => {
let window = windows.get(&id).expect("No window found!");
window.set_decorations(!window.is_decorated());
}
},
command::Action::System(action) => match action {
system::Action::QueryInformation(_tag) => {

View file

@ -37,7 +37,7 @@ where
let title = application.title();
let scale_factor = application.scale_factor();
let theme = application.theme();
let appearance = theme.appearance(application.style());
let appearance = theme.appearance(&application.style());
let viewport = {
let physical_size = window.inner_size();
@ -216,6 +216,6 @@ where
// Update theme and appearance
self.theme = application.theme();
self.appearance = self.theme.appearance(application.style());
self.appearance = self.theme.appearance(&application.style());
}
}

View file

@ -863,6 +863,10 @@ pub fn run_command<A, E>(
.send_event(Event::CloseWindow(id))
.expect("Send message to event loop");
}
window::Action::Drag => {
let window = windows.get(&id).expect("No window found");
let _res = window.drag_window();
}
window::Action::Resize { width, height } => {
let window = windows.get(&id).expect("No window found");
window.set_inner_size(winit::dpi::LogicalSize {
@ -897,6 +901,22 @@ pub fn run_command<A, E>(
.send_event(Event::Application(tag(mode)))
.expect("Send message to event loop");
}
window::Action::Maximize(value) => {
let window = windows.get(&id).expect("No window found!");
window.set_maximized(value);
}
window::Action::Minimize(value) => {
let window = windows.get(&id).expect("No window found!");
window.set_minimized(value);
}
window::Action::ToggleMaximize => {
let window = windows.get(&id).expect("No window found!");
window.set_maximized(!window.is_maximized());
}
window::Action::ToggleDecorations => {
let window = windows.get(&id).expect("No window found!");
window.set_decorations(!window.is_decorated());
}
},
command::Action::System(action) => match action {
system::Action::QueryInformation(_tag) => {

View file

@ -35,7 +35,7 @@ where
let title = application.title();
let scale_factor = application.scale_factor();
let theme = application.theme();
let appearance = theme.appearance(application.style());
let appearance = theme.appearance(&application.style());
let viewport = {
let physical_size = window.inner_size();
@ -213,6 +213,6 @@ where
// Update theme and appearance
self.theme = application.theme();
self.appearance = self.theme.appearance(application.style());
self.appearance = self.theme.appearance(&application.style());
}
}