summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redo/containerctrls_windows.go17
-rw-r--r--redo/sizer_windows.go (renamed from redo/sizing_windows.go)4
-rw-r--r--redo/sizing_windows.c2
-rw-r--r--redo/window_windows.go4
4 files changed, 15 insertions, 12 deletions
diff --git a/redo/containerctrls_windows.go b/redo/containerctrls_windows.go
index e81c340..1aa2c57 100644
--- a/redo/containerctrls_windows.go
+++ b/redo/containerctrls_windows.go
@@ -19,7 +19,7 @@ TODO
type tab struct {
*controlbase
- tabs []*container
+ tabs []*sizer
supersetParent func(p *controlParent)
superallocate func(x int, y int, width int, height int, d *sizing) []*allocation
}
@@ -48,15 +48,15 @@ func (t *tab) tabsetParent(p *controlParent) {
}
func (t *tab) Append(name string, control Control) {
- c := new(container)
- t.tabs = append(t.tabs, c)
- c.child = control
+ s := new(sizer)
+ t.tabs = append(t.tabs, s)
+ s.child = control
if t.parent != nil {
- c.child.setParent(&controlParent{t.parent})
+ s.child.setParent(&controlParent{t.parent})
}
// initially hide tab 1..n controls; if we don't, they'll appear over other tabs, resulting in weird behavior
if len(t.tabs) != 1 {
- c.child.containerHide()
+ s.child.containerHide()
}
C.tabAppend(t.hwnd, toUTF16(name))
}
@@ -74,6 +74,7 @@ func tabChanged(data unsafe.Pointer, new C.LRESULT) {
}
// a tab control contains other controls; size appropriately
+// TODO change this to commitResize()
func (t *tab) taballocate(x int, y int, width int, height int, d *sizing) []*allocation {
var r C.RECT
@@ -85,9 +86,9 @@ func (t *tab) taballocate(x int, y int, width int, height int, d *sizing) []*all
C.tabGetContentRect(t.hwnd, &r)
// and allocate
// don't allocate to just the current tab; allocate to all tabs!
- for _, c := range t.tabs {
+ for _, s := range t.tabs {
// because each widget is actually a child of the Window, the origin is the one we calculated above
- c.resize(int(r.left), int(r.top), int(r.right - r.left), int(r.bottom - r.top))
+ s.resize(int(r.left), int(r.top), int(r.right - r.left), int(r.bottom - r.top))
}
// and now allocate the tab control itself
return t.superallocate(x, y, width, height, d)
diff --git a/redo/sizing_windows.go b/redo/sizer_windows.go
index 08bb0ab..554b285 100644
--- a/redo/sizing_windows.go
+++ b/redo/sizer_windows.go
@@ -41,7 +41,7 @@ const (
paddingDialogUnits = 4
)
-func (c *container) beginResize() (d *sizing) {
+func (s *sizer) beginResize() (d *sizing) {
d = new(sizing)
d.baseX = C.baseX
@@ -57,7 +57,7 @@ func (c *container) beginResize() (d *sizing) {
return d
}
-func (c *container) translateAllocationCoords(allocations []*allocation, winwidth, winheight int) {
+func (s *sizer) translateAllocationCoords(allocations []*allocation, winwidth, winheight int) {
// no translation needed on windows
}
diff --git a/redo/sizing_windows.c b/redo/sizing_windows.c
index e6f27a6..60d57f3 100644
--- a/redo/sizing_windows.c
+++ b/redo/sizing_windows.c
@@ -3,6 +3,8 @@
#include "winapi_windows.h"
#include "_cgo_export.h"
+/* TODO rename to sizer_windows.c and move all but the first function to control_windows.c */
+
BOOL baseUnitsCalculated = FALSE;
int baseX;
int baseY;
diff --git a/redo/window_windows.go b/redo/window_windows.go
index 8c64858..341f226 100644
--- a/redo/window_windows.go
+++ b/redo/window_windows.go
@@ -17,7 +17,7 @@ type window struct {
closing *event
- *container
+ *sizer
}
const windowclassname = ""
@@ -37,7 +37,7 @@ func newWindow(title string, width int, height int, control Control) *window {
w := &window{
// hwnd set in WM_CREATE handler
closing: newEvent(),
- container: new(container),
+ sizer: new(sizer),
}
hwnd := C.newWindow(toUTF16(title), C.int(width), C.int(height), unsafe.Pointer(w))
if hwnd != w.hwnd {