Struct kas_widgets::ScrollBar
source · pub struct ScrollBar<D: Directional> { /* private fields */ }
Expand description
Implementations§
source§impl<D> ScrollBar<D>where
D: Default + Directional,
impl<D> ScrollBar<D>where D: Default + Directional,
source§impl<D: Directional> ScrollBar<D>
impl<D: Directional> ScrollBar<D>
sourcepub fn new_with_direction(direction: D) -> Self
pub fn new_with_direction(direction: D) -> Self
Construct a scroll bar with the given direction
Default values are assumed for all parameters.
sourcepub fn set_invisible(&mut self, invisible: bool)
pub fn set_invisible(&mut self, invisible: bool)
Set invisible property
An “invisible” scroll bar is only drawn on mouse-hover
sourcepub fn with_invisible(self, invisible: bool) -> Self
pub fn with_invisible(self, invisible: bool) -> Self
Set invisible property (inline)
An “invisible” scroll bar is only drawn on mouse-hover
sourcepub fn with_limits(self, max_value: i32, handle_value: i32) -> Self
pub fn with_limits(self, max_value: i32, handle_value: i32) -> Self
Set the initial page length
sourcepub fn with_value(self, value: i32) -> Self
pub fn with_value(self, value: i32) -> Self
Set the initial value
sourcepub fn set_limits(&mut self, max_value: i32, handle_value: i32) -> Action
pub fn set_limits(&mut self, max_value: i32, handle_value: i32) -> Action
Set the page limits
The max_value
parameter specifies the maximum possible value.
(The minimum is always 0.) For a scroll region, this should correspond
to the maximum possible offset.
The handle_value
parameter specifies the size of the handle relative to
the maximum value: the handle size relative to the length of the scroll
bar is handle_value / (max_value + handle_value)
. For a scroll region,
this should correspond to the size of the visible region.
The minimum value is 1.
The choice of units is not important (e.g. can be pixels or lines), so long as both parameters use the same units.
Returns Action::REDRAW
if a redraw is required.
sourcepub fn max_value(&self) -> i32
pub fn max_value(&self) -> i32
Read the current max value
See also the ScrollBar::set_limits
documentation.
sourcepub fn handle_value(&self) -> i32
pub fn handle_value(&self) -> i32
Read the current handle value
See also the ScrollBar::set_limits
documentation.
sourcepub fn set_value(&mut self, mgr: &mut EventState, value: i32) -> bool
pub fn set_value(&mut self, mgr: &mut EventState, value: i32) -> bool
Set the value
Returns true if the value changes.
Trait Implementations§
source§impl<D: Directional> Layout for ScrollBar<D>
impl<D: Directional> Layout for ScrollBar<D>
source§impl<D: Directional> Widget for ScrollBar<D>
impl<D: Directional> Widget for ScrollBar<D>
source§fn handle_message(&mut self, mgr: &mut EventMgr<'_>)
fn handle_message(&mut self, mgr: &mut EventMgr<'_>)
source§fn translation(&self) -> Offset
fn translation(&self) -> Offset
source§fn steal_event(
&mut self,
mgr: &mut EventMgr<'_>,
id: &WidgetId,
event: &Event
) -> Response
fn steal_event( &mut self, mgr: &mut EventMgr<'_>, id: &WidgetId, event: &Event ) -> Response
source§impl<D: Directional> WidgetChildren for ScrollBar<D>
impl<D: Directional> WidgetChildren for ScrollBar<D>
source§fn num_children(&self) -> usize
fn num_children(&self) -> usize
source§fn get_child(&self, _index: usize) -> Option<&dyn Widget>
fn get_child(&self, _index: usize) -> Option<&dyn Widget>
None
if the index is
out of bounds. Read moresource§fn get_child_mut(&mut self, _index: usize) -> Option<&mut dyn Widget>
fn get_child_mut(&mut self, _index: usize) -> Option<&mut dyn Widget>
source§impl<D: Directional> WidgetCore for ScrollBar<D>
impl<D: Directional> WidgetCore for ScrollBar<D>
source§fn widget_name(&self) -> &'static str
fn widget_name(&self) -> &'static str
source§fn as_widget_mut(&mut self) -> &mut dyn Widget
fn as_widget_mut(&mut self) -> &mut dyn Widget
Auto Trait Implementations§
impl<D> RefUnwindSafe for ScrollBar<D>where D: RefUnwindSafe,
impl<D> !Send for ScrollBar<D>
impl<D> !Sync for ScrollBar<D>
impl<D> Unpin for ScrollBar<D>where D: Unpin,
impl<D> UnwindSafe for ScrollBar<D>where D: UnwindSafe,
Blanket Implementations§
§impl<S, T> Cast<T> for Swhere
T: Conv<S>,
impl<S, T> Cast<T> for Swhere T: Conv<S>,
§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere T: ConvApprox<S>,
§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
§fn cast_approx(self) -> T
fn cast_approx(self) -> T
§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere T: ConvFloat<S>,
§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
§fn cast_floor(self) -> T
fn cast_floor(self) -> T
§fn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
§fn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
§fn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
§fn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
source§impl<W> WidgetExt for Wwhere
W: Widget + ?Sized,
impl<W> WidgetExt for Wwhere W: Widget + ?Sized,
source§fn eq_id<T>(&self, rhs: T) -> boolwhere
WidgetId: PartialEq<T>,
fn eq_id<T>(&self, rhs: T) -> boolwhere WidgetId: PartialEq<T>,
source§fn identify(&self) -> IdentifyWidget
fn identify(&self) -> IdentifyWidget
source§fn is_ancestor_of(&self, id: &WidgetId) -> bool
fn is_ancestor_of(&self, id: &WidgetId) -> bool
id
is self or a descendant Read moresource§fn is_strict_ancestor_of(&self, id: &WidgetId) -> bool
fn is_strict_ancestor_of(&self, id: &WidgetId) -> bool
id
is not self and is a descendant Read more