pub trait WindowExt: Sized {
Show 20 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;
fn selected_text(&mut self, cx: &mut App) -> String;
fn has_text_selection(&mut self, cx: &mut App) -> bool;
fn clear_text_selection(&mut self, cx: &mut App);
fn end_text_selection(&mut self, cx: &mut App);
}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.
Sourcefn selected_text(&mut self, cx: &mut App) -> String
👎Deprecated: use gpui_base::TextSelection::selected_text instead
fn selected_text(&mut self, cx: &mut App) -> String
use gpui_base::TextSelection::selected_text instead
Returns the merged selected text across registered selectable regions
in this window, in logical document order and joined with \n.
Sourcefn has_text_selection(&mut self, cx: &mut App) -> bool
👎Deprecated: use gpui_base::TextSelection::has_selection instead
fn has_text_selection(&mut self, cx: &mut App) -> bool
use gpui_base::TextSelection::has_selection instead
Returns true if any registered region has an active text selection in this window, including renderer-local selections such as select-all.
Sourcefn clear_text_selection(&mut self, cx: &mut App)
👎Deprecated: use gpui_base::TextSelection::clear instead
fn clear_text_selection(&mut self, cx: &mut App)
use gpui_base::TextSelection::clear instead
Clears the window text selection and all registered renderer-local selections.
Sourcefn end_text_selection(&mut self, cx: &mut App)
👎Deprecated: use gpui_base::TextSelection::end instead
fn end_text_selection(&mut self, cx: &mut App)
use gpui_base::TextSelection::end instead
Ends the in-progress window-level text selection drag (if any).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl WindowExt for Window
impl WindowExt for Window
fn open_sheet<F>(&mut self, cx: &mut App, build: F)
fn open_sheet_at<F>(&mut self, placement: Placement, cx: &mut App, build: F)
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)
fn open_alert_dialog<F>(&mut self, cx: &mut App, build: F)
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 has_focused_input(&mut self, cx: &mut App) -> bool
fn focused_input(&mut self, cx: &mut App) -> Option<AnyInputState>
Source§fn selected_text(&mut self, cx: &mut App) -> String
fn selected_text(&mut self, cx: &mut App) -> String
use gpui_base::TextSelection::selected_text instead
Source§fn has_text_selection(&mut self, cx: &mut App) -> bool
fn has_text_selection(&mut self, cx: &mut App) -> bool
use gpui_base::TextSelection::has_selection instead
Source§fn clear_text_selection(&mut self, cx: &mut App)
fn clear_text_selection(&mut self, cx: &mut App)
use gpui_base::TextSelection::clear instead
Source§fn end_text_selection(&mut self, cx: &mut App)
fn end_text_selection(&mut self, cx: &mut App)
use gpui_base::TextSelection::end instead