[−][src]Trait unsegen_pager::LineDecorator
Interface for anything that is able to decorate lines, i.e., to draw something next to the left of a pager line, given some information about the line.
Associated Types
Loading content...Required methods
fn horizontal_space_demand<'a, 'b: 'a>(
&'a self,
lines: impl DoubleEndedIterator<Item = (LineIndex, &'b Self::Line)> + 'b
) -> ColDemand where
Self::Line: 'b,
&'a self,
lines: impl DoubleEndedIterator<Item = (LineIndex, &'b Self::Line)> + 'b
) -> ColDemand where
Self::Line: 'b,
Define how much (horizontal) space is required to draw the decoration of the given lines.
As the width of the decorator column is fixed for all lines, the implementer should choose the maximum demand of all lines.
fn decorate(
&self,
line: &Self::Line,
line_to_decorate_index: LineIndex,
active_line_index: LineIndex,
window: Window
)
&self,
line: &Self::Line,
line_to_decorate_index: LineIndex,
active_line_index: LineIndex,
window: Window
)
Decorate the given line
by drawing to `window.
Information of how to decorate the line can retrieved from the line itself, its index, and/or the index of the currently active line of the pager.
Note that window is at least one row in height and in fact is so in most cases, but an
implementer cannot rely on that. It is also not guaranteed that the window is as wide as
specified in the last call to horizontal_space_demand
.
Implementors
impl<L: PagerLine> LineDecorator for LineNumberDecorator<L>
[src]
type Line = L
fn horizontal_space_demand<'a, 'b: 'a>(
&'a self,
lines: impl DoubleEndedIterator<Item = (LineIndex, &'b Self::Line)> + 'b
) -> ColDemand where
Self::Line: 'b,
[src]
&'a self,
lines: impl DoubleEndedIterator<Item = (LineIndex, &'b Self::Line)> + 'b
) -> ColDemand where
Self::Line: 'b,
fn decorate(
&self,
_: &L,
line_to_decorate_index: LineIndex,
_: LineIndex,
window: Window
)
[src]
&self,
_: &L,
line_to_decorate_index: LineIndex,
_: LineIndex,
window: Window
)