diff options
author | Marc-André Moreau <marcandre.moreau@gmail.com> | 2011-03-24 05:21:07 +0300 |
---|---|---|
committer | Marc-André Moreau <marcandre.moreau@gmail.com> | 2011-03-24 05:21:07 +0300 |
commit | 0bd8143f6e324d48413caf1998a524629c6e7828 (patch) | |
tree | f9fc0108e7e9cafdf112e9b3f02c3697702bc012 |
started GDI implementation tester in Gtk#, using Mono.Cairo
-rw-r--r-- | GdiTest.sln | 20 | ||||
-rw-r--r-- | GdiTest.userprefs | 13 | ||||
-rw-r--r-- | GdiTest/AssemblyInfo.cs | 27 | ||||
-rw-r--r-- | GdiTest/GdiTest.csproj | 58 | ||||
-rw-r--r-- | GdiTest/GdiTest.pidb | bin | 0 -> 6597 bytes | |||
-rw-r--r-- | GdiTest/Main.cs | 58 | ||||
-rw-r--r-- | GdiTest/MainWindow.cs | 17 | ||||
-rw-r--r-- | GdiTest/gtk-gui/MainWindow.cs | 21 | ||||
-rw-r--r-- | GdiTest/gtk-gui/generated.cs | 29 | ||||
-rw-r--r-- | GdiTest/gtk-gui/gui.stetic | 20 |
10 files changed, 263 insertions, 0 deletions
diff --git a/GdiTest.sln b/GdiTest.sln new file mode 100644 index 0000000..04e2723 --- /dev/null +++ b/GdiTest.sln @@ -0,0 +1,20 @@ +
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GdiTest", "GdiTest\GdiTest.csproj", "{FD3B15EF-0F5E-492E-BAB2-8375E8CCCCB1}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FD3B15EF-0F5E-492E-BAB2-8375E8CCCCB1}.Debug|x86.ActiveCfg = Debug|x86
+ {FD3B15EF-0F5E-492E-BAB2-8375E8CCCCB1}.Debug|x86.Build.0 = Debug|x86
+ {FD3B15EF-0F5E-492E-BAB2-8375E8CCCCB1}.Release|x86.ActiveCfg = Release|x86
+ {FD3B15EF-0F5E-492E-BAB2-8375E8CCCCB1}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = GdiTest\GdiTest.csproj
+ EndGlobalSection
+EndGlobal
diff --git a/GdiTest.userprefs b/GdiTest.userprefs new file mode 100644 index 0000000..b190e39 --- /dev/null +++ b/GdiTest.userprefs @@ -0,0 +1,13 @@ +<Properties> + <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" /> + <MonoDevelop.Ide.Workbench ActiveDocument="GdiTest/Main.cs"> + <Files> + <File FileName="GdiTest/Main.cs" Line="37" Column="22" /> + <File FileName="GdiTest/MainWindow.cs" Line="18" Column="1" /> + </Files> + </MonoDevelop.Ide.Workbench> + <MonoDevelop.Ide.DebuggingService.Breakpoints> + <BreakpointStore /> + </MonoDevelop.Ide.DebuggingService.Breakpoints> + <MonoDevelop.Ide.DebuggingService.PinnedWatches /> +</Properties>
\ No newline at end of file diff --git a/GdiTest/AssemblyInfo.cs b/GdiTest/AssemblyInfo.cs new file mode 100644 index 0000000..ca7f9c2 --- /dev/null +++ b/GdiTest/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("GdiTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/GdiTest/GdiTest.csproj b/GdiTest/GdiTest.csproj new file mode 100644 index 0000000..c820a4b --- /dev/null +++ b/GdiTest/GdiTest.csproj @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">x86</Platform> + <ProductVersion>9.0.21022</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{FD3B15EF-0F5E-492E-BAB2-8375E8CCCCB1}</ProjectGuid> + <OutputType>WinExe</OutputType> + <RootNamespace>GdiTest</RootNamespace> + <AssemblyName>GdiTest</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <PlatformTarget>x86</PlatformTarget> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <DebugType>none</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <PlatformTarget>x86</PlatformTarget> + <ConsolePause>false</ConsolePause> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="Mono.Posix" /> + <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <Reference Include="Mono.Cairo" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="gtk-gui\gui.stetic"> + <LogicalName>gui.stetic</LogicalName> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <Compile Include="gtk-gui\generated.cs" /> + <Compile Include="MainWindow.cs" /> + <Compile Include="gtk-gui\MainWindow.cs" /> + <Compile Include="Main.cs" /> + <Compile Include="AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/GdiTest/GdiTest.pidb b/GdiTest/GdiTest.pidb Binary files differnew file mode 100644 index 0000000..5638050 --- /dev/null +++ b/GdiTest/GdiTest.pidb diff --git a/GdiTest/Main.cs b/GdiTest/Main.cs new file mode 100644 index 0000000..17cd08e --- /dev/null +++ b/GdiTest/Main.cs @@ -0,0 +1,58 @@ +using System; +using Gtk; +using Cairo; + +namespace GdiTest +{ + class MainClass + { + public static void Main (string[] args) + { + Application.Init (); + MainWindow w = new MainWindow (); + + DrawingArea a = new CairoGraphic (); + + Box box = new HBox (true, 0); + box.Add (a); + w.Add (box); + w.Resize (500, 500); + w.ShowAll (); + + Application.Run (); + } + } +} + +public class CairoGraphic : DrawingArea +{ + protected override bool OnExposeEvent (Gdk.EventExpose args) + { + using (Context g = Gdk.CairoHelper.Create (args.Window)) + { + g.Antialias = Antialias.None; + g.LineWidth = 4; + + g.Color = new Color(1,0,0); + g.MoveTo (10, 10); + g.LineTo (110, 10); + g.Stroke (); + + g.Color = new Color(0,1,0); + g.MoveTo (10, 10); + g.LineTo (10, 110); + g.Stroke (); + + g.Color = new Color(0,0,1); + g.MoveTo (10, 10); + g.LineTo (110, 110); + g.Stroke (); + + g.Color = new Color(0,0,0); + Rectangle rect = new Rectangle(210, 10, 260, 110); + g.Rectangle(rect); + g.Stroke (); + } + return true; + } +} diff --git a/GdiTest/MainWindow.cs b/GdiTest/MainWindow.cs new file mode 100644 index 0000000..e21b756 --- /dev/null +++ b/GdiTest/MainWindow.cs @@ -0,0 +1,17 @@ +using System; +using Cairo; +using Gtk; + +public partial class MainWindow : Gtk.Window +{ + public MainWindow () : base(Gtk.WindowType.Toplevel) + { + Build (); + } + + protected void OnDeleteEvent (object sender, DeleteEventArgs a) + { + Application.Quit (); + a.RetVal = true; + } +} diff --git a/GdiTest/gtk-gui/MainWindow.cs b/GdiTest/gtk-gui/MainWindow.cs new file mode 100644 index 0000000..8e9739c --- /dev/null +++ b/GdiTest/gtk-gui/MainWindow.cs @@ -0,0 +1,21 @@ + +// This file has been generated by the GUI designer. Do not modify. + +public partial class MainWindow +{ + protected virtual void Build () + { + global::Stetic.Gui.Initialize (this); + // Widget MainWindow + this.Name = "MainWindow"; + this.Title = global::Mono.Unix.Catalog.GetString ("MainWindow"); + this.WindowPosition = ((global::Gtk.WindowPosition)(4)); + if ((this.Child != null)) { + this.Child.ShowAll (); + } + this.DefaultWidth = 400; + this.DefaultHeight = 300; + this.Show (); + this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent); + } +} diff --git a/GdiTest/gtk-gui/generated.cs b/GdiTest/gtk-gui/generated.cs new file mode 100644 index 0000000..8463caa --- /dev/null +++ b/GdiTest/gtk-gui/generated.cs @@ -0,0 +1,29 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace Stetic +{ + internal class Gui + { + private static bool initialized; + + static internal void Initialize (Gtk.Widget iconRenderer) + { + if ((Stetic.Gui.initialized == false)) { + Stetic.Gui.initialized = true; + } + } + } + + internal class ActionGroups + { + public static Gtk.ActionGroup GetActionGroup (System.Type type) + { + return Stetic.ActionGroups.GetActionGroup (type.FullName); + } + + public static Gtk.ActionGroup GetActionGroup (string name) + { + return null; + } + } +} diff --git a/GdiTest/gtk-gui/gui.stetic b/GdiTest/gtk-gui/gui.stetic new file mode 100644 index 0000000..faedde8 --- /dev/null +++ b/GdiTest/gtk-gui/gui.stetic @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<stetic-interface> + <configuration> + <images-root-path>..</images-root-path> + <target-gtk-version>2.12</target-gtk-version> + </configuration> + <import> + <widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> + <widget-library name="../bin/Debug/GdiTest.exe" internal="true" /> + </import> + <widget class="Gtk.Window" id="MainWindow" design-size="400 300"> + <property name="MemberName" /> + <property name="Title" translatable="yes">MainWindow</property> + <property name="WindowPosition">CenterOnParent</property> + <signal name="DeleteEvent" handler="OnDeleteEvent" /> + <child> + <placeholder /> + </child> + </widget> +</stetic-interface>
\ No newline at end of file |