pub struct RegionSelection {
pub area: WidgetId,
pub anchor: RegionPoint,
pub extent: RegionPoint,
pub ranges: HashMap<WidgetId, (usize, usize)>,
pub all: bool,
pub bar: bool,
pub handles: bool,
pub start: Option<RegionPoint>,
pub end: Option<RegionPoint>,
}Expand description
The selection an area holds: where the press landed, where the pointer is now, and what that makes selected in each text.
Fields§
§area: WidgetIdThe area the selection belongs to: a drag never carries it into another.
anchor: RegionPointWhere the press landed.
extent: RegionPointWhere the pointer is now.
ranges: HashMap<WidgetId, (usize, usize)>The (start, end) character range selected in each text that has one.
all: boolWhether every text of the area is selected whole — Select all would do nothing.
bar: boolWhether the bar (Copy, Select all) shows over the selection: one made with a finger does, one made with a mouse does not. Put away while a handle is dragged.
handles: boolWhether the selection carries handles at its two ends, for a finger to widen or narrow it: one made with a finger does.
start: Option<RegionPoint>Where the selection begins, in reading order — whichever of anchor and extent comes
first — as the first character selected. None when nothing is.
end: Option<RegionPoint>Where it ends, in reading order, as the boundary after the last character selected.
Implementations§
Source§impl RegionSelection
impl RegionSelection
Sourcepub fn new(
area: WidgetId,
anchor: RegionPoint,
extent: RegionPoint,
stops: &[(WidgetId, usize)],
) -> RegionSelection
pub fn new( area: WidgetId, anchor: RegionPoint, extent: RegionPoint, stops: &[(WidgetId, usize)], ) -> RegionSelection
The selection from anchor to extent over stops, the area’s texts in order, each
with its length in characters.
Sourcepub fn with_bar(self, bar: bool) -> RegionSelection
pub fn with_bar(self, bar: bool) -> RegionSelection
This selection as one made with a finger, with its bar and its handles — or as one made with a mouse, with neither.
Trait Implementations§
Source§impl Clone for RegionSelection
impl Clone for RegionSelection
Source§fn clone(&self) -> RegionSelection
fn clone(&self) -> RegionSelection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegionSelection
impl Debug for RegionSelection
Source§impl PartialEq for RegionSelection
impl PartialEq for RegionSelection
impl StructuralPartialEq for RegionSelection
Auto Trait Implementations§
impl Freeze for RegionSelection
impl RefUnwindSafe for RegionSelection
impl Send for RegionSelection
impl Sync for RegionSelection
impl Unpin for RegionSelection
impl UnsafeUnpin for RegionSelection
impl UnwindSafe for RegionSelection
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.