Beispiel #1
0
func gtk_label_new() *C.GtkWidget {
	label := C.gtk_label_new(emptystring)
	C.gtk_label_set_line_wrap(togtklabel(label), C.FALSE) // turn off line wrap
	// don't call gtk_label_set_line_wrap_mode(); there's no "wrap none" value there anyway
	C.gtk_label_set_ellipsize(togtklabel(label), C.PANGO_ELLIPSIZE_NONE) // turn off ellipsizing; this + line wrapping above will guarantee cutoff as documented
	// there's a function gtk_label_set_justify() that indicates GTK_JUSTIFY_LEFT is the default
	// but this actually is NOT the control justification, just the multi-line justification
	// so we need to do THIS instead
	// this will also valign to the top
	// thanks to mclasen in irc.gimp.net/#gtk+
	C.gtk_misc_set_alignment((*C.GtkMisc)(unsafe.Pointer(label)), 0, 0)
	return label
}
Beispiel #2
0
func gtk_label_new() *C.GtkWidget {
	label := C.gtk_label_new(emptystring)
	C.gtk_label_set_line_wrap(togtklabel(label), C.FALSE) // turn off line wrap
	// don't call gtk_label_set_line_wrap_mode(); there's no "wrap none" value there anyway
	C.gtk_label_set_ellipsize(togtklabel(label), C.PANGO_ELLIPSIZE_NONE) // turn off ellipsizing; this + line wrapping above will guarantee cutoff as documented
	// there's a function gtk_label_set_justify() that indicates GTK_JUSTIFY_LEFT is the default
	// but this actually is NOT the control justification, just the multi-line justification
	// so we need to do THIS instead
	// this will valign to the center, which is what the HIG says (https://developer.gnome.org/hig-book/3.4/design-text-labels.html.en) for all controls that label to the side; thankfully this means we don't need to do any extra positioning magic
	// this will also valign to the top
	// thanks to mclasen in irc.gimp.net/#gtk+
	gtk_misc_set_alignment(label, 0, 0.5)
	return label
}
Beispiel #3
0
// SetLineWrap is a wrapper around gtk_label_set_line_wrap().
func (v *Label) SetLineWrap(wrap bool) {
	C.gtk_label_set_line_wrap(v.native(), gbool(wrap))
}
Beispiel #4
0
func (self *Label) SetLineWrap(wrap bool) {
	b := gobject.GBool(wrap)
	defer b.Free()
	C.gtk_label_set_line_wrap(self.object, *((*C.gboolean)(b.GetPtr())))
}