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:
Pietro Gagliardi 2014-08-04 13:39:33 -04:00
parent 0496cf77b5
commit 0ac40be173
25 changed files with 5 additions and 196 deletions

View File

@ -55,14 +55,6 @@ func (b *button) setParent(p *controlParent) {
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 {
return baseallocate(b, x, y, width, height, d)
}

View File

@ -65,14 +65,6 @@ func (b *button) setParent(p *controlParent) {
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 {
return baseallocate(b, x, y, width, height, d)
}

View File

@ -66,14 +66,6 @@ func (b *button) setParent(p *controlParent) {
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 {
return baseallocate(b, x, y, width, height, d)
}

View File

@ -62,14 +62,6 @@ func (c *checkbox) setParent(p *controlParent) {
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 {
return baseallocate(c, x, y, width, height, d)
}

View File

@ -75,14 +75,6 @@ func (c *checkbox) setParent(p *controlParent) {
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 {
return baseallocate(c, x, y, width, height, d)
}

View File

@ -78,14 +78,6 @@ func (c *checkbox) setParent(p *controlParent) {
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 {
return baseallocate(c, x, y, width, height, d)
}

View File

@ -7,9 +7,6 @@ package ui
type Control interface {
setParent(p *controlParent) // controlParent defined per-platform
// 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
}

View File

@ -20,14 +20,6 @@ func basesetParent(c controlPrivate, p *controlParent) {
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) {
s := C.controlPrefSize(c.id())
return int(s.width), int(s.height)

View File

@ -22,17 +22,10 @@ type controlParent struct {
}
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
c.containerShow()
}
func basecontainerShow(c controlPrivate) {
C.gtk_widget_show_all(c.widget())
}
func basecontainerHide(c controlPrivate) {
C.gtk_widget_hide(c.widget())
C.gtk_widget_show_all(widget)
}
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) {
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)
}

View File

@ -18,14 +18,6 @@ func basesetParent(c controlPrivate, p *controlParent) {
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
func basecommitResize(c controlPrivate, a *allocation, d *sizing) {

View File

@ -10,14 +10,6 @@ func (AAA *BBB) setParent(p *controlParent) {
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 {
return baseallocate(AAA, x, y, width, height, d)
}

View File

@ -49,14 +49,6 @@ func (l *label) setParent(p *controlParent) {
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 {
return baseallocate(l, x, y, width, height, d)
}

View File

@ -62,14 +62,6 @@ func (l *label) setParent(p *controlParent) {
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 {
return baseallocate(l, x, y, width, height, d)
}

View File

@ -60,14 +60,6 @@ func (l *label) setParent(p *controlParent) {
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 {
return baseallocate(l, x, y, width, height, d)
}

View File

@ -1,2 +1,3 @@
Window.SetSize()
Window.Center() (only really effective on Mac OS X)
Control.Show()/Control.Hide() (too much effort to get right)

View File

@ -65,18 +65,6 @@ func (s *Stack) setParent(parent *controlParent) {
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) {
var stretchywid, stretchyht int
var current *allocation // for neighboring

View File

@ -47,14 +47,6 @@ func (t *tab) setParent(p *controlParent) {
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 {
return baseallocate(t, x, y, width, height, d)
}

View File

@ -50,14 +50,6 @@ func (t *tab) setParent(p *controlParent) {
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 {
return baseallocate(t, x, y, width, height, d)
}

View File

@ -74,16 +74,6 @@ func (t *tab) setParent(p *controlParent) {
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 {
return baseallocate(t, x, y, width, height, d)
}

View File

@ -71,14 +71,6 @@ func (t *table) setParent(p *controlParent) {
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 {
return baseallocate(t, x, y, width, height, d)
}

View File

@ -102,14 +102,6 @@ func (t *table) setParent(p *controlParent) {
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 {
return baseallocate(t, x, y, width, height, d)
}

View File

@ -61,14 +61,6 @@ func (t *table) setParent(p *controlParent) {
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 {
return baseallocate(t, x, y, width, height, d)
}

View File

@ -43,14 +43,6 @@ func (t *textField) setParent(p *controlParent) {
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 {
return baseallocate(t, x, y, width, height, d)
}

View File

@ -54,14 +54,6 @@ func (t *textField) setParent(p *controlParent) {
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 {
return baseallocate(t, x, y, width, height, d)
}

View File

@ -55,14 +55,6 @@ func (t *textField) setParent(p *controlParent) {
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 {
return baseallocate(t, x, y, width, height, d)
}