#widgets #ui #bindings #graphics

fltk-extras

Some extra widgets for fltk-rs

9 releases

0.1.8 Sep 5, 2023
0.1.7 Sep 2, 2023
0.1.6 Aug 28, 2023
0.1.3 May 20, 2023
0.1.1 Jan 17, 2023

#1222 in GUI


Used in sysinfo-gui

MIT license

36KB
968 lines

fltk-extras

Some extra fltk widgets:

Buttons

use fltk::{prelude::*, *};
use fltk_extras::button::*;

fn main() {
    let a = app::App::default();
    app::set_background_color(0, 0, 0);
    app::set_foreground_color(255, 255, 255);
    app::set_background2_color(128, 128, 128);
    let mut w = window::Window::default().with_size(400, 300);
    let col = group::Flex::default()
        .with_size(80, 200)
        .column()
        .center_of_parent();
    Toggle::default();
    RoundToggle::default();
    CheckButton::default().with_label("Done?");
    HollowRoundToggle::default();
    RadioButton::default().with_label("Radio");
    HoverButton::default().with_label("Hover");
    col.end();
    w.end();
    w.show();
    a.run().unwrap();
}

image

Sliders

use fltk::{prelude::*, *};
use fltk_extras::slider::*;

fn main() {
    let a = app::App::default();
    app::set_background_color(0, 0, 0);
    app::set_foreground_color(255, 255, 255);
    app::set_background2_color(128, 128, 128);
    let mut w = window::Window::default().with_size(400, 300);
    let col = group::Flex::default()
        .column()
        .with_size(200, 200)
        .center_of_parent();
    let _hslider = FancyHorSlider::default().with_label("Hor");
    let _vslider = FancyVertSlider::default().with_label("Vert");
    col.end();
    w.end();
    w.show();
    a.run().unwrap();
}

image

Dials

use fltk::{prelude::*, *};
use fltk_extras::dial::*;

fn main() {
    let a = app::App::default();
    app::set_background_color(0, 0, 0);
    app::set_foreground_color(255, 255, 255);
    app::set_background2_color(128, 128, 128);
    let mut w = window::Window::default().with_size(400, 300);
    let col = group::Flex::default()
        .column()
        .with_size(100, 200)
        .center_of_parent();
    let mut dial = Dial::default();
    dial.modifiable(false);
    dial.set_value(75);
    let mut halfdial = HalfDial::default();
    halfdial.set_value(23);
    col.end();
    w.end();
    w.show();
    a.run().unwrap();
}

image

RadioGroups

use fltk::{prelude::*, *};
use fltk_extras::radiogroup::*;

fn main() {
    let a = app::App::default();
    app::set_background_color(0, 0, 0);
    app::set_foreground_color(255, 255, 255);
    app::set_background2_color(128, 128, 128);
    let mut w = window::Window::default().with_size(400, 400);
    let mut rg = RadioGroup::default().with_size(200, 30).center_of_parent();
    button::RadioButton::default().with_label("First");
    button::RadioButton::default().with_label("Second");
    button::RadioButton::default().with_label("Third");
    rg.end();
    w.end();
    w.show();
    a.run().unwrap();
}

ss

Dependencies

~15MB
~332K SLoC