diff options
| author | Pietro Gagliardi <[email protected]> | 2014-04-01 21:17:27 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-04-01 21:17:27 -0400 |
| commit | 8cb3991ef9245ebc84d3760bd2bb279b0a3e09ed (patch) | |
| tree | b05ceacb0d4425402fe988c5bbca2eb3921f2951 /sysdata_windows.go | |
| parent | af952325890580a63d821b03241480f91519e340 (diff) | |
Fixed Windows control sizing: turns out simply calling GetTextMetrics() was not enough, as the GetDC() functions don't load the control font into the DC; we have to do it ourselves with SelectObject() (according to GetTextMetrics()'s docs on MSDN). Upon re-evaluation, the only things that need custom fonts are menus and statusbars; I don't know if menus can be done with the standard contorls and statusbars change the font of all controls inside... so how fonts are handled in classData needs to change now.
Diffstat (limited to 'sysdata_windows.go')
| -rw-r--r-- | sysdata_windows.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sysdata_windows.go b/sysdata_windows.go index 978cbb3..6093f12 100644 --- a/sysdata_windows.go +++ b/sysdata_windows.go @@ -107,11 +107,13 @@ var classTypes = [nctypes]*classData{ name: _PROGRESS_CLASS, style: _PBS_SMOOTH | controlstyle, xstyle: 0 | controlxstyle, + font: &controlFont, }, c_area: &classData{ register: registerAreaWndClass, style: areastyle, xstyle: areaxstyle, + font: &controlFont, }, } @@ -192,6 +194,8 @@ func (s *sysData) make(window *sysData) (err error) { ret: ret, } <-ret + } else if s.ctype != c_window { + panic(fmt.Errorf("internal ui package error: control type %d does not have a font (needed for preferred size calculations)", s.ctype)) } return nil } |
