-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayoutManager.ahk
45 lines (42 loc) · 1.38 KB
/
layoutManager.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class DefaultLayoutManagerClass
{
leftOffset := 0
__new()
{
return this
}
getSizeAndPositions(arrayOfWindows)
{
;arrays are actually associative objects...i need the real number of items in this array
numberOfWindows := 0
for key, val in arrayOfWindows
{
numberOfWindows := A_Index
}
if(numberOfWindows == 0)
{
return []
} else if(numberOfWindows == 1)
{
return [new PositionObjectClass(A_ScreenHeight, A_ScreenWidth, x:=0, y:=0)]
} else if(numberOfWindows == 2)
{
return [new PositionObjectClass(A_ScreenHeight, A_ScreenWidth / 2 - this.leftOffset, x:=0, y:=0)
, new PositionObjectClass(A_ScreenHeight, A_ScreenWidth / 2 + this.leftOffset, x:=A_ScreenWidth/2 - this.leftOffset, y:=0)]
} else
{
main := [new PositionObjectClass(A_ScreenHeight, A_ScreenWidth / 2 - this.leftOffset, x:=0, y:=0)
, new PositionObjectClass(A_ScreenHeight / 2, A_ScreenWidth / 2 + this.leftOffset, x:=A_ScreenWidth/2 - this.leftOffset, y:=0)]
return this.getRemainingPositions(main, numberOfWindows)
}
}
getRemainingPositions(positions, numberOfWindows)
{
height := (A_ScreenHeight / 2) / (numberOfWindows - 2)
loop, % numberOfWindows -2
{
positions.push(new PositionObjectClass(height, A_ScreenWidth / 2 + this.leftOffset, x:=A_ScreenWidth/2 - this.leftOffset, (A_screenHeight / 2) + (height * (A_Index - 1))))
}
return positions
}
}