Enum cosmic::iced_runtime::window::Action
source · pub enum Action {
Show 30 variants
Open(Id, Settings, Sender<Id>),
Close(Id),
GetOldest(Sender<Option<Id>>),
GetLatest(Sender<Option<Id>>),
Drag(Id),
Resize(Id, Size),
GetSize(Id, Sender<Size>),
GetMaximized(Id, Sender<bool>),
Maximize(Id, bool),
GetMinimized(Id, Sender<Option<bool>>),
Minimize(Id, bool),
GetPosition(Id, Sender<Option<Point>>),
GetScaleFactor(Id, Sender<f32>),
Move(Id, Point),
ChangeMode(Id, Mode),
GetMode(Id, Sender<Mode>),
ToggleMaximize(Id),
ToggleDecorations(Id),
RequestUserAttention(Id, Option<UserAttention>),
GainFocus(Id),
ChangeLevel(Id, Level),
ShowSystemMenu(Id),
GetRawId(Id, Sender<u64>),
ChangeIcon(Id, Icon),
RunWithHandle(Id, Box<dyn FnOnce(WindowHandle<'_>) + Send>),
Screenshot(Id, Sender<Screenshot>),
EnableMousePassthrough(Id),
DisableMousePassthrough(Id),
EnableBlur(Id),
DisableBlur(Id),
}
Expand description
An operation to be performed on some window.
Variants§
Open(Id, Settings, Sender<Id>)
Opens a new window with some Settings
.
Close(Id)
Close the window and exits the application.
GetOldest(Sender<Option<Id>>)
Gets the Id
of the oldest window.
GetLatest(Sender<Option<Id>>)
Gets the Id
of the latest window.
Drag(Id)
Move the window with the left mouse button until the button is released.
There’s no guarantee that this will work unless the left mouse button was pressed immediately before this function is called.
Resize(Id, Size)
Resize the window to the given logical dimensions.
GetSize(Id, Sender<Size>)
Get the current logical dimensions of the window.
GetMaximized(Id, Sender<bool>)
Get if the current window is maximized or not.
Maximize(Id, bool)
Set the window to maximized or back
GetMinimized(Id, Sender<Option<bool>>)
Minimize(Id, bool)
Set the window to minimized or back
GetPosition(Id, Sender<Option<Point>>)
Get the current logical coordinates of the window.
GetScaleFactor(Id, Sender<f32>)
Get the current scale factor (DPI) of the window.
Move(Id, Point)
Move the window to the given logical coordinates.
Unsupported on Wayland.
ChangeMode(Id, Mode)
Change the Mode
of the window.
GetMode(Id, Sender<Mode>)
Get the current Mode
of the window.
ToggleMaximize(Id)
Toggle the window to maximized or back
ToggleDecorations(Id)
RequestUserAttention(Id, Option<UserAttention>)
Request user attention to the window, this has no effect if the application
is already focused. How requesting for user attention manifests is platform dependent,
see UserAttention
for details.
Providing None
will unset the request for user attention. Unsetting the request for
user attention might not be done automatically by the WM when the window receives input.
§Platform-specific
- iOS / Android / Web: Unsupported.
- macOS:
None
has no effect. - X11: Requests for user attention must be manually cleared.
- Wayland: Requires
xdg_activation_v1
protocol,None
has no effect.
GainFocus(Id)
Bring the window to the front and sets input focus. Has no effect if the window is already in focus, minimized, or not visible.
This method steals input focus from other applications. Do not use this method unless you are certain that’s what the user wants. Focus stealing can cause an extremely disruptive user experience.
§Platform-specific
- Web / Wayland: Unsupported.
ChangeLevel(Id, Level)
Change the window Level
.
ShowSystemMenu(Id)
Show the system menu at cursor position.
§Platform-specific
Android / iOS / macOS / Orbital / Web / X11: Unsupported.
GetRawId(Id, Sender<u64>)
Get the raw identifier unique to the window.
ChangeIcon(Id, Icon)
Change the window Icon
.
On Windows and X11, this is typically the small icon in the top-left corner of the titlebar.
§Platform-specific
-
Web / Wayland / macOS: Unsupported.
-
Windows: Sets
ICON_SMALL
. The base size for a window icon is 16x16, but it’s recommended to account for screen scaling and pick a multiple of that, i.e. 32x32. -
X11: Has no universal guidelines for icon sizes, so you’re at the whims of the WM. That said, it’s usually in the same ballpark as on Windows.
RunWithHandle(Id, Box<dyn FnOnce(WindowHandle<'_>) + Send>)
Runs the closure with the native window handle of the window with the given Id
.
Screenshot(Id, Sender<Screenshot>)
Screenshot the viewport of the window.
EnableMousePassthrough(Id)
Enables mouse passthrough for the given window.
This disables mouse events for the window and passes mouse events through to whatever window is underneath.
DisableMousePassthrough(Id)
Disable mouse passthrough for the given window.
This enables mouse events for the window and stops mouse events from being passed to whatever is underneath.
EnableBlur(Id)
Enable window blur.
DisableBlur(Id)
Disable window blur.
Auto Trait Implementations§
impl Freeze for Action
impl !RefUnwindSafe for Action
impl Send for Action
impl !Sync for Action
impl Unpin for Action
impl !UnwindSafe for Action
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
source§fn into_color(self) -> U
fn into_color(self) -> U
source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more