pub struct RwArea(/* private fields */);Expand description
A type erased RawArea
This type houses the inner Area, and provides type erased access
to its functions.
Implementations§
Source§impl RwArea
impl RwArea
Sourcepub fn write_as<'a, A>(&'a self, pa: &'a mut Pass) -> Option<&'a mut A>where
A: RawArea,
pub fn write_as<'a, A>(&'a self, pa: &'a mut Pass) -> Option<&'a mut A>where
A: RawArea,
Attempt to write this as a specific implementation of
RawArea
You can use this to deal with individual RawAreas, so you
can do a “per Ui” configuration for your
Plugin/configuration. This could be used to, for example,
place frames around an Area when making use of a terminal
Ui, or using some custom css when using a web Ui.
This will return None if the RawArea within is of a
different type.
Sourcepub fn set_width(&self, pa: &mut Pass, width: f32) -> Result<(), Text>
pub fn set_width(&self, pa: &mut Pass, width: f32) -> Result<(), Text>
Sets the width of the RawArea
Sourcepub fn set_height(&self, pa: &mut Pass, height: f32) -> Result<(), Text>
pub fn set_height(&self, pa: &mut Pass, height: f32) -> Result<(), Text>
Sets the height of the RawArea
Sourcepub fn set_as_active(&self, pa: &mut Pass)
pub fn set_as_active(&self, pa: &mut Pass)
Sourcepub fn size_of_text(
&self,
pa: &Pass,
opts: PrintOpts,
text: &Text,
) -> Result<Coord, Text>
pub fn size_of_text( &self, pa: &Pass, opts: PrintOpts, text: &Text, ) -> Result<Coord, Text>
What size the given Text would occupy, if unwrapped
The x component represents the width needed to show the
Text without wrapping, while the y component represents
the height needed to show all the lines of the Text.
This function does take into account the size of the screen,
and assumes that you will want to iterate from the start of
the Text. Therefore, it will preemptively stop iterating
through the Text when the remaining characters wouldn’t show
up on screen.
Sourcepub fn get_print_info(&self, pa: &Pass) -> PrintInfo
pub fn get_print_info(&self, pa: &Pass) -> PrintInfo
The current printing information of the area
Sourcepub fn set_print_info(&self, pa: &mut Pass, info: PrintInfo)
pub fn set_print_info(&self, pa: &mut Pass, info: PrintInfo)
Sets a previously acquired PrintInfo to the area
Sourcepub fn scroll_around_points(
&self,
pa: &mut Pass,
text: &Text,
points: TwoPoints,
opts: PrintOpts,
)
pub fn scroll_around_points( &self, pa: &mut Pass, text: &Text, points: TwoPoints, opts: PrintOpts, )
Scrolls the Text on all four directions until the given
TwoPoints is within the ScrollOff range
There are two other scrolling methods for Area:
scroll_ver and scroll_to_points. The difference
between this and scroll_to_points is that this method
doesn’t do anything if the TwoPoints is already on screen.
Sourcepub fn scroll_to_points(
&self,
pa: &mut Pass,
text: &Text,
points: TwoPoints,
opts: PrintOpts,
)
pub fn scroll_to_points( &self, pa: &mut Pass, text: &Text, points: TwoPoints, opts: PrintOpts, )
Scrolls the Text to the visual line of a TwoPoints
This method takes line wrapping into account, so it’s not
the same as setting the starting points to the
Text::visual_line_start of these TwoPoints.
If scroll_beyond is set, then the Text will be allowed
to scroll beyond the last line, up until reaching the
scrolloff.y value.
Sourcepub fn has_changed(&self, pa: &Pass) -> bool
pub fn has_changed(&self, pa: &Pass) -> bool
Sourcepub fn is_master_of(&self, pa: &Pass, other: &RwArea) -> bool
pub fn is_master_of(&self, pa: &Pass, other: &RwArea) -> bool
Whether or not this Area is the “master” of another
Sourcepub fn store_cache(&self, pa: &Pass, path: impl AsRef<Path>) -> Result<(), Text>
pub fn store_cache(&self, pa: &Pass, path: impl AsRef<Path>) -> Result<(), Text>
Stores the cache of the Area, given a path to associate
with this cache
Sourcepub fn bottom_right(&self, pa: &Pass) -> Coord
pub fn bottom_right(&self, pa: &Pass) -> Coord
The bottom right Coord of this Area
Sourcepub fn points_at_coord(
&self,
pa: &Pass,
text: &Text,
coord: Coord,
opts: PrintOpts,
) -> Option<TwoPointsPlace>
pub fn points_at_coord( &self, pa: &Pass, text: &Text, coord: Coord, opts: PrintOpts, ) -> Option<TwoPointsPlace>
Sourcepub fn coord_at_points(
&self,
pa: &Pass,
text: &Text,
points: TwoPoints,
opts: PrintOpts,
) -> Option<Coord>
pub fn coord_at_points( &self, pa: &Pass, text: &Text, points: TwoPoints, opts: PrintOpts, ) -> Option<Coord>
Sourcepub fn columns_at(
&self,
pa: &Pass,
text: &Text,
points: TwoPoints,
opts: PrintOpts,
) -> Option<Columns>
pub fn columns_at( &self, pa: &Pass, text: &Text, points: TwoPoints, opts: PrintOpts, ) -> Option<Columns>
Returns column information about a TwoPoints.
If the points are part of the Strs, returns a Columns
struct. This contains the line column and the wrapped
column.
The former measures the distance since the last \n character
or start of Text. The latter measures the distance since the
last wrap, i.e., the distance to the left edge of the area.