summaryrefslogtreecommitdiff
path: root/redo/sizer_unix.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-04 21:08:18 -0400
committerPietro Gagliardi <[email protected]>2014-08-04 21:08:18 -0400
commit23baffe55ed5964a24f41e719b8f538f1bb04168 (patch)
tree26cf4690421ea913772bf7ba8befa4e45e5d2db1 /redo/sizer_unix.go
parent91f1a34003d56a5778d1ae48f7d18c3f27eea1ed (diff)
Applied the container change to the GTK+ backend. Woo!
Diffstat (limited to 'redo/sizer_unix.go')
-rw-r--r--redo/sizer_unix.go84
1 files changed, 0 insertions, 84 deletions
diff --git a/redo/sizer_unix.go b/redo/sizer_unix.go
deleted file mode 100644
index 4a3c7b4..0000000
--- a/redo/sizer_unix.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// +build !windows,!darwin
-
-// 23 february 2014
-
-package ui
-
-import (
- "unsafe"
-"fmt"
-)
-
-// #include "gtk_unix.h"
-// extern void layoutResizing(GtkWidget *, GdkRectangle *, gpointer);
-import "C"
-
-type sizing struct {
- sizingbase
-
- // for size calculations
- // gtk+ needs nothing
-
- // for the actual resizing
- shouldVAlignTop bool
-}
-
-const (
- gtkXMargin = 12
- gtkYMargin = 12
- gtkXPadding = 12
- gtkYPadding = 6
-)
-
-func (s *sizer) beginResize() (d *sizing) {
- d = new(sizing)
- if spaced {
- d.xmargin = gtkXMargin
- d.ymargin = gtkYMargin
- d.xpadding = gtkXPadding
- d.ypadding = gtkYPadding
- }
- return d
-}
-
-func (s *sizer) translateAllocationCoords(allocations []*allocation, winwidth, winheight int) {
- // no need for coordinate conversion with gtk+
-}
-
-// layout maintains the widget hierarchy by containing all of a sizer's children in a single layout widget
-type layout struct {
- *sizer
- layoutwidget *C.GtkWidget
- layoutcontainer *C.GtkContainer
- layout *C.GtkLayout
-}
-
-func newLayout(child Control) *layout {
- widget := C.gtk_layout_new(nil, nil)
- l := &layout{
- sizer: new(sizer),
- layoutwidget: widget,
- layoutcontainer: (*C.GtkContainer)(unsafe.Pointer(widget)),
- layout: (*C.GtkLayout)(unsafe.Pointer(widget)),
- }
- l.child = child
- l.child.setParent(&controlParent{l.layoutcontainer})
- // we connect to the layout's size-allocate, not to the window's configure-event
- // this allows us to handle client-side decoration-based configurations (such as GTK+ on Wayland) properly
- // also see commitResize() in sizing_unix.go for additional notes
- // thanks to many people in irc.gimp.net/#gtk+ for help (including tristan for suggesting g_signal_connect_after())
- g_signal_connect_after(
- C.gpointer(unsafe.Pointer(l.layout)),
- "size-allocate",
- C.GCallback(C.layoutResizing),
- C.gpointer(unsafe.Pointer(l)))
- return l
-}
-
-//export layoutResizing
-func layoutResizing(wid *C.GtkWidget, r *C.GdkRectangle, data C.gpointer) {
- l := (*layout)(unsafe.Pointer(data))
- // the layout's coordinate system is localized, so the origin is (0, 0)
- l.resize(0, 0, int(r.width), int(r.height))
-fmt.Printf("new size %d x %d\n", r.width, r.height)
-}