pub struct ShellControl { /* private fields */ }Expand description
Handle for runtime control of shell operations
Cloneable and can be sent across threads for triggering shell operations.
Implementations§
Source§impl ShellControl
impl ShellControl
pub fn new(sender: Sender<ShellCommand>) -> Self
pub fn popups(&self) -> PopupShell
Sourcepub fn close_popup(&self, handle: PopupHandle) -> Result<()>
pub fn close_popup(&self, handle: PopupHandle) -> Result<()>
Closes a specific popup by its handle
Use this when you need to close a specific popup that you opened previously.
The handle is returned by crate::PopupShell::show.
§Example
// Store handle when showing popup
let handle = context.popups().builder("MenuPopup").show()?;
// Later, close it
control.close_popup(handle)?;Sourcepub fn resize_popup(
&self,
handle: PopupHandle,
width: f32,
height: f32,
) -> Result<()>
pub fn resize_popup( &self, handle: PopupHandle, width: f32, height: f32, ) -> Result<()>
Resizes a popup to the specified dimensions
Dynamically changes the size of an active popup. This is typically used in response to content changes or user interaction.
For automatic content-based sizing, use PopupSize::Content with the
resize_on callback configuration in PopupConfig.
§Example
shell.on("Main", "expand_menu", |control| {
// Assuming we have the popup handle stored somewhere
control.resize_popup(menu_handle, 400.0, 600.0)?;
Value::Void
});Sourcepub fn request_redraw(&self) -> Result<()>
pub fn request_redraw(&self) -> Result<()>
Requests a redraw of all surfaces
Sourcepub fn surface_instance(&self, id: &SurfaceInstanceId) -> SurfaceControlHandle
pub fn surface_instance(&self, id: &SurfaceInstanceId) -> SurfaceControlHandle
Returns a control handle for a specific surface instance
Sourcepub fn surface_by_handle(&self, handle: SurfaceHandle) -> SurfaceControlHandle
pub fn surface_by_handle(&self, handle: SurfaceHandle) -> SurfaceControlHandle
Returns a control handle for all instances of a surface by handle
Sourcepub fn surface_by_name(&self, name: impl Into<String>) -> SurfaceControlHandle
pub fn surface_by_name(&self, name: impl Into<String>) -> SurfaceControlHandle
Returns a control handle for all surfaces with the given name
Sourcepub fn surface_by_name_and_output(
&self,
name: impl Into<String>,
output: OutputHandle,
) -> SurfaceControlHandle
pub fn surface_by_name_and_output( &self, name: impl Into<String>, output: OutputHandle, ) -> SurfaceControlHandle
Returns a control handle for surfaces with the given name on a specific output
Sourcepub fn surface(&self, name: impl Into<String>) -> SurfaceControlHandle
pub fn surface(&self, name: impl Into<String>) -> SurfaceControlHandle
Alias for surface_by_name
Trait Implementations§
Source§impl Clone for ShellControl
impl Clone for ShellControl
Source§fn clone(&self) -> ShellControl
fn clone(&self) -> ShellControl
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ShellControl
impl RefUnwindSafe for ShellControl
impl !Send for ShellControl
impl !Sync for ShellControl
impl Unpin for ShellControl
impl UnwindSafe for ShellControl
Blanket Implementations§
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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> 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 more