Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

rust-native-ui/libui-rs

Repository files navigation

A cross-platform UI toolkit for Rust based on libui

libui-rs travis build statuslibui-rs appveyor build status badgeactively developed badge

iui:iui crates.io version badgedocs.rs for iuiui-sys:ui-sys crates.io version badgedocs.rs for ui-sys

iui is a simple, small, easy to distribute GUI library, a Rusty user interface library that binds to platform native APIs.These are work-in-progress bindings to the minimalistic native UI library [libui][libui] via theui-sys bindings crate.

Addiui to your project with:

iui ="0.3"

Organization

This repository contains multiple Rust crates. Also be sure to look at ourchangelog and learnhow to contribute.

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

Based on work by@pcwalton. Licensed MIT.

Example

Three example GUI applications running on Linux

externcrate iui;use iui::prelude::*;use iui::controls::{Label,Button,VerticalBox,Group};fnmain(){// Initialize the UI librarylet ui =UI::init().expect("Couldn't initialize UI library");// Create a window into which controls can be placedletmut win =Window::new(&ui,"Test App",200,200,WindowType::NoMenubar);// Create a vertical layout to hold the controlsletmut vbox =VerticalBox::new(&ui);    vbox.set_padded(&ui,true);letmut group_vbox =VerticalBox::new(&ui);letmut group =Group::new(&ui,"Group");// Create two buttons to place in the windowletmut button =Button::new(&ui,"Button");    button.on_clicked(&ui,{let ui = ui.clone();move |btn|{            btn.set_text(&ui,"Clicked!");}});letmut quit_button =Button::new(&ui,"Quit");    quit_button.on_clicked(&ui,{let ui = ui.clone();move |_|{            ui.quit();}});// Create a new label. Note that labels don't auto-wrap!letmut label_text =String::new();    label_text.push_str("There is a ton of text in this label.\n");    label_text.push_str("Pretty much every unicode character is supported.\n");    label_text.push_str("🎉 用户界面 사용자 인터페이스");let label =Label::new(&ui,&label_text);    vbox.append(&ui, label,LayoutStrategy::Stretchy);    group_vbox.append(&ui, button,LayoutStrategy::Compact);    group_vbox.append(&ui, quit_button,LayoutStrategy::Compact);    group.set_child(&ui, group_vbox);    vbox.append(&ui, group,LayoutStrategy::Compact);// Actually put the button in the window    win.set_child(&ui, vbox);// Show the window    win.show(&ui);// Run the application    ui.main();}

Building ui-sys

ui-sys includeslibui as a sub-module and allows it to be built on-the-fly with thedefault featuresfetch andbuild. Withfetch disabled, it will simply build theexisting sources without updating them, and withbuild disabled it will build nothing,assuming either a system or local (in./lib/) version oflibui is available.

Note thatmost of the time, buildinglibui on the fly is what you want. It does howeverrequire a copy of cmake, essential build tools, et cetera.

About

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

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors21

Languages


[8]ページ先頭

©2009-2025 Movatter.jp