|
|
@ -104,6 +104,7 @@ impl std::fmt::Debug for Response { |
|
|
|
|
|
|
|
impl Response { |
|
|
|
/// Returns true if this widget was clicked this frame by the primary button.
|
|
|
|
#[inline(always)] |
|
|
|
pub fn clicked(&self) -> bool { |
|
|
|
self.clicked[PointerButton::Primary as usize] |
|
|
|
} |
|
|
@ -149,11 +150,13 @@ impl Response { |
|
|
|
/// Was the widget enabled?
|
|
|
|
/// If false, there was no interaction attempted
|
|
|
|
/// and the widget should be drawn in a gray disabled look.
|
|
|
|
#[inline(always)] |
|
|
|
pub fn enabled(&self) -> bool { |
|
|
|
self.enabled |
|
|
|
} |
|
|
|
|
|
|
|
/// The pointer is hovering above this widget or the widget was clicked/tapped this frame.
|
|
|
|
#[inline(always)] |
|
|
|
pub fn hovered(&self) -> bool { |
|
|
|
self.hovered |
|
|
|
} |
|
|
@ -194,6 +197,7 @@ impl Response { |
|
|
|
///
|
|
|
|
/// To find out which button(s), query [`crate::PointerState::button_down`]
|
|
|
|
/// (`ui.input().pointer.button_down(…)`).
|
|
|
|
#[inline(always)] |
|
|
|
pub fn dragged(&self) -> bool { |
|
|
|
self.dragged |
|
|
|
} |
|
|
@ -239,6 +243,7 @@ impl Response { |
|
|
|
|
|
|
|
/// Is the pointer button currently down on this widget?
|
|
|
|
/// This is true if the pointer is pressing down or dragging a widget
|
|
|
|
#[inline(always)] |
|
|
|
pub fn is_pointer_button_down_on(&self) -> bool { |
|
|
|
self.is_pointer_button_down_on |
|
|
|
} |
|
|
@ -249,6 +254,7 @@ impl Response { |
|
|
|
/// Always `false` for something like a `Button`.
|
|
|
|
/// Can sometimes be `true` even though the data didn't changed
|
|
|
|
/// (e.g. if the user entered a character and erased it the same frame).
|
|
|
|
#[inline(always)] |
|
|
|
pub fn changed(&self) -> bool { |
|
|
|
self.changed |
|
|
|
} |
|
|
@ -257,6 +263,7 @@ impl Response { |
|
|
|
///
|
|
|
|
/// This must be called by widgets that represent some mutable data,
|
|
|
|
/// e.g. checkboxes, sliders etc.
|
|
|
|
#[inline(always)] |
|
|
|
pub fn mark_changed(&mut self) { |
|
|
|
self.changed = true; |
|
|
|
} |
|
|
|