pub trait Panel<R: Runtime = Wry>: Send + Sync {
Show 40 methods
// Required methods
fn show(&self);
fn hide(&self);
fn to_window(&self) -> Option<WebviewWindow<R>>;
fn as_panel(&self) -> &NSPanel;
fn label(&self) -> &str;
fn as_any(&self) -> &dyn Any;
fn set_event_handler(
&self,
handler: Option<&ProtocolObject<dyn NSWindowDelegate>>,
);
fn is_visible(&self) -> bool;
fn is_floating_panel(&self) -> bool;
fn becomes_key_only_if_needed(&self) -> bool;
fn can_become_key_window(&self) -> bool;
fn can_become_main_window(&self) -> bool;
fn hides_on_deactivate(&self) -> bool;
fn make_key_window(&self);
fn make_main_window(&self);
fn resign_key_window(&self);
fn make_key_and_order_front(&self);
fn order_front_regardless(&self);
fn show_and_make_key(&self);
fn set_level(&self, level: i64);
fn set_floating_panel(&self, value: bool);
fn set_becomes_key_only_if_needed(&self, value: bool);
fn set_hides_on_deactivate(&self, value: bool);
fn set_works_when_modal(&self, value: bool);
fn set_alpha_value(&self, value: f64);
fn set_released_when_closed(&self, released: bool);
fn set_content_size(&self, width: f64, height: f64);
fn set_has_shadow(&self, value: bool);
fn set_opaque(&self, value: bool);
fn set_accepts_mouse_moved_events(&self, value: bool);
fn set_ignores_mouse_events(&self, value: bool);
fn set_movable_by_window_background(&self, value: bool);
fn set_collection_behavior(&self, behavior: NSWindowCollectionBehavior);
fn content_view(&self) -> Retained<NSView> ⓘ;
fn resign_main_window(&self);
fn set_style_mask(
&self,
style_mask: NSWindowStyleMask,
) -> Result<(), StyleMaskError>;
fn make_first_responder(&self, responder: Option<&NSResponder>) -> bool;
fn set_corner_radius(&self, radius: f64);
fn set_transparent(&self, transparent: bool);
// Provided method
fn add_style_mask(
&self,
style_mask: NSWindowStyleMask,
) -> Result<(), StyleMaskError> { ... }
}Expand description
Common trait for all panel types
Required Methods§
Sourcefn to_window(&self) -> Option<WebviewWindow<R>>
fn to_window(&self) -> Option<WebviewWindow<R>>
Convert the panel back to a regular Tauri window.
This restores Tauri-compatible native window ownership before returning the window.
Sourcefn set_event_handler(
&self,
handler: Option<&ProtocolObject<dyn NSWindowDelegate>>,
)
fn set_event_handler( &self, handler: Option<&ProtocolObject<dyn NSWindowDelegate>>, )
Set the event handler (window delegate).
The panel retains the handler until it is replaced or cleared, so the caller does not
need to keep its own Retained handle alive. Pass None to restore the original Tauri
window delegate.
For behavior that changes at runtime, prefer installing one handler whose callbacks read shared state instead of repeatedly replacing the delegate.
Sourcefn is_visible(&self) -> bool
fn is_visible(&self) -> bool
Check if the panel is visible
Sourcefn is_floating_panel(&self) -> bool
fn is_floating_panel(&self) -> bool
Check if this is a floating panel
Sourcefn becomes_key_only_if_needed(&self) -> bool
fn becomes_key_only_if_needed(&self) -> bool
Check if panel becomes key only if needed
Sourcefn can_become_key_window(&self) -> bool
fn can_become_key_window(&self) -> bool
Check if panel can become key window
Sourcefn can_become_main_window(&self) -> bool
fn can_become_main_window(&self) -> bool
Check if panel can become main window
Sourcefn hides_on_deactivate(&self) -> bool
fn hides_on_deactivate(&self) -> bool
Check if panel hides on deactivate
Sourcefn make_key_window(&self)
fn make_key_window(&self)
Make the panel key window
Sourcefn make_main_window(&self)
fn make_main_window(&self)
Make the panel main window
Sourcefn resign_key_window(&self)
fn resign_key_window(&self)
Resign key window status
Sourcefn make_key_and_order_front(&self)
fn make_key_and_order_front(&self)
Make key and order front
Sourcefn order_front_regardless(&self)
fn order_front_regardless(&self)
Order front regardless
Sourcefn show_and_make_key(&self)
fn show_and_make_key(&self)
Show and make key
Sourcefn set_floating_panel(&self, value: bool)
fn set_floating_panel(&self, value: bool)
Set whether this is a floating panel
Sourcefn set_becomes_key_only_if_needed(&self, value: bool)
fn set_becomes_key_only_if_needed(&self, value: bool)
Set whether panel becomes key only if needed
Sourcefn set_hides_on_deactivate(&self, value: bool)
fn set_hides_on_deactivate(&self, value: bool)
Set whether panel hides on deactivate
Sourcefn set_works_when_modal(&self, value: bool)
fn set_works_when_modal(&self, value: bool)
Set whether panel works when modal
Sourcefn set_alpha_value(&self, value: f64)
fn set_alpha_value(&self, value: f64)
Set the alpha value
Sourcefn set_released_when_closed(&self, released: bool)
fn set_released_when_closed(&self, released: bool)
Set whether AppKit should release the panel when it closes.
Keep this false when Tauri owns the window. Panel::to_window resets it to false
before returning ownership to Tauri.
Sourcefn set_content_size(&self, width: f64, height: f64)
fn set_content_size(&self, width: f64, height: f64)
Set the content size
Sourcefn set_has_shadow(&self, value: bool)
fn set_has_shadow(&self, value: bool)
Set whether panel has shadow
Sourcefn set_opaque(&self, value: bool)
fn set_opaque(&self, value: bool)
Set whether panel is opaque
Sourcefn set_accepts_mouse_moved_events(&self, value: bool)
fn set_accepts_mouse_moved_events(&self, value: bool)
Set whether panel accepts mouse moved events
Sourcefn set_ignores_mouse_events(&self, value: bool)
fn set_ignores_mouse_events(&self, value: bool)
Set whether panel ignores mouse events
Sourcefn set_movable_by_window_background(&self, value: bool)
fn set_movable_by_window_background(&self, value: bool)
Set whether panel is movable by window background
Sourcefn set_collection_behavior(&self, behavior: NSWindowCollectionBehavior)
fn set_collection_behavior(&self, behavior: NSWindowCollectionBehavior)
Set the collection behavior
Sourcefn content_view(&self) -> Retained<NSView> ⓘ
fn content_view(&self) -> Retained<NSView> ⓘ
Get the content view
Sourcefn resign_main_window(&self)
fn resign_main_window(&self)
Resign main window status
Sourcefn set_style_mask(
&self,
style_mask: NSWindowStyleMask,
) -> Result<(), StyleMaskError>
fn set_style_mask( &self, style_mask: NSWindowStyleMask, ) -> Result<(), StyleMaskError>
Replace the panel’s style mask.
Synchronizes application activation prevention with the nonactivating panel flag when AppKit provides the corresponding selector. Removing the flag restores normal activation.
AppKit may reject structural changes to a live window. Such Objective-C exceptions are caught and returned instead of crossing into Rust and aborting the process.
Sourcefn make_first_responder(&self, responder: Option<&NSResponder>) -> bool
fn make_first_responder(&self, responder: Option<&NSResponder>) -> bool
Make a view the first responder
Sourcefn set_corner_radius(&self, radius: f64)
fn set_corner_radius(&self, radius: f64)
Set the corner radius for the panel
Sourcefn set_transparent(&self, transparent: bool)
fn set_transparent(&self, transparent: bool)
Set the panel background to be transparent
Provided Methods§
Sourcefn add_style_mask(
&self,
style_mask: NSWindowStyleMask,
) -> Result<(), StyleMaskError>
fn add_style_mask( &self, style_mask: NSWindowStyleMask, ) -> Result<(), StyleMaskError>
Add flags to the panel’s current style mask.
Prefer this when enabling behavior such as
NSWindowStyleMask::NonactivatingPanel
without removing Tauri’s existing structural window styles.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".