pub struct Row { /* private fields */ }
Expand description
A wrapper around a Flex row
Implementations§
source§impl Row
impl Row
source§impl Row
impl Row
sourcepub fn with_label(self, title: &str) -> Self
pub fn with_label(self, title: &str) -> Self
Initialize with a label
sourcepub fn with_align(self, align: Align) -> Self
pub fn with_align(self, align: Align) -> Self
Initialize with alignment
sourcepub fn with_type<T: WidgetType>(self, typ: T) -> Self
pub fn with_type<T: WidgetType>(self, typ: T) -> Self
Initialize with type
sourcepub fn below_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
pub fn below_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
Initialize at bottom of another widget
sourcepub fn above_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
pub fn above_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
Initialize above of another widget
sourcepub fn right_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
pub fn right_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
Initialize right of another widget
sourcepub fn left_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
pub fn left_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self
Initialize left of another widget
sourcepub fn center_x<W: WidgetExt>(self, w: &W) -> Self
pub fn center_x<W: WidgetExt>(self, w: &W) -> Self
Initialize center of another widget on the x axis
sourcepub fn center_y<W: WidgetExt>(self, w: &W) -> Self
pub fn center_y<W: WidgetExt>(self, w: &W) -> Self
Initialize center of another widget on the y axis
sourcepub fn center_of_parent(self) -> Self
pub fn center_of_parent(self) -> Self
Initialize center of parent
sourcepub fn size_of_parent(self) -> Self
pub fn size_of_parent(self) -> Self
Initialize to the size of the parent
Methods from Deref<Target = Flex>§
sourcepub fn set_size<W: WidgetExt>(&mut self, w: &W, size: i32)
👎Deprecated since 1.4.8: please use fixed
instead
pub fn set_size<W: WidgetExt>(&mut self, w: &W, size: i32)
fixed
insteadSet the size of the widget, same as fixed
(before it was changed in FLTK 1.4)
sourcepub fn fixed<W: WidgetExt>(&mut self, w: &W, size: i32)
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
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(®, 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);
}
sourcepub fn set_margin(&mut self, m: i32)
pub fn set_margin(&mut self, m: i32)
Set the margin
sourcepub fn set_pad(&mut self, p: i32)
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();
}
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more