<EmbeddedResource Include="Images\Icons\Cursors\top_left_corner" />\r
<EmbeddedResource Include="Images\Icons\Cursors\top_right_corner" />\r
<EmbeddedResource Include="Images\Icons\Cursors\arrow" />\r
+ <EmbeddedResource Include="Images\Icons\exit2.svg" />\r
+ <EmbeddedResource Include="Images\Icons\Cursors\sb_h_double_arrow" />\r
+ <EmbeddedResource Include="Images\Icons\Cursors\sb_v_double_arrow" />\r
</ItemGroup>\r
<ItemGroup>\r
<None Include="Images\Icons\Cursors\hand" />\r
: base(800, 600,"test")\r
{}\r
\r
- Window g;\r
\r
protected override void OnLoad (EventArgs e)\r
{\r
base.OnLoad (e);\r
- LoadInterface("Interfaces/testWindow.goml", out g);\r
+ LoadInterface("Interfaces/testWindow.goml");\r
+ LoadInterface("Interfaces/testWindow.goml");\r
// LoadInterface("Interfaces/testWindow.goml", out g);\r
// LoadInterface("Interfaces/testWindow.goml", out g);\r
// LoadInterface("Interfaces/testWindow.goml", out g);\r
this.Quit ();\r
}\r
\r
+ void butQuitPress (object sender, MouseButtonEventArgs e)\r
+ {\r
+ DeleteWidget (sender as GraphicObject);\r
+ }\r
+\r
[STAThread]\r
static void Main ()\r
{\r
<?xml version="1.0"?>\r
<!--<Group>-->\r
-<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,5" \r
- Focusable="True">\r
+<Window Name="window1" Left="10" Top="10" Title="Test window" Width="200" Height="200" Background="0,5;0,5;0,5;0,8" \r
+ Focusable="True" CornerRadius="20" MinimumSize="100;100" MaximumSize="500;500">\r
+ <Template>\r
+ <Border BorderWidth="1" BorderColor="White" Margin="0" CornerRadius="20">\r
+ <VerticalStack Height="0" Width="0" Margin="0">\r
+ <Border BorderWidth="1" BorderColor="White" Height="-1" Width="0" Background="0,1;0,5;1,0;0,5">\r
+ <HorizontalStack Name="hs" Margin="1" Spacing="1" Height="-1" Width="0" Focusable="false" >\r
+ <GraphicObject Width="5" Height="0"/>\r
+ <Image Name="Image" Margin="1" Width="12" Height="12" Path="#go.Images.Icons.tetra.png"/>\r
+ <Label Foreground="White" Width="0" Name="Title" Margin="1" TextAlignment="Center" />\r
+ <Border CornerRadius="6" BorderWidth="1" Margin="0" BorderColor="Transparent" Height="12" Width="12"\r
+ MouseEnter="{BorderColor=White}" MouseLeave="{BorderColor=Transparent}">\r
+ <Image Focusable="true" Name="Image" Margin="0" Width="0" Height="0" Path="#go.Images.Icons.exit2.svg"\r
+ MouseClick="butQuitPress"/>\r
+ </Border>\r
+ <GraphicObject Width="5" Height="0"/>\r
+ </HorizontalStack>\r
+ </Border>\r
+ <Container Name="Content" Margin="0" Width="0" Height="0"/>\r
+ </VerticalStack>\r
+ </Border>\r
+ </Template>\r
<VerticalStack Name="contentVSStack" Height="0" Width="0" Margin="10" Spacing="10">\r
<Slider Name="slider" Height="10" Width="0"/>\r
\r
<Checkbox Height="-1" Width="-1"/>\r
<Checkbox Height="-1" Width="-1"/>\r
</HorizontalStack>\r
- <GroupBox Title="test" Height="0" Width="0" Margin="0">\r
- <VerticalStack Width="0">\r
+ <GroupBox Title="test" Height="-1" Width="-1" Margin="5">\r
+ <VerticalStack Width="-1">\r
<RadioButton Caption="Radio 1"/>\r
<RadioButton Caption="Radio 2" IsChecked="true"/>\r
<RadioButton Caption="Radio 3"/>\r
public Window () : base()
{
}
-
- void Window_MouseMove (object sender, OpenTK.Input.MouseMoveEventArgs e)
- {
-
-
- }
+
enum Direction
{
None,
NW,
NE,
SW,
- SE
+ SE,
}
Direction currentDirection = Direction.None;
OpenTKGameWindow otkgw = TopContainer as OpenTKGameWindow;
- int borderLim = 5;
-
-
-
- if (TopContainer.activeWidget == null) {
+ if (otkgw.activeWidget == null) {
Direction lastDir = currentDirection;
- if ((e.Position - this.Slot.TopLeft).Length < borderLim)
- currentDirection = Direction.NW;
- else if ((e.Position - this.Slot.TopRight).Length < borderLim)
- currentDirection = Direction.NE;
- else if ((e.Position - this.Slot.BottomLeft).Length < borderLim)
- currentDirection = Direction.SW;
- else if ((e.Position - this.Slot.BottomRight).Length < borderLim)
- currentDirection = Direction.SE;
+ if (Math.Abs (e.Position.Y - this.Slot.Y) < Interface.BorderThreshold) {
+ if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold)
+ currentDirection = Direction.NW;
+ else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold)
+ currentDirection = Direction.NE;
+ else
+ currentDirection = Direction.N;
+ } else if (Math.Abs (e.Position.Y - this.Slot.Bottom) < Interface.BorderThreshold) {
+ if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold)
+ currentDirection = Direction.SW;
+ else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold)
+ currentDirection = Direction.SE;
+ else
+ currentDirection = Direction.S;
+ } else if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold)
+ currentDirection = Direction.W;
+ else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold)
+ currentDirection = Direction.E;
else
currentDirection = Direction.None;
-
if (currentDirection != lastDir) {
switch (currentDirection) {
case Direction.None:
otkgw.Cursor = XCursor.Default;
break;
case Direction.N:
- otkgw.Cursor = XCursor.Cross;
+ otkgw.Cursor = XCursor.V;
break;
case Direction.S:
- otkgw.Cursor = XCursor.Cross;
+ otkgw.Cursor = XCursor.V;
break;
case Direction.E:
- otkgw.Cursor = XCursor.Cross;
+ otkgw.Cursor = XCursor.H;
break;
case Direction.W:
- otkgw.Cursor = XCursor.Cross;
+ otkgw.Cursor = XCursor.H;
break;
case Direction.NW:
otkgw.Cursor = XCursor.NW;
this.Top += e.YDelta;
break;
case Direction.N:
+ this.Top += e.YDelta;
+ this.Height -= e.YDelta;
break;
case Direction.S:
- break;
- case Direction.E:
+ this.Height += e.YDelta;
break;
case Direction.W:
+ this.Left += e.XDelta;
+ this.Width -= e.XDelta;
+ break;
+ case Direction.E:
+ this.Width += e.XDelta;
break;
case Direction.NW:
this.Left += e.XDelta;
public static int TabSize = 4;
public static string LineBreak = "\r\n";
public static bool ReplaceTabsWithSpace = false;
+ /// <summary> Allow rendering of interface in development environment </summary>
public static bool DesignerMode = false;
+ /// <summary> Threshold to catch borders for sizing </summary>
+ public static int BorderThreshold = 5;
/// <summary>
/// Graphic objects References use in dynamic delegates for binding
XCursor.NE = XCursorFile.Load("#go.Images.Icons.Cursors.top_right_corner").Cursors[0];\r
XCursor.SW = XCursorFile.Load("#go.Images.Icons.Cursors.bottom_left_corner").Cursors[0];\r
XCursor.SE = XCursorFile.Load("#go.Images.Icons.Cursors.bottom_right_corner").Cursors[0];\r
-\r
+ XCursor.H = XCursorFile.Load("#go.Images.Icons.Cursors.sb_h_double_arrow").Cursors[0];\r
+ XCursor.V = XCursorFile.Load("#go.Images.Icons.Cursors.sb_v_double_arrow").Cursors[0];\r
} \r
#endregion\r
\r
public static XCursor NE;
public static XCursor N;
public static XCursor S;
-
-
+ public static XCursor V;
+ public static XCursor H;
public uint Width;
public uint Height;