From 80f43a613ae073276ce4d31e988cb12e9d0ba480 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 14 Feb 2014 11:12:08 -0500 Subject: [PATCH] Renamed Control.apply() to Control.make(). --- button.go | 2 +- checkbox.go | 2 +- control.go | 2 +- stack.go | 4 ++-- window.go | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/button.go b/button.go index 2c6706f..9750037 100644 --- a/button.go +++ b/button.go @@ -35,7 +35,7 @@ func (b *Button) SetText(text string) (err error) { return nil } -func (b *Button) apply(window *sysData) error { +func (b *Button) make(window *sysData) error { b.lock.Lock() defer b.lock.Unlock() diff --git a/checkbox.go b/checkbox.go index fc5c197..9836823 100644 --- a/checkbox.go +++ b/checkbox.go @@ -47,7 +47,7 @@ func (c *Checkbox) Checked() bool { return check } -func (c *Checkbox) apply(window *sysData) error { +func (c *Checkbox) make(window *sysData) error { c.lock.Lock() defer c.lock.Unlock() diff --git a/control.go b/control.go index bf204ed..314709c 100644 --- a/control.go +++ b/control.go @@ -8,6 +8,6 @@ import ( // A Control represents an UI control. Note that Control contains unexported members; this has the consequence that you can't build custom controls that interface directly with the system-specific code (fo rinstance, to import an unsupported control), or at least not without some hackery. If you want to make your own controls, embed Area and provide its necessities. type Control interface { - apply(window *sysData) error + make(window *sysData) error setRect(x int, y int, width int, height int) error } diff --git a/stack.go b/stack.go index 78fbc99..693558f 100644 --- a/stack.go +++ b/stack.go @@ -33,9 +33,9 @@ func NewStack(o Orientation, controls ...Control) *Stack { } // TODO adorn errors with which stage failed -func (s *Stack) apply(window *sysData) error { +func (s *Stack) make(window *sysData) error { for _, c := range s.controls { - err := c.apply(window) + err := c.make(window) if err != nil { return err } diff --git a/window.go b/window.go index 5bf167a..70f51f5 100644 --- a/window.go +++ b/window.go @@ -74,7 +74,7 @@ func (w *Window) Open(control Control) (err error) { } if control != nil { w.sysData.resize = control.setRect - err = control.apply(w.sysData) + err = control.make(w.sysData) if err != nil { return err } @@ -95,8 +95,8 @@ func (w *Window) Hide() (err error) { // These satisfy the Control interface, allowing a window to own a control. As a consequence, Windows are themselves Controls. THIS IS UNDOCUMENTED AND UNSUPPORTED. I can make it supported in the future, but for now, no. You shouldn't be depending on the internals of the library to develop your programs: if the documentation is incomplete and/or wrong, get the person responsible to fix it, as the documentation, not the implementation, is your contract to what you can or cannot do. Don't worry, this package is in good company: Go itself was designed spec-first for this reason. // If I decide not to support windows as controls, a better way to deal with controls would be in order. Perhaps separate interfaces...? Making Windows Controls seems the cleanest option for now (and with correct usage of the library costs nothing). -func (w *Window) apply(window *sysData) error { - panic("Window.apply() should never be called") +func (w *Window) make(window *sysData) error { + panic("Window.make() should never be called") } func (w *Window) setRect(x int, y int, width int, height int) error { panic("Window.setRect() should never be called")