rsgt 0.3.5

Rust simple GUI Toolkit
//========================================================================
// RSGT | lib.rs - https://overtimecoder.github.io
//------------------------------------------------------------------------
// Lib
//------------------------------------------------------------------------
//
// Author LatteS
//
// File was created in 2022/12/31
//
//========================================================================
//! # RSGT : Rust simple GUI Toolkit
//! # Event handling
//! RSGT's event handling is based on Swing (Java) event handling.
//! [Event Listener](event/trait.EventListener.html)
#![doc(html_logo_url = "https://raw.githubusercontent.com/OvertimeCoder/RSGT/main/src/icon.png")]

use std::fmt;
use std::fmt::Debug;
use winit::dpi::{LogicalPosition, PhysicalPosition, PhysicalSize};

pub mod error;
pub mod event;
pub mod graphic;
pub mod os;
pub mod rframe;

// Modules
mod color;
pub mod theme;
pub mod widget;

/// Message Box Results
/// Enumerator for 'match' in message box result
pub enum ResponseType {
    /// If nothing has changed
    None,
    /// When OK is pressed
    Ok,
    /// When Yes is pressed
    Yes,
    /// When No is pressed
    No,
    /// When Cancel is pressed
    Cancel,
    /// When Close is pressed
    Close,
}

/// Cursor icon for Window or Widget
pub enum CursorIcon {
    Arrow,
    ScrollAll,
    CrossHair,
    Help,
    Hand,
    NotAllowed,
    Progress,
}

/// Window buttons
/// Enumerator for specifying window buttons
pub enum WindowButton {
    /// Close button
    Close,
    /// Maximize button
    Maximize,
    /// Minimize button
    Minimize,
}

#[derive(Debug, Clone, Copy)]
pub struct Size<T>(pub T, pub T);

impl<T> Size<T> {
    pub fn into_tuple(self) -> (T, T) {
        (self.0, self.1)
    }
}

impl From<Size<u32>> for PhysicalSize<u32> {
    fn from(value: Size<u32>) -> Self {
        Self {
            width: value.0,
            height: value.1,
        }
    }
}

#[derive(Debug, Clone, Copy)]
pub struct Position<T>(pub T, pub T);

impl<T> Position<T> {
    pub fn into_tuple(self) -> (T, T) {
        (self.0, self.1)
    }
}

impl From<Position<u32>> for LogicalPosition<u32> {
    fn from(value: Position<u32>) -> Self {
        Self {
            x: value.0,
            y: value.1,
        }
    }
}