Moved Window.SetControl() into window.go pending addition of fake resize events.
This commit is contained in:
parent
de92b822a7
commit
e989c953fa
|
@ -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
|
||||||
|
}
|
||||||
|
|
|
@ -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))
|
||||||
}
|
}
|
||||||
|
|
|
@ -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))
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue