diff options
| author | Pietro Gagliardi <[email protected]> | 2014-04-13 18:05:07 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-04-13 18:05:07 -0400 |
| commit | fb50badf00db0ba2da8a99aa75b489c620f8a971 (patch) | |
| tree | be2cf962c861c650607589cbb279364ccfd3107a | |
| parent | e4c27a4a725c898ffb674f5202295dc96ce05ff1 (diff) | |
Fixed Area test time label weirdness by making Labels truncate their text instead of word-wrapping on all platforms. This doesn't explain GTK+/Wayland, alas.
| -rw-r--r-- | gtkcalls_unix.go | 6 | ||||
| -rw-r--r-- | label.go | 1 | ||||
| -rw-r--r-- | sysdata_darwin.go | 16 | ||||
| -rw-r--r-- | sysdata_windows.go | 3 | ||||
| -rw-r--r-- | todo.md | 4 |
5 files changed, 24 insertions, 6 deletions
diff --git a/gtkcalls_unix.go b/gtkcalls_unix.go index 158f5f9..f49263a 100644 --- a/gtkcalls_unix.go +++ b/gtkcalls_unix.go @@ -203,7 +203,11 @@ var _emptystring = [1]C.gchar{0} var emptystring = &_emptystring[0] func gtk_label_new() *C.GtkWidget { - return C.gtk_label_new(emptystring) + label := C.gtk_label_new(emptystring) + C.gtk_label_set_line_wrap(togtklabel(label), C.FALSE) + // TODO explicitly set line wrap mode as well? + // TODO explicitly disable ellipsizing + return label // TODO left-justify? } @@ -7,6 +7,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. type Label struct { lock sync.Mutex created bool diff --git a/sysdata_darwin.go b/sysdata_darwin.go index 12b6b12..ed50132 100644 --- a/sysdata_darwin.go +++ b/sysdata_darwin.go @@ -79,6 +79,8 @@ var ( _setEditable = sel_getUid("setEditable:") _setBordered = sel_getUid("setBordered:") _setDrawsBackground = sel_getUid("setDrawsBackground:") + _cell = sel_getUid("cell") + _setLineBreakMode = sel_getUid("setLineBreakMode:") _setStyle = sel_getUid("setStyle:") _setControlSize = sel_getUid("setControlSize:") _setIndeterminate = sel_getUid("setIndeterminate:") @@ -281,11 +283,25 @@ var classTypes = [nctypes]*classData{ }, c_label: &classData{ make: func(parentWindow C.id, alternate bool) C.id { + const ( + _NSLineBreakByWordWrapping = iota + _NSLineBreakByCharWrapping + _NSLineBreakByClipping + _NSLineBreakByTruncatingHead + _NSLineBreakByTruncatingTail + _NSLineBreakByTruncatingMiddle + ) + label := C.objc_msgSend_noargs(_NSTextField, _alloc) label = initWithDummyFrame(label) C.objc_msgSend_bool(label, _setEditable, C.BOOL(C.NO)) C.objc_msgSend_bool(label, _setBordered, C.BOOL(C.NO)) C.objc_msgSend_bool(label, _setDrawsBackground, C.BOOL(C.NO)) + // this disables both word wrap AND ellipsizing in one fell swoop + // we have to send to the control's cell for this + C.objc_msgSend_uint(C.objc_msgSend_noargs(label, _cell), + _setLineBreakMode, _NSLineBreakByClipping) + // for a multiline label, we either use WordWrapping and send setTruncatesLastVisibleLine: to disable ellipsizing OR use one of those ellipsizing styles applyStandardControlFont(label) addControl(parentWindow, label) return label diff --git a/sysdata_windows.go b/sysdata_windows.go index 57f7d58..9b0e25b 100644 --- a/sysdata_windows.go +++ b/sysdata_windows.go @@ -82,7 +82,8 @@ var classTypes = [nctypes]*classData{ }, c_label: &classData{ name: "STATIC", - style: _SS_NOPREFIX | controlstyle, + // TODO add no-ellipsizing flags if I didn't do so already + style: _SS_NOPREFIX | _SS_LEFTNOWORDWRAP | controlstyle, xstyle: 0 | controlxstyle, }, c_listbox: &classData{ @@ -1,10 +1,6 @@ important things: - NSComboBox scans the entered text to see if it matches one of the items and returns the index of that item if it does; find out how to suppress this so that it returns -1 unless the item was chosen from the list (like the other platforms) - make sure mouse events trigger when we move the mouse over an Area with a button held on OS X -- area test time label weirdness - this indicates bugs in Stack - - does not show full time initally on Windows; it does after you resize the window - - does not show initially on OS X; it shows up once you resize, and even shows up after you resize back to the original size - - I think both bugs and the GTK+ Wayland bug below are related... super ultra important things: - window sizes are inconsistent and wrong: we need to see on which platforms the titlebars/borders/etc. count... |
