Struct kas_widgets::DragHandle [−][src]
pub struct DragHandle { /* fields omitted */ }
Expand description
Draggable Handle
A DragHandle
is a draggable object with a given size which is restricted
to a track and has an offset relative to the start of that track.
This widget is unusual in several ways:
Layout::size_rules
does not request any size; the parent is expected to do this.Layout::set_rect
sets the track within which this handle may move; the parent should always callDragHandle::set_size_and_offset
afterwards.Layout::draw
does nothing. The parent should handle all drawing.- Optionally, this widget can handle clicks on the track area via
DragHandle::handle_press_on_track
.
Implementations
Set a new handle size and offset
Returns TkAction::REDRAW
if a redraw is required.
Get the maximum allowed offset
This depends on size of the handle and the track.
Set a new handle offset
Returns the new offset (after clamping input) and an action: empty if
the handle hasn’t moved; REDRAW
if it has (though this widget is
not directly responsible for drawing, so this may not be accurate).
pub fn handle_press_on_track(
&mut self,
mgr: &mut Manager<'_>,
source: PressSource,
coord: Coord
) -> Offset
pub fn handle_press_on_track(
&mut self,
mgr: &mut Manager<'_>,
source: PressSource,
coord: Coord
) -> Offset
Handle an event on the track itself
If it is desired to make the handle move when the track area is clicked,
then the parent widget should call this method when receiving
Event::PressStart
.
This method moves the handle immediately and returns the new offset.
Trait Implementations
Returns the “default value” for a type. Read more
This implementation is unusual in that:
size_rules
always returnsSizeRules::EMPTY
set_rect
sets the track within which this handle may move; the parent should callDragHandle::set_size_and_offset
afterset_rect
(otherwise the handle’s offset will not be updated)draw
does nothing: the parent is expected to do all drawing
Get the number of child widgets
Get a reference to a child widget by index, or None
if the index is
out of bounds. Read more
Mutable variant of get Read more
Record first identifier Read more
Check whether id
is a descendant Read more
Find the child which is an ancestor of this id
, if any Read more
Find the leaf (lowest descendant) with this id
, if any Read more
Find the leaf (lowest descendant) with this id
, if any Read more
Walk through all widgets, calling f
once on each. Read more
Walk through all widgets, calling f
once on each. Read more
Get self as type Any
(mutable)
Get the name of the widget struct
Erase type
Erase type
Get whether the widget is disabled
Set the disabled state of a widget Read more
Set disabled state (chaining) Read more
Construct InputState
Read more
Auto Trait Implementations
impl RefUnwindSafe for DragHandle
impl Send for DragHandle
impl Sync for DragHandle
impl Unpin for DragHandle
impl UnwindSafe for DragHandle
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more