| Crates.io | grade |
| lib.rs | grade |
| version | 0.3.0 |
| created_at | 2019-08-02 00:11:26.261853+00 |
| updated_at | 2019-08-21 13:38:44.238671+00 |
| description | A convenience macro for gtk-rs. |
| homepage | |
| repository | https://github.com/TomSteu/grade |
| max_upload_size | |
| id | 153662 |
| size | 27,253 |
Grade is a macro for declarative development of gtk-rs. It provides the macro build! that creates a GTK widget from declaration.
use gtk::*;
use grade::build;
// build! macro provided by this crate
let main_window = build! {
// any Object that has a corresponding ObjectBuilder
Window {
// properties (methods to the ObjectBuilder)
title: "Grade test",
show_menubar: false,
default_height: 300,
default_width: 400,
// conncect signals of the Object
=> activate_focus: |_| { /*...*/ },
=> notify(title): |_| { /*...*/ },
// children
-- Viewport {
// named object, will be saved under this identifier
-- main_grid: Grid {
vexpand: true,
name: "main_grid",
// child added with `parent.attach(&child, 1,1,1,1);`
// the default `--` is short for `-- [add]`
-- [attach, 1, 1, 1, 1] Label {
label: "Please type...",
}
// cascade-style syntax for methods of the parent
..insert_row(2)
// of course, `build!` is nestable
..attach(
& build!(/*...*/).downcast::<Widget>(),
1, 2, 3, 3
)
}
}
}
};