diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-01 20:56:11 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-01 20:56:11 -0400 |
| commit | 3fca1117107cb8a264abbb10b9755eefd93547e8 (patch) | |
| tree | 7e93cdd5291d8803b9e27ddc2e2e814d82ceea35 /redo/basicctrls_windows.go | |
| parent | 83eeae1ec2baea366c06c3220c7e396c924241b7 (diff) | |
Removed previous commit's TODO and added Checkbox preferredSize() on Windows.
Diffstat (limited to 'redo/basicctrls_windows.go')
| -rw-r--r-- | redo/basicctrls_windows.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/redo/basicctrls_windows.go b/redo/basicctrls_windows.go index b116ae3..feb4332 100644 --- a/redo/basicctrls_windows.go +++ b/redo/basicctrls_windows.go @@ -66,6 +66,7 @@ func newCheckbox(text string) *checkbox { // we'll handle actually toggling the check state ourselves (see controls_windows.c) button: startNewButton(text, C.BS_CHECKBOX), } + c.fpreferredSize = c.checkboxpreferredSize C.setCheckboxSubclass(c.hwnd, unsafe.Pointer(c)) return c } @@ -96,6 +97,18 @@ type textField struct { *controlbase } +const ( + // from http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing + checkboxHeight = 10 + // from http://msdn.microsoft.com/en-us/library/windows/desktop/bb226818%28v=vs.85%29.aspx + checkboxXFromLeftOfBoxToLeftOfLabel = 12 +) + +func (c *checkbox) checkboxpreferredSize(d *sizing) (width, height int) { + return fromdlgunitsX(checkboxXFromLeftOfBoxToLeftOfLabel, d) + int(c.textlen), + fromdlgunitsY(checkboxHeight, d) +} + var editclass = toUTF16("EDIT") func startNewTextField(style C.DWORD) *textField { @@ -174,7 +187,6 @@ const ( ) func (l *label) labelpreferredSize(d *sizing) (width, height int) { - // TODO have some padding to the right of the width return int(l.textlen), fromdlgunitsY(labelHeight, d) } |
