Finished the previous commit.
This commit is contained in:
parent
f24e177d99
commit
5198f7202f
|
@ -22,7 +22,7 @@ type sizing struct {
|
|||
// for size calculations
|
||||
baseX C.int
|
||||
baseY C.int
|
||||
internalLeading C.LONG
|
||||
internalLeading C.LONG // for Label; see Label.commitResize() for details
|
||||
|
||||
// for the actual resizing
|
||||
// possibly the HDWP
|
||||
|
|
|
@ -68,7 +68,6 @@ 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) preferredSize(d *sizing) (width, height int) {
|
||||
|
@ -80,9 +79,13 @@ func (l *label) commitResize(c *allocation, d *sizing) {
|
|||
yoff := fromdlgunitsY(labelYOffset, d)
|
||||
c.y += yoff
|
||||
c.height -= yoff
|
||||
// by default, labels are drawn offset by the internal leading (the space reserved for accents on uppercase letters)
|
||||
// the above calculation assumes otherwise, so account for the difference
|
||||
// there will be enough space left over for the internal leading anyway (at least on the standard fonts)
|
||||
// don't do this to standalone labels, otherwise those accents get cut off!
|
||||
c.y -= int(d.internalLeading)
|
||||
c.height += int(d.internalLeading)
|
||||
}
|
||||
c.y -= int(d.internalLeading)
|
||||
c.height += int(d.internalLeading)
|
||||
basecommitResize(l, c, d)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue