diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-03 09:18:35 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-03 09:18:35 -0400 |
| commit | 1aea308645585f2fbc6c8b170381c811d562cc99 (patch) | |
| tree | 1db721a972133a1ed0d9808eafabfbed66f6892f /redo/control.go | |
| parent | 585f5f5b62da3170d4398b39670d16811013d078 (diff) | |
Set up the Control restructure and migrated the Windows implementation over. Lots of repetition, but hopefully more correct and maintainable!
Diffstat (limited to 'redo/control.go')
| -rw-r--r-- | redo/control.go | 62 |
1 files changed, 9 insertions, 53 deletions
diff --git a/redo/control.go b/redo/control.go index 0b88533..953e241 100644 --- a/redo/control.go +++ b/redo/control.go @@ -13,57 +13,13 @@ type Control interface { controlSizing } -// All Controls on the backend (that is, everything except Stack and Grid) embed this structure, which provides the Control interface methods. -// If a Control needs to override one of these functions, it assigns to the function variables. -type controldefs struct { - fsetParent func(p *controlParent) - fcontainerShow func() - fcontainerHide func() - fallocate func(x int, y int, width int, height int, d *sizing) []*allocation - fpreferredSize func(*sizing) (int, int) - fcommitResize func(*allocation, *sizing) - fgetAuxResizeInfo func(*sizing) -} - -// There's no newcontroldefs() function; all defaults are set by controlbase. - -func (w *controldefs) setParent(p *controlParent) { - w.fsetParent(p) -} - -func (w *controldefs) containerShow() { - w.fcontainerShow() -} - -func (w *controldefs) containerHide() { - w.fcontainerHide() -} - -func (w *controldefs) allocate(x int, y int, width int, height int, d *sizing) []*allocation { - return w.fallocate(x, y, width, height, d) -} - -func (w *controldefs) preferredSize(d *sizing) (int, int) { - return w.fpreferredSize(d) -} - -func (w *controldefs) commitResize(c *allocation, d *sizing) { - w.fcommitResize(c, d) -} - -func (w *controldefs) getAuxResizeInfo(d *sizing) { - w.fgetAuxResizeInfo(d) -} - -// and this is the same across all platforms -func baseallocate(c *controlbase) func(x int, y int, width int, height int, d *sizing) []*allocation { - return func(x int, y int, width int, height int, d *sizing) []*allocation { - return []*allocation{&allocation{ - x: x, - y: y, - width: width, - height: height, - this: c, - }} - } +// this is the same across all platforms +func baseallocate(c Control, x int, y int, width int, height int, d *sizing) []*allocation { + return []*allocation{&allocation{ + x: x, + y: y, + width: width, + height: height, + this: c, + }} } |
