summaryrefslogtreecommitdiff
path: root/redo
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-04 13:39:33 -0400
committerPietro Gagliardi <[email protected]>2014-08-04 13:39:33 -0400
commit0ac40be173f9a1410c5149da605ffd1db24fc911 (patch)
treec4489c16c36bcba5bb85888615895d43b8f0fa06 /redo
parent0496cf77b52e1713749fe40a8ef1b22f4918ad1d (diff)
Removed Control.containerShow() and Control.containerHide() and the overall ability to show and hide Controls in general; too much effort to get right.
Diffstat (limited to 'redo')
-rw-r--r--redo/button_darwin.go8
-rw-r--r--redo/button_unix.go8
-rw-r--r--redo/button_windows.go8
-rw-r--r--redo/checkbox_darwin.go8
-rw-r--r--redo/checkbox_unix.go8
-rw-r--r--redo/checkbox_windows.go8
-rw-r--r--redo/control.go3
-rw-r--r--redo/control_darwin.go8
-rw-r--r--redo/control_unix.go15
-rw-r--r--redo/control_windows.go8
-rwxr-xr-xredo/controlbase.sh8
-rw-r--r--redo/label_darwin.go8
-rw-r--r--redo/label_unix.go8
-rw-r--r--redo/label_windows.go8
-rw-r--r--redo/scrapped1
-rw-r--r--redo/stack.go12
-rw-r--r--redo/tab_darwin.go8
-rw-r--r--redo/tab_unix.go8
-rw-r--r--redo/tab_windows.go10
-rw-r--r--redo/table_darwin.go8
-rw-r--r--redo/table_unix.go8
-rw-r--r--redo/table_windows.go8
-rw-r--r--redo/textfield_darwin.go8
-rw-r--r--redo/textfield_unix.go8
-rw-r--r--redo/textfield_windows.go8
25 files changed, 5 insertions, 196 deletions
diff --git a/redo/button_darwin.go b/redo/button_darwin.go
index 1e6cf33..9444da4 100644
--- a/redo/button_darwin.go
+++ b/redo/button_darwin.go
@@ -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)
}
diff --git a/redo/button_unix.go b/redo/button_unix.go
index d6a19bb..7d41b55 100644
--- a/redo/button_unix.go
+++ b/redo/button_unix.go
@@ -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)
}
diff --git a/redo/button_windows.go b/redo/button_windows.go
index 8c2ebec..ac2b9b7 100644
--- a/redo/button_windows.go
+++ b/redo/button_windows.go
@@ -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)
}
diff --git a/redo/checkbox_darwin.go b/redo/checkbox_darwin.go
index fa27892..ac3375a 100644
--- a/redo/checkbox_darwin.go
+++ b/redo/checkbox_darwin.go
@@ -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)
}
diff --git a/redo/checkbox_unix.go b/redo/checkbox_unix.go
index 034dbf8..3cae5fa 100644
--- a/redo/checkbox_unix.go
+++ b/redo/checkbox_unix.go
@@ -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)
}
diff --git a/redo/checkbox_windows.go b/redo/checkbox_windows.go
index 88c82ef..eab0764 100644
--- a/redo/checkbox_windows.go
+++ b/redo/checkbox_windows.go
@@ -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)
}
diff --git a/redo/control.go b/redo/control.go
index 953e241..4ba9618 100644
--- a/redo/control.go
+++ b/redo/control.go
@@ -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
}
diff --git a/redo/control_darwin.go b/redo/control_darwin.go
index c356749..faeb899 100644
--- a/redo/control_darwin.go
+++ b/redo/control_darwin.go
@@ -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)
diff --git a/redo/control_unix.go b/redo/control_unix.go
index 715e3d3..2c27b1b 100644
--- a/redo/control_unix.go
+++ b/redo/control_unix.go
@@ -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)
}
diff --git a/redo/control_windows.go b/redo/control_windows.go
index ac57527..49ac644 100644
--- a/redo/control_windows.go
+++ b/redo/control_windows.go
@@ -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) {
diff --git a/redo/controlbase.sh b/redo/controlbase.sh
index 1945e2d..6d10bb1 100755
--- a/redo/controlbase.sh
+++ b/redo/controlbase.sh
@@ -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)
}
diff --git a/redo/label_darwin.go b/redo/label_darwin.go
index 65b2720..ab2cbab 100644
--- a/redo/label_darwin.go
+++ b/redo/label_darwin.go
@@ -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)
}
diff --git a/redo/label_unix.go b/redo/label_unix.go
index 7697f59..445556c 100644
--- a/redo/label_unix.go
+++ b/redo/label_unix.go
@@ -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)
}
diff --git a/redo/label_windows.go b/redo/label_windows.go
index 8e55943..b61404a 100644
--- a/redo/label_windows.go
+++ b/redo/label_windows.go
@@ -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)
}
diff --git a/redo/scrapped b/redo/scrapped
index fb9b993..9334eb5 100644
--- a/redo/scrapped
+++ b/redo/scrapped
@@ -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)
diff --git a/redo/stack.go b/redo/stack.go
index 9f37812..739934d 100644
--- a/redo/stack.go
+++ b/redo/stack.go
@@ -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
diff --git a/redo/tab_darwin.go b/redo/tab_darwin.go
index 5175698..503c138 100644
--- a/redo/tab_darwin.go
+++ b/redo/tab_darwin.go
@@ -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)
}
diff --git a/redo/tab_unix.go b/redo/tab_unix.go
index 264ce5f..22a0c66 100644
--- a/redo/tab_unix.go
+++ b/redo/tab_unix.go
@@ -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)
}
diff --git a/redo/tab_windows.go b/redo/tab_windows.go
index a0cf637..8e96871 100644
--- a/redo/tab_windows.go
+++ b/redo/tab_windows.go
@@ -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)
}
diff --git a/redo/table_darwin.go b/redo/table_darwin.go
index a3e3b76..64c78bd 100644
--- a/redo/table_darwin.go
+++ b/redo/table_darwin.go
@@ -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)
}
diff --git a/redo/table_unix.go b/redo/table_unix.go
index 05baa57..c2d59b6 100644
--- a/redo/table_unix.go
+++ b/redo/table_unix.go
@@ -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)
}
diff --git a/redo/table_windows.go b/redo/table_windows.go
index 3fef105..2748b0d 100644
--- a/redo/table_windows.go
+++ b/redo/table_windows.go
@@ -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)
}
diff --git a/redo/textfield_darwin.go b/redo/textfield_darwin.go
index 475bda7..cb5b8fa 100644
--- a/redo/textfield_darwin.go
+++ b/redo/textfield_darwin.go
@@ -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)
}
diff --git a/redo/textfield_unix.go b/redo/textfield_unix.go
index 53dfcaf..8f609f5 100644
--- a/redo/textfield_unix.go
+++ b/redo/textfield_unix.go
@@ -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)
}
diff --git a/redo/textfield_windows.go b/redo/textfield_windows.go
index c4e3d48..8410432 100644
--- a/redo/textfield_windows.go
+++ b/redo/textfield_windows.go
@@ -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)
}