Moved Window.SetControl() into window.go pending addition of fake resize events.

This commit is contained in:
Pietro Gagliardi 2014-07-22 00:07:41 -04:00
parent de92b822a7
commit e989c953fa
4 changed files with 14 additions and 27 deletions

View File

@ -34,3 +34,17 @@ type Window interface {
func NewWindow(title string, width int, height int) Window { func NewWindow(title string, width int, height int) Window {
return newWindow(title, width, height) return newWindow(title, width, height)
} }
// everything below is kept here because they're the same on all platforms
// TODO move event stuff here and make windowbase
func (w *window) SetControl(control Control) {
if w.child != nil { // unparent existing control
w.child.unparent()
}
control.unparent()
control.parent(w)
w.child = control
// TODO trigger a resize to let the new control actually be shown
// TODO do the same with control's old parent, if any
}

View File

@ -33,15 +33,6 @@ func newWindow(title string, width int, height int) *window {
return w return w
} }
func (w *window) SetControl(control Control) {
if w.child != nil { // unparent existing control
w.child.unparent()
}
control.unparent()
control.parent(w)
w.child = control
}
func (w *window) Title() string { func (w *window) Title() string {
return C.GoString(C.windowTitle(w.id)) return C.GoString(C.windowTitle(w.id))
} }

View File

@ -66,15 +66,6 @@ func newWindow(title string, width int, height int) *window {
return w return w
} }
func (w *window) SetControl(control Control) {
if w.child != nil { // unparent existing control
w.child.unparent()
}
control.unparent()
control.parent(w)
w.child = control
}
func (w *window) Title() string { func (w *window) Title() string {
return fromgstr(C.gtk_window_get_title(w.window)) return fromgstr(C.gtk_window_get_title(w.window))
} }

View File

@ -47,15 +47,6 @@ func newWindow(title string, width int, height int) *window {
return w return w
} }
func (w *window) SetControl(control Control) {
if w.child != nil { // unparent existing control
w.child.unparent()
}
control.unparent()
control.parent(w)
w.child = control
}
func (w *window) Title() string { func (w *window) Title() string {
return getWindowText(w.hwnd) return getWindowText(w.hwnd)
} }