ferroui_base/media/text_formatting/
text_line_break.rs1use std::cell::{Cell, RefCell};
2use std::rc::Rc;
3
4use crate::media::text_formatting::TextRun;
5use crate::media::FlowDirection;
6
7pub struct TextLineBreak {
10 text_end_of_line: Option<Rc<dyn TextRun>>,
11 flow_direction: FlowDirection,
12 is_split: bool,
13 pub(crate) remaining_runs: RefCell<Option<Vec<Rc<dyn TextRun>>>>,
15 pub(crate) is_wrapping: Cell<bool>,
17}
18
19impl TextLineBreak {
20 pub fn new(text_end_of_line: Option<Rc<dyn TextRun>>, flow_direction: FlowDirection, is_split: bool) -> Self {
25 Self { text_end_of_line, flow_direction, is_split, remaining_runs: RefCell::new(None), is_wrapping: Cell::new(false) }
26 }
27
28 pub fn text_end_of_line(&self) -> Option<&Rc<dyn TextRun>> {
30 self.text_end_of_line.as_ref()
31 }
32
33 pub fn flow_direction(&self) -> FlowDirection {
35 self.flow_direction
36 }
37
38 pub fn is_split(&self) -> bool {
41 self.is_split
42 }
43}