Skip to content

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

License

Notifications You must be signed in to change notification settings

fltk-rs/fltk-accesskit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages