Struct fltk::group::Row

source ·
pub struct Row { /* private fields */ }
Expand description

A wrapper around a Flex row

Implementations§

source§

impl Row

source

pub fn default_fill() -> Self

Constructs a widget with the size of its parent

source

pub fn new<T: Into<Option<&'static str>>>( x: i32, y: i32, width: i32, height: i32, label: T ) -> Row

Create a new row

source

pub fn add<W: WidgetExt>(&mut self, w: &W)

Add a widget to the row with automatic layouting

source§

impl Row

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

Methods from Deref<Target = Flex>§

source

pub fn add<W: WidgetExt>(&mut self, widget: &W)

Add a widget to the Flex box

source

pub fn insert<W: WidgetExt>(&mut self, widget: &W, idx: i32)

Add a widget to the Flex box

source

pub fn set_size<W: WidgetExt>(&mut self, w: &W, size: i32)

👎Deprecated since 1.4.8: please use fixed instead

Set the size of the widget, same as fixed (before it was changed in FLTK 1.4)

source

pub fn fixed<W: WidgetExt>(&mut self, w: &W, size: i32)

Set the size of the widget, same as set_size, but more inline with the new FLTK Fl_Flex api

Examples found in repository?
examples/editor2.rs (line 250)
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
fn main() {
    let a = app::App::default().with_scheme(app::Scheme::Oxy);
    app::get_system_colors();

    let mut buf = text::TextBuffer::default();
    buf.set_tab_distance(4);

    let state = State::new(buf.clone());
    app::GlobalState::new(state);

    let mut w = window::Window::default()
        .with_size(WIDTH, HEIGHT)
        .with_label("Ted");
    w.set_xclass("ted");
    {
        let mut col = group::Flex::default_fill().column();
        col.set_pad(0);
        let mut m = menu::SysMenuBar::default();
        init_menu(&mut m);
        let mut ed = text::TextEditor::default().with_id("ed");
        ed.set_buffer(buf);
        ed.set_linenumber_width(40);
        ed.set_text_font(Font::Courier);
        ed.set_trigger(CallbackTrigger::Changed);
        ed.set_callback(editor_cb);
        handle_drag_drop(&mut ed);
        w.resizable(&col);
        col.fixed(&m, 30);
        col.end();
    }
    w.end();
    w.show();
    w.set_callback(win_cb);
    a.run().unwrap();
}
More examples
Hide additional examples
examples/temp_converter2.rs (line 52)
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
    pub fn new() -> Self {
        let a = app::App::default();
        MyApp::init_styles();
        let (s, r) = app::channel();

        let (inp1, inp2) = {
            let mut win = window::Window::default().with_size(150, 200);
            let mut flex = group::Flex::default()
                .with_size(130, 180)
                .center_of(&win)
                .column();
            make_label("Celcius");
            let mut inp1 = input::FloatInput::default().with_size(0, 40);
            make_label("Fahrenheit");
            let mut inp2 = input::FloatInput::default().with_size(0, 40);
            flex.fixed(&inp1, 30);
            flex.fixed(&inp2, 30);
            flex.end();
            win.end();
            win.make_resizable(true);
            win.show();

            inp1.set_value(&format!("{}", 0.0));
            inp2.set_value(&format!("{}", 32.0));

            inp1.set_trigger(CallbackTrigger::Changed);
            inp2.set_trigger(CallbackTrigger::Changed);

            inp1.emit(s, Message::CelciusChanged);
            inp2.emit(s, Message::FahrenheitChanged);

            (inp1, inp2)
        };
        Self { a, inp1, inp2, r }
    }
