pub struct Focus {
pub annot: usize,
pub box_: FocusBox,
}Expand description
Which annotation on the page holds the keyboard focus, and what its focus rectangle is.
Both halves are needed and they are independent. The index alone decides the tint: a widget with a live control is never tinted, focused or not, and the focused one is the only widget a live control reaches in a single-focus session. The box decides whether anything is stroked in its place, which most field types answer with nothing.
use pdfrum_doc::{AnnotOverlay, Focus, FocusBox, geom};
let mut overlay = AnnotOverlay::with_capacity(2);
overlay.set_focus(Focus {
annot: 1,
box_: FocusBox::Rect(geom::rect(0.0, 0.0, 100.0, 20.0)),
});
assert_eq!(overlay.focus().map(|f| f.annot), Some(1));Fields§
§annot: usizeThe raw /Annots index of the focused annotation — the same key space
AnnotOverlay::set uses.
box_: FocusBoxThe rectangle to stroke, in page space.
Implementations§
Source§impl Focus
impl Focus
Sourcepub fn at(annot: usize) -> Focus
pub fn at(annot: usize) -> Focus
Focus on one annotation with no rectangle to stroke — the answer a text field and an editable combo box give.
use pdfrum_doc::{Focus, FocusBox};
let focus = Focus::at(2);
assert_eq!(focus.annot, 2);
// No rectangle to stroke, which is what a text field answers.
assert_eq!(focus.box_, FocusBox::None);Trait Implementations§
impl Copy for Focus
impl StructuralPartialEq for Focus
Auto Trait Implementations§
impl Freeze for Focus
impl RefUnwindSafe for Focus
impl Send for Focus
impl Sync for Focus
impl Unpin for Focus
impl UnsafeUnpin for Focus
impl UnwindSafe for Focus
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
Mutably borrows from an owned value. Read more