<EmbeddedResource Include="Images\Icons\expandable.svg" />\r
<EmbeddedResource Include="Templates\Checkbox2.goml" />\r
<EmbeddedResource Include="Templates\Popper.goml" />\r
+ <EmbeddedResource Include="Templates\Window.goml" />\r
</ItemGroup>\r
</Project>\r
<?xml version="1.0"?>\r
-<Border BorderWidth="1" BorderColor="LightGray" Height="50" Width="100" MouseClick="onMouseClick">\r
+<Border BorderWidth="1" BorderColor="LightGray" Height="-1" MouseClick="onMouseClick">\r
<HorizontalStack Name="hsTemplateExpander" Spacing="1" Focusable="false" Height="-1" Width="0">\r
<Image Name="Image" Margin="3" Width="16" Height="16" Path="#go.Images.Icons.expandable.svg"/>\r
<Label Name="Caption"/>\r
--- /dev/null
+<?xml version="1.0"?>\r
+<Border BorderWidth="1" BorderColor="LightGray" MouseClick="onMouseClick" Margin="0" Focusable="true">\r
+ <VerticalStack MouseClick="onMouseClick" Height="0" Width="0" Margin="0" Focusable="true">\r
+ <Border BorderWidth="1" BorderColor="LightGray" Height="-1" Width="0" MouseClick="onMouseClick" Background="BlueCrayola" Focusable="true"\r
+ MouseMove="Window_MouseMove">\r
+ <HorizontalStack Margin="0" Spacing="1" Height="-1" Width="0" Focusable="true" MouseMove="Window_MouseMove">\r
+ <Image Name="Image" Margin="3" Width="16" Height="16" Path="#go.Images.Icons.expandable.svg"/>\r
+ <Label Focusable="true" Name="Title" MouseMove="Window_MouseMove"/>\r
+ </HorizontalStack>\r
+ </Border>\r
+ <Container Name="Content" Margin="1"/>\r
+ </VerticalStack>\r
+</Border>
\ No newline at end of file
int oldVal = _fps;\r
_fps = value;\r
\r
- if (_fps > fpsMax) {\r
- fpsMax = _fps;\r
- ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMax", fpsMax, _fps));\r
- } else if (_fps < fpsMin) {\r
- ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin, _fps));\r
- fpsMin = _fps;\r
- }\r
-\r
- if (ValueChanged != null)\r
- ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", oldVal, _fps));\r
-\r
- //ValueChanged.Raise (this, new ValueChangeEventArgs ("fps", oldVal, _fps));\r
+// if (_fps > fpsMax) {\r
+// fpsMax = _fps;\r
+// ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMax", fpsMax, _fps));\r
+// } else if (_fps < fpsMin) {\r
+// ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin, _fps));\r
+// fpsMin = _fps;\r
+// }\r
+//\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", oldVal, _fps));\r
}\r
}\r
\r
--- /dev/null
+#define MONO_CAIRO_DEBUG_DISPOSE\r
+\r
+\r
+using System;\r
+using System.Runtime.InteropServices;\r
+using OpenTK;\r
+using OpenTK.Graphics.OpenGL;\r
+using OpenTK.Input;\r
+\r
+using System.Diagnostics;\r
+\r
+//using GGL;\r
+using go;\r
+using System.Threading;\r
+\r
+\r
+namespace test2\r
+{\r
+ class GOLIBTest_Container : OpenTKGameWindow , IValueChange\r
+ {\r
+ #region FPS\r
+ int _fps = 0;\r
+\r
+ public int fps {\r
+ get { return _fps; }\r
+ set {\r
+ if (_fps == value)\r
+ return;\r
+ \r
+ int oldVal = _fps;\r
+ _fps = value;\r
+\r
+ if (_fps > fpsMax) {\r
+ fpsMax = _fps;\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMax", fpsMax, _fps));\r
+ } else if (_fps < fpsMin) {\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin, _fps));\r
+ fpsMin = _fps;\r
+ }\r
+\r
+ if (ValueChanged != null)\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", oldVal, _fps));\r
+\r
+ //ValueChanged.Raise (this, new ValueChangeEventArgs ("fps", oldVal, _fps));\r
+ }\r
+ }\r
+ string name = "testName";\r
+\r
+ public string Name {\r
+ get {\r
+ return name;\r
+ }\r
+ set {\r
+ name = value;\r
+ }\r
+ }\r
+\r
+ public int fpsMin = int.MaxValue;\r
+ public int fpsMax = 0;\r
+\r
+ void resetFps ()\r
+ {\r
+ fpsMin = int.MaxValue;\r
+ fpsMax = 0;\r
+ _fps = 0;\r
+ }\r
+ #endregion\r
+\r
+ public GOLIBTest_Container ()\r
+ : base(600, 400,"test")\r
+ {}\r
+\r
+ Container g;\r
+\r
+ protected override void OnLoad (EventArgs e)\r
+ {\r
+ base.OnLoad (e);\r
+ LoadInterface("Interfaces/testContainer.goml", out g);\r
+\r
+ }\r
+ protected override void OnRenderFrame (FrameEventArgs e)\r
+ {\r
+ GL.Clear (ClearBufferMask.ColorBufferBit);\r
+ base.OnRenderFrame (e);\r
+ SwapBuffers ();\r
+ }\r
+\r
+ private int frameCpt = 0;\r
+ protected override void OnUpdateFrame (FrameEventArgs e)\r
+ {\r
+ base.OnUpdateFrame (e);\r
+\r
+ fps = (int)RenderFrequency;\r
+\r
+ if (frameCpt > 200) {\r
+ resetFps ();\r
+ frameCpt = 0;\r
+\r
+ }\r
+ frameCpt++;\r
+ }\r
+\r
+ #region IValueChange implementation\r
+\r
+ public event EventHandler<ValueChangeEventArgs> ValueChanged;\r
+\r
+ #endregion\r
+\r
+ [STAThread]\r
+ static void Main ()\r
+ {\r
+ Console.WriteLine ("starting example");\r
+\r
+ using (GOLIBTest_Container win = new GOLIBTest_Container( )) {\r
+ win.Run (30.0);\r
+ }\r
+ }\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+#define MONO_CAIRO_DEBUG_DISPOSE\r
+\r
+\r
+using System;\r
+using System.Runtime.InteropServices;\r
+using OpenTK;\r
+using OpenTK.Graphics.OpenGL;\r
+using OpenTK.Input;\r
+\r
+using System.Diagnostics;\r
+\r
+//using GGL;\r
+using go;\r
+using System.Threading;\r
+\r
+\r
+namespace test\r
+{\r
+ class GOLIBTest_Label : OpenTKGameWindow , IValueChange\r
+ {\r
+ #region FPS\r
+ int _fps = 0;\r
+\r
+ public int fps {\r
+ get { return _fps; }\r
+ set {\r
+ if (_fps == value)\r
+ return;\r
+ \r
+ int oldVal = _fps;\r
+ _fps = value;\r
+\r
+ if (_fps > fpsMax) {\r
+ fpsMax = _fps;\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMax", fpsMax, _fps));\r
+ } else if (_fps < fpsMin) {\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin, _fps));\r
+ fpsMin = _fps;\r
+ }\r
+\r
+ if (ValueChanged != null)\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", oldVal, _fps));\r
+\r
+ //ValueChanged.Raise (this, new ValueChangeEventArgs ("fps", oldVal, _fps));\r
+ }\r
+ }\r
+ string name = "testName";\r
+\r
+ public string Name {\r
+ get {\r
+ return name;\r
+ }\r
+ set {\r
+ name = value;\r
+ }\r
+ }\r
+\r
+ public int fpsMin = int.MaxValue;\r
+ public int fpsMax = 0;\r
+\r
+ void resetFps ()\r
+ {\r
+ fpsMin = int.MaxValue;\r
+ fpsMax = 0;\r
+ _fps = 0;\r
+ }\r
+ #endregion\r
+\r
+ public GOLIBTest_Label ()\r
+ : base(600, 400,"test")\r
+ {}\r
+\r
+ Label g;\r
+\r
+ protected override void OnLoad (EventArgs e)\r
+ {\r
+ base.OnLoad (e);\r
+ LoadInterface("Interfaces/testLabel.goml", out g);\r
+\r
+ }\r
+ protected override void OnRenderFrame (FrameEventArgs e)\r
+ {\r
+ GL.Clear (ClearBufferMask.ColorBufferBit);\r
+ base.OnRenderFrame (e);\r
+ SwapBuffers ();\r
+ }\r
+\r
+ private int frameCpt = 0;\r
+ protected override void OnUpdateFrame (FrameEventArgs e)\r
+ {\r
+ base.OnUpdateFrame (e);\r
+\r
+ fps = (int)RenderFrequency;\r
+\r
+ if (frameCpt > 200) {\r
+ resetFps ();\r
+ frameCpt = 0;\r
+\r
+ }\r
+ frameCpt++;\r
+ }\r
+\r
+ #region IValueChange implementation\r
+\r
+ public event EventHandler<ValueChangeEventArgs> ValueChanged;\r
+\r
+ #endregion\r
+\r
+ [STAThread]\r
+ static void Main ()\r
+ {\r
+ Console.WriteLine ("starting example");\r
+\r
+ using (GOLIBTest_Label win = new GOLIBTest_Label( )) {\r
+ win.Run (30.0);\r
+ }\r
+ }\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+#define MONO_CAIRO_DEBUG_DISPOSE\r
+\r
+\r
+using System;\r
+using System.Runtime.InteropServices;\r
+using OpenTK;\r
+using OpenTK.Graphics.OpenGL;\r
+using OpenTK.Input;\r
+\r
+using System.Diagnostics;\r
+\r
+//using GGL;\r
+using go;\r
+using System.Threading;\r
+\r
+\r
+namespace test\r
+{\r
+ class GOLIBTest_Window : OpenTKGameWindow , IValueChange\r
+ {\r
+ #region FPS\r
+ int _fps = 0;\r
+\r
+ public int fps {\r
+ get { return _fps; }\r
+ set {\r
+ if (_fps == value)\r
+ return;\r
+ \r
+ int oldVal = _fps;\r
+ _fps = value;\r
+\r
+ if (_fps > fpsMax) {\r
+ fpsMax = _fps;\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMax", fpsMax, _fps));\r
+ } else if (_fps < fpsMin) {\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fpsMin", fpsMin, _fps));\r
+ fpsMin = _fps;\r
+ }\r
+\r
+ if (ValueChanged != null)\r
+ ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", oldVal, _fps));\r
+\r
+ //ValueChanged.Raise (this, new ValueChangeEventArgs ("fps", oldVal, _fps));\r
+ }\r
+ }\r
+ string name = "testName";\r
+\r
+ public string Name {\r
+ get {\r
+ return name;\r
+ }\r
+ set {\r
+ name = value;\r
+ }\r
+ }\r
+\r
+ public int fpsMin = int.MaxValue;\r
+ public int fpsMax = 0;\r
+\r
+ void resetFps ()\r
+ {\r
+ fpsMin = int.MaxValue;\r
+ fpsMax = 0;\r
+ _fps = 0;\r
+ }\r
+ #endregion\r
+\r
+ public GOLIBTest_Window ()\r
+ : base(600, 400,"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
+\r
+ }\r
+ protected override void OnRenderFrame (FrameEventArgs e)\r
+ {\r
+ GL.Clear (ClearBufferMask.ColorBufferBit);\r
+ base.OnRenderFrame (e);\r
+ SwapBuffers ();\r
+ }\r
+\r
+ private int frameCpt = 0;\r
+ protected override void OnUpdateFrame (FrameEventArgs e)\r
+ {\r
+ base.OnUpdateFrame (e);\r
+\r
+ fps = (int)RenderFrequency;\r
+\r
+ if (frameCpt > 200) {\r
+ resetFps ();\r
+ frameCpt = 0;\r
+\r
+ }\r
+ frameCpt++;\r
+ }\r
+\r
+ #region IValueChange implementation\r
+\r
+ public event EventHandler<ValueChangeEventArgs> ValueChanged;\r
+\r
+ #endregion\r
+\r
+ [STAThread]\r
+ static void Main ()\r
+ {\r
+ Console.WriteLine ("starting example");\r
+\r
+ using (GOLIBTest_Window win = new GOLIBTest_Window( )) {\r
+ win.Run (30.0);\r
+ }\r
+ }\r
+ }\r
+}
\ No newline at end of file
<Slider Height="10" Width="300" BorderWidth="1" Background="Transparent" />\r
<GraduatedSlider Name="slider" Height="30" Width="300" Foreground="BlueBell"/>\r
</VerticalStack>\r
- <VerticalStack Width="-1" Height="-1" BorderWidth="1" Margin="5" WidgetSpacing="4">\r
+ <VerticalStack Width="-1" Height="-1" Margin="0" WidgetSpacing="1">\r
<Button Margin="1" Width="150" Height="100">\r
<Image Path="#Tests.image.tetra.png"/>\r
</Button>\r
- <Popper>\r
+ <Popper Width="100">\r
<Image Fit="true" Path="#Tests.image.tetra.png"/>\r
</Popper>\r
- <HorizontalStack>\r
- <Label Text="Update" FontColor="White"/>\r
- <Label Name="labUpdate" Text="xxxx" FontSize="16" Width="60" TextAlignment="Center" Background="DarkGreen"/>\r
- </HorizontalStack>\r
- <HorizontalStack>\r
- <Label Text="Fps:" Width = "30"/>\r
- <Label Name="labFps" Text="{fps}" Font="droid bold, 14"\r
- TextAlignment="Center" Background="AoEnglish"/>\r
- </HorizontalStack>\r
- <HorizontalStack>\r
- <Label Text="Min:" Width = "30"/>\r
- <Label Name="labFpsMin" Text="{fpsMin}" Font="droid bold, 14"\r
- TextAlignment="Center" Background="AoEnglish"/>\r
- </HorizontalStack>\r
- <HorizontalStack>\r
- <Label Text="Max:" Width = "30"/>\r
- <Label Name="labFpsMax" Text="{fpsMax}" Font="droid bold, 14"\r
- TextAlignment="Center" Background="AoEnglish"/>\r
- </HorizontalStack>\r
<Expandable Name="expander" Width="150" Height="-1">\r
<VerticalStack Name="vsExpanded" Width="100">\r
<Checkbox Name="chk1"/>\r
<Checkbox Name="chk2"/>\r
</VerticalStack> \r
</Expandable>\r
+ <HorizontalStack>\r
+ <Label Text="Update" FontColor="White"/>\r
+ <Label Name="labUpdate" Text="xxxx" FontSize="16" Width="60" TextAlignment="Center" Background="DarkGreen"/>\r
+ </HorizontalStack>\r
+ <HorizontalStack>\r
+ <Label Text="Fps:" Width = "30"/>\r
+ <Label Name="labFps" Text="{fps}" Font="droid bold, 14"\r
+ TextAlignment="Center" Background="AoEnglish"/>\r
+ </HorizontalStack>\r
+ <HorizontalStack>\r
+ <Label Text="Min:" Width = "30"/>\r
+ <Label Name="labFpsMin" Text="{fpsMin}" Font="droid bold, 14"\r
+ TextAlignment="Center" Background="AoEnglish"/>\r
+ </HorizontalStack>\r
+ <HorizontalStack>\r
+ <Label Text="Max:" Width = "30"/>\r
+ <Label Name="labFpsMax" Text="{fpsMax}" Font="droid bold, 14"\r
+ TextAlignment="Center" Background="AoEnglish"/>\r
+ </HorizontalStack>\r
</VerticalStack>\r
\r
<Scroller Background="DimGray" Height="350" Width="150" \r
--- /dev/null
+<?xml version="1.0"?>\r
+<Container Background="Red" Left="100" Top="100" Height="300" Width="300" >\r
+ <Container Left="100" Top="100" Height="100" Width="100" Background="LightGreen" Margin="0">\r
+ <Label Text="{fps}" Background="DarkRed"/>\r
+ </Container>\r
+</Container>\r
--- /dev/null
+<?xml version="1.0"?>\r
+ <Label Name="labFps" Text="{fps}" Font="droid bold, 12"\r
+ TextAlignment="Center" Background="AoEnglish" />\r
--- /dev/null
+<?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
+ <VerticalStack Height="0" Width="0">\r
+ <Label Text="{fps}" Background="DarkRed"/>\r
+ <Label/>\r
+ <Label/>\r
+ <Label/>\r
+ </VerticalStack>\r
+</Window>\r
+<!--</Group>-->\r
<OutputType>Exe</OutputType>
<RootNamespace>Tests</RootNamespace>
<AssemblyName>Tests</AssemblyName>
- <StartupObject>test.GOLIBTest_fps</StartupObject>
+ <StartupObject>test.GOLIBTest_4</StartupObject>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<OutputPath>..\bin\$(configuration)</OutputPath>
<IntermediateOutputPath>obj\$(configuration)</IntermediateOutputPath>
<Compile Include="GOLIBTest_Listbox.cs" />
<Compile Include="GOLIBTest_Spinner.cs" />
<Compile Include="GOLIBTest_Expandable.cs" />
+ <Compile Include="GOLIBTest_Label.cs" />
+ <Compile Include="GOLIBTest_Window.cs" />
+ <Compile Include="GOLIBTest_Container.cs" />
</ItemGroup>
<ItemGroup>
<None Include="image\u.svg">
<None Include="Interfaces\testExpandable.goml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <None Include="Interfaces\testLabel.goml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="Interfaces\testWindow.goml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="Interfaces\testContainer.goml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<ItemGroup>
<Folder Include="Interfaces\" />
} \r
ComputeChildrenPositions ();\r
//if no layouting remains in queue for item, registre for redraw\r
- if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0)\r
+ if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp==null)\r
this.RegisterForRedraw ();\r
}else\r
base.UpdateLayout(layoutType);\r
}\r
\r
//if no layouting remains in queue for item, registre for redraw\r
- if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0)\r
+ if (Interface.LayoutingQueue.Where (lq => lq.GraphicObject == this).Count () <= 0 && bmp == null)\r
this.RegisterForRedraw ();\r
}\r
\r
using System.Xml.Serialization;
using System.ComponentModel;
using OpenTK.Input;
+using Cairo;
namespace go
{
public override Rectangle ContextCoordinates (Rectangle r)
{
return
- Parent.ContextCoordinates(r) + getSlot().Position + ClientRectangle.Position;
+ Parent.ContextCoordinates(r) + Slot.Position + ClientRectangle.Position;
}
public override void Paint(ref Cairo.Context ctx, Rectangles clip = null)
{
// ctx.Rectangle(ContextCoordinates(Slot));
// ctx.Clip();
//
+
+
if (clip != null)
clip.clip(ctx);
ctx.Restore();
}
+
#endregion
#region Mouse handling
using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+using System.Diagnostics;
+using OpenTK.Input;
namespace go
{
- public class Window : Container
+ [DefaultTemplate("#go.Templates.Window.goml")]
+ public class Window : TemplatedContainer
{
- public Window ()
+ Label _title;
+ Image _icon;
+ Container _contentContainer;
+
+ public override GraphicObject Content {
+ get {
+ return _contentContainer == null ? null : _contentContainer.Child;
+ }
+ set {
+ _contentContainer.SetChild(value);
+ }
+ }
+ [XmlAttributeAttribute()][DefaultValue("Window")]
+ public string Title {
+ get { return _title.Text; }
+ set {
+ if (_title == null)
+ return;
+ _title.Text = value;
+ }
+ }
+ public Window () : base()
+ {
+ }
+
+ void Window_MouseMove (object sender, OpenTK.Input.MouseMoveEventArgs e)
{
+ if (!e.Mouse.IsButtonDown (MouseButton.Left))
+ return;
+ this.TopContainer.redrawClip.AddRectangle (this.ScreenCoordinates(this.Slot));
+ this.Left += e.XDelta;
+ this.Top += e.YDelta;
+ this.registerForGraphicUpdate ();
}
+
+ protected override void loadTemplate(GraphicObject template = null)
+ {
+ base.loadTemplate (template);
+
+ _contentContainer = this.child.FindByName ("Content") as Container;
+ _title = this.child.FindByName ("Title") as Label;
+ _icon = this.child.FindByName ("Icon") as Image;
+ }
+
+
}
}
\r
ctx.Save ();\r
if (redrawClip.count > 0) {\r
- Rectangles clip = redrawClip.intersectingRects (p.ContextCoordinates(p.Slot.Size));\r
+ Rectangles clip = redrawClip.intersectingRects (p.Slot);\r
\r
if (clip.count > 0)\r
p.Paint (ref ctx, clip);\r