rsgt 0.1.7

Rust simple GUI Toolkit
Documentation

RSGT : Rust simple GUI Toolkit

Note:The following is what we are aiming for, not what is currently possible.

rust-clippy analyze Crates.io Crates.io (latest)

RSGT is a fast hold-mode GUI library; RSGT runs primarily natively (WASM support is under consideration...)

Design

RSGT's event handling is based on Swing (Java) event handling. Also, the rendering of GUI components will be unique, so that components can be easily designed using CSS and other scripts.

Example

use std::path::{Path, PathBuf};
use rsgt::rframe::{FrameEvent, RFrame};
use rsgt::event::WindowListener;

fn main() {
    // Apply Visual Style (Windows only)
    rsgt::os::enable_visual_style();
    // Initialize RFrame
    let mut frame = RFrame::new("RSGT Sample window", "sample_window", 1280, 720);
    // Add window listener(Callback to detect Window events)
    frame.add_window_listener(SampleWindowListener{});
    // Set window icon
    frame.set_icon(rsgt::graphic::load_icon(Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/icon.png"))));
    // Show window
    frame.run();
}

struct SampleWindowListener {

}

impl WindowListener for SampleWindowListener {
    // Event fired when a file is dropped on the Window
    fn window_dropped_file(&self, path: PathBuf, _event: &FrameEvent) {
        // Get RFrame from FrameEvent
        let frame = _event.get_frame();
        frame.set_icon(rsgt::graphic::load_icon(path.as_path()));
    }
}

Goal

  • To be able to handle a wide range of applications from simple to complex
  • Ensure that the same code works the same in any environment

License

"RSGT" is under MIT LICENSE