From 7c9c51a0832b90fbd2e1c35ed0ba3f547911a31e Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 16 Oct 2014 15:16:11 -0400 Subject: [PATCH] Fixed preferred size forgetfulness. --- newctrl/button_windows.go | 2 -- newctrl/checkbox_windows.go | 4 +--- newctrl/label_windows.go | 2 +- newctrl/textfield_windows.go | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/newctrl/button_windows.go b/newctrl/button_windows.go index d7cfff8..6937473 100644 --- a/newctrl/button_windows.go +++ b/newctrl/button_windows.go @@ -55,7 +55,6 @@ const ( ) func (b *button) preferredSize(d *sizing) (width, height int) { -return 0,0/*TODO/* // comctl32.dll version 6 thankfully provides a method to grab this... var size C.SIZE @@ -69,5 +68,4 @@ return 0,0/*TODO/* // don't worry about the error return from GetSystemMetrics(); there's no way to tell (explicitly documented as such) xmargins := 2 * int(C.GetSystemMetrics(C.SM_CXEDGE)) return xmargins + int(b.textlen), fromdlgunitsY(buttonHeight, d) -*/ } diff --git a/newctrl/checkbox_windows.go b/newctrl/checkbox_windows.go index b1f2e8a..ffabbdc 100644 --- a/newctrl/checkbox_windows.go +++ b/newctrl/checkbox_windows.go @@ -69,8 +69,6 @@ const ( ) func (c *checkbox) preferredSize(d *sizing) (width, height int) { -return 0,0/*TODO - return fromdlgunitsX(checkboxXFromLeftOfBoxToLeftOfLabel, d) + int(c._textlen), + return fromdlgunitsX(checkboxXFromLeftOfBoxToLeftOfLabel, d) + int(c.textlen), fromdlgunitsY(checkboxHeight, d) -*/ } diff --git a/newctrl/label_windows.go b/newctrl/label_windows.go index 1e6089d..f926081 100644 --- a/newctrl/label_windows.go +++ b/newctrl/label_windows.go @@ -42,7 +42,7 @@ const ( ) func (l *label) preferredSize(d *sizing) (width, height int) { -return 0,0//TODO return int(l._textlen), fromdlgunitsY(labelHeight, d) + return int(l.textlen), fromdlgunitsY(labelHeight, d) } /*TODO diff --git a/newctrl/textfield_windows.go b/newctrl/textfield_windows.go index 416cc2f..8b30a26 100644 --- a/newctrl/textfield_windows.go +++ b/newctrl/textfield_windows.go @@ -71,5 +71,5 @@ const ( ) func (t *textfield) preferredSize(d *sizing) (width, height int) { -return 0,0//TODO return fromdlgunitsX(textfieldWidth, d), fromdlgunitsY(textfieldHeight, d) + return fromdlgunitsX(textfieldWidth, d), fromdlgunitsY(textfieldHeight, d) }