diff options
Diffstat (limited to 'testfiles/column.txt')
-rw-r--r-- | testfiles/column.txt | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/testfiles/column.txt b/testfiles/column.txt deleted file mode 100644 index d7f24cf..0000000 --- a/testfiles/column.txt +++ /dev/null @@ -1,58 +0,0 @@ -package main - -type Columns []*Column - -type Column struct { - x, y int - w, h int - windows []*Window -} - -// Add adds a new column and resizes. It returns the index of the newly created column. -func (cs Columns) Add() Columns { - nw, nh := screen.Size() - - var nx, ny int - if len(cs) > 0 { - nx = cs[len(cs)-1].x + cs[len(cs)-1].w/2 - nw = cs[len(cs)-1].w / 2 - cs[len(cs)-1].w /= 2 - } - - newcol := &Column{nx, ny, nw, nh, nil} - newwin := NewWindow("") - newcol.windows = append(newcol.windows, newwin) - cs = append(cs, newcol) - - return cs -} - -func (c *Column) AddWindow(win *Window) { - c.windows = append(c.windows, win) - c.ResizeInternal() -} - -func (c *Column) Resize(x, y, w, h int) { - c.x, c.y = x, y - c.w, c.h = w, h - - c.ResizeInternal() -} - -func (c *Column) ResizeInternal() { - var n int - for i := range c.windows { - if c.windows[i].visible { - n++ - } - } - - remainder := c.h % n - for i, win := range c.windows { - if i == 0 { - win.Resize(c.x, c.y, c.w, c.h/n+remainder) - continue - } - win.Resize(c.x, c.y+(c.h/n)*(i)+remainder, c.w, c.h/n) - } -} |