summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--prefsize_windows.go20
-rw-r--r--sysdata_windows.go2
2 files changed, 18 insertions, 4 deletions
diff --git a/prefsize_windows.go b/prefsize_windows.go
index 8b29e2f..5605484 100644
--- a/prefsize_windows.go
+++ b/prefsize_windows.go
@@ -28,6 +28,8 @@ type dlgunits struct {
longest bool // TODO actually use this
getsize uintptr
area bool // use area sizes instead
+ yoff int
+ yoffalt int
}
var stdDlgSizes = [nctypes]dlgunits{
@@ -56,6 +58,8 @@ var stdDlgSizes = [nctypes]dlgunits{
c_label: dlgunits{
longest: true,
height: 8,
+ yoff: 3,
+ yoffalt: 0,
},
c_listbox: dlgunits{
longest: true,
@@ -80,10 +84,10 @@ var (
)
// This function runs on uitask; call the functions directly.
-func (s *sysData) preferredSize() (width int, height int) {
+func (s *sysData) preferredSize() (width int, height int, yoff int) {
// the preferred size of an Area is its size
if stdDlgSizes[s.ctype].area {
- return s.areawidth, s.areaheight
+ return s.areawidth, s.areaheight, 0 // no yoff for areas
}
if msg := stdDlgSizes[s.ctype].getsize; msg != 0 {
@@ -95,7 +99,7 @@ func (s *sysData) preferredSize() (width int, height int) {
uintptr(0),
uintptr(unsafe.Pointer(&size)))
if r1 != uintptr(_FALSE) { // success
- return int(size.cx), int(size.cy)
+ return int(size.cx), int(size.cy), 0 // TODO
}
// otherwise the message approach failed, so fall back to the regular approach
println("message failed; falling back")
@@ -139,7 +143,15 @@ func (s *sysData) preferredSize() (width int, height int) {
height = stdDlgSizes[s.ctype].height
width = muldiv(width, baseX, 4) // equivalent to right of rect
height = muldiv(height, baseY, 8) // equivalent to bottom of rect
- return width, height
+
+ yoff = stdDlgSizes[s.ctype].yoff
+ if s.alternate {
+ yoff = stdDlgSizes[s.ctype].yoffalt
+ }
+ if yoff != 0 {
+ yoff = muldiv(yoff, baseY, 8)
+ }
+ return width, height, yoff
}
var (
diff --git a/sysdata_windows.go b/sysdata_windows.go
index 317840a..caac1c1 100644
--- a/sysdata_windows.go
+++ b/sysdata_windows.go
@@ -89,6 +89,8 @@ var classTypes = [nctypes]*classData{
// controls are vertically aligned to the top by default (thanks Xeek in irc.freenode.net/#winapi)
style: _SS_NOPREFIX | _SS_LEFTNOWORDWRAP | controlstyle,
xstyle: 0 | controlxstyle,
+ // MAKE SURE THIS IS THE SAME
+ altStyle: _SS_NOPREFIX | _SS_LEFTNOWORDWRAP | controlstyle,
},
c_listbox: &classData{
name: toUTF16("LISTBOX"),