Removed Control.containerShow() and Control.containerHide() and the overall ability to show and hide Controls in general; too much effort to get right.
This commit is contained in:
parent
0496cf77b5
commit
0ac40be173
|
@ -55,14 +55,6 @@ func (b *button) setParent(p *controlParent) {
|
||||||
basesetParent(b, p)
|
basesetParent(b, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *button) containerShow() {
|
|
||||||
basecontainerShow(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *button) containerHide() {
|
|
||||||
basecontainerHide(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *button) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (b *button) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(b, x, y, width, height, d)
|
return baseallocate(b, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,14 +65,6 @@ func (b *button) setParent(p *controlParent) {
|
||||||
basesetParent(b, p)
|
basesetParent(b, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *button) containerShow() {
|
|
||||||
basecontainerShow(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *button) containerHide() {
|
|
||||||
basecontainerHide(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *button) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (b *button) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(b, x, y, width, height, d)
|
return baseallocate(b, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,14 +66,6 @@ func (b *button) setParent(p *controlParent) {
|
||||||
basesetParent(b, p)
|
basesetParent(b, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *button) containerShow() {
|
|
||||||
basecontainerShow(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *button) containerHide() {
|
|
||||||
basecontainerHide(b)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *button) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (b *button) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(b, x, y, width, height, d)
|
return baseallocate(b, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,14 +62,6 @@ func (c *checkbox) setParent(p *controlParent) {
|
||||||
basesetParent(c, p)
|
basesetParent(c, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *checkbox) containerShow() {
|
|
||||||
basecontainerShow(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *checkbox) containerHide() {
|
|
||||||
basecontainerHide(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *checkbox) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (c *checkbox) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(c, x, y, width, height, d)
|
return baseallocate(c, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,14 +75,6 @@ func (c *checkbox) setParent(p *controlParent) {
|
||||||
basesetParent(c, p)
|
basesetParent(c, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *checkbox) containerShow() {
|
|
||||||
basecontainerShow(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *checkbox) containerHide() {
|
|
||||||
basecontainerHide(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *checkbox) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (c *checkbox) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(c, x, y, width, height, d)
|
return baseallocate(c, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,14 +78,6 @@ func (c *checkbox) setParent(p *controlParent) {
|
||||||
basesetParent(c, p)
|
basesetParent(c, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *checkbox) containerShow() {
|
|
||||||
basecontainerShow(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *checkbox) containerHide() {
|
|
||||||
basecontainerHide(c)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *checkbox) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (c *checkbox) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(c, x, y, width, height, d)
|
return baseallocate(c, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,6 @@ package ui
|
||||||
type Control interface {
|
type Control interface {
|
||||||
setParent(p *controlParent) // controlParent defined per-platform
|
setParent(p *controlParent) // controlParent defined per-platform
|
||||||
// TODO enable/disable (public)
|
// TODO enable/disable (public)
|
||||||
// TODO show/hide (public)
|
|
||||||
containerShow() // for Windows, where all controls need ot belong to an overlapped window, not to a container control; these respect programmer settings
|
|
||||||
containerHide()
|
|
||||||
controlSizing
|
controlSizing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,6 @@ func basesetParent(c controlPrivate, p *controlParent) {
|
||||||
C.parent(c.id(), p.id)
|
C.parent(c.id(), p.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func basecontainerShow(c controlPrivate) {
|
|
||||||
C.controlSetHidden(c.id(), C.NO)
|
|
||||||
}
|
|
||||||
|
|
||||||
func basecontainerHide(c controlPrivate) {
|
|
||||||
C.controlSetHidden(c.id(), C.YES)
|
|
||||||
}
|
|
||||||
|
|
||||||
func basepreferredSize(c controlPrivate, d *sizing) (int, int) {
|
func basepreferredSize(c controlPrivate, d *sizing) (int, int) {
|
||||||
s := C.controlPrefSize(c.id())
|
s := C.controlPrefSize(c.id())
|
||||||
return int(s.width), int(s.height)
|
return int(s.width), int(s.height)
|
||||||
|
|
|
@ -22,17 +22,10 @@ type controlParent struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func basesetParent(c controlPrivate, p *controlParent) {
|
func basesetParent(c controlPrivate, p *controlParent) {
|
||||||
C.gtk_container_add(p.c, c.widget())
|
widget := c.widget() // avoid multiple interface lookups
|
||||||
|
C.gtk_container_add(p.c, widget)
|
||||||
// make sure the new widget is shown if not explicitly hidden
|
// make sure the new widget is shown if not explicitly hidden
|
||||||
c.containerShow()
|
C.gtk_widget_show_all(widget)
|
||||||
}
|
|
||||||
|
|
||||||
func basecontainerShow(c controlPrivate) {
|
|
||||||
C.gtk_widget_show_all(c.widget())
|
|
||||||
}
|
|
||||||
|
|
||||||
func basecontainerHide(c controlPrivate) {
|
|
||||||
C.gtk_widget_hide(c.widget())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func basepreferredSize(c controlPrivate, d *sizing) (int, int) {
|
func basepreferredSize(c controlPrivate, d *sizing) (int, int) {
|
||||||
|
@ -103,7 +96,7 @@ func newScroller(widget *C.GtkWidget, native bool) *scroller {
|
||||||
|
|
||||||
func (s *scroller) setParent(p *controlParent) {
|
func (s *scroller) setParent(p *controlParent) {
|
||||||
C.gtk_container_add(p.c, s.scrollwidget)
|
C.gtk_container_add(p.c, s.scrollwidget)
|
||||||
// TODO for when hiding/showing is implemented
|
// see basesetParent() above for why we call gtk_widget_show_all()
|
||||||
C.gtk_widget_show_all(s.scrollwidget)
|
C.gtk_widget_show_all(s.scrollwidget)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,6 @@ func basesetParent(c controlPrivate, p *controlParent) {
|
||||||
C.controlSetParent(c.hwnd(), p.hwnd)
|
C.controlSetParent(c.hwnd(), p.hwnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func basecontainerShow(c controlPrivate) {
|
|
||||||
C.ShowWindow(c.hwnd(), C.SW_SHOW)
|
|
||||||
}
|
|
||||||
|
|
||||||
func basecontainerHide(c controlPrivate) {
|
|
||||||
C.ShowWindow(c.hwnd(), C.SW_HIDE)
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't specify basepreferredSize; it is custom on ALL controls
|
// don't specify basepreferredSize; it is custom on ALL controls
|
||||||
|
|
||||||
func basecommitResize(c controlPrivate, a *allocation, d *sizing) {
|
func basecommitResize(c controlPrivate, a *allocation, d *sizing) {
|
||||||
|
|
|
@ -10,14 +10,6 @@ func (AAA *BBB) setParent(p *controlParent) {
|
||||||
basesetParent(AAA, p)
|
basesetParent(AAA, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (AAA *BBB) containerShow() {
|
|
||||||
basecontainerShow(AAA)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (AAA *BBB) containerHide() {
|
|
||||||
basecontainerHide(AAA)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (AAA *BBB) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (AAA *BBB) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(AAA, x, y, width, height, d)
|
return baseallocate(AAA, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,14 +49,6 @@ func (l *label) setParent(p *controlParent) {
|
||||||
basesetParent(l, p)
|
basesetParent(l, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *label) containerShow() {
|
|
||||||
basecontainerShow(l)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *label) containerHide() {
|
|
||||||
basecontainerHide(l)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *label) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (l *label) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(l, x, y, width, height, d)
|
return baseallocate(l, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,14 +62,6 @@ func (l *label) setParent(p *controlParent) {
|
||||||
basesetParent(l, p)
|
basesetParent(l, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *label) containerShow() {
|
|
||||||
basecontainerShow(l)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *label) containerHide() {
|
|
||||||
basecontainerHide(l)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *label) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (l *label) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(l, x, y, width, height, d)
|
return baseallocate(l, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,14 +60,6 @@ func (l *label) setParent(p *controlParent) {
|
||||||
basesetParent(l, p)
|
basesetParent(l, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *label) containerShow() {
|
|
||||||
basecontainerShow(l)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *label) containerHide() {
|
|
||||||
basecontainerHide(l)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *label) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (l *label) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(l, x, y, width, height, d)
|
return baseallocate(l, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
Window.SetSize()
|
Window.SetSize()
|
||||||
Window.Center() (only really effective on Mac OS X)
|
Window.Center() (only really effective on Mac OS X)
|
||||||
|
Control.Show()/Control.Hide() (too much effort to get right)
|
||||||
|
|
|
@ -65,18 +65,6 @@ func (s *Stack) setParent(parent *controlParent) {
|
||||||
s.created = true
|
s.created = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stack) containerShow() {
|
|
||||||
for _, c := range s.controls {
|
|
||||||
c.containerShow()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Stack) containerHide() {
|
|
||||||
for _, c := range s.controls {
|
|
||||||
c.containerHide()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Stack) allocate(x int, y int, width int, height int, d *sizing) (allocations []*allocation) {
|
func (s *Stack) allocate(x int, y int, width int, height int, d *sizing) (allocations []*allocation) {
|
||||||
var stretchywid, stretchyht int
|
var stretchywid, stretchyht int
|
||||||
var current *allocation // for neighboring
|
var current *allocation // for neighboring
|
||||||
|
|
|
@ -47,14 +47,6 @@ func (t *tab) setParent(p *controlParent) {
|
||||||
basesetParent(t, p)
|
basesetParent(t, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *tab) containerShow() {
|
|
||||||
basecontainerShow(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *tab) containerHide() {
|
|
||||||
basecontainerHide(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *tab) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (t *tab) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(t, x, y, width, height, d)
|
return baseallocate(t, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,14 +50,6 @@ func (t *tab) setParent(p *controlParent) {
|
||||||
basesetParent(t, p)
|
basesetParent(t, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *tab) containerShow() {
|
|
||||||
basecontainerShow(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *tab) containerHide() {
|
|
||||||
basecontainerHide(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *tab) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (t *tab) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(t, x, y, width, height, d)
|
return baseallocate(t, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,16 +74,6 @@ func (t *tab) setParent(p *controlParent) {
|
||||||
t.parent = p
|
t.parent = p
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO get rid of this
|
|
||||||
func (t *tab) containerShow() {
|
|
||||||
basecontainerShow(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO get rid of this
|
|
||||||
func (t *tab) containerHide() {
|
|
||||||
basecontainerHide(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *tab) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (t *tab) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(t, x, y, width, height, d)
|
return baseallocate(t, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,14 +71,6 @@ func (t *table) setParent(p *controlParent) {
|
||||||
t.scroller.setParent(p)
|
t.scroller.setParent(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *table) containerShow() {
|
|
||||||
basecontainerShow(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *table) containerHide() {
|
|
||||||
basecontainerHide(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *table) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (t *table) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(t, x, y, width, height, d)
|
return baseallocate(t, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,14 +102,6 @@ func (t *table) setParent(p *controlParent) {
|
||||||
t.scroller.setParent(p)
|
t.scroller.setParent(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *table) containerShow() {
|
|
||||||
basecontainerShow(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *table) containerHide() {
|
|
||||||
basecontainerHide(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *table) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (t *table) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(t, x, y, width, height, d)
|
return baseallocate(t, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,14 +61,6 @@ func (t *table) setParent(p *controlParent) {
|
||||||
basesetParent(t, p)
|
basesetParent(t, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *table) containerShow() {
|
|
||||||
basecontainerShow(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *table) containerHide() {
|
|
||||||
basecontainerHide(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *table) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (t *table) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(t, x, y, width, height, d)
|
return baseallocate(t, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,14 +43,6 @@ func (t *textField) setParent(p *controlParent) {
|
||||||
basesetParent(t, p)
|
basesetParent(t, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *textField) containerShow() {
|
|
||||||
basecontainerShow(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *textField) containerHide() {
|
|
||||||
basecontainerHide(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *textField) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (t *textField) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(t, x, y, width, height, d)
|
return baseallocate(t, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,14 +54,6 @@ func (t *textField) setParent(p *controlParent) {
|
||||||
basesetParent(t, p)
|
basesetParent(t, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *textField) containerShow() {
|
|
||||||
basecontainerShow(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *textField) containerHide() {
|
|
||||||
basecontainerHide(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *textField) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (t *textField) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(t, x, y, width, height, d)
|
return baseallocate(t, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,14 +55,6 @@ func (t *textField) setParent(p *controlParent) {
|
||||||
basesetParent(t, p)
|
basesetParent(t, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *textField) containerShow() {
|
|
||||||
basecontainerShow(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *textField) containerHide() {
|
|
||||||
basecontainerHide(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *textField) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
func (t *textField) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
|
||||||
return baseallocate(t, x, y, width, height, d)
|
return baseallocate(t, x, y, width, height, d)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue