diff options
| author | Pietro Gagliardi <[email protected]> | 2014-07-25 19:44:32 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-07-25 19:44:32 -0400 |
| commit | d1702d33e055fb254cfacb1ad7d3d3f60314bba6 (patch) | |
| tree | 34aaaa02191d3ba81907b11a885bbd57a7da74c2 /redo/controls_unix.go | |
| parent | 010c97d686f8e10f940c98b62ffb5a6735f73490 (diff) | |
Updated the GTK+ backend to have the new parenting and sizing changes. Now to implement Tab! ...though I should probably implement the changes on Mac OS X first.
Diffstat (limited to 'redo/controls_unix.go')
| -rw-r--r-- | redo/controls_unix.go | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/redo/controls_unix.go b/redo/controls_unix.go index 9011d50..21c01e4 100644 --- a/redo/controls_unix.go +++ b/redo/controls_unix.go @@ -15,8 +15,6 @@ import "C" type widgetbase struct { widget *C.GtkWidget - parentw *window - floating bool } func newWidget(w *C.GtkWidget) *widgetbase { @@ -27,31 +25,18 @@ func newWidget(w *C.GtkWidget) *widgetbase { // these few methods are embedded by all the various Controls since they all will do the same thing -func (w *widgetbase) unparent() { - if w.parentw != nil { - // add another reference so it doesn't get removed by accident - C.g_object_ref(C.gpointer(unsafe.Pointer(w.widget))) - // we unref this in parent() below - w.floating = true - C.gtk_container_remove(w.parentw.layoutc, w.widget) - // redraw since we changed controls (by queueing a resize; thanks Jasper in irc.gimp.net/#gtk+) - C.gtk_widget_queue_resize(w.parentw.layoutw) - w.parentw = nil - } +func (w *widgetbase) setParent(c *C.GtkContainer) { + C.gtk_container_add(c, w.widget) + // make sure the new widget is shown + C.gtk_widget_show_all(w.widget) } -func (w *widgetbase) parent(win *window) { - C.gtk_container_add(win.layoutc, w.widget) - w.parentw = win - // was previously parented; unref our saved ref - if w.floating { - C.g_object_unref(C.gpointer(unsafe.Pointer(w.widget))) - w.floating = false - } - // make sure the new widget is shown +func (w *widgetbase) containerShow() { C.gtk_widget_show_all(w.widget) - // redraw since we changed controls (see above) - C.gtk_widget_queue_resize(win.layoutw) +} + +func (w *widgetbase) containerHide() { + C.gtk_widget_hide(w.widget) } type button struct { @@ -135,3 +120,7 @@ func (c *checkbox) Checked() bool { func (c *checkbox) SetChecked(checked bool) { C.gtk_toggle_button_set_active(c.toggle, togbool(checked)) } + +//TODO +func newTab() Tab{return newButton("tab")} +func(*button)Append(string,Control){} |
