summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-06-02 15:22:31 -0400
committerPietro Gagliardi <[email protected]>2014-06-02 15:22:31 -0400
commit9903fd624c3be9982b9572a181894a5c922fafaa (patch)
treeb6d2218c5dd952c2185ea488c59a33b4c0047bc0
parent812d547a5a8e916515b9634dcbd960160e54f2a6 (diff)
Properly left-aligned Labels in GTK+. Also added a note to decide on/document/verify vertical alignment of Labels.
-rw-r--r--gtkcalls_unix.go6
-rw-r--r--label.go1
2 files changed, 7 insertions, 0 deletions
diff --git a/gtkcalls_unix.go b/gtkcalls_unix.go
index 5367447..174e943 100644
--- a/gtkcalls_unix.go
+++ b/gtkcalls_unix.go
@@ -217,6 +217,12 @@ func gtk_label_new() *C.GtkWidget {
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
// TODO left-justify?
}
diff --git a/label.go b/label.go
index 74bc0f7..e07dc47 100644
--- a/label.go
+++ b/label.go
@@ -8,6 +8,7 @@ import (
// A Label is a static line of text used to mark other controls.
// Label text is drawn on a single line; text that does not fit is truncated.
+// TODO vertical alignment
type Label struct {
lock sync.Mutex
created bool