Began making the spaced property per-container.
This commit is contained in:
parent
99101c0264
commit
ea391ef841
|
@ -32,11 +32,9 @@ type controlSizing interface {
|
||||||
// All containers must embed containerbase.
|
// All containers must embed containerbase.
|
||||||
type containerbase struct {
|
type containerbase struct {
|
||||||
child Control
|
child Control
|
||||||
|
spaced bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// set to true to apply spacing to all windows
|
|
||||||
var spaced bool = false
|
|
||||||
|
|
||||||
func (c *container) resize(x, y, width, height int) {
|
func (c *container) resize(x, y, width, height int) {
|
||||||
if c.child == nil { // no children; nothing to do
|
if c.child == nil { // no children; nothing to do
|
||||||
return
|
return
|
||||||
|
|
|
@ -49,7 +49,7 @@ const (
|
||||||
|
|
||||||
func (c *container) beginResize() (d *sizing) {
|
func (c *container) beginResize() (d *sizing) {
|
||||||
d = new(sizing)
|
d = new(sizing)
|
||||||
if spaced {
|
if c.spaced {
|
||||||
d.xmargin = macXMargin
|
d.xmargin = macXMargin
|
||||||
d.ymargintop = macYMargin
|
d.ymargintop = macYMargin
|
||||||
d.ymarginbottom = d.ymargintop
|
d.ymarginbottom = d.ymargintop
|
||||||
|
|
|
@ -56,7 +56,7 @@ const (
|
||||||
|
|
||||||
func (c *container) beginResize() (d *sizing) {
|
func (c *container) beginResize() (d *sizing) {
|
||||||
d = new(sizing)
|
d = new(sizing)
|
||||||
if spaced {
|
if c.spaced {
|
||||||
d.xmargin = gtkXMargin
|
d.xmargin = gtkXMargin
|
||||||
d.ymargintop = gtkYMargin
|
d.ymargintop = gtkYMargin
|
||||||
d.ymarginbottom = d.ymargintop
|
d.ymarginbottom = d.ymargintop
|
||||||
|
|
|
@ -122,7 +122,7 @@ func (c *container) beginResize() (d *sizing) {
|
||||||
d.baseY = baseY
|
d.baseY = baseY
|
||||||
d.internalLeading = internalLeading
|
d.internalLeading = internalLeading
|
||||||
|
|
||||||
if spaced {
|
if c.spaced {
|
||||||
d.xmargin = fromdlgunitsX(marginDialogUnits, d)
|
d.xmargin = fromdlgunitsX(marginDialogUnits, d)
|
||||||
d.ymargintop = fromdlgunitsY(marginDialogUnits, d)
|
d.ymargintop = fromdlgunitsY(marginDialogUnits, d)
|
||||||
d.ymarginbottom = d.ymargintop
|
d.ymarginbottom = d.ymargintop
|
||||||
|
|
|
@ -18,6 +18,7 @@ import (
|
||||||
|
|
||||||
var closeOnClick = flag.Bool("close", false, "close on click")
|
var closeOnClick = flag.Bool("close", false, "close on click")
|
||||||
var smallWindow = flag.Bool("small", false, "open a small window (test Mac OS X initial control sizing)")
|
var smallWindow = flag.Bool("small", false, "open a small window (test Mac OS X initial control sizing)")
|
||||||
|
var spaced = flag.Bool("spaced", false, "enable spacing")
|
||||||
|
|
||||||
type dtype struct {
|
type dtype struct {
|
||||||
Name string
|
Name string
|
||||||
|
@ -262,7 +263,6 @@ var tw *testwin
|
||||||
|
|
||||||
// because Cocoa hates being run off the main thread, even if it's run exclusively off the main thread
|
// because Cocoa hates being run off the main thread, even if it's run exclusively off the main thread
|
||||||
func init() {
|
func init() {
|
||||||
flag.BoolVar(&spaced, "spaced", false, "enable spacing")
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
go func() {
|
go func() {
|
||||||
tw = new(testwin)
|
tw = new(testwin)
|
||||||
|
|
Loading…
Reference in New Issue