[][src]Struct glerminal::menu_systems::Dialog

pub struct Dialog {
    pub fg_color_unfocused: [f32; 4],
    pub bg_color_unfocused: [f32; 4],
    pub fg_color_focused: [f32; 4],
    pub bg_color_focused: [f32; 4],
    pub up_buttons: Vec<VirtualKeyCode>,
    pub down_buttons: Vec<VirtualKeyCode>,
    // some fields omitted
}

Represents a dialog-window, meaning a window of text that can be scrolled up and down.

For example

use glerminal::menu_systems::Dialog;

Dialog::new(12, None, 3)
    .with_text("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis faucibus.");

// Looks like:

// Lorem ipsum
// dolor sit
// amet,

// And can be scrolled down to reveal more text.

Fields

fg_color_unfocused: [f32; 4]

Background-color when the dialog is unfocused

bg_color_unfocused: [f32; 4]

Background-color when the dialog is unfocused

fg_color_focused: [f32; 4]

Background-color when the dialog is focused

bg_color_focused: [f32; 4]

Background-color when the dialog is focused

up_buttons: Vec<VirtualKeyCode>

The buttons that make the dialog scroll up when focused

down_buttons: Vec<VirtualKeyCode>

The buttons that make the dialog scroll down when focused

Methods

impl Dialog
[src]

pub fn new<T: Into<Option<u32>>, U: Into<Option<u32>>>(
    width: u32,
    min_height: T,
    max_height: U
) -> Dialog
[src]

Creates a new dialog input with the given width and optionally given min and max heights.

pub fn with_pos(self, pos: (u32, u32)) -> Dialog
[src]

Sets the initial position

pub fn with_focused(self, focused: bool) -> Dialog
[src]

Set whether the checkbox is initially focused or not

pub fn with_unfocused_colors(self, colors: ([f32; 4], [f32; 4])) -> Dialog
[src]

Set the initial colors when it is unfocused

pub fn with_focused_colors(self, colors: ([f32; 4], [f32; 4])) -> Dialog
[src]

Set the initial colors when it is focused

pub fn set_unfocused_colors(&mut self, colors: ([f32; 4], [f32; 4]))
[src]

Set the colors when it is unfocused

pub fn set_focused_colors(&mut self, colors: ([f32; 4], [f32; 4]))
[src]

Set the colors when it is focused

pub fn with_width(self, width: u32) -> Dialog
[src]

Sets the initial width of the dialog window

pub fn with_min_height(self, min_height: Option<u32>) -> Dialog
[src]

Sets the initial minimum height of the dialog window

pub fn with_max_height(self, max_height: Option<u32>) -> Dialog
[src]

Sets the initial maximum height of the dialog window

pub fn with_text<T: Into<String>>(self, text: T) -> Dialog
[src]

Sets the initial text of the dialog window

pub fn with_up_buttons(self, buttons: Vec<VirtualKeyCode>) -> Dialog
[src]

Set the initial buttons that scroll the dialog up.

pub fn with_down_buttons(self, buttons: Vec<VirtualKeyCode>) -> Dialog
[src]

Set the initial buttons that scroll the dialog down.

pub fn set_width(&mut self, width: u32)
[src]

Sets the width of the dialog window

pub fn set_min_height(&mut self, min_height: Option<u32>)
[src]

Sets the minimum height of the dialog window

pub fn set_max_height(&mut self, max_height: Option<u32>)
[src]

Sets the maximum height of the dialog window

pub fn set_text<T: Into<String>>(&mut self, text: T)
[src]

Sets the text of the dialog window

pub fn scroll_up(&mut self) -> bool
[src]

Attempt to scroll the dialog up. Returns true if successful, false if not.

pub fn scroll_down(&mut self) -> bool
[src]

Attempt to scroll the dialog down. Returns true if successful, false if not.

pub fn get_scroll(&self) -> u32
[src]

Get the current scroll idx of this dialog

pub fn set_scroll(&mut self, scroll: u32)
[src]

Sets the current scroll idx of this dialog, assuming scroll is within boundaries.

Trait Implementations

impl InterfaceItem for Dialog
[src]

impl Clone for Dialog
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Dialog
[src]

Auto Trait Implementations

impl Send for Dialog

impl Sync for Dialog

Blanket Implementations

impl<T> InterfaceItemClone for T where
    T: 'static + InterfaceItem + Clone
[src]

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]