pub struct Panel { /* private fields */ }Expand description
The keyboard’s state and geometry. Coordinates are those the host passes in, physical pixels in ltk’s runtime.
Implementations§
Source§impl Panel
impl Panel
Sourcepub fn draw(&mut self, canvas: &mut Canvas)
pub fn draw(&mut self, canvas: &mut Canvas)
Paint the panel where Panel::set_rect put it.
Source§impl Panel
impl Panel
Sourcepub fn new(layouts: Vec<Layout>, preferred: &str) -> Self
pub fn new(layouts: Vec<Layout>, preferred: &str) -> Self
A panel over layouts, starting on the one named preferred when present. No layouts means the built-in one.
Sourcepub fn for_language(lang: &str) -> Self
pub fn for_language(lang: &str) -> Self
Every installed layout, the one for lang (es, en-GB…) first.
pub fn layout(&self) -> &Layout
pub fn layer(&self) -> &str
pub fn rect(&self) -> Rect
pub fn keys(&self) -> &[KeyRect]
pub fn popup(&self) -> Option<&Popup>
pub fn shift_locked(&self) -> bool
pub fn modifiers(&self) -> Modifiers
pub fn purpose(&self) -> Purpose
Sourcepub fn set_purpose(&mut self, purpose: Purpose)
pub fn set_purpose(&mut self, purpose: Purpose)
Change what the panel types into; a terminal gets its row of keys above the layout.
Sourcepub fn height(&self, width: f32, scale: f32) -> f32
pub fn height(&self, width: f32, scale: f32) -> f32
Height the panel needs width pixels wide at scale, for its current layer and purpose.
Sourcepub fn height_within(&self, width: f32, scale: f32, screen_height: f32) -> f32
pub fn height_within(&self, width: f32, scale: f32, screen_height: f32) -> f32
Self::height kept within 40 % of screen_height, so a wide screen gets short keys instead of a keyboard that covers it.
Sourcepub fn set_rect(&mut self, rect: Rect, scale: f32)
pub fn set_rect(&mut self, rect: Rect, scale: f32)
Place the keys inside rect: the purpose’s rows first, each spanning the width, then the layout’s, which share one key unit and are centred when narrower than the widest.
Sourcepub fn press_down(&mut self, pos: Point, now: Instant) -> Option<Event>
pub fn press_down(&mut self, pos: Point, now: Instant) -> Option<Event>
A press at pos; None when it is outside the panel and the host should treat it as its own.
Sourcepub fn press_move(&mut self, pos: Point) -> bool
pub fn press_move(&mut self, pos: Point) -> bool
The held finger or pointer moved; with the variants open, selects the one under it.
Sourcepub fn press_up(&mut self, pos: Point, now: Instant) -> Option<Event>
pub fn press_up(&mut self, pos: Point, now: Instant) -> Option<Event>
The press ended: type the key, the chosen variant, or act.
Sourcepub fn tick(&mut self, now: Instant) -> Option<Event>
pub fn tick(&mut self, now: Instant) -> Option<Event>
Time passed with a key held: opens its variants, or repeats backspace.
Sourcepub fn next_deadline(&self) -> Option<Instant>
pub fn next_deadline(&self) -> Option<Instant>
When Panel::tick next has something to do.
pub fn cancel_press(&mut self)
Auto Trait Implementations§
impl Freeze for Panel
impl RefUnwindSafe for Panel
impl Send for Panel
impl Sync for Panel
impl Unpin for Panel
impl UnwindSafe for Panel
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more