diff options
| author | Pietro Gagliardi <[email protected]> | 2014-02-12 10:29:56 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-02-12 10:29:56 -0500 |
| commit | e9e2c0f269aac1157a3ea6a6021a86869fdd6888 (patch) | |
| tree | 7edd6ae853fd47ea09972833bd74b3239674fcfa /window.go | |
| parent | 0f373195de316b1b20a05ebff1463fb8a56b1f1b (diff) | |
Set up restrictions tracking. Added a restriction that a window and its controls are fixed to the window once it has been open. Started accounting for parent windows in controls.
Diffstat (limited to 'window.go')
| -rw-r--r-- | window.go | 22 |
1 files changed, 8 insertions, 14 deletions
@@ -32,23 +32,17 @@ func NewWindow(title string) *Window { } } -// SetControl sets the window's central control to control. +// SetControl sets the window's central control to control. This function cannot be called once the window has been opened. func (w *Window) SetControl(control Control) (err error) { w.lock.Lock() defer w.lock.Unlock() - w.control = control - err = w.control.unapply() - if err != nil { - return err - } - w.control.setParent(w) if w.created { - err = w.control.apply() - if err != nil { - return err - } + panic("cannot set window control after window has been opened") } + w.control = control + w.control.setParent(w) + w.control.setParentWindow(w) return nil } @@ -85,9 +79,9 @@ func (w *Window) Close() (err error) { func (w *Window) apply() error { panic("Window.apply() should never be called") } -func (w *Window) unapply() error { - panic("Window.unapply() should never be called") -} func (w *Window) setParent(c Control) { panic("Window.setParent() should never be called") } +func (w *Window) setParentWindow(w *Window) { + panic("Window.setParent() should never be called") +} |
