Crates.io | fui_core |
lib.rs | fui_core |
version | 0.14.1 |
source | src |
created_at | 2020-08-01 16:29:53.783953 |
updated_at | 2024-05-30 15:44:15.914334 |
description | Core library of FUI MVVM UI Framework |
homepage | |
repository | https://github.com/marek-g/rust-fui |
max_upload_size | |
id | 271961 |
size | 228,222 |
MVVM Rust UI Framework Library.
fui_core
Core library of FUI MVVM UI Framework.
fui_macros
Macros for FUI UI Framework.
fui_controls
Standard controls for FUI UI Framework.
fui_controls_media
Media controls for FUI UI Framework.
fui_system
Cross-platform windowing library focused on good desktop integration (dialogs, menus, tray icons etc.).
fui_app
Application backend of FUI UI Framework.
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.
OpenGL
backendui!
macro for easier view creation#![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(())
}
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:
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.