logo
Expand description

Rust Handy bindings

This library contains safe Rust bindings for Handy, a library that offers building blocks for modern adaptive GNOME applications.

See also

Example

use gtk::prelude::*;
use gtk::{Application, Box, ListBox, Orientation};
use libhandy::prelude::*;
use libhandy::{ActionRow, ApplicationWindow, HeaderBar};

fn main() {
    let application = Application::builder()
        .application_id("com.example.FirstHandyApp")
        .build();

    application.connect_activate(|app| {
        libhandy::init();

        // ActionRows are only available in Handy
        let row = ActionRow::builder()
            .activatable(true)
            .selectable(false)
            .margin(32)
            .title("Click me")
            .build();
        row.connect_activated(|_| {
            eprintln!("Clicked!");
        });

        let list = ListBox::builder().child(&row).build();
        // the content class makes the list look nicer
        list.style_context().add_class("content");

        // Combine the content in a box
        let content = Box::new(Orientation::Vertical, 0);
        // Handy's ApplicationWindow does not include a HeaderBar
        content.add(
            &HeaderBar::builder()
                .show_close_button(true)
                .title("First Handy Program")
                .build(),
        );
        content.add(&list);

        let window = ApplicationWindow::builder()
            .default_width(350)
            .default_height(70)
            // add content to window
            .child(&content)
            .build();
        window.set_application(Some(app));
        window.show_all();
    });

    application.run();
}

Modules

Structs

A gtk::ListBoxRow used to present actions.

A freeform application window.

A widget displaying an image, with a generated fallback.

A paginated scrolling widget.

A dots indicator for Carousel.

A lines indicator for Carousel.

A widget constraining its child to a given size.

A gtk::ListBoxRow used to choose from a list of items.

A swipeable widget showing one of the visible children at a time.

An object representing an GObject::EnumValue.

A gtk::ListBoxRow used to reveal widgets.

An adaptive container acting like a box or an overlay.

A title bar widget.

An object handling composite title bars.

A child object for HeaderGroup.

A keypad for dialing numbers

An adaptive container acting like a box or a stack.

A group of preference rows.

A gtk::ListBoxRow used to present preferences.

A window to present an application’s preferences.

A toolbar to integrate a search entry with.

A best fit container.

A page used for empty/error states and similar use-cases.

A class for managing application-wide styling.

An object for syncing swipeable widgets.

Swipe tracker used in Carousel and Leaflet.

An interface for swipeable widgets.

A tab bar for TabView.

An auxiliary class used by TabView.

A dynamic tabbed container.

A simple title bar container.

An object representing a glib::Value.

An adaptive view switcher.

A view switcher action bar.

A view switcher title.

A freeform window.

A bin that acts like a titlebar.

Enums

Describes title centering behavior of a gtk::HeaderBar widget.

Application color schemes for property::StyleManager::color-scheme.

Describes the possible transitions in a Deck widget.

Describes the possible folding behavior of a Flap widget.

Describes transitions types of a Flap widget.

Describes the child types handled by HeaderGroup.

Describes the possible transitions in a Leaflet widget.

Describes the direction of a swipe navigation gesture.

Describes the possible transitions in a Squeezer widget.

Describes the adaptive modes of ViewSwitcher.

Traits

Functions

Computes the ease out for a value.

Checks whether animations are enabled for @widget.

Initializes Libhandy.