PPTerm

Struct PPTerm 

Source
pub struct PPTerm { /* private fields */ }

Implementations§

Source§

impl PPTerm

Source

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).

Source

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).

Source

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().

Source

pub fn with_dimensions_and_scrollback( cols: u16, rows: u16, scrollback_lines: usize, ) -> Self

Convenience: construct with (cols, rows, scrollback_lines).

Source

pub fn widget(&self) -> &Scroll

Source

pub fn redraw(&mut self)

Source

pub fn buffer(&self) -> Arc<Mutex<CellBuffer>>

Source

pub fn shutdown(&self)

Source

pub fn set_auto_follow(&mut self, enabled: bool)

Source

pub fn auto_follow_handle(&self) -> Arc<Mutex<bool>>

Source

pub fn cols(&self) -> u16

Current column count reported by the widget.

Source

pub fn rows(&self) -> u16

Current row count reported by the widget.

Source

pub fn write_all(&self, s: &[u8]) -> Result<(), Error>

Write raw bytes to the underlying PTY.

Examples found in repository?
examples/ex1.rs (line 13)
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}
Source

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

Source

pub fn with_pos(self, x: i32, y: i32) -> Self

Initialize to position x, y

Source

pub fn with_size(self, width: i32, height: i32) -> Self

Initialize to size width, height

Source

pub fn with_label(self, title: &str) -> Self

Initialize with a label

Source

pub fn with_align(self, align: Align) -> Self

Initialize with alignment

Source

pub fn with_type<T: WidgetType>(self, typ: T) -> Self

Initialize with type

Source

pub fn below_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self

Initialize at bottom of another widget

Source

pub fn above_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self

Initialize above of another widget

Source

pub fn right_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self

Initialize right of another widget

Source

pub fn left_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self

Initialize left of another widget

Source

pub fn center_of<W: WidgetExt>(self, w: &W) -> Self

Initialize center of another widget

Source

pub fn center_x<W: WidgetExt>(self, w: &W) -> Self

Initialize center of another widget on the x axis

Source

pub fn center_y<W: WidgetExt>(self, w: &W) -> Self

Initialize center of another widget on the y axis

Source

pub fn center_of_parent(self) -> Self

Initialize center of parent

Source

pub fn size_of<W: WidgetExt>(self, w: &W) -> Self

Initialize to the size of another widget

Source

pub fn size_of_parent(self) -> Self

Initialize to the size of the parent

Examples found in repository?
examples/ex1.rs (line 7)
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>§

Source

pub fn scrollbar(&self) -> Scrollbar

Returns the vertical scrollbar

Source

pub fn hscrollbar(&self) -> Scrollbar

Returns the horizontal scrollbar

Source

pub fn xposition(&self) -> i32

Returns the x position

Source

pub fn yposition(&self) -> i32

Returns the y position

Source

pub fn scroll_to(&mut self, x: i32, y: i32)

Scrolls to x and y

Source

pub fn scrollbar_size(&self) -> i32

Gets the scrollbar size

Source

pub fn set_scrollbar_size(&mut self, new_size: i32)

Sets the scrollbar size

Source

pub fn auto_layout(&mut self)

Auto layout a scroll widget

Trait Implementations§

Source§

impl Default for PPTerm

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Deref for PPTerm

Source§

type Target = Scroll

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for PPTerm

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Drop for PPTerm

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.