[−][src]Struct egui::Response
The result of adding a widget to an Ui.
This lets you know whether or not a widget has been clicked this frame. It also lets you easily show a tooltip on hover.
Fields
ctx: Arc<Context>Used for optionally showing a tooltip
rect: RectThe area of the screen we are talking about
sense: SenseThe senses (click or drag) that the widget is interested in (if any).
hovered: boolThe mouse is hovering above this
clicked: boolThe mouse clicked this thing this frame
double_clicked: boolThe thing was double-clicked
active: boolThe mouse is interacting with this thing (e.g. dragging it)
has_kb_focus: boolThis widget has the keyboard focus (i.e. is receiving key pressed)
Implementations
impl Response[src]
pub fn on_hover_ui(self, add_contents: impl FnOnce(&mut Ui)) -> Self[src]
Show this UI if the item was hovered (i.e. a tooltip)
pub fn on_hover_text(self, text: impl Into<String>) -> Self[src]
Show this text if the item was hovered (i.e. a tooltip)
pub fn tooltip_text(self, text: impl Into<String>) -> Self[src]
Deprecated 2020-10-01: use on_hover_text instead.
impl Response[src]
pub fn union(&self, other: Self) -> Self[src]
A logical "or" operation.
For instance a.union(b).hovered means "was either a or b hovered?".
Trait Implementations
impl BitOr<Response> for Response[src]
To summarize the response from many widgets you can use this pattern:
use egui::*; fn draw_vec2(ui: &mut Ui, v: &mut Vec2) -> Response { ui.add(DragValue::f32(&mut v.x)) | ui.add(DragValue::f32(&mut v.y)) }
Now draw_vec2(ui, foo).hovered is true if either DragValue were hovered.
type Output = Self
The resulting type after applying the | operator.
fn bitor(self, rhs: Self) -> Self[src]
impl BitOrAssign<Response> for Response[src]
To summarize the response from many widgets you can use this pattern:
let mut response = ui.add(widget_a); response |= ui.add(widget_b); response |= ui.add(widget_c); if response.active { ui.label("You are interacting with one of the widgets"); }
fn bitor_assign(&mut self, rhs: Self)[src]
impl Clone for Response[src]
impl Debug for Response[src]
Auto Trait Implementations
impl !RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl !UnwindSafe for Response
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,