Struct rustty_oxide::Label [] [src]

pub struct Label { /* fields omitted */ }

Display text to widgets

Examples

use oxide::core::{VerticalAlign, HorizontalAlign, Widget};
use oxide::{Dialog, Label};

let mut maindlg = Dialog::new(60, 10);

let mut label = Label::from_str("Hi, this is an example!");
label.pack(&maindlg, HorizontalAlign::Middle, VerticalAlign::Middle, (0,0));

maindlg.add_label(label);
maindlg.draw_box();

Methods

impl Label
[src]

[src]

Construct a new Label widget cols wide by rols high. Initial text is empty and left aligned

Examples

use oxide::Label;

let mut label = Label::new(60, 10);

[src]

Construct a new label widget from an existing string s. s can either be a &str or String , and a label will be constructed that is the size of the length of characters in s. Text is left aligned by default

Examples

use oxide::Label;

let mut label1 = Label::from_str("This is a label");    // label is size (15x1)

let s = "Here's another label".to_string();
let mut label2 = Label::from_str(s);                    // label is size (20x1)

[src]

Construct a new label widget from an existing string s. s can either be a &str or String , and a label will be constructed that is the size of the length of characters in s. Text is left aligned by default

Examples

use oxide::Label;

let mut label1 = Label::from_str("This is a label");    // label is size (15x1)

let s = "Here's another label".to_string();
let mut label2 = Label::from_str(s);                    // label is size (20x1)

[src]

Specify a custom alignment for the text within the widget. Each line drawn within the label will adhere to the alignments passed for the text. *note that text alignment is with respect to the label

Examples

use oxide::core::{HorizontalAlign, VerticalAlign};
use oxide::Label;

let mut label = Label::new(20, 3);
label.set_text("Centered");
label.align_text(HorizontalAlign::Middle, VerticalAlign::Middle, (0,0));

[src]

Set the text of the widget to the passed &str or String. If the widget does not have enough room to display the new text, the label will only show the truncated text. resize() must be called to extend the size of the label.

Examples

use rustty::HasSize;
use oxide::core::Widget;
use oxide::Label;

let mut label1 = Label::new(20, 3);
label1.set_text("Initial text");

Trait Implementations

impl Widget for Label
[src]

[src]

Draws the widget to the valid CellAccessor passed

[src]

Aligns the widget with the parent as reference

[src]

Expose the painter trait draw_box for all widgets, which outlines the space enclosed within the widget Read more

[src]

Resize the given widget to new dimensions given by Size

[src]

Return a reference the renderer, Base in general cases

[src]

Return a mutable reference to the renderer, Base in general cases