Clear Coat is a Rust wrapper for the IUP GUI library.

Related tags

GUI clear-coat
Overview

Clear Coat

Clear Coat is a Rust wrapper for the IUP GUI library. IUP uses native controls and has Windows and GTK backends. A macOS backend has been on its shrinking TODO list for a long time, so I'm hopeful it will happen.

[dependencies]
clear-coat = { git = "https://github.com/jminer/clear-coat" }

For the most part, the wrapper should be thin and use the same naming so that it is easy to use IUP's documentation. There are a couple of attributes like FGCOLOR that may not ever be supported because they are generally not good to use (easy to mess up accessibility, etc.). Otherwise, the goal is to support every feature in IUP. There are a couple of features that IUP does not have, but the wrapper will:

  • Support for notifying the event thread from another thread (IUP really should have this ability)
  • Support for registering multiple callbacks to one event (can be worked around, but is still useful)
  • The default minimum size of buttons on Windows is correct.
  • Indexes are always zero-based, never one-based (IUP's list item indexes are one-based).

Of course, being written in Rust, Clear Coat provides a memory-safe interface. It should be impossible to use-after-free or get a segfault/access violation without using unsafe code. If you find a way, I'd love to hear about it so that I can fix it.

Status of controls supported

License

This library is licensed under the MIT license, the same as IUP is.

Comments
  • Panic while panicking on closing showcase example

    Panic while panicking on closing showcase example

    I ran the showcase example as:

    cargo run --release --example showcase
    

    and got this stack trace on closing the application:

         Running `target\release\examples\showcase.exe`
    thread '<unnamed>' panicked at 'cannot access a Thread Local Storage value during or after destruction: AccessError', src\libcore\result.rs:1188:5
    stack backtrace:
       0: backtrace::backtrace::trace_unsynchronized
                 at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.40\src\backtrace\mod.rs:66
       1: std::sys_common::backtrace::_print_fmt
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys_common\backtrace.rs:84
       2: std::sys_common::backtrace::_print::{{impl}}::fmt
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys_common\backtrace.rs:61
       3: core::fmt::write
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libcore\fmt\mod.rs:1057
       4: std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\io\mod.rs:1426
       5: std::sys_common::backtrace::_print
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys_common\backtrace.rs:65
       6: std::sys_common::backtrace::print
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys_common\backtrace.rs:50
       7: std::panicking::default_hook::{{closure}}
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:193
       8: std::panicking::default_hook
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:210
       9: std::panicking::rust_panic_with_hook
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:471
      10: std::panicking::begin_panic_handler
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:375
      11: core::panicking::panic_fmt
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libcore\panicking.rs:84
      12: core::result::unwrap_failed
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libcore\result.rs:1188
      13: std::thread::local::LocalKey<T>::with
      14: <clear_coat::handle_rc::HandleBox as core::ops::drop::Drop>::drop
      15: core::ptr::real_drop_in_place
      16: <alloc::vec::Vec<T> as core::ops::drop::Drop>::drop
      17: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
      18: <hashbrown::raw::RawTable<T> as core::ops::drop::Drop>::drop
      19: std::thread::local::fast::destroy_value
      20: std::sys_common::thread_local::register_dtor_fallback::run_dtors
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys_common\thread_local.rs:257
      21: std::sys::windows::thread_local::run_dtors
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys\windows\thread_local.rs:229
      22: std::sys::windows::thread_local::on_tls_callback
                 at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys\windows\thread_local.rs:198
      23: RtlActivateActivationContextUnsafeFast
      24: RtlActivateActivationContextUnsafeFast
      25: LdrShutdownProcess
      26: RtlExitUserProcess
      27: ExitProcess
      28: o_free
      29: exit
      30: __scrt_common_main_seh
                 at d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:295
      31: BaseThreadInitThunk
      32: RtlUserThreadStart
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    thread '<unnamed>' panicked at 'cannot access a Thread Local Storage value during or after destruction: AccessError', src\libcore\result.rs:1188:5
    stack backtrace:
       0:     0x7ff69f0b3c29 - backtrace::backtrace::trace_unsynchronized
                                   at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.40\src\backtrace\mod.rs:66
       1:     0x7ff69f0b3c29 - std::sys_common::backtrace::_print_fmt
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys_common\backtrace.rs:84
       2:     0x7ff69f0b3c29 - std::sys_common::backtrace::_print::{{impl}}::fmt
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys_common\backtrace.rs:61
       3:     0x7ff69f0c35db - core::fmt::write
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libcore\fmt\mod.rs:1057
       4:     0x7ff69f0b1bf4 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\io\mod.rs:1426
       5:     0x7ff69f0b62d9 - std::sys_common::backtrace::_print
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys_common\backtrace.rs:65
       6:     0x7ff69f0b62d9 - std::sys_common::backtrace::print
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys_common\backtrace.rs:50
       7:     0x7ff69f0b62d9 - std::panicking::default_hook::{{closure}}
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:193
       8:     0x7ff69f0b5f2c - std::panicking::default_hook
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:210
       9:     0x7ff69f0b6a7c - std::panicking::rust_panic_with_hook
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:471
      10:     0x7ff69f0b6600 - std::panicking::begin_panic_handler
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:375
      11:     0x7ff69f0c0f8d - core::panicking::panic_fmt
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libcore\panicking.rs:84
      12:     0x7ff69f0c108f - core::result::unwrap_failed
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libcore\result.rs:1188
      13:     0x7ff69f0a981c - std::thread::local::LocalKey<T>::with::hc5369f099aa00d23
      14:     0x7ff69f0a1b44 - <clear_coat::handle_rc::HandleBox as core::ops::drop::Drop>::drop::hb08ada81a4e237c1
      15:     0x7ff69f09acb1 - core::ptr::real_drop_in_place::h0852df87acd39e67
      16:     0x7ff69f09d36c - core::ptr::real_drop_in_place::h35b2fd28b1887b6b
      17:     0x7ffc5f261030 - <unknown>
      18:     0x7ffc5f2635c6 - is_exception_typeof
      19:     0x7ffc5f26c454 - _C_specific_handler
      20:     0x7ffc5f263021 - is_exception_typeof
      21:     0x7ffc5f26c8f1 - _CxxFrameHandler3
      22:     0x7ffc659c127f - _chkstk
      23:     0x7ffc6593da32 - RtlUnwindEx
      24:     0x7ffc659ac719 - _C_specific_handler
      25:     0x7ffc659c11ff - _chkstk
      26:     0x7ffc6598a289 - RtlRaiseException
      27:     0x7ffc6598a043 - RtlRaiseException
      28:     0x7ffc634fa839 - RaiseException
      29:     0x7ffc5f264880 - CxxThrowException
      30:     0x7ff69f0b9073 - panic_unwind::imp::panic
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libpanic_unwind\seh.rs:260
      31:     0x7ff69f0b9019 - panic_unwind::__rust_start_panic
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libpanic_unwind\lib.rs:103
      32:     0x7ff69f0b6b48 - std::panicking::rust_panic
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:521
      33:     0x7ff69f0b6b2e - std::panicking::rust_panic_with_hook
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:491
      34:     0x7ff69f0b6600 - std::panicking::begin_panic_handler
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\panicking.rs:375
      35:     0x7ff69f0c0f8d - core::panicking::panic_fmt
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libcore\panicking.rs:84
      36:     0x7ff69f0c108f - core::result::unwrap_failed
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libcore\result.rs:1188
      37:     0x7ff69f0a981c - std::thread::local::LocalKey<T>::with::hc5369f099aa00d23
      38:     0x7ff69f0a1b44 - <clear_coat::handle_rc::HandleBox as core::ops::drop::Drop>::drop::hb08ada81a4e237c1
      39:     0x7ff69f09d263 - core::ptr::real_drop_in_place::h35b2fd28b1887b6b
      40:     0x7ff69f09b0f2 - <alloc::vec::Vec<T> as core::ops::drop::Drop>::drop::h04ae795cde9d6cbf
      41:     0x7ff69f09ac04 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h1a67293cb116af3b
      42:     0x7ff69f0ab128 - <hashbrown::raw::RawTable<T> as core::ops::drop::Drop>::drop::h4c36d9f43fdc8c7e
      43:     0x7ff69f0addcb - std::thread::local::fast::destroy_value::h2e2e9d44c04a8ad4
      44:     0x7ff69f0b515e - std::sys_common::thread_local::register_dtor_fallback::run_dtors
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys_common\thread_local.rs:257
      45:     0x7ff69f0b80c8 - std::sys::windows::thread_local::run_dtors
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys\windows\thread_local.rs:229
      46:     0x7ff69f0b80c8 - std::sys::windows::thread_local::on_tls_callback
                                   at /rustc/9b98af84c4aa66392236fff59c86da2130d46d46\/src\libstd\sys\windows\thread_local.rs:198
      47:     0x7ffc659450a1 - RtlActivateActivationContextUnsafeFast
      48:     0x7ffc65945183 - RtlActivateActivationContextUnsafeFast
      49:     0x7ffc6598abb0 - LdrShutdownProcess
      50:     0x7ffc6598a9ad - RtlExitUserProcess
      51:     0x7ffc639ecd8a - ExitProcess
      52:     0x7ffc62baae38 - o_free
      53:     0x7ffc62ba86ef - exit
      54:     0x7ff69f165a47 - __scrt_common_main_seh
                                   at d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:295
      55:     0x7ffc639e7bd4 - BaseThreadInitThunk
      56:     0x7ffc6598ced1 - RtlUserThreadStart
    thread panicked while panicking. aborting.
    
    opened by skligys 1
  • nightly build failed

    nightly build failed

    seems code on crate not updated, it's OK when build with offline depends.

    cargo build
       Compiling clear-coat v0.0.3
    error[E0432]: unresolved import `std::panic::RecoverSafe`
      --> C:\Users\xl\.cargo\registry\src\mirrors.ustc.edu.cn-15f9db60536bad60\clear-coat-0.0.3\src\callbacks.rs:14:24
       |
    14 | use std::panic::{self, RecoverSafe};
       |                        ^^^^^^^^^^^ no `RecoverSafe` in `panic`
    
    error[E0423]: expected function, found macro `panic::recover`
       --> C:\Users\xl\.cargo\registry\src\mirrors.ustc.edu.cn-15f9db60536bad60\clear-coat-0.0.3\src\callbacks.rs:205:18
        |
    205 |     let result = panic::recover(move || {
        |                  ^^^^^^^^^^^^^^ did you mean `panic::recover!(...)`?
    
    opened by lynnux 1
  • Uniform columns/lines naming

    Uniform columns/lines naming

    IUP doesn't use consistent naming for "columns" and "lines". On a GridBox, it uses COL and LIN as in NUMCOL and NUMLIN. Yet List and Text have VISIBLECOLUMNS and VISIBLELINES attributes. I currently bound them with the names IUP uses, but I should probably make them consistent. Spelling them out is probably best.

    opened by jminer 0
  • Tracking issue for List

    Tracking issue for List

    Attributes

    • [x] id
    • [x] APPENDITEM
    • [ ] AUTOHIDE
    • [ ] AUTOREDRAW
    • BGCOLOR
    • [ ] CANFOCUS
    • [x] COUNT
    • [ ] DRAGDROPLIST
    • DROPFILESTARGET
    • [x] DROPDOWN
    • [ ] DROPEXPAND
    • [x] EDITBOX
    • FGCOLOR
    • [ ] IMAGEid
    • [x] INSERTITEMid
    • [x] MULTIPLE
    • [x] REMOVEITEM
    • SCROLLBAR
    • [ ] SHOWDRAGDROP
    • [ ] SHOWDROPDOWN
    • SHOWIMAGE
    • [ ] SIZE
    • [ ] SORT
    • [ ] TOPITEM
    • SPACING
    • [x] VALUE
    • VALUESTRING
    • VALUEMASKED
    • [ ] VISIBLEITEMS
    • [ ] VISIBLECOLUMNS
    • [ ] VISIBLELINES

    Text Attributes

    • APPEND
    • CARET
    • CARETPOS
    • CLIPBOARD
    • CUEBANNER
    • FILTER
    • INSERT
    • PADDING
    • MASK
    • NC
    • READONLY
    • SELECTEDTEXT
    • SELECTION
    • SELECTIONPOS
    • SCROLLTO
    • SCROLLTOPOS

    Callbacks

    • [x] ACTION
    • [ ] BUTTON_CB
    • [ ] CARET_CB
    • [ ] DBLCLICK_CB
    • [ ] DRAGDROP_CB
    • [ ] DROPDOWN_CB
    • [ ] DROPFILES_CB
    • [ ] EDIT_CB
    • [ ] MOTION_CB
    • [ ] MULTISELECT_CB
    • [ ] VALUECHANGED_CB
    opened by jminer 0
  • Tracking issue for Tabs

    Tracking issue for Tabs

    Attributes

    • BGCOLOR
    • [ ] CHILDOFFSET
    • COUNT
    • [ ] EXPAND
    • FGCOLOR
    • [ ] MULTILINE
    • [ ] PADDING
    • [ ] SHOWCLOSE
    • [ ] SIZE
    • [ ] TABIMAGEn
    • TABORIENTATION
    • [ ] TABVISIBLEn
    • [x] TABTITLEn
    • TABTYPE - Windows' visual styles are removed when this setting is not TOP
    • VALUE
    • [ ] VALUE_HANDLE
    • [ ] VALUEPOS

    Callbacks

    • [ ] TABCHANGE_CB
    • [ ] TABCHANGEPOS_CB
    • [ ] TABCLOSE_CB
    • [ ] RIGHTCLICK_CB
    opened by jminer 0
  • Tracking issue for Canvas

    Tracking issue for Canvas

    Attributes

    • BACKINGSTORE
    • BGCOLOR
    • BORDER
    • [x] CANFOCUS
    • [ ] CAIRO_CR
    • [x] CLIPRECT
    • [x] CURSOR
    • [ ] EXPAND
    • [ ] DROPFILESTARGET
    • [x] DRAWSIZE
    • [x] HDC_WMPAINT
    • [x] HWND
    • [x] SCROLLBAR
    • [x] DX
    • [x] DY
    • [x] POSX
    • [x] POSY
    • [x] XMIN
    • [x] XMAX
    • [x] YMIN
    • [x] YMAX
    • [x] LINEX
    • [x] LINEY
    • [ ] XAUTOHIDE
    • [ ] YAUTOHIDE
    • [ ] TOUCH
    • [ ] XDISPLAY
    • [x] XWINDOW

    Callbacks

    • [x] ACTION
    • [x] BUTTON_CB
    • [ ] DROPFILES_CB
    • [ ] FOCUS_CB
    • [x] MOTION_CB
    • [x] KEYPRESS_CB
    • [x] RESIZE_CB
    • [ ] SCROLL_CB
    • [ ] TOUCH_CB
    • [ ] MULTITOUCH_CB
    • [x] WHEEL_CB
    • WOM_CB
    opened by jminer 0
Owner
Jordan Miner
Jordan Miner
Rust binding for IUP

IUP Rust This library provides a high level wrapper around IUP, a multi-platform toolkit for building graphical user interfaces. See rust-iup-sys for

David Campbell 41 May 28, 2022
Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.

libui: a portable GUI library for C This README is being written. Status It has come to my attention that I have not been particularly clear about how

Pietro Gagliardi 10.4k Dec 31, 2022
An easy-to-use, 2D GUI library written entirely in Rust.

Conrod An easy-to-use, 2D GUI library written entirely in Rust. Guide What is Conrod? A Brief Summary Screenshots and Videos Feature Overview Availabl

PistonDevelopers 3.3k Jan 1, 2023
Rust bindings for the FLTK GUI library.

fltk-rs Rust bindings for the FLTK Graphical User Interface library. The FLTK crate is a crossplatform lightweight gui library which can be statically

Mohammed Alyousef 1.1k Jan 9, 2023
Idiomatic, GTK+-based, GUI library, inspired by Elm, written in Rust

Relm Asynchronous, GTK+-based, GUI library, inspired by Elm, written in Rust. This library is in beta stage: it has not been thoroughly tested and its

null 2.2k Dec 31, 2022
A cross-platform GUI library for Rust, inspired by Elm

Iced A cross-platform GUI library for Rust focused on simplicity and type-safety. Inspired by Elm. Features Simple, easy-to-use, batteries-included AP

Héctor Ramón 17.5k Jan 2, 2023
A cross-platform GUI library for Rust focused on simplicity and type-safety

A cross-platform GUI library for Rust, inspired by Elm

Héctor Ramón 17.5k Jan 8, 2023
A cross-platform GUI library for Rust, inspired by Elm

Iced A cross-platform GUI library for Rust focused on simplicity and type-safety. Inspired by Elm. Features Simple, easy-to-use, batteries-included AP

null 17.5k Dec 28, 2022
Rust bindings for the FLTK GUI library.

fltk-rs Rust bindings for the FLTK Graphical User Interface library. The fltk crate is a cross-platform lightweight gui library which can be staticall

fltk-rs 1.1k Jan 9, 2023
A single-header ANSI C immediate mode cross-platform GUI library

Nuklear This is a minimal-state, immediate-mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed a

Immediate Mode UIs, Nuklear, etc. 6.9k Jan 8, 2023
The bindings to the Nuklear 2D immediate GUI library.

nuklear-rust The bindings to the Nuklear 2D immediate GUI library. Currently beta. Drawing backends: gfx-pre-ll for GFX 3D drawing engine (examples: O

Serhii Plyhun 332 Dec 27, 2022
An idiomatic GUI library inspired by Elm and based on gtk4-rs

An idiomatic GUI library inspired by Elm and based on gtk4-rs. Relm4 is a new version of relm that's built from scratch and is compatible with GTK4 an

Aaron Erhardt 722 Dec 31, 2022
A simple, cross-platform GUI automation module for Rust.

AutoPilot AutoPilot is a Rust port of the Python C extension AutoPy, a simple, cross-platform GUI automation library for Python. For more information,

null 271 Dec 27, 2022
Truly cross platform, truly native. multiple backend GUI for rust

WIP: Sauron-native a rust UI library that conquers all platforms ranging from desktop to mobile devices. An attempt to create a truly native, truly cr

Jovansonlee Cesar 627 Jan 5, 2023
A simple news reading GUI app built in Rust

Headlines [WIP] A native GUI app built with Rust using egui. Uses newsapi.org as the source to fetch news articles. This is a WIP and the current stat

creativcoder 89 Dec 29, 2022
Build GUI applications with minimal dependencies in Rust

winapi-app-windows A crate to build applications' windows in Windows using WinAPI. This would be less confusing if the operating system was called som

Lonami 5 Jul 26, 2022
GUI based tool to sort and categorize images written in Rust

ImageSieve GUI based tool to sort out images based on similarity, categorize them according to their creation date and archive them in a target folder

Florian Fetz 67 Dec 14, 2022
egui: an easy-to-use immediate mode GUI in pure Rust

?? egui: an easy-to-use GUI in pure Rust egui is a simple, fast, and highly portable immediate mode GUI library for Rust. egui runs on the web, native

Emil Ernerfeldt 12.6k Jan 3, 2023
Cross-platform GUI toolkit written in Rust

Tuix is a cross-platform GUI toolkit written in Rust. The driving principle behind tuix is to be a self-contained, small-as-possible, but still fast,

George Atkinson 166 Dec 13, 2022