Added tooltips (#127)

This commit is contained in:
undefinedDarkness 2021-03-09 03:02:33 +05:30 committed by GitHub
parent 30305cd506
commit c4cbdedec5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,6 +74,10 @@ pub(super) fn resolve_widget_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Wi
prop(height: as_f64) { gtk_widget.set_size_request(gtk_widget.get_allocated_width(), height as i32) }, prop(height: as_f64) { gtk_widget.set_size_request(gtk_widget.get_allocated_width(), height as i32) },
// @prop active - If this widget can be interacted with // @prop active - If this widget can be interacted with
prop(active: as_bool = true) { gtk_widget.set_sensitive(active) }, prop(active: as_bool = true) { gtk_widget.set_sensitive(active) },
// @prop tooltip - tooltip text (on hover)
prop(tooltip: as_string) {
gtk_widget.set_tooltip_text(Some(&tooltip));
},
// @prop visible - visibility of the widget // @prop visible - visibility of the widget
prop(visible: as_bool = true) { prop(visible: as_bool = true) {
// TODO how do i call this only after the widget has been mapped? this is actually an issue,.... // TODO how do i call this only after the widget has been mapped? this is actually an issue,....
@ -107,7 +111,8 @@ pub(super) fn resolve_widget_attrs(bargs: &mut BuilderArgs, gtk_widget: &gtk::Wi
}) })
)); ));
old_id.map(|id| gtk_widget.disconnect(id)); old_id.map(|id| gtk_widget.disconnect(id));
} },
}); });
} }
@ -239,6 +244,7 @@ fn build_gtk_checkbox(bargs: &mut BuilderArgs) -> Result<gtk::CheckButton> {
old_id.map(|id| gtk_widget.disconnect(id)); old_id.map(|id| gtk_widget.disconnect(id));
} }
}); });
Ok(gtk_widget) Ok(gtk_widget)
} }