examples/flex.rs (line 28)
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
fn buttons_panel(parent: &mut group::Flex) {
    frame::Frame::default();
    let w = frame::Frame::default().with_label("Welcome to Flex Login");

    let mut urow = group::Flex::default().row();
    {
        frame::Frame::default()
            .with_label("Username:")
            .with_align(enums::Align::Inside | enums::Align::Right);
        let username = input::Input::default();

        urow.fixed(&username, 180);
        urow.end();
    }

    let mut prow = group::Flex::default().row();
    {
        frame::Frame::default()
            .with_label("Password:")
            .with_align(enums::Align::Inside | enums::Align::Right);
        let password = input::Input::default();

        prow.fixed(&password, 180);
        prow.end();
    }

    let pad = frame::Frame::default();

    let mut brow = group::Flex::default().row();
    {
        frame::Frame::default();
        let reg = create_button("Register");
        let login = create_button("Login");

        brow.fixed(&reg, 80);
        brow.fixed(&login, 80);
        brow.end();
    }

    let b = frame::Frame::default();

    frame::Frame::default();

    parent.fixed(&w, 60);
    parent.fixed(&urow, 30);
    parent.fixed(&prow, 30);
    parent.fixed(&pad, 1);
    parent.fixed(&brow, 30);
    parent.fixed(&b, 30);
}

fn middle_panel(parent: &mut group::Flex) {
    frame::Frame::default();

    let mut frame = frame::Frame::default().with_label("Image");
    frame.set_frame(enums::FrameType::BorderBox);
    frame.set_color(enums::Color::from_rgb(0, 200, 0));
    let spacer = frame::Frame::default();

    let mut bp = group::Flex::default().column();
    buttons_panel(&mut bp);
    bp.end();

    frame::Frame::default();

    parent.fixed(&frame, 200);
    parent.fixed(&spacer, 10);
    parent.fixed(&bp, 300);
}

fn main_panel(parent: &mut group::Flex) {
    frame::Frame::default();

    let mut mp = group::Flex::default().row();
    middle_panel(&mut mp);
    mp.end();

    frame::Frame::default();

    parent.fixed(&mp, 200);
}
source

pub fn recalc(&self)

Recalculate children’s coords and sizes

source

pub fn layout(&self)

Recalculate children’s coords and sizes

source

pub fn set_margin(&mut self, m: i32)

Set the margin

source

pub fn margin(&self) -> i32

Get the margin

source

pub fn set_pad(&mut self, p: i32)

Set the padding

Examples found in repository?
examples/editor2.rs (line 239)
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
fn main() {
    let a = app::App::default().with_scheme(app::Scheme::Oxy);
    app::get_system_colors();

    let mut buf = text::TextBuffer::default();
    buf.set_tab_distance(4);

    let state = State::new(buf.clone());
    app::GlobalState::new(state);

    let mut w = window::Window::default()
        .with_size(WIDTH, HEIGHT)
        .with_label("Ted");
    w.set_xclass("ted");
    {
        let mut col = group::Flex::default_fill().column();
        col.set_pad(0);
        let mut m = menu::SysMenuBar::default();
        init_menu(&mut m);
        let mut ed = text::TextEditor::default().with_id("ed");
        ed.set_buffer(buf);
        ed.set_linenumber_width(40);
        ed.set_text_font(Font::Courier);
        ed.set_trigger(CallbackTrigger::Changed);
        ed.set_callback(editor_cb);
        handle_drag_drop(&mut ed);
        w.resizable(&col);
        col.fixed(&m, 30);
        col.end();
    }
    w.end();
    w.show();
    w.set_callback(win_cb);
    a.run().unwrap();
}
source

pub fn pad(&self) -> i32

Get the padding

source

pub fn set_margins(&mut self, left: i32, top: i32, right: i32, bottom: i32)

Set the margins

source

pub fn margins(&self) -> (i32, i32, i32, i32)

Get the margins -> returns (left, top, right, bottom)

Trait Implementations§

source§

impl Clone for Row

source§

fn clone(&self) -> Row

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Row

source§

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

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

impl Default for Row

source§

fn default() -> Self

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

impl Deref for Row

§

type Target = Flex

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl DerefMut for Row

source§

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

Mutably dereferences the value.

Auto Trait Implementations§

§

impl RefUnwindSafe for Row

§

impl Send for Row

§

impl Sync for Row

§

impl Unpin for Row

§

impl UnwindSafe for Row

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.