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.
This commit is contained in:
parent
e4c27a4a72
commit
fb50badf00
|
@ -203,7 +203,11 @@ var _emptystring = [1]C.gchar{0}
|
||||||
var emptystring = &_emptystring[0]
|
var emptystring = &_emptystring[0]
|
||||||
|
|
||||||
func gtk_label_new() *C.GtkWidget {
|
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?
|
// TODO left-justify?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
label.go
1
label.go
|
@ -7,6 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Label is a static line of text used to mark other controls.
|
// 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 {
|
type Label struct {
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
created bool
|
created bool
|
||||||
|
|
|
@ -79,6 +79,8 @@ var (
|
||||||
_setEditable = sel_getUid("setEditable:")
|
_setEditable = sel_getUid("setEditable:")
|
||||||
_setBordered = sel_getUid("setBordered:")
|
_setBordered = sel_getUid("setBordered:")
|
||||||
_setDrawsBackground = sel_getUid("setDrawsBackground:")
|
_setDrawsBackground = sel_getUid("setDrawsBackground:")
|
||||||
|
_cell = sel_getUid("cell")
|
||||||
|
_setLineBreakMode = sel_getUid("setLineBreakMode:")
|
||||||
_setStyle = sel_getUid("setStyle:")
|
_setStyle = sel_getUid("setStyle:")
|
||||||
_setControlSize = sel_getUid("setControlSize:")
|
_setControlSize = sel_getUid("setControlSize:")
|
||||||
_setIndeterminate = sel_getUid("setIndeterminate:")
|
_setIndeterminate = sel_getUid("setIndeterminate:")
|
||||||
|
@ -281,11 +283,25 @@ var classTypes = [nctypes]*classData{
|
||||||
},
|
},
|
||||||
c_label: &classData{
|
c_label: &classData{
|
||||||
make: func(parentWindow C.id, alternate bool) C.id {
|
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 := C.objc_msgSend_noargs(_NSTextField, _alloc)
|
||||||
label = initWithDummyFrame(label)
|
label = initWithDummyFrame(label)
|
||||||
C.objc_msgSend_bool(label, _setEditable, C.BOOL(C.NO))
|
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, _setBordered, C.BOOL(C.NO))
|
||||||
C.objc_msgSend_bool(label, _setDrawsBackground, 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)
|
applyStandardControlFont(label)
|
||||||
addControl(parentWindow, label)
|
addControl(parentWindow, label)
|
||||||
return label
|
return label
|
||||||
|
|
|
@ -82,7 +82,8 @@ var classTypes = [nctypes]*classData{
|
||||||
},
|
},
|
||||||
c_label: &classData{
|
c_label: &classData{
|
||||||
name: "STATIC",
|
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,
|
xstyle: 0 | controlxstyle,
|
||||||
},
|
},
|
||||||
c_listbox: &classData{
|
c_listbox: &classData{
|
||||||
|
|
4
todo.md
4
todo.md
|
@ -1,10 +1,6 @@
|
||||||
important things:
|
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)
|
- 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
|
- 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:
|
super ultra important things:
|
||||||
- window sizes are inconsistent and wrong: we need to see on which platforms the titlebars/borders/etc. count...
|
- window sizes are inconsistent and wrong: we need to see on which platforms the titlebars/borders/etc. count...
|
||||||
|
|
Loading…
Reference in New Issue