Guide API
Skip to main content

GrowMode

Struct GrowMode 

Source
pub struct GrowMode {
    pub lo_x: bool,
    pub lo_y: bool,
    pub hi_x: bool,
    pub hi_y: bool,
    pub rel: bool,
    pub fixed: bool,
}
Expand description

Grow-mode flags — control how each edge of the view tracks its owner when the owner is resized.

Set the flags on ViewState::grow_mode before inserting a view into its owner. The most common combinations are:

  • Stay anchored to the bottom-right corner (e.g. a scrollbar thumb): hi_x = true; hi_y = true
  • Fill the full width of the owner (e.g. a status bar): hi_x = true — only the right edge tracks; the left stays fixed.
  • Fill the entire owner (e.g. a text viewer inside a window): use GrowMode::grow_all().
  • Fixed size, just anchor to the right edge (e.g. a vertical scrollbar): hi_x = true; fixed = true (or use Window::standard_scroll_bar).
  • Desktop window, scales with the desktop: hi_x = true; hi_y = true; rel = true — all edges scale proportionally.

§Turbo Vision heritage

Ports the gf* flag family (views.h) as a struct-of-bools (deviation D5); each field names its gf* source.

Fields§

§lo_x: bool

gfGrowLoX — the left edge tracks the owner’s right edge.

Uncommon alone; usually paired with hi_x when the view should slide right with its owner rather than grow.

§lo_y: bool

gfGrowLoY — the top edge tracks the owner’s bottom edge.

Uncommon alone; usually paired with hi_y when the view should slide down with its owner rather than grow.

§hi_x: bool

gfGrowHiX — the right edge tracks the owner’s right edge.

The most common flag: lets the view widen when its owner widens. Set alone for a view that stays left-anchored and grows to the right.

§hi_y: bool

gfGrowHiY — the bottom edge tracks the owner’s bottom edge.

Lets the view grow taller when its owner grows. Pair with hi_x for a view that fills its owner’s interior (use GrowMode::grow_all()).

§rel: bool

gfGrowRel — grow proportionally to the owner (windows on the desktop).

When set, all active lo_*/hi_* edges scale as a fraction of the owner size rather than by a fixed delta. Use for windows that should keep their relative position when the terminal is resized.

§fixed: bool

gfFixed — the view keeps its size regardless of the owner’s resize.

The view moves to stay in the same relative position but does not change its width or height. Combine with hi_x/hi_y to anchor to the right/bottom edge while staying fixed-size (e.g. a scrollbar).

Implementations§

Source§

impl GrowMode

Source

pub fn grow_all() -> Self

gfGrowAll (gfGrowLoX | gfGrowLoY | gfGrowHiX | gfGrowHiY) — every edge tracks the owner (the view grows with its owner on all sides).

Use for a view that should fill its owner’s interior and resize with it, such as a text editor pane or a list viewer inside a window.

Trait Implementations§

Source§

impl Clone for GrowMode

Source§

fn clone(&self) -> GrowMode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for GrowMode

Source§

impl Debug for GrowMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GrowMode

Source§

fn default() -> GrowMode

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

impl Eq for GrowMode

Source§

impl Hash for GrowMode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for GrowMode

Source§

fn eq(&self, other: &GrowMode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GrowMode

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CustomValue for T
where T: Any + Debug,

Source§

fn as_any_rc(self: Rc<T>) -> Rc<dyn Any>

Upcast Rc<Self> to Rc<dyn Any> so FieldValue::as_custom / FieldValue::value_as can downcast.
§

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

§

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

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

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

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

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

§

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

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.