Split ymargin into top and bottom margins to accomodate Groups on Windows; fixed those.
This commit is contained in:
parent
01db831c4c
commit
f9c5c41c77
|
@ -12,10 +12,11 @@ type allocation struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type sizingbase struct {
|
type sizingbase struct {
|
||||||
xmargin int
|
xmargin int
|
||||||
ymargin int
|
ymargintop int
|
||||||
xpadding int
|
ymarginbottom int
|
||||||
ypadding int
|
xpadding int
|
||||||
|
ypadding int
|
||||||
}
|
}
|
||||||
|
|
||||||
type controlSizing interface {
|
type controlSizing interface {
|
||||||
|
@ -41,7 +42,8 @@ func (c *container) resize(x, y, width, height int) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
d := c.beginResize()
|
d := c.beginResize()
|
||||||
allocations := c.child.allocate(x + d.xmargin, y + d.ymargin, width - (2 * d.xmargin), height - (2 * d.ymargin), d)
|
allocations := c.child.allocate(x + d.xmargin, y + d.ymargintop,
|
||||||
|
width - (2 * d.xmargin), height - d.ymargintop - d.ymarginbottom, d)
|
||||||
c.translateAllocationCoords(allocations, width, height)
|
c.translateAllocationCoords(allocations, width, height)
|
||||||
// move in reverse so as to approximate right->left order so neighbors make sense
|
// move in reverse so as to approximate right->left order so neighbors make sense
|
||||||
for i := len(allocations) - 1; i >= 0; i-- {
|
for i := len(allocations) - 1; i >= 0; i-- {
|
||||||
|
|
|
@ -51,7 +51,8 @@ func (c *container) beginResize() (d *sizing) {
|
||||||
d = new(sizing)
|
d = new(sizing)
|
||||||
if spaced {
|
if spaced {
|
||||||
d.xmargin = macXMargin
|
d.xmargin = macXMargin
|
||||||
d.ymargin = macYMargin
|
d.ymargintop = macYMargin
|
||||||
|
d.ymarginbottom = d.ymargintop
|
||||||
d.xpadding = macXPadding
|
d.xpadding = macXPadding
|
||||||
d.ypadding = macYPadding
|
d.ypadding = macYPadding
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,8 @@ func (c *container) beginResize() (d *sizing) {
|
||||||
d = new(sizing)
|
d = new(sizing)
|
||||||
if spaced {
|
if spaced {
|
||||||
d.xmargin = gtkXMargin
|
d.xmargin = gtkXMargin
|
||||||
d.ymargin = gtkYMargin
|
d.ymargintop = gtkYMargin
|
||||||
|
d.ymarginbottom = d.ymargintop
|
||||||
d.xpadding = gtkXPadding
|
d.xpadding = gtkXPadding
|
||||||
d.ypadding = gtkYPadding
|
d.ypadding = gtkYPadding
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,6 @@ const (
|
||||||
paddingDialogUnits = 4
|
paddingDialogUnits = 4
|
||||||
|
|
||||||
groupXMargin = 6
|
groupXMargin = 6
|
||||||
// TODO
|
|
||||||
groupYMarginTop = 11 // note this value /includes the groupbox label/
|
groupYMarginTop = 11 // note this value /includes the groupbox label/
|
||||||
groupYMarginBottom = 7
|
groupYMarginBottom = 7
|
||||||
)
|
)
|
||||||
|
@ -125,7 +124,8 @@ func (c *container) beginResize() (d *sizing) {
|
||||||
|
|
||||||
if spaced {
|
if spaced {
|
||||||
d.xmargin = fromdlgunitsX(marginDialogUnits, d)
|
d.xmargin = fromdlgunitsX(marginDialogUnits, d)
|
||||||
d.ymargin = fromdlgunitsY(marginDialogUnits, d)
|
d.ymargintop = fromdlgunitsY(marginDialogUnits, d)
|
||||||
|
d.ymarginbottom = d.ymargintop
|
||||||
d.xpadding = fromdlgunitsX(paddingDialogUnits, d)
|
d.xpadding = fromdlgunitsX(paddingDialogUnits, d)
|
||||||
d.ypadding = fromdlgunitsY(paddingDialogUnits, d)
|
d.ypadding = fromdlgunitsY(paddingDialogUnits, d)
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,9 @@ func (c *container) beginResize() (d *sizing) {
|
||||||
// this is because Windows groupboxes have the client rect spanning the entire size of the control, not just the active work area
|
// this is because Windows groupboxes have the client rect spanning the entire size of the control, not just the active work area
|
||||||
// the measurements Microsoft give us are for spaced margining; let's just use them
|
// the measurements Microsoft give us are for spaced margining; let's just use them
|
||||||
d.xmargin = fromdlgunitsX(groupXMargin, d)
|
d.xmargin = fromdlgunitsX(groupXMargin, d)
|
||||||
d.ymargin = fromdlgunitsY(groupYMarginTop, d)
|
d.ymargintop = fromdlgunitsY(groupYMarginTop, d)
|
||||||
|
d.ymarginbottom = fromdlgunitsY(groupYMarginBottom, d)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
Loading…
Reference in New Issue