Skip to main content

Panel

Trait Panel 

Source
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§

Source

fn show(&self)

Show the panel

Source

fn hide(&self)

Hide the panel

Source

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.

Source

fn as_panel(&self) -> &NSPanel

Get a reference to the underlying NSPanel

Source

fn label(&self) -> &str

Get the panel label

Source

fn as_any(&self) -> &dyn Any

Downcast to concrete type

Source

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.

Source

fn is_visible(&self) -> bool

Check if the panel is visible

Source

fn is_floating_panel(&self) -> bool

Check if this is a floating panel

Source

fn becomes_key_only_if_needed(&self) -> bool

Check if panel becomes key only if needed

Source

fn can_become_key_window(&self) -> bool

Check if panel can become key window

Source

fn can_become_main_window(&self) -> bool

Check if panel can become main window

Source

fn hides_on_deactivate(&self) -> bool

Check if panel hides on deactivate

Source

fn make_key_window(&self)

Make the panel key window

Source

fn make_main_window(&self)

Make the panel main window

Source

fn resign_key_window(&self)

Resign key window status

Source

fn make_key_and_order_front(&self)

Make key and order front

Source

fn order_front_regardless(&self)

Order front regardless

Source

fn show_and_make_key(&self)

Show and make key

Source

fn set_level(&self, level: i64)

Set the window level

Source

fn set_floating_panel(&self, value: bool)

Set whether this is a floating panel

Source

fn set_becomes_key_only_if_needed(&self, value: bool)

Set whether panel becomes key only if needed

Source

fn set_hides_on_deactivate(&self, value: bool)

Set whether panel hides on deactivate

Source

fn set_works_when_modal(&self, value: bool)

Set whether panel works when modal

Source

fn set_alpha_value(&self, value: f64)

Set the alpha value

Source

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.

Source

fn set_content_size(&self, width: f64, height: f64)

Set the content size

Source

fn set_has_shadow(&self, value: bool)

Set whether panel has shadow

Source

fn set_opaque(&self, value: bool)

Set whether panel is opaque

Source

fn set_accepts_mouse_moved_events(&self, value: bool)

Set whether panel accepts mouse moved events

Source

fn set_ignores_mouse_events(&self, value: bool)

Set whether panel ignores mouse events

Source

fn set_movable_by_window_background(&self, value: bool)

Set whether panel is movable by window background

Source

fn set_collection_behavior(&self, behavior: NSWindowCollectionBehavior)

Set the collection behavior

Source

fn content_view(&self) -> Retained<NSView> ⓘ

Get the content view

Source

fn resign_main_window(&self)

Resign main window status

Source

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.

Source

fn make_first_responder(&self, responder: Option<&NSResponder>) -> bool

Make a view the first responder

Source

fn set_corner_radius(&self, radius: f64)

Set the corner radius for the panel

Source

fn set_transparent(&self, transparent: bool)

Set the panel background to be transparent

Provided Methods§

Source

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".

Implementors§