diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-01 19:32:19 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-01 19:32:19 -0400 |
| commit | ed38a2cac742a8fa513a68c411831f7c26a78ecf (patch) | |
| tree | 7842bffbd9eb519e7390eed963e4d2266fb32e8d | |
| parent | e2b8fb81d64499b9a27b72b0cbb0c37f60e49c25 (diff) | |
Implemented preferredSize() for Label on Windows. Seems to work...
| -rw-r--r-- | redo/basicctrls_windows.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/redo/basicctrls_windows.go b/redo/basicctrls_windows.go index 5c77085..75503d0 100644 --- a/redo/basicctrls_windows.go +++ b/redo/basicctrls_windows.go @@ -144,6 +144,7 @@ func finishNewLabel(text string, standalone bool) *label { controlbase: c, standalone: standalone, } + l.fpreferredSize = l.labelpreferredSize l.supercommitResize = l.fcommitResize l.fcommitResize = l.labelcommitResize return l @@ -167,10 +168,15 @@ func (l *label) SetText(text string) { const ( // via http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing + labelHeight = 8 labelYOffset = 3 // TODO the label is offset slightly by default... ) +func (l *label) labelpreferredSize(d *sizing) (width, height int) { + return int(l.textlen), fromdlgunitsY(labelHeight, d) +} + func (l *label) labelcommitResize(c *allocation, d *sizing) { if !l.standalone { yoff := fromdlgunitsY(labelYOffset, d) |
