Crate libadwaita

Crate libadwaita 

Source
Expand description

§Rust Adwaita bindings

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

See also

§Example

Adwaita needs to be initialized before use. This can be done by either:

The libadwaita crate is usually renamed to adw. You can do this globally in your Cargo.toml file:

[dependencies.adw]
package = "libadwaita"
version = "0.x.y"
use adw::prelude::*;

use adw::{ActionRow, Application, ApplicationWindow, HeaderBar};
use gtk::{Box, ListBox, Orientation, SelectionMode};

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

    application.connect_activate(|app| {
        // ActionRows are only available in Adwaita
        let row = ActionRow::builder()
            .activatable(true)
            .title("Click me")
            .build();
        row.connect_activated(|_| {
            eprintln!("Clicked!");
        });

        let list = ListBox::builder()
            .margin_top(32)
            .margin_end(32)
            .margin_bottom(32)
            .margin_start(32)
            .selection_mode(SelectionMode::None)
            // makes the list look nicer
            .css_classes(vec![String::from("boxed-list")])
            .build();
        list.append(&row);

        // Combine the content in a box
        let content = Box::new(Orientation::Vertical, 0);
        // Adwaitas' ApplicationWindow does not include a HeaderBar
        content.append(&HeaderBar::new());
        content.append(&list);

        let window = ApplicationWindow::builder()
            .application(app)
            .title("First App")
            .default_width(350)
            // add content to window
            .content(&content)
            .build();
        window.present();
    });

    application.run();
}

Re-exports§

pub use ffi;
pub use gdk;
pub use gio;
pub use glib;
pub use gtk;

Modules§

builders
prelude
subclass

Structs§

AboutDialog
GLib type: GObject with reference counted clone semantics.
AboutWindowDeprecated
GLib type: GObject with reference counted clone semantics.
ActionRow
GLib type: GObject with reference counted clone semantics.
AlertDialog
GLib type: GObject with reference counted clone semantics.
Animation
GLib type: GObject with reference counted clone semantics.
AnimationTarget
GLib type: GObject with reference counted clone semantics.
Application
GLib type: GObject with reference counted clone semantics.
ApplicationWindow
GLib type: GObject with reference counted clone semantics.
Avatar
GLib type: GObject with reference counted clone semantics.
Banner
GLib type: GObject with reference counted clone semantics.
Bin
GLib type: GObject with reference counted clone semantics.
BottomSheet
GLib type: GObject with reference counted clone semantics.
Breakpoint
GLib type: GObject with reference counted clone semantics.
BreakpointBin
GLib type: GObject with reference counted clone semantics.
BreakpointCondition
GLib type: Boxed type with copy-on-clone semantics.
ButtonContent
GLib type: GObject with reference counted clone semantics.
ButtonRow
GLib type: GObject with reference counted clone semantics.
CallbackAnimationTarget
GLib type: GObject with reference counted clone semantics.
Carousel
GLib type: GObject with reference counted clone semantics.
CarouselIndicatorDots
GLib type: GObject with reference counted clone semantics.
CarouselIndicatorLines
GLib type: GObject with reference counted clone semantics.
Clamp
GLib type: GObject with reference counted clone semantics.
ClampLayout
GLib type: GObject with reference counted clone semantics.
ClampScrollable
GLib type: GObject with reference counted clone semantics.
ComboRow
GLib type: GObject with reference counted clone semantics.
Dialog
GLib type: GObject with reference counted clone semantics.
EntryRow
GLib type: GObject with reference counted clone semantics.
EnumListItem
GLib type: GObject with reference counted clone semantics.
EnumListModel
GLib type: GObject with reference counted clone semantics.
ExpanderRow
GLib type: GObject with reference counted clone semantics.
FlapDeprecated
GLib type: GObject with reference counted clone semantics.
HeaderBar
GLib type: GObject with reference counted clone semantics.
InlineViewSwitcher
GLib type: GObject with reference counted clone semantics.
Layout
GLib type: GObject with reference counted clone semantics.
LayoutSlot
GLib type: GObject with reference counted clone semantics.
LeafletDeprecated
GLib type: GObject with reference counted clone semantics.
LeafletPageDeprecated
GLib type: GObject with reference counted clone semantics.
MessageDialogDeprecated
GLib type: GObject with reference counted clone semantics.
MultiLayoutView
GLib type: GObject with reference counted clone semantics.
NavigationPage
GLib type: GObject with reference counted clone semantics.
NavigationSplitView
GLib type: GObject with reference counted clone semantics.
NavigationView
GLib type: GObject with reference counted clone semantics.
NoneAnimationTarget
GLib type: GObject with reference counted clone semantics.
OverlaySplitView
GLib type: GObject with reference counted clone semantics.
PasswordEntryRow
GLib type: GObject with reference counted clone semantics.
PreferencesDialog
GLib type: GObject with reference counted clone semantics.
PreferencesGroup
GLib type: GObject with reference counted clone semantics.
PreferencesPage
GLib type: GObject with reference counted clone semantics.
PreferencesRow
GLib type: GObject with reference counted clone semantics.
PreferencesWindowDeprecated
GLib type: GObject with reference counted clone semantics.
PropertyAnimationTarget
GLib type: GObject with reference counted clone semantics.
ShortcutLabel
GLib type: GObject with reference counted clone semantics.
ShortcutsDialog
GLib type: GObject with reference counted clone semantics.
ShortcutsItem
GLib type: GObject with reference counted clone semantics.
ShortcutsSection
GLib type: GObject with reference counted clone semantics.
Sidebar
GLib type: GObject with reference counted clone semantics.
SidebarItem
GLib type: GObject with reference counted clone semantics.
SidebarSection
GLib type: GObject with reference counted clone semantics.
SpinRow
GLib type: GObject with reference counted clone semantics.
Spinner
GLib type: GObject with reference counted clone semantics.
SpinnerPaintable
GLib type: GObject with reference counted clone semantics.
SplitButton
GLib type: GObject with reference counted clone semantics.
SpringAnimation
GLib type: GObject with reference counted clone semantics.
SpringParams
GLib type: Shared boxed type with reference counted clone semantics.
SqueezerDeprecated
GLib type: GObject with reference counted clone semantics.
SqueezerPageDeprecated
GLib type: GObject with reference counted clone semantics.
StatusPage
GLib type: GObject with reference counted clone semantics.
StyleManager
GLib type: GObject with reference counted clone semantics.
SwipeTracker
GLib type: GObject with reference counted clone semantics.
Swipeable
GLib type: GObject with reference counted clone semantics.
SwitchRow
GLib type: GObject with reference counted clone semantics.
TabBar
GLib type: GObject with reference counted clone semantics.
TabButton
GLib type: GObject with reference counted clone semantics.
TabOverview
GLib type: GObject with reference counted clone semantics.
TabPage
GLib type: GObject with reference counted clone semantics.
TabView
GLib type: GObject with reference counted clone semantics.
TabViewShortcuts
TimedAnimation
GLib type: GObject with reference counted clone semantics.
Toast
GLib type: GObject with reference counted clone semantics.
ToastOverlay
GLib type: GObject with reference counted clone semantics.
Toggle
GLib type: GObject with reference counted clone semantics.
ToggleGroup
GLib type: GObject with reference counted clone semantics.
ToolbarView
GLib type: GObject with reference counted clone semantics.
ViewStack
GLib type: GObject with reference counted clone semantics.
ViewStackPage
GLib type: GObject with reference counted clone semantics.
ViewStackPages
GLib type: GObject with reference counted clone semantics.
ViewSwitcher
GLib type: GObject with reference counted clone semantics.
ViewSwitcherBar
GLib type: GObject with reference counted clone semantics.
ViewSwitcherSidebar
GLib type: GObject with reference counted clone semantics.
ViewSwitcherTitleDeprecated
GLib type: GObject with reference counted clone semantics.
Window
GLib type: GObject with reference counted clone semantics.
WindowTitle
GLib type: GObject with reference counted clone semantics.
WrapBox
GLib type: GObject with reference counted clone semantics.
WrapLayout
GLib type: GObject with reference counted clone semantics.

Enums§

AccentColor
AnimationState
BannerButtonStyle
BreakpointConditionLengthType
BreakpointConditionRatioType
CenteringPolicy
ColorScheme
DialogPresentationMode
Easing
FlapFoldPolicyDeprecated
FlapTransitionTypeDeprecated
FoldThresholdPolicyDeprecated
InlineViewSwitcherDisplayMode
JustifyMode
LeafletTransitionTypeDeprecated
LengthUnit
NavigationDirection
PackDirection
ResponseAppearance
SidebarMode
SqueezerTransitionTypeDeprecated
ToastPriority
ToolbarStyle
ViewSwitcherPolicy
WrapPolicy

Functions§

init
is_animations_enabled
is_initialized
lerp
major_version
micro_version
minor_version
rgba_to_standalone