Merge branch 'dev'
This commit is contained in:
commit
4b86f84479
1 changed files with 5 additions and 6 deletions
|
@ -293,19 +293,18 @@ fn build_gtk_box(bargs: &mut BuilderArgs) -> Result<gtk::Box> {
|
||||||
/// @widget label
|
/// @widget label
|
||||||
fn build_gtk_label(bargs: &mut BuilderArgs) -> Result<gtk::Label> {
|
fn build_gtk_label(bargs: &mut BuilderArgs) -> Result<gtk::Label> {
|
||||||
let gtk_widget = gtk::Label::new(None);
|
let gtk_widget = gtk::Label::new(None);
|
||||||
|
|
||||||
resolve_block!(bargs, gtk_widget, {
|
resolve_block!(bargs, gtk_widget, {
|
||||||
// @prop text - the text to display
|
// @prop text - the text to display
|
||||||
prop(text: as_string) {
|
// @prop limit-width - maximum count of characters to display
|
||||||
gtk_widget.set_text(&text);
|
prop(text: as_string, limit_width: as_i32 = i32::MAX) {
|
||||||
|
gtk_widget.set_text(&text.chars().take(limit_width as usize).collect::<String>());
|
||||||
},
|
},
|
||||||
// @prop markup - Pango markup to display
|
// @prop markup - Pango markup to display
|
||||||
prop(markup: as_string) {
|
prop(markup: as_string) {
|
||||||
gtk_widget.set_markup(&markup);
|
gtk_widget.set_markup(&markup);
|
||||||
},
|
},
|
||||||
// @prop limit-width - maximum count of characters to display
|
// @prop wrap - Wrap the text. This mainly makes sense if you set the width of this widget.
|
||||||
prop(limit_width: as_i32) {
|
|
||||||
gtk_widget.set_max_width_chars(limit_width);
|
|
||||||
},
|
|
||||||
prop(wrap: as_bool) {
|
prop(wrap: as_bool) {
|
||||||
gtk_widget.set_line_wrap(wrap)
|
gtk_widget.set_line_wrap(wrap)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue