#ui #accessibility

fltk-accesskit

fltk accesskit adapter made to work with the fltk gui crate

4 releases

0.1.3 Jun 14, 2023
0.1.2 Jun 11, 2023
0.1.1 Jun 8, 2023
0.1.0 Jun 6, 2023

#1209 in GUI

Download history 1/week @ 2023-11-05 1/week @ 2023-11-12 5/week @ 2023-11-19 14/week @ 2023-11-26 4/week @ 2023-12-03 5/week @ 2023-12-17 8/week @ 2023-12-24 13/week @ 2024-01-28 5/week @ 2024-02-04 23/week @ 2024-02-11 70/week @ 2024-02-18

111 downloads per month

MIT license

34KB
753 lines

fltk-accesskit

fltk-accesskit is an fltk accesskit adapter made to work with the fltk gui crate.

Example code:

#![windows_subsystem = "windows"]
use fltk::{prelude::*, *};
use fltk_accesskit::{AccessibilityContext, AccessibleApp};

fn main() {
    let a = app::App::default().with_scheme(app::Scheme::Oxy);
    let mut w = window::Window::default()
        .with_size(400, 300)
        .with_label("Hello fltk-accesskit");
    let col = group::Flex::default()
        .with_size(200, 100)
        .center_of_parent()
        .column();
    let inp = input::Input::default().with_id("inp").with_label("Enter name:");
    let mut btn = button::Button::default().with_label("Greet");
    let out = output::Output::default().with_id("out");
    col.end();
    w.end();
    w.make_resizable(true);
    w.show();

    btn.set_callback(btn_callback);

    let ac = AccessibilityContext::new(
        w,
        vec![Box::new(inp), Box::new(btn), Box::new(out)],
    );

    a.run_with_accessibility(ac).unwrap();
}

fn btn_callback(_btn: &mut button::Button) {
    let inp: input::Input = app::widget_from_id("inp").unwrap();
    let mut out: output::Output = app::widget_from_id("out").unwrap();
    let name = inp.value();
    if name.is_empty() {
        return;
    }
    out.set_value(&format!("Hello {}", name));
}

To use fltk-accesskit, add fltk-accesskit to your Cargo.toml:

[dependencies]
fltk = "1.4"
fltk-accesskit = "0.1.0"

image

Video demo

Dependencies

~13–48MB
~776K SLoC