pub struct GlobalState { /* private fields */ }Expand description
Application-wide state shared by Base behaviors.
Implementations§
Source§impl GlobalState
impl GlobalState
Sourcepub fn note_touch(cx: &mut App)
pub fn note_touch(cx: &mut App)
Records that a finger went down. Called from the touch drag GPUI offers on every touch, before it becomes a tap, a long press or a pan.
Sourcepub fn is_touch_press(cx: &App) -> bool
pub fn is_touch_press(cx: &App) -> bool
Whether the press being handled came from a finger: a touch went down recently enough that the mouse events of a tap are still arriving. A double tap takes up to twice the tap interval.
Sourcepub fn suppress_text_selection(cx: &mut App)
pub fn suppress_text_selection(cx: &mut App)
Suppresses window-level text selection for the current mouse down.
Controls that own a press or drag interaction use this so the same pointer event does not also start application text selection.
pub fn global(cx: &App) -> &Self
pub fn global_mut(cx: &mut App) -> &mut Self
Returns the application menus.
Replaces the application menus.
Sourcepub fn is_in_deferred_context(cx: &App) -> bool
pub fn is_in_deferred_context(cx: &App) -> bool
Returns whether any deferred popup currently owns an open interaction context.
Sourcepub fn register_deferred_popover(cx: &mut App) -> DeferredPopover
pub fn register_deferred_popover(cx: &mut App) -> DeferredPopover
Registers an open deferred popup, which stays registered for as long as the returned token is held.
A token rather than an identifier, because popup state is routinely dropped without ever being closed: state that stops being rendered — a popover scrolled out of a virtual list, a panel closed while its menu is open — is collected at the end of the frame, with no chance to deregister. A registration that outlived its popup would leave the application believing a popup is open forever, and everything that steps aside for open popups (the native context menu of a text input, say) would stay disabled for the rest of the session.
Trait Implementations§
impl Global for GlobalState
Auto Trait Implementations§
impl !RefUnwindSafe for GlobalState
impl !Send for GlobalState
impl !Sync for GlobalState
impl !UnwindSafe for GlobalState
impl Freeze for GlobalState
impl Unpin for GlobalState
impl UnsafeUnpin for GlobalState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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