fui_core

Crates.iofui_core
lib.rsfui_core
version0.14.1
sourcesrc
created_at2020-08-01 16:29:53.783953
updated_at2024-05-30 15:44:15.914334
descriptionCore library of FUI MVVM UI Framework
homepage
repositoryhttps://github.com/marek-g/rust-fui
max_upload_size
id271961
size228,222
Marek Gibek (marek-g)

documentation

https://docs.rs/fui_core

README

fui

Crates.io Version Docs.rs Version GPL-3.0-or-later WITH Classpath-exception-2.0

FUI Logo

MVVM Rust UI Framework Library.

Documentation

FUI's documentation

Crates

fui_core Crates.io Version

Core library of FUI MVVM UI Framework.

fui_macros Crates.io Version

Macros for FUI UI Framework.

fui_controls Crates.io Version

Standard controls for FUI UI Framework.

fui_controls_media Crates.io Version

Media controls for FUI UI Framework.

fui_system Crates.io Version

Cross-platform windowing library focused on good desktop integration (dialogs, menus, tray icons etc.).

fui_app Crates.io Version

Application backend of FUI UI Framework.

Screenshots

Note! The visual aspect of the library is a subject to change. Margins are missing. You can also write your own styles and make it look completely different.

Screenshot1 Screenshot2

Features

  • cross-platform:
    • Linux (x11 & wayland using Qt)
    • Windows (using Qt)
    • Android
    • Wasm
  • renderer agnostic:
    • OpenGL backend
  • native elements:
    • multiple windows
    • tray icons
    • native popup windows
    • fallback to simulated popup windows (rendered in parent window)
  • accessibility:
    • keyboard support
    • AccessKit
  • MVVM model with:
    • properties,
    • bindings,
    • observable collections
  • async support
  • ui! macro for easier view creation
  • extensive styling (style can change behavior)

Example

#![windows_subsystem = "windows"]

use fui_app::*;
use fui_controls::*;
use fui_core::*;
use fui_macros::ui;

use std::cell::RefCell;
use std::rc::Rc;

use typed_builder::TypedBuilder;
use typemap::TypeMap;
use winit::window::WindowBuilder;

struct MainViewModel {
    pub counter: Property<i32>,
}

impl MainViewModel {
    pub fn new() -> Rc<Self> {
        Rc::new(MainViewModel {
            counter: Property::new(0),
        })
    }

    pub fn increase(self: &Rc<Self>) {
        self.counter.change(|c| c + 1);
    }
}

impl ViewModel for MainViewModel {
    fn create_view(self: &Rc<Self>) -> Rc<RefCell<dyn ControlObject>> {
        ui!(
            Horizontal {
                Text { text: (&self.counter, |counter| format!("Counter {}", counter)) },
                Button {
                    clicked: Callback::new_rc(self, |vm, _| vm.increase()),
                    Text { text: "Increase" }
                },
            }
        )
    }
}

fn main() -> anyhow::Result<()> {
    let mut app = Application::new("Example: button").unwrap();

    app.add_window(
        WindowBuilder::new().with_title("Example: button"),
        MainViewModel::new(),
    )?;

    app.run();

    Ok(())
}

More examples

License

Licensed under

It's essentially the GNU GPL except it allows the distribution of an executable with a statically or dynamically linked library under the terms of your choice. The reason it's not LGPL is that dynamic linking is difficult with Rust.

The project is partially based on code from other projects:

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.

Commit count: 636

cargo fmt