pub struct PPTerm { /* private fields */ }
Implementations§
Source§impl PPTerm
impl PPTerm
Sourcepub fn new<L: Into<Option<&'static str>>>(
x: i32,
y: i32,
w: i32,
h: i32,
label: L,
) -> Self
pub fn new<L: Into<Option<&'static str>>>( x: i32, y: i32, w: i32, h: i32, label: L, ) -> Self
Create a new canvas terminal with default dimensions (80x24).
Sourcepub fn new_with_dims<L: Into<Option<&'static str>>>(
x: i32,
y: i32,
w: i32,
h: i32,
label: L,
cols: u16,
rows: u16,
) -> Self
pub fn new_with_dims<L: Into<Option<&'static str>>>( x: i32, y: i32, w: i32, h: i32, label: L, cols: u16, rows: u16, ) -> Self
Create a new canvas terminal with explicit terminal dimensions (cols x rows).
Sourcepub fn with_dimensions(cols: u16, rows: u16) -> Self
pub fn with_dimensions(cols: u16, rows: u16) -> Self
Convenience: construct with only (cols, rows). Position/size can be
set later via standard FLTK WidgetExt
methods like size_of_parent()
.
Sourcepub fn with_dimensions_and_scrollback(
cols: u16,
rows: u16,
scrollback_lines: usize,
) -> Self
pub fn with_dimensions_and_scrollback( cols: u16, rows: u16, scrollback_lines: usize, ) -> Self
Convenience: construct with (cols, rows, scrollback_lines).
pub fn widget(&self) -> &Scroll
pub fn redraw(&mut self)
pub fn buffer(&self) -> Arc<Mutex<CellBuffer>>
pub fn shutdown(&self)
pub fn set_auto_follow(&mut self, enabled: bool)
pub fn auto_follow_handle(&self) -> Arc<Mutex<bool>>
Sourcepub fn write_all(&self, s: &[u8]) -> Result<(), Error>
pub fn write_all(&self, s: &[u8]) -> Result<(), Error>
Write raw bytes to the underlying PTY.
Examples found in repository?
4fn main() {
5 let a = app::App::default();
6 let mut w = window::Window::default().with_size(600, 400);
7 let term = PPTerm::default().size_of_parent();
8 w.end();
9 w.show();
10
11 // app::add_timeout3(0.2, move |_| {
12 // Test the original command that should show red text
13 term.write_all(r#"echo -e "\033[1;31mHELLO""#.as_bytes())
14 .unwrap();
15 term.write_all(b"\n").unwrap();
16 // });
17
18 a.run().unwrap();
19}
Sourcepub fn set_dims(&mut self, cols: u16, rows: u16) -> Result<(), Box<dyn Error>>
pub fn set_dims(&mut self, cols: u16, rows: u16) -> Result<(), Box<dyn Error>>
Manually set terminal cell dimensions (cols x rows) and resize the PTY. Note: the periodic layout updater will continue to sync PTY size to the current widget size; this method is most useful for initial sizing or when external code coordinates widget resizing alongside PTY resize.
Source§impl PPTerm
impl PPTerm
Sourcepub fn with_label(self, title: &str) -> Self
pub fn with_label(self, title: &str) -> Self
Initialize with a label
Sourcepub fn with_align(self, align: Align) -> Self
pub fn with_align(self, align: Align) -> Self
Initialize with alignment
Sourcepub fn with_type<T: WidgetType>(self, typ: T) -> Self
pub fn with_type<T: WidgetType>(self, typ: T) -> Self
Initialize with type
Sourcepub fn below_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
pub fn below_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
Initialize at bottom of another widget
Sourcepub fn above_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
pub fn above_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
Initialize above of another widget
Sourcepub fn right_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
pub fn right_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
Initialize right of another widget
Sourcepub fn left_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
pub fn left_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
Initialize left of another widget
Sourcepub fn center_x<W: WidgetExt>(self, w: &W) -> Self
pub fn center_x<W: WidgetExt>(self, w: &W) -> Self
Initialize center of another widget on the x axis
Sourcepub fn center_y<W: WidgetExt>(self, w: &W) -> Self
pub fn center_y<W: WidgetExt>(self, w: &W) -> Self
Initialize center of another widget on the y axis
Sourcepub fn center_of_parent(self) -> Self
pub fn center_of_parent(self) -> Self
Initialize center of parent
Sourcepub fn size_of_parent(self) -> Self
pub fn size_of_parent(self) -> Self
Initialize to the size of the parent
Examples found in repository?
4fn main() {
5 let a = app::App::default();
6 let mut w = window::Window::default().with_size(600, 400);
7 let term = PPTerm::default().size_of_parent();
8 w.end();
9 w.show();
10
11 // app::add_timeout3(0.2, move |_| {
12 // Test the original command that should show red text
13 term.write_all(r#"echo -e "\033[1;31mHELLO""#.as_bytes())
14 .unwrap();
15 term.write_all(b"\n").unwrap();
16 // });
17
18 a.run().unwrap();
19}
Methods from Deref<Target = Scroll>§
Sourcepub fn hscrollbar(&self) -> Scrollbar
pub fn hscrollbar(&self) -> Scrollbar
Returns the horizontal scrollbar
Sourcepub fn scrollbar_size(&self) -> i32
pub fn scrollbar_size(&self) -> i32
Gets the scrollbar size
Sourcepub fn set_scrollbar_size(&mut self, new_size: i32)
pub fn set_scrollbar_size(&mut self, new_size: i32)
Sets the scrollbar size
Sourcepub fn auto_layout(&mut self)
pub fn auto_layout(&mut self)
Auto layout a scroll widget
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PPTerm
impl !RefUnwindSafe for PPTerm
impl Send for PPTerm
impl Sync for PPTerm
impl Unpin for PPTerm
impl !UnwindSafe for PPTerm
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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
.Source§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
.Source§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.Source§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.