git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1244 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -12,7 +12,47 @@ namespace OpenRa.Game
|
||||
Size size;
|
||||
MethodInvoker drawFunction;
|
||||
|
||||
public Region(Point location, Size size, MethodInvoker drawFunction)
|
||||
static Size MakeSize(Viewport v, DockStyle d, int size)
|
||||
{
|
||||
switch (d)
|
||||
{
|
||||
case DockStyle.Top:
|
||||
case DockStyle.Bottom:
|
||||
return new Size(v.Width, size);
|
||||
|
||||
case DockStyle.Left:
|
||||
case DockStyle.Right:
|
||||
return new Size(size, v.Height);
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public static Region Create(Viewport v, DockStyle d, int size, MethodInvoker f)
|
||||
{
|
||||
Point topLeft = new Point(0, 0);
|
||||
Point bottomRight = new Point(v.ClientSize);
|
||||
|
||||
Size s = MakeSize(v, d, size);
|
||||
|
||||
switch (d)
|
||||
{
|
||||
case DockStyle.Top:
|
||||
case DockStyle.Left:
|
||||
return new Region(topLeft, s, f);
|
||||
|
||||
case DockStyle.Right:
|
||||
case DockStyle.Bottom:
|
||||
Point origin = bottomRight; origin.Offset( -s.Width, -s.Height );
|
||||
return new Region(origin, s, f);
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
Region(Point location, Size size, MethodInvoker drawFunction)
|
||||
{
|
||||
this.location = location;
|
||||
this.size = size;
|
||||
|
||||
Reference in New Issue
Block a user