Crate libhandy[][src]

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

functions
prelude
subclass

Structs

ActionRow

Implements

ActionRowBuilder

A builder-pattern type to construct ActionRow objects.

ApplicationWindow

Implements

ApplicationWindowBuilder

A builder-pattern type to construct ApplicationWindow objects.

Avatar

Implements

AvatarBuilder

A builder-pattern type to construct Avatar objects.

Carousel

Implements

CarouselBuilder

A builder-pattern type to construct Carousel objects.

CarouselIndicatorDots

Implements

CarouselIndicatorDotsBuilder

A builder-pattern type to construct CarouselIndicatorDots objects.

CarouselIndicatorLines

Implements

CarouselIndicatorLinesBuilder

A builder-pattern type to construct CarouselIndicatorLines objects.

Clamp

Implements

ClampBuilder

A builder-pattern type to construct Clamp objects.

ComboRow

Implements

ComboRowBuilder

A builder-pattern type to construct ComboRow objects.

Deck

Implements

DeckBuilder

A builder-pattern type to construct Deck objects.

EnumValueObject

Implements

ExpanderRow

Implements

ExpanderRowBuilder

A builder-pattern type to construct ExpanderRow objects.

Flap

Implements

FlapBuilder

A builder-pattern type to construct Flap objects.

HeaderBar

Implements

HeaderBarBuilder

A builder-pattern type to construct HeaderBar objects.

HeaderGroup

Implements

HeaderGroupBuilder

A builder-pattern type to construct HeaderGroup objects.

HeaderGroupChild

Implements

Keypad

Implements

KeypadBuilder

A builder-pattern type to construct Keypad objects.

Leaflet

Implements

LeafletBuilder

A builder-pattern type to construct Leaflet objects.

PreferencesGroup

Implements

PreferencesGroupBuilder

A builder-pattern type to construct PreferencesGroup objects.

PreferencesPage

Implements

PreferencesPageBuilder

A builder-pattern type to construct PreferencesPage objects.

PreferencesRow

Implements

PreferencesRowBuilder

A builder-pattern type to construct PreferencesRow objects.

PreferencesWindow

Implements

PreferencesWindowBuilder

A builder-pattern type to construct PreferencesWindow objects.

SearchBar

Implements

SearchBarBuilder

A builder-pattern type to construct SearchBar objects.

Squeezer

Implements

SqueezerBuilder

A builder-pattern type to construct Squeezer objects.

StatusPage

Implements

StatusPageBuilder

A builder-pattern type to construct StatusPage objects.

SwipeGroup

Implements

SwipeTracker

Implements

SwipeTrackerBuilder

A builder-pattern type to construct SwipeTracker objects.

Swipeable

Implements

TabBar

Implements

TabBarBuilder

A builder-pattern type to construct TabBar objects.

TabPage

Implements

TabPageBuilder

A builder-pattern type to construct TabPage objects.

TabView

Implements

TabViewBuilder

A builder-pattern type to construct TabView objects.

TitleBar

Implements

TitleBarBuilder

A builder-pattern type to construct TitleBar objects.

ValueObject

Implements

ViewSwitcher

Implements

ViewSwitcherBar

Implements

ViewSwitcherBarBuilder

A builder-pattern type to construct ViewSwitcherBar objects.

ViewSwitcherBuilder

A builder-pattern type to construct ViewSwitcher objects.

ViewSwitcherTitle

Implements

ViewSwitcherTitleBuilder

A builder-pattern type to construct ViewSwitcherTitle objects.

Window

Implements

WindowBuilder

A builder-pattern type to construct Window objects.

WindowHandle

Implements

WindowHandleBuilder

A builder-pattern type to construct WindowHandle objects.

Enums

CenteringPolicy
DeckTransitionType

This enumeration value describes the possible transitions between children in a Deck widget.

FlapFoldPolicyv1_2

These enumeration values describe the possible folding behavior in a Flap widget.

FlapTransitionTypev1_2

These enumeration values describe the possible transitions between children in a Flap widget, as well as which areas can be swiped via property::Flap::swipe-to-open and property::Flap::swipe-to-close.

HeaderGroupChildType

This enumeration value describes the child types handled by HeaderGroup.

LeafletTransitionType

This enumeration value describes the possible transitions between modes and children in a Leaflet widget.

NavigationDirection

Represents direction of a swipe navigation gesture in Deck and Leaflet.

SqueezerTransitionType

These enumeration values describe the possible transitions between children in a Squeezer widget.

ViewSwitcherPolicy

Constants

NONE_ACTION_ROW
NONE_APPLICATION_WINDOW
NONE_COMBO_ROW
NONE_DECK
NONE_EXPANDER_ROW
NONE_HEADER_BAR
NONE_KEYPAD
NONE_LEAFLET
NONE_PREFERENCES_GROUP
NONE_PREFERENCES_PAGE
NONE_PREFERENCES_ROW
NONE_PREFERENCES_WINDOW
NONE_SEARCH_BAR
NONE_SWIPEABLE
NONE_WINDOW

Traits

ValueObjectExtManual

Functions

ease_out_cubic

Computes the ease out for t.

enables_animations

Returns whether animations are enabled for that widget. This should be used when implementing an animated widget to know whether to animate it or not.

init

Call this function just after initializing GTK, if you are using GtkApplication it means it must be called when the GApplication::startup signal is emitted. If libhandy has already been initialized, the function will simply return.