summaryrefslogtreecommitdiff
path: root/redo/control.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-30 02:06:01 -0400
committerPietro Gagliardi <[email protected]>2014-07-30 02:06:01 -0400
commit210102fe95a72f32f9149fd674bb0c2190f14171 (patch)
treefad1fddb067ebc3705ff1ddba3c6f2673c03f36a /redo/control.go
parent5a51263adc6d2e8ee7ea0dac4d92a66755c07cb1 (diff)
Set up a new, cleaner model for deriving Control's methods and applied it to the Windows backend.
Diffstat (limited to 'redo/control.go')
-rw-r--r--redo/control.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/redo/control.go b/redo/control.go
new file mode 100644
index 0000000..bd4ef00
--- /dev/null
+++ b/redo/control.go
@@ -0,0 +1,45 @@
+// 30 july 2014
+
+package ui
+
+// All Controls 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)
+}