Compare commits

...

2 Commits

Author SHA1 Message Date
Greg Shuflin
9e962ab9ac Hook up to signal 2022-05-30 13:58:09 -07:00
Greg Shuflin
e13df0eb72 Add button 2022-05-30 13:57:19 -07:00

View File

@ -1,5 +1,5 @@
use gtk::prelude::*; use gtk::prelude::*;
use gtk::{Application, ApplicationWindow}; use gtk::{Application, ApplicationWindow, Button};
const APP_ID: &'static str = "org.gtk-rs.Gamarjoba"; const APP_ID: &'static str = "org.gtk-rs.Gamarjoba";
@ -10,9 +10,23 @@ fn main() {
} }
fn build_ui(app: &Application) { fn build_ui(app: &Application) {
let button = Button::builder()
.label("Hit me!")
.margin_top(12)
.margin_bottom(12)
.margin_start(12)
.margin_end(12)
.build();
button.connect_clicked(move |button| {
button.set_label("Hahaha! Gay!");
});
let window = ApplicationWindow::builder() let window = ApplicationWindow::builder()
.application(app) .application(app)
.title("Gamarjoba from GTK4") .title("Gamarjoba from GTK4")
.child(&button)
.build(); .build();
window.present(); window.present();