Rust bindings to the minimalist, native, cross-platform UI toolkit `libui`

Related tags

GUI libui-rs
Overview

Improved User Interface

A cross-platform UI toolkit for Rust based on libui

travis-ci build status libui-rs appveyor build status badge actively developed badge

iui: iui crates.io version badge docs.rs for iui rustc 1.40 ui-sys: ui-sys crates.io version badge docs.rs for ui-sys rustc 1.40

iui is a simple (about 4 kLOC of Rust), small (about 800kb, including libui), easy to distribute (one shared library) GUI library, providing a Rusty user interface library that binds to native APIs via the libui and the ui-sys bindings crate.

iui wraps native retained mode GUI libraries, like Win32API on Windows, Cocoa on Mac OS X, and GTK+ on Linux and elsewhere. Thus all iui apps have a native look and feel and start from a highly performant base which is well integrated with the native ecosystem on each platform. Because it implements only the least common subset of these platform APIs, your apps will work on all platforms and won't have significant behavioral inconsistencies, with no additional effort on your part.

Using

Add iui to your project with:

iui = "0.3"

Then, in your code, all you have to do is:

  1. create a UI handle, initializing the UI library and guarding against memory unsafety
  2. make a window, or a few, with title and platform-native decorations, into which your app will be drawn
  3. add all your controls, like buttons and text inputs, laid out with both axial and grid layout options
  4. implement some callbacks for user input, taking full advantage of Rust's concurrency protections
  5. call UI::main, or take control over the event processing with an EventLoop, and voíla! A GUI!

Or, you can track the trunk branch, which may be broken and whose API often changes, with:

iui = { git = "https://github.com/rust-native-ui/libui-rs.git" branch="trunk" }

We have documentation on docs.rs for released versions and on github for trunk.

Examples

Three example GUI applications running on Linux Three example GUI applications running on Ubuntu

Check out the examples/ directory from the latest release for these examples and more.

Organization

This repository contains multiple Rust crates:

  • iui is the safe Rust wrapper, to be used by most users.
  • ui-sys is the raw unsafe bindings to the libui C code. libui is included as a submodule.

Also be sure to look at our changelog and learn how to contribute.

Building ui-sys

ui-sys includes libui as a sub-module and allows it to be built on-the-fly with the default features fetch and build. With fetch disabled, it will simply build the existing sources without updating them, and with build disabled it will build nothing, assuming either a system or local (in ./lib/) version of libui is available.

Note that most of the time, building libui on the fly is what you want.

Acknowledgments

Based on work by @pcwalton.

Comments
  • Trying to `cargo build` fails on `ui-sys`

    Trying to `cargo build` fails on `ui-sys`

    Doing: cargo build causes following error on Windows 7 (64bit) and Rust 1.24.

    _Compiling ui-sys v0.1.1 error: failed to run custom build command for ui-sys v0.1.1

    --- stderr fatal: Not a git repository (or any of the parent directories): .git thread 'main' panicked at '_

    The trace leads to: 10: build_script_build::main at .\build.rs:15

    If I initialise a git-repo inside the folder, it just keeps the same error-trace but no actual mentioning of a fatal error.

    c-bug x-help wanted p-high 
    opened by heliasi4 18
  • Remove cmake dependency

    Remove cmake dependency

    This is an experimental patch that removes the dependency on cmake. It has been fully tested on Windows and Unix, and Darwin.

    Additionally, a CI test for Darwin has been added, although the test currently times out on Travis in src/controls/progressbar.rs - controls::progressbar::ProgressBarValue (line 19). This is an upstream issue (see https://github.com/andlabs/libui/issues/495).

    Platform support:

    • [x] Darwin
    • [x] Unix
    • [x] Windows MSVC
    • [x] Windows GNU

    This has not been tested without the build feature enabled, as I am not familiar with how that should work.

    c-enhancement p-high k-dependencies k-buildprocess 
    opened by xobs 17
  • Transition to bindgen bindings.

    Transition to bindgen bindings.

    This ensures that iui and ui-sys will be accurately tracking libui's development, and allows us to be more agile in terms of implementing new (and experimental) features.

    Closes #28

    @kennytm review would be appreciated

    c-bug c-enhancement x-help wanted p-high k-dependencies 
    opened by NoraCodes 14
  • Static linking of libui

    Static linking of libui

    I looked around but I did not see any option to build a static version of libui and link it directly in our binary. I would prefer this to shipping libui.dll with my exectuable.

    Have you looked into this before?

    c-enhancement x-help wanted p-medium k-dependencies 
    opened by nshtg 10
  • Readd functionality from masche842 libui-rs fork

    Readd functionality from masche842 libui-rs fork

    Hi Leo,

    as bespoken on reddit. Let's do this.

    I've merged my changes onto your libui-rs fork, and readded all the functionality I need at the moment to iui. It works for me on mac OS, but I'm pretty sure there are issues on other platforms. Moreover, I'm still using my own libui-fork ([email protected]:masche842/libui) which diverged from libui upstream quite a bit.

    Nonetheless, this is all I need at the moment and with these changes in iui, there is no reason for me to maintain my own version of libui-rs. Instead, I can help you with iui.

    opened by masche842 10
  • compiling example failed with error not LNK1181: ui.lib not found on Windows 10

    compiling example failed with error not LNK1181: ui.lib not found on Windows 10

    After updating to the master branch, I came across an error of LNK1181:

    $ cargo run
       Compiling unicode-xid v0.0.4
       Compiling winapi v0.3.4
       Compiling quote v0.3.15
       Compiling cc v1.0.15
       Compiling rustc-demangle v0.1.8
       Compiling cfg-if v0.1.3
       Compiling libc v0.2.41
       Compiling bitflags v1.0.3
       Compiling synom v0.11.3
       Compiling syn v0.11.11
       Compiling cmake v0.1.31
       Compiling ui-sys v0.1.2 (https://github.com/LeoTindall/libui-rs#5a68a471)
       Compiling backtrace v0.3.8
       Compiling synstructure v0.6.1
       Compiling failure_derive v0.1.1
       Compiling failure v0.1.1
       Compiling iui v0.2.0 (https://github.com/LeoTindall/libui-rs#5a68a471)
       Compiling iui-example v0.1.0 (file:///C:/Users/34937/Desktop/learning-rust/iui-example)
    error: linking with `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX64\x64\link.exe` failed: exit code: 1181
      |
      = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.12.25827\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.138pesuvab4dy035.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.16u6js6g0l3k1ic6.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.1ckp3bwk0jmrbky4.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.1im38lueib99jsk0.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.1mvmz58owquyropc.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.1y16o1qfye96o7m0.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.1zeawhkbeobww1zn.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.23tqyymcb18u96mb.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.287fjwldxriihryb.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.2jqywn86b2gsqohu.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.2lyh15q6cjwzy18c.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.2yyg5bd89e3irycb.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.3171x0bwu82dptu7.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.3ayaeypdcro9d6yk.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.3cx7oljifvb206q7.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.3p4871ksc97vnnrn.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.3rngp6bm2u2q5z0y.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.3vv0q9obd6w3595h.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.3woqeoqf0goarhik.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.436dotimmrgzkwfa.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.45nf4z58qqykpcpi.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.45pc7c65foh9i35f.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.48721dc4k5qxei0u.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.4954tfkopzmp0j3d.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.49a7n47po4ttqjl7.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.4e37gusgw81ck2ot.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.4ezmh1vbs95c5ack.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.4xq48u46a1pwiqn7.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.4yekh4a49ri9ikb0.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.4yh8x2b62dcih00t.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.4ypvbwho0bu5tnww.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.63mmpc50mjcb0lb.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.8xzrsc1ux72v29j.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.98g0d9x8aw3akpe.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.9elsx31vb4it187.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.c6lbtaiefvx3wya.rcgu.o" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.uj1kr5j3wr6o9sy.rcgu.o" "/OUT:C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.exe" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\iui_example-7e5f53b6c9b28dbe.crate.allocator.rcgu.o" "/OPT:REF,NOICF" "/DEBUG" "/NATVIS:C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/LIBPATH:C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps" "/LIBPATH:C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\build\\ui-sys-0d6721beb6524842\\out\\build\\out" "/LIBPATH:C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\libiui-9d03c669f0fd7bc0.rlib" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\libui_sys-d2250fba2a597401.rlib" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\liblibc-29d80453b21edd84.rlib" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\libfailure-c342c1ff1ee122ce.rlib" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\libbacktrace-dc01882281fe6157.rlib" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\librustc_demangle-89653463bfc73aaf.rlib" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\libcfg_if-354d1195934b0143.rlib" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\libwinapi-b854eb8bfb29492c.rlib" "C:\\Users\\34937\\Desktop\\learning-rust\\iui-example\\target\\debug\\deps\\libbitflags-d08788bbacc8698c.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd-81327c94ecbc69b1.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libpanic_unwind-904bdc107e3475d8.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libunwind-97dd6b71b2944814.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liblibc-7810a3f9a7e6d71a.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc_system-a6c908865d944125.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\liballoc-1337600a3a219c73.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libstd_unicode-0e6be5c2cb6a5139.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcore-34c46a8013b46e75.rlib" "C:\\Users\\34937\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-e8d853735a158029.rlib" "ui.lib" "libui.lib" "dbghelp.lib" "kernel32.lib" "advapi32.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "shell32.lib" "msvcrt.lib"
      
    # the error indicate ui.lib not found
      = note: Non-UTF-8 output: LINK : fatal error LNK1181: \xce\xde\xb7\xa8\xb4\xf2\xbf\xaa\xca\xe4\xc8\xeb\xce\xc4\xbc\xfe\xa1\xb0ui.lib\xa1\xb1\r\n  
    
    error: aborting due to previous error
    
    error: Could not compile `iui-example`.
    
    To learn more, run the command again with --verbose.
    

    I have had cmake installed, and compiled it with rust 1.26 stable:

    $ cmake --version
    cmake version 3.11.2
    
    CMake suite maintained and supported by Kitware (kitware.com/cmake).
    
    $ rustc --version
    rustc 1.26.0 (a77568041 2018-05-07)
    

    Did I miss some steps to do?

    opened by huangjj27 9
  • error: failed to run custom build command for `ui-sys v0.1.3`

    error: failed to run custom build command for `ui-sys v0.1.3`

    I'm trying to execute the example in the crate.io but got this error, I read #14, #249 and #282 but did not get what shall I do exactly.

    I'm at Mac.

    The full error is:

    Hasans-Air:hello-iui hasan$ cargo build Compiling proc-macro2 v0.4.19
    Compiling unicode-xid v0.1.0 Compiling cc v1.0.25 Compiling failure_derive v0.1.2 Compiling libc v0.2.43 Compiling cfg-if v0.1.5 Compiling rustc-demangle v0.1.9 Compiling bitflags v1.0.4 Compiling backtrace v0.3.9 Compiling cmake v0.1.34 Compiling ui-sys v0.1.3 Compiling quote v0.6.8 Compiling syn v0.14.9 error: failed to run custom build command for ui-sys v0.1.3 process didn't exit successfully: /Users/hasan/hello-iui/target/debug/build/ui-sys-0fdbd7b46e2e8b27/build-script-build (exit code: 101) --- stdout git version 2.17.1 running: "cmake" "/Users/hasan/.cargo/registry/src/github.com-1ecc6299db9ec823/ui-sys-0.1.3/libui" "-DCMAKE_INSTALL_PREFIX=/Users/hasan/hello-iui/target/debug/build/ui-sys-95463f95efa66ad5/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_BUILD_TYPE=release" -- The C compiler identification is AppleClang 10.0.0.10001044 -- The CXX compiler identification is AppleClang 10.0.0.10001044 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- broken -- Configuring incomplete, errors occurred! See also "/Users/hasan/hello-iui/target/debug/build/ui-sys-95463f95efa66ad5/out/build/CMakeFiles/CMakeOutput.log". See also "/Users/hasan/hello-iui/target/debug/build/ui-sys-95463f95efa66ad5/out/build/CMakeFiles/CMakeError.log".

    --- stderr fatal: not a git repository (or any of the parent directories): .git CMake Error at /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/CMakeTestCXXCompiler.cmake:45 (message): The C++ compiler

    "/usr/bin/c++"
    

    is not able to compile a simple test program.

    It fails with the following output:

    Change Dir: /Users/hasan/hello-iui/target/debug/build/ui-sys-95463f95efa66ad5/out/build/CMakeFiles/CMakeTmp
    
    Run Build Command:"/usr/bin/make" "cmTC_31f52/fast"
    /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_31f52.dir/build.make CMakeFiles/cmTC_31f52.dir/build
    Building CXX object CMakeFiles/cmTC_31f52.dir/testCXXCompiler.cxx.o
    /usr/bin/c++    -ffunction-sections -fdata-sections -fPIC -m64  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8   -o CMakeFiles/cmTC_31f52.dir/testCXXCompiler.cxx.o -c /Users/hasan/hello-iui/target/debug/build/ui-sys-95463f95efa66ad5/out/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    1 warning generated.
    Linking CXX executable cmTC_31f52
    /usr/local/Cellar/cmake/3.11.4/bin/cmake -E cmake_link_script CMakeFiles/cmTC_31f52.dir/link.txt --verbose=1
    /usr/bin/c++   -ffunction-sections -fdata-sections -fPIC -m64  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names   CMakeFiles/cmTC_31f52.dir/testCXXCompiler.cxx.o  -o cmTC_31f52 
    clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
    ld: library not found for -lstdc++
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_31f52] Error 1
    make: *** [cmTC_31f52/fast] Error 2
    

    CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:35 (project)

    thread 'main' panicked at ' command did not execute successfully, got: exit code: 1

    build script failed, must exit now', /Users/hasan/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.34/src/lib.rs:776:5 note: Run with RUST_BACKTRACE=1 for a backtrace.

    warning: build failed, waiting for other jobs to finish... error: build failed

    c-bug p-high k-buildprocess 
    opened by hasanOryx 7
  • Is there a way to create a scrollable area?

    Is there a way to create a scrollable area?

    I'm currently writing a program that will need to render long lists of stuff. Currently, the items extend off the screen. Is it possible to make a scrollable area?

    c-enhancement t-wontfix k-dependencies 
    opened by chenshuiluke 6
  • No line breaks show in MultilineEntry

    No line breaks show in MultilineEntry

    MultilineEntry does not display line breaks if those are supplied with set_value, such as

    let mut mle = MultilineEntry::new(&ui);
    mle.set_value(&ui, "hello\nworld");
    

    The MultilineEntry will show "helloworld". The text returned from that MultilineEntry will be shown correctly with a line break when displayed with println!("{}", mle.value(&ui));

    c-bug p-medium 
    opened by woelper 6
  • Add a canvas example

    Add a canvas example

    fixes #24. the example just renders the following: 2019-01-12-06

    /cc @Pomettini (you wanted to know about this ~12 days ago. sorry! hopefully this is a good reference)

    opened by barzamin 5
  • `UI::queue_main` and `UI::on_should_quit` are unsound

    `UI::queue_main` and `UI::on_should_quit` are unsound

    This program prints garbage to the console on my system:

        let ev = iui::UI::init().unwrap();
    
        {
            let v = vec![1, 2, 3, 4];
            ev.queue_main(|| {
                for i in &v {
                    println!("{}", i);
                }
            });
        }
    
        ev.main();
    

    This is a use-after-free on the vector v and should not compile. Both UI::queue_main and UI::on_should_quit must require the callback to be 'static.

    This is probably the case for all functions that take a callback, not just those 2, but I just started using iui, so I don't which (if any) other functions are affected.

    You can test that this code example doesn't compile using compiletest-rs.

    c-bug p-high 
    opened by jonas-schievink 5
  • Move controls to separate files where possible

    Move controls to separate files where possible

    This PR does not introduce any functional changes and does not depend on any of my others. It moves some of the controls into their own files for better maintainability. Controls with common traits are left together. In the light of future use of libui-ng, where there will be more functions to some of the controls it seemed like a good thing to do.

    Its not strictly necessary however and comes down to personal preference, so feel free to decline this PR.

    opened by nptr 0
  • Removed 'regex' and 'lazy_static' dependency

    Removed 'regex' and 'lazy_static' dependency

    I noticed that insert_dual_endings() pulls in two dependencies (including a full regex engine) for a task that doesn't really justify their use. As a friend of independent applications and libraries I'd welcome if those two crates can be removed.

    Of course the new algorithm passes the unit tests. If you are wondering about the len+ 2 in String::with_capacity(), I though i'd leave room for two inserts before causing an allocation.

    opened by nptr 0
  • Use libui-ng instead of dormant libui

    Use libui-ng instead of dormant libui

    Because libui didn't show any activity for years, i propose to use the active libui-ng instead. No API functions were remove (only added) and it still compiles wonderfully. I only had to:

    • add the one new file to the build script.
    • hide warnings as we can't do much about them.

    I successfully built and then ran a test application on Debian 11 and on Windows 10. I encountered no issues that i could attribute to the updated library.

    opened by nptr 1
  • Cmake issue when building iui v 0.3.0 on windows 8.1

    Cmake issue when building iui v 0.3.0 on windows 8.1

    Compiling ui-sys v0.1.3 error: failed to run custom build command for ui-sys v0.1.3

    Caused by: process didn't exit successfully: C:\Users\intel\Desktop\Rust_Projects\guessing-game\target\debug\build\ui-sys-1a90a5063783f1a4\build-script-build (exit code: 101) --- stdout git version 2.37.1.windows.1 CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-msvc = None CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_msvc = None HOST_CMAKE_TOOLCHAIN_FILE = None CMAKE_TOOLCHAIN_FILE = None CMAKE_GENERATOR_x86_64-pc-windows-msvc = None CMAKE_GENERATOR_x86_64_pc_windows_msvc = None HOST_CMAKE_GENERATOR = None CMAKE_GENERATOR = None CMAKE_PREFIX_PATH_x86_64-pc-windows-msvc = None CMAKE_PREFIX_PATH_x86_64_pc_windows_msvc = None HOST_CMAKE_PREFIX_PATH = None CMAKE_PREFIX_PATH = None CMAKE_x86_64-pc-windows-msvc = None CMAKE_x86_64_pc_windows_msvc = None HOST_CMAKE = None CMAKE = None running: "cmake" "C:\Users\intel\.cargo\registry\src\github.com-1ecc6299db9ec823\ui-sys-0.1.3\libui" "-G" "Visual Studio 16 2019" "-Thost=x64" "-Ax64" "-DCMAKE_INSTALL_PREFIX=C:\Users\intel\Desktop\Rust_Projects\guessing-game\target\debug\build\ui-sys-bb7b023830056e1d\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_BUILD_TYPE=release" -- Selecting Windows SDK version 10.0.19041.0 to target Windows 6.3.9600. -- Configuring done -- Generating done -- Build files have been written to: C:/Users/intel/Desktop/Rust_Projects/guessing-game/target/debug/build/ui-sys-bb7b023830056e1d/out/build running: "cmake" "--build" "." "--target" "" "--config" "release" "--parallel" "4"

    --- stderr fatal: not a git repository (or any of the parent directories): .git Usage: cmake --build

    [options] [-- [native-options]] cmake --build --preset [options] [-- [native-options]] Options: = Project binary directory to be built. --preset , --preset= = Specify a build preset. --list-presets = List available build presets. --parallel [], -j [] = Build in parallel using the given number of jobs. If is omitted the native build tool's default number is used. The CMAKE_BUILD_PARALLEL_LEVEL environment variable specifies a default parallel level when this option is not given. --target ..., -t ... = Build instead of default targets. --config = For multi-configuration tools, choose . --clean-first = Build target 'clean' first, then build. (To clean only, use --target 'clean'.) --resolve-package-references={on|only|off} = Restore/resolve package references during build. --verbose, -v = Enable verbose output - if supported - including the build commands to be executed. -- = Pass remaining options to the native tool. thread 'main' panicked at ' command did not execute successfully, got: exit code: 1

    build script failed, must exit now', C:\Users\intel.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.48\src\lib.rs:975:5 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

    opened by mhamedGd 0
  • Reference-counted AreaHandlers for interactive canvas scenarios

    Reference-counted AreaHandlers for interactive canvas scenarios

    I'm using this library to implement widgets for a STEM toolkit I'm building. It's perfect, super simple, and has just what I need. Thank you!

    Some of my components require both custom painting and interaction, but when I started to use Area and AreaHandler, I ran into some limitations. The AreaHandler object passed into Area::new is boxed, and there's no way to access that object from a reference to an Area, so its state can't be changed after the area is created.

    let meter = Box::new(Meter { value: 100.0 });
    let area = Area::new(&ui, meter);
    // Can't change it anymore!
    meter = 50.0;
    

    In my fork, I've modified area.rs to also support reference-counted handlers (Rc<RefCell<dyn AreaHandler>>).

    let meter = Rc::new(RefCell:new(Meter { value: 100.0 }));
    let area = Area::new(&ui, meter.clone());
    // Can change this any time.
    meter.borrow_mut().value = 50.0;
    area.queue_redraw_all(&ui);
    

    The change still supports boxed handlers, and requires no changes to existing code - the existing canvas example runs perfectly - but I've also created a new example that shows how to build an interactive canvas with a ref-counted handler. The handler also implements a changed event that can be hooked by the application. In effect, someone could use this technique to build simple controls on top of an Area.

    Would you be interested in a PR to add this change? I'd be happy to do the work to get it PR-ready.

    Thanks again for this project!

    opened by shankuniyogi 1
Releases(0.3.0)
  • 0.3.0(Jun 13, 2018)

    Added

    • README now has syntax coloring
    • README now has badges and sample screenshot
    • Checkbox control for Boolean input
    • Combobox control for selecting from one of a fixed set of options
    • LayoutGrid control for grid-based 2D layouts
    • ui-sys can now be built without either pulling or building libui, controlled by Cargo features
    • Building on MSVC now works

    Changed

    • ptr() method on controls is no longer unsafe
    • iui now uses bitflags 1.0
    • Area functions which have UB based on the type of Area are now unsafe

    Deprecated

    No deprecations.

    Removed

    • The old ui codebase no longer lives in this repository.

    Fixed

    • HorizontalBox::new now correctly returns a HorizontalBox

    Security

    No security changes.

    Source code(tar.gz)
    Source code(zip)
Owner
Rust Native UI Group
A group for the libui-rs, Improved User Interface, and other Rust native UI crates.
Rust Native UI Group
A Rust binding of the wxWidgets cross platform toolkit.

wxRust master: / mac(0.10): This is a Rust binding for the wxWidgets cross platform toolkit. API wxRust API documentation How it works The wxRust libr

KENZ 129 Jan 4, 2023
A cross-platform GUI toolkit in Rust

NXUI - Native X UI A cross-platform GUI toolkit in Rust NXUI is a GUI toolkit that calls OS native APIs as much as possible to achieve fast operation.

らて 11 Jun 3, 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
Cross-platform native Rust menu library

A cross-platform Rust library for managing the native operating system menus.

Mads Marquart 16 Jan 6, 2023
A data-first Rust-native UI design toolkit.

Druid A data-first Rust-native UI toolkit. Druid is an experimental Rust-native UI toolkit. Its main goal is to offer a polished user experience. Ther

null 8.2k Dec 31, 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
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
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
rsautogui aims to be a cross-platform GUI automation rust crate.

rsautogui rsautogui aims to be a cross-platform GUI automation rust crate. It lets you control the mouse and keyboard to automate interactions with ot

null 5 Sep 18, 2022
Alerion is a cross-platform Rust rewrite of Pterodactyl Wings

alerion ?? A complete rewrite of pterodactyl wings. Caution Here be dragons. This project is still a huge work in progress and is not ready for produc

Pyro 5 Apr 15, 2024
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
A cross-platform Mod Manager for RimWorld intended to work with macOS, linux and Windows

TODOs are available here. Discussions, PRs and Issues are open for anyone who is willing to contribute. rrm Inspired by Spoons rmm. This is a cross-pl

Alejandro Osornio 7 Sep 5, 2022
A lightweight cross-platform system-monitoring fltk gui application based on sysinfo

Sysinfo-gui A lightweight cross-platform system-monitoring fltk gui application based on sysinfo. The UI design is inspired by stacer. The svg icons a

Mohammed Alyousef 22 Dec 31, 2022
The Rust UI-Toolkit.

The Orbital Widget Toolkit is a cross-platform (G)UI toolkit for building scalable user interfaces with the programming language Rust. It's based on t

Redox OS 3.7k Jan 1, 2023
SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. We support multiple programming languages, such as Rust, C++ or JavaScript.

SixtyFPS is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. We support multiple programming languages, such as Rust, C++ or JavaScript.

SixtyFPS 5.5k Jan 1, 2023
A light windows GUI toolkit for rust

Native Windows GUI Welcome to Native Windows GUI (aka NWG). A rust library to develop native GUI applications on the desktop for Microsoft Windows. NW

Gabriel Dube 1.6k Jan 7, 2023
Modular FFXIV data toolkit written in rust.

ironworks Modular FFXIV data toolkit written in rust. ironworks is pre-1.0, and as such its API should be considered unstable. Breaking API changes wi

Saxon Landers 10 Oct 21, 2022