improv: allow overrides for corner radius or blur that apply on creation as well
This commit is contained in:
parent
f268bb86cf
commit
ac4a1ab259
9 changed files with 415 additions and 285 deletions
|
|
@ -81,7 +81,7 @@ impl<Message: Clone + 'static> ContextMenu<'_, Message> {
|
|||
my_state: &mut LocalState,
|
||||
) {
|
||||
if self.window_id != window::Id::NONE && self.on_surface_action.is_some() {
|
||||
use crate::surface::action::destroy_popup;
|
||||
use crate::surface::action::{LiveSettings, destroy_popup};
|
||||
use crate::widget::menu::Menu;
|
||||
use iced_runtime::platform_specific::wayland::popup::{
|
||||
SctkPopupSettings, SctkPositioner,
|
||||
|
|
@ -187,6 +187,7 @@ impl<Message: Clone + 'static> ContextMenu<'_, Message> {
|
|||
let parent = self.window_id;
|
||||
shell.publish((self.on_surface_action.as_ref().unwrap())(
|
||||
crate::surface::action::simple_popup(
|
||||
|| LiveSettings::default(),
|
||||
move || SctkPopupSettings {
|
||||
parent,
|
||||
id,
|
||||
|
|
|
|||
|
|
@ -580,6 +580,8 @@ pub fn update<
|
|||
use iced_runtime::platform_specific::wayland::popup::{
|
||||
SctkPopupSettings, SctkPositioner,
|
||||
};
|
||||
|
||||
use crate::surface::action::LiveSettings;
|
||||
let bounds = layout.bounds();
|
||||
let anchor_rect = Rectangle {
|
||||
x: bounds.x as i32,
|
||||
|
|
@ -606,6 +608,7 @@ pub fn update<
|
|||
let on_surface_action_clone = on_surface_action.clone();
|
||||
let translation = layout.virtual_offset();
|
||||
let get_popup_action = surface::action::simple_popup::<AppMessage>(
|
||||
|| LiveSettings::default(),
|
||||
move || {
|
||||
SctkPopupSettings {
|
||||
parent,
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ where
|
|||
my_state: &mut MenuBarState,
|
||||
) {
|
||||
if self.window_id != window::Id::NONE && self.on_surface_action.is_some() {
|
||||
use crate::surface::action::destroy_popup;
|
||||
use crate::surface::action::{LiveSettings, destroy_popup};
|
||||
use iced_runtime::platform_specific::wayland::popup::{
|
||||
SctkPopupSettings, SctkPositioner,
|
||||
};
|
||||
|
|
@ -501,6 +501,7 @@ where
|
|||
};
|
||||
let parent = self.window_id;
|
||||
shell.publish((surface_action)(crate::surface::action::simple_popup(
|
||||
|| LiveSettings::default(),
|
||||
move || SctkPopupSettings {
|
||||
parent,
|
||||
id,
|
||||
|
|
|
|||
|
|
@ -988,6 +988,8 @@ impl<Message: std::clone::Clone + 'static> Widget<Message, crate::Theme, crate::
|
|||
use iced_runtime::platform_specific::wayland::popup::{
|
||||
SctkPopupSettings, SctkPositioner,
|
||||
};
|
||||
|
||||
use crate::surface::action::LiveSettings;
|
||||
let overlay_offset = Point::ORIGIN - viewport.position();
|
||||
|
||||
let overlay_cursor = cursor.position().unwrap_or_default() - overlay_offset;
|
||||
|
|
@ -1103,6 +1105,7 @@ impl<Message: std::clone::Clone + 'static> Widget<Message, crate::Theme, crate::
|
|||
let parent = self.window_id;
|
||||
shell.publish((self.on_surface_action.as_ref().unwrap())(
|
||||
crate::surface::action::simple_popup(
|
||||
|| LiveSettings::default(),
|
||||
move || SctkPopupSettings {
|
||||
parent,
|
||||
id: popup_id,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ use iced_core::{
|
|||
Vector, Widget, layout, mouse, overlay, renderer, svg, touch,
|
||||
};
|
||||
|
||||
use crate::surface::action::LiveSettings;
|
||||
|
||||
pub use super::{Catalog, Style};
|
||||
|
||||
/// Internally defines different button widget variants.
|
||||
|
|
@ -521,8 +523,15 @@ pub fn update<'a, Message: Clone + 'static, TopLevelMessage: Clone + 'static>(
|
|||
> = Box::new(move || s(bounds));
|
||||
let boxed: Box<dyn Any + Send + Sync + 'static> =
|
||||
Box::new(boxed);
|
||||
|
||||
let boxed_live: Box<
|
||||
dyn Fn() -> LiveSettings + Send + Sync + 'static,
|
||||
> = Box::new(move || Default::default());
|
||||
let boxed_live: Box<dyn Any + Send + Sync + 'static> =
|
||||
Box::new(boxed_live);
|
||||
crate::surface::Action::Popup(
|
||||
Arc::new(boxed),
|
||||
Arc::new(boxed_live),
|
||||
Some({
|
||||
let boxed: Box<
|
||||
dyn Fn() -> crate::Element<
|
||||
|
|
@ -553,9 +562,14 @@ pub fn update<'a, Message: Clone + 'static, TopLevelMessage: Clone + 'static>(
|
|||
+ 'static,
|
||||
> = Box::new(move || s(bounds));
|
||||
let boxed: Box<dyn Any + Send + Sync + 'static> = Box::new(boxed);
|
||||
let boxed_live: Box<dyn Fn() -> LiveSettings + Send + Sync + 'static> =
|
||||
Box::new(move || Default::default());
|
||||
let boxed_live: Box<dyn Any + Send + Sync + 'static> =
|
||||
Box::new(boxed_live);
|
||||
|
||||
let sm = crate::surface::Action::Popup(
|
||||
Arc::new(boxed),
|
||||
Arc::new(boxed_live),
|
||||
Some({
|
||||
let boxed: Box<
|
||||
dyn Fn() -> crate::Element<
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue