pub trait WindowExt: Sized {
Show 16 methods
// Required methods
fn open_sheet<F>(&mut self, cx: &mut App, build: F)
where F: Fn(Sheet, &mut Window, &mut App) -> Sheet + 'static;
fn open_sheet_at<F>(&mut self, placement: Placement, cx: &mut App, build: F)
where F: Fn(Sheet, &mut Window, &mut App) -> Sheet + 'static;
fn has_active_sheet(&mut self, cx: &mut App) -> bool;
fn close_sheet(&mut self, cx: &mut App);
fn open_dialog<F>(&mut self, cx: &mut App, build: F)
where F: Fn(Dialog, &mut Window, &mut App) -> Dialog + 'static;
fn open_alert_dialog<F>(&mut self, cx: &mut App, build: F)
where F: Fn(AlertDialog, &mut Window, &mut App) -> AlertDialog + 'static;
fn has_active_dialog(&mut self, cx: &mut App) -> bool;
fn close_dialog(&mut self, cx: &mut App);
fn close_all_dialogs(&mut self, cx: &mut App);
fn push_notification(&mut self, note: impl Into<Notification>, cx: &mut App);
fn remove_notification<T: Sized + 'static>(&mut self, cx: &mut App);
fn remove_notification1<T: Sized + 'static>(
&mut self,
key: impl Into<ElementId>,
cx: &mut App,
);
fn clear_notifications(&mut self, cx: &mut App);
fn notifications(&mut self, cx: &mut App) -> Rc<Vec<Entity<Notification>>>;
fn focused_input(&mut self, cx: &mut App) -> Option<AnyInputState>;
fn has_focused_input(&mut self, cx: &mut App) -> bool;
}Expand description
Extension trait for Window to add dialog, sheet .. functionality.
Required Methods§
Sourcefn open_sheet<F>(&mut self, cx: &mut App, build: F)
fn open_sheet<F>(&mut self, cx: &mut App, build: F)
Opens a Sheet at right placement.
Sourcefn open_sheet_at<F>(&mut self, placement: Placement, cx: &mut App, build: F)
fn open_sheet_at<F>(&mut self, placement: Placement, cx: &mut App, build: F)
Opens a Sheet at the given placement.
Sourcefn has_active_sheet(&mut self, cx: &mut App) -> bool
fn has_active_sheet(&mut self, cx: &mut App) -> bool
Return true, if there is an active Sheet.
Sourcefn close_sheet(&mut self, cx: &mut App)
fn close_sheet(&mut self, cx: &mut App)
Closes the active Sheet.
Sourcefn open_dialog<F>(&mut self, cx: &mut App, build: F)
fn open_dialog<F>(&mut self, cx: &mut App, build: F)
Opens a Dialog.
Sourcefn open_alert_dialog<F>(&mut self, cx: &mut App, build: F)
fn open_alert_dialog<F>(&mut self, cx: &mut App, build: F)
Opens an AlertDialog.
This is a convenience method for opening an alert dialog with opinionated defaults. The footer buttons are center-aligned and include an icon based on the variant.
§Examples
use gpui_kit::component::{AlertDialog, alert::AlertVariant};
window.open_alert_dialog(cx, |alert, _, _| {
alert.warning()
.title("Unsaved Changes")
.description("You have unsaved changes. Are you sure you want to leave?")
.show_cancel(true)
});Sourcefn has_active_dialog(&mut self, cx: &mut App) -> bool
fn has_active_dialog(&mut self, cx: &mut App) -> bool
Return true, if there is an active Dialog.
Sourcefn close_dialog(&mut self, cx: &mut App)
fn close_dialog(&mut self, cx: &mut App)
Closes the last active Dialog.
Sourcefn close_all_dialogs(&mut self, cx: &mut App)
fn close_all_dialogs(&mut self, cx: &mut App)
Closes all active Dialogs.
Sourcefn push_notification(&mut self, note: impl Into<Notification>, cx: &mut App)
fn push_notification(&mut self, note: impl Into<Notification>, cx: &mut App)
Pushes a notification to the notification list.
Sourcefn remove_notification<T: Sized + 'static>(&mut self, cx: &mut App)
fn remove_notification<T: Sized + 'static>(&mut self, cx: &mut App)
Removes all notifications whose id matches T, including ones registered with
either Notification::id or Notification::id1 (any key).
Sourcefn remove_notification1<T: Sized + 'static>(
&mut self,
key: impl Into<ElementId>,
cx: &mut App,
)
fn remove_notification1<T: Sized + 'static>( &mut self, key: impl Into<ElementId>, cx: &mut App, )
Removes a single notification matching the given type T and key (paired with Notification::id1).
Sourcefn clear_notifications(&mut self, cx: &mut App)
fn clear_notifications(&mut self, cx: &mut App)
Clears all notifications.
Sourcefn notifications(&mut self, cx: &mut App) -> Rc<Vec<Entity<Notification>>>
fn notifications(&mut self, cx: &mut App) -> Rc<Vec<Entity<Notification>>>
Returns number of notifications.
Sourcefn focused_input(&mut self, cx: &mut App) -> Option<AnyInputState>
fn focused_input(&mut self, cx: &mut App) -> Option<AnyInputState>
Return the currently focused input state.
Covers Input, Textarea, Editor and OtpInput, use
AnyInputState::as_input and friends to get the concrete state.
A registration whose focus handle is no longer focused (e.g. the input
was removed from the tree while focused) is treated as None.
Sourcefn has_focused_input(&mut self, cx: &mut App) -> bool
fn has_focused_input(&mut self, cx: &mut App) -> bool
Returns true if there is a focused Input entity.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".