GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.StandardHeader = $1
- $1.Text = @\n${FileName}\n \nAuthor:\n ${AuthorName} <${AuthorEmail}>\n\nCopyright (c) 2013-2017 Jean-Philippe Bruyère\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.
+ $1.Text = @Copyright (c) ${Year} ${AuthorName} <${AuthorEmail}>\n\nThis code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
$0.DotNetNamingPolicy = $2
$0.TextStylePolicy = $3
$3.EolMarker = Unix
$6.LastFilePostfix = "@:\n "
$6.LineAlign = 0
$6.Wrap = False
- $5.inheritsSet = Mono
description = @C.R.O.W. c# Rapid Open Widgets\n\nCrow is a pure c# widget toolkit with XML definition of interface, bindings, styling...\n
version = 0.8.0
EndGlobalSection
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)netfx.props" />
<PropertyGroup>
- <TargetFrameworks>net471;netstandard2.0</TargetFrameworks>
+ <TargetFrameworks>net461;net471;netstandard2.0</TargetFrameworks>
<AssemblyName>Crow</AssemblyName>
<Copyright></Copyright>
- <AssemblyVersion>0.8.1</AssemblyVersion>
+ <AssemblyVersion>0.8.3.2</AssemblyVersion>
<Description>C.R.O.W. is a widget toolkit and rendering engine entirely developed in C# with templates, styles, compositing, and bindings.</Description>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageIconUrl>https://jpbruyere.github.io/Crow/images/crow.png</PackageIconUrl>
<PackageCopyright>Copyright 2013-2019</PackageCopyright>
<PackageReleaseNotes>xcb backend</PackageReleaseNotes>
- <RepositoryUrl>https://github.com/jpbruyere/Crow</RepositoryUrl>
+ <RepositoryUrl>https://github.com/jpbruyere/Crow</RepositoryUrl>
+
+ <LangVersion>7.2</LangVersion>
<OutputPath>$(SolutionDir)build\$(Configuration)\</OutputPath>
<DefineConstants>DESIGN_MODE</DefineConstants>
- <ReleaseVersion>0.8.0</ReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
<DefineConstants>TRACE;DESIGN_MODE;_DEBUG_CLIP_RECTANGLE;_DEBUG_FOCUS;_DEBUG_DRAGNDROP;DEBUG;NETFRAMEWORK;NET471</DefineConstants>
- <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
+ <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
using System;
using System.IO;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
foreach (Type expT in a.GetExportedTypes ()) {
if (expT.Name != strDataType)
continue;
- knownTypes.Add (strDataType, expT);
+ if (!knownTypes.ContainsKey(strDataType))
+ knownTypes.Add (strDataType, expT);
return expT;
}
}
using System;
using System.Collections.Generic;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
// THE SOFTWARE.
using System;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
using System;
using System.Collections.Generic;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
using System.Xml.Serialization;
using System.ComponentModel;
using System.Diagnostics;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
using System.Diagnostics;
using System.Xml.Serialization;
-using Cairo;
+using Crow.Cairo;
using System.ComponentModel;
namespace Crow
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using Cairo;
+using Crow.Cairo;
using System.Xml.Serialization;
namespace Crow
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Serialization;
-using Cairo;
+using Crow.Cairo;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
using System;
using System.Xml.Serialization;
using System.ComponentModel;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
// THE SOFTWARE.
using System;
-using Cairo;
+using Crow.Cairo;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
-using Cairo;
+using Crow.Cairo;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using System.ComponentModel;
using System;
using System.Xml.Serialization;
using System.ComponentModel;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using Cairo;
+using Crow.Cairo;
using System.Diagnostics;
using System.Xml.Serialization;
using System.ComponentModel;
// THE SOFTWARE.
using System;
-using Cairo;
+using Crow.Cairo;
using System.Xml.Serialization;
namespace Crow
using System.Xml.Serialization;
using System.ComponentModel;
using System.Diagnostics;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
using System.Xml.Serialization;
using System.ComponentModel;
using System.Collections;
-using Cairo;
+using Crow.Cairo;
namespace Crow
using System.ComponentModel;
using System.IO;
using System.Text;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
// THE SOFTWARE.
using System;
-using Cairo;
+using Crow.Cairo;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Diagnostics;
-using Cairo;
+using Crow.Cairo;
using System.Linq;
namespace Crow
using System;
using System.Xml.Serialization;
using System.ComponentModel;
-using Cairo;
+using Crow.Cairo;
using System.Diagnostics;
using System.Linq;
using System.IO;
using System.Xml;
using System.Reflection;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
// THE SOFTWARE.
using System;
-using System.Xml.Serialization;
-using System.Xml;
-using System.Reflection;
+using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
-using System.Collections;
-using System.Threading;
using System.Linq;
using Crow.IML;
-using System.Diagnostics;
-using System.IO;
-namespace Crow
-{
+namespace Crow {
public abstract class TemplatedGroup : TemplatedControl
{
#if DESIGN_MODE
public event EventHandler Loaded;
#endregion
- IList data;
+ IEnumerable data;
int _selectedIndex = -1;
Color selBackground, selForeground;
}
}
[XmlIgnore]public virtual object SelectedItem{
- get { return data == null ? null : _selectedIndex < 0 ? data.GetDefaultValue() : data[_selectedIndex]; }
+ get { return data == null ? null : _selectedIndex < 0 ? data.GetDefaultValue() : ((IList)data)?[_selectedIndex]; }
set {
if (data == null) {
SelectedIndex = -1;
if (value == SelectedItem)
return;
- SelectedIndex = data.IndexOf (value);
+ SelectedIndex = (int)((IList)data)?.IndexOf (value);
}
}
[XmlIgnore]public bool HasItems {
get { return Items.Count > 0; }
}
- public IList Data {
+ public IEnumerable Data {
get { return data; }
set {
if (value == data)
if (loadingThread != null)
loadingThread.Cancel ();
}
- void loadPage(IList _data, Group page, string _dataTest)
+ void loadPage(IEnumerable _data, Group page, string _dataTest)
{
#if DEBUG_LOAD
Stopwatch loadingTime = Stopwatch.StartNew ();
// typeof(Wrapper).IsAssignableFrom (items.GetType ())) {
//page = items;
itemPerPage = int.MaxValue;
-// } else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) {
-// GenericStack gs = new GenericStack (items.CurrentInterface);
-// gs.Orientation = (items as GenericStack).Orientation;
-// gs.Width = items.Width;
-// gs.Height = items.Height;
-// gs.VerticalAlignment = items.VerticalAlignment;
-// gs.HorizontalAlignment = items.HorizontalAlignment;
-// page = gs;
-// page.Name = "page" + pageNum;
-// isPaged = true;
-// } else {
-// page = Activator.CreateInstance (items.GetType ()) as Group;
-// page.CurrentInterface = items.CurrentInterface;
-// page.Initialize ();
-// page.Name = "page" + pageNum;
-// isPaged = true;
-// }
-
- for (int i = 0; i < _data.Count; i++) {
- loadItem (_data[i], page, _dataTest);
+ // } else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) {
+ // GenericStack gs = new GenericStack (items.CurrentInterface);
+ // gs.Orientation = (items as GenericStack).Orientation;
+ // gs.Width = items.Width;
+ // gs.Height = items.Height;
+ // gs.VerticalAlignment = items.VerticalAlignment;
+ // gs.HorizontalAlignment = items.HorizontalAlignment;
+ // page = gs;
+ // page.Name = "page" + pageNum;
+ // isPaged = true;
+ // } else {
+ // page = Activator.CreateInstance (items.GetType ()) as Group;
+ // page.CurrentInterface = items.CurrentInterface;
+ // page.Initialize ();
+ // page.Name = "page" + pageNum;
+ // isPaged = true;
+ // }
+
+
+ foreach (object d in _data) {
+ loadItem (d, page, _dataTest);
if (loadingThread.cancelRequested)
break;
}
if (iTemp.Expand != null && g is Expandable) {
Expandable e = g as Expandable;
e.Expand += iTemp.Expand;
- e.GetIsExpandable = iTemp.HasSubItems;
+ if ((o as ICollection) == null)
+ e.GetIsExpandable = new BooleanTestOnInstance((instance) => true);
+ else
+ e.GetIsExpandable = iTemp.HasSubItems;
}
g.DataSource = o;
}
-// protected void _list_LayoutChanged (object sender, LayoutingEventArgs e)
-// {
-// #if DEBUG_LAYOUTING
-// Debug.WriteLine("list_LayoutChanged");
-// #endif
-// if (_gsList.Orientation == Orientation.Horizontal) {
-// if (e.LayoutType == LayoutingType.Width)
-// _gsList.Width = approxSize;
-// } else if (e.LayoutType == LayoutingType.Height)
-// _gsList.Height = approxSize;
-// }
+
+
+ // protected void _list_LayoutChanged (object sender, LayoutingEventArgs e)
+ // {
+ // #if DEBUG_LAYOUTING
+ // Debug.WriteLine("list_LayoutChanged");
+ // #endif
+ // if (_gsList.Orientation == Orientation.Horizontal) {
+ // if (e.LayoutType == LayoutingType.Width)
+ // _gsList.Width = approxSize;
+ // } else if (e.LayoutType == LayoutingType.Height)
+ // _gsList.Height = approxSize;
+ // }
int approxSize
{
get {
return -1;
return page1.Orientation == Orientation.Horizontal ?
- data.Count < itemPerPage ?
+ (data as ICollection)?.Count < itemPerPage ?
-1:
- (int)Math.Ceiling ((double)page1.Slot.Width / (double)itemPerPage * (double)(data.Count+1)):
- data.Count < itemPerPage ?
+ (int)Math.Ceiling ((double)page1.Slot.Width / (double)itemPerPage * (double)((data as ICollection)?.Count+1)):
+ (data as ICollection)?.Count < itemPerPage ?
-1:
- (int)Math.Ceiling ((double)page1.Slot.Height / (double)itemPerPage * (double)(data.Count+1));
+ (int)Math.Ceiling ((double)page1.Slot.Height / (double)itemPerPage * (double)((data as ICollection)?.Count+1));
}
}
internal virtual void itemClick(object sender, MouseButtonEventArgs e){
- SelectedIndex = data.IndexOf((sender as Widget).DataSource);
+ SelectedIndex = (int)((IList)data)?.IndexOf((sender as Widget).DataSource);
}
bool emitHelperIsAlreadyExpanded (Widget go){
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
// THE SOFTWARE.
using System;
-using Cairo;
+using Crow.Cairo;
using System.Diagnostics;
using System.Xml.Serialization;
using System.Linq;
using System.Text;
using System.Diagnostics;
-using Cairo;
+using Crow.Cairo;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.ComponentModel;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
-using Cairo;
+using Crow.Cairo;
using System.Diagnostics;
using Crow.IML;
using System.Threading;
#if DEBUG_LOG
DbgEvent dbgEvt = DebugLog.AddEvent(DbgEvtType.GOLockLayouting, this);
#endif
- lock (IFace.LayoutMutex) {
+ lock (IFace.UpdateMutex) {
OnDataSourceChanged (this, dse);
NotifyValueChanged ("DataSource", DataSource);
}
using System.Linq;
using System.Reflection;
using System.Threading;
-using Cairo;
+using Crow.Cairo;
using Crow.IML;
/// The resulting surface (a byte array in the OpenTK renderer) is made available and protected with the
/// RenderMutex of the interface.
/// </remarks>
- public class Interface : ILayoutable, IDisposable ,IValueChange
+ public class Interface : ILayoutable, IDisposable, IValueChange
{
#region IValueChange implementation
public event EventHandler<ValueChangeEventArgs> ValueChanged;
- public virtual void NotifyValueChanged(string MemberName, object _value)
+ public virtual void NotifyValueChanged (string MemberName, object _value)
{
//Debug.WriteLine ("Value changed: {0}->{1} = {2}", this, MemberName, _value);
- ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value));
+ ValueChanged.Raise (this, new ValueChangeEventArgs (MemberName, _value));
}
#endregion
- internal IBackend backend;
+ protected IBackend backend;
+ protected bool running;
+
#region CTOR
- static Interface(){
+ static Interface () {
/*if (Type.GetType ("Mono.Runtime") == null) {
throw new Exception (@"C.R.O.W. run only on Mono, download latest version at: http://www.mono-project.com/download/stable/");
}*/
CROW_CONFIG_ROOT =
- System.IO.Path.Combine(
- Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
+ System.IO.Path.Combine (
+ Environment.GetFolderPath (Environment.SpecialFolder.UserProfile),
".config");
CROW_CONFIG_ROOT = System.IO.Path.Combine (CROW_CONFIG_ROOT, "crow");
if (!Directory.Exists (CROW_CONFIG_ROOT))
Directory.CreateDirectory (CROW_CONFIG_ROOT);
//ensure all assemblies are loaded, because IML could contains classes not instanciated in source
- foreach (string af in Directory.GetFiles (AppDomain.CurrentDomain.BaseDirectory, "*.dll")){
+ foreach (string af in Directory.GetFiles (AppDomain.CurrentDomain.BaseDirectory, "*.dll")) {
try {
- Assembly.LoadFrom (af);
+ Assembly.LoadFrom (af);
} catch (Exception ex) {
Console.WriteLine ("{0} not loaded as assembly.", af);
}
FontRenderingOptions.SubpixelOrder = SubpixelOrder.Default;
}
- public Interface(int width=800, int height=600){
-
+ public Interface(int width=800, int height=600, IBackend _backend = null){
+ CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
+ CurrentInterface = this;
clientRectangle = new Rectangle (0, 0, width, height);
+ backend = _backend;
- Init ();
-
- InitBackend ();
+ Thread t = new Thread (InterfaceThread) {
+ IsBackground = true
+ };
+ t.Start ();
+#if MEASURE_TIME
+ PerfMeasures.Add (updateMeasure);
+ PerfMeasures.Add (drawingMeasure);
+ PerfMeasures.Add (layoutingMeasure);
+ PerfMeasures.Add (clippingMeasure);
+#endif
}
#endregion
- protected bool running;
- protected virtual void InitBackend () {
- if (Environment.OSVersion.Platform == PlatformID.Unix)
- backend = new Crow.XCB.XCBBackend();
- //backend = new Crow.XLib.XLibBackend ();
- else
- backend = new Crow.Win32.Win32Backend();
-
+ public virtual void InterfaceThread ()
+ {
+ if (backend == null) {
+ if (Environment.OSVersion.Platform == PlatformID.Unix)
+ backend = new XCB.XCBBackend ();
+ else
+ backend = new Win32.Win32Backend ();
+ }
+
backend.Init (this);
+ while (!running)
+ Thread.Sleep (2);
+
+ while (running) {
+ Update ();
+ Thread.Sleep (5);
+ }
+ }
+ protected virtual void Startup ()
+ {
+ try {
+ Load ("#main.crow").DataSource = this;
+ } catch { }
+ }
+ public virtual void Run () {
+ loadStyling ();
+
initTooltip ();
initContextMenus ();
running = true;
- Thread t = new Thread (interfaceThread);
- t.IsBackground = true;
- t.Start ();
- }
- public void Run () {
Startup ();
+
while (running) {
ProcessEvents ();
Thread.Sleep(1);
}
}
- protected virtual void Startup ()
- {
- //load default main.crow if present
- try {
- Load ("#main.crow").DataSource = this;
- } catch { }
- }
+
public void ProcessKeyPress (char c)
{
_focusedWidget?.onKeyPress (_focusedWidget, new KeyPressEventArgs(c));
}
-
public void ProcessKeyUp (Key key)
{
_focusedWidget?.onKeyUp (_focusedWidget, new KeyEventArgs(key, false));
// keyboardRepeatThread.IsBackground = true;
// keyboardRepeatThread.Start ();
}
-
public bool Shift {
get { return backend.Shift; }
}
-
public bool Ctrl {
get { return backend.Ctrl; }
}
-
public bool Alt {
get { return backend.Alt; }
}
- void interfaceThread()
- {
- while (running) {
- Update ();
- Thread.Sleep (5);
- }
- }
#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls
FocusedWidget = w;
break;
}
- w = w.LogicalParent as Widget;
+ w = w.FocusParent;
}
}
- public void Init () {
- CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
-
- CurrentInterface = this;
- //loadCursors ();
- loadStyling ();
-
- #if MEASURE_TIME
- PerfMeasures.Add (updateMeasure);
- PerfMeasures.Add (drawingMeasure);
- PerfMeasures.Add (layoutingMeasure);
- PerfMeasures.Add (clippingMeasure);
- #endif
- }
#region Static and constants
/// <summary>
if (s == null)
s = Assembly.GetAssembly (declaringType).GetManifestResourceStream (resId);
if (s == null)
- throw new Exception ($"Template not found '{path}'");
+ throw new Exception ($"Template ressource not found '{path}'");
} else {
if (!File.Exists (path))
- throw new FileNotFoundException ("Template not found: ", path);
+ throw new FileNotFoundException ($"Template not found: {path}", path);
s = new FileStream (path, FileMode.Open, FileAccess.Read);
}
return s;
throw new Exception ("Resource not found: " + path);
} else {
if (!File.Exists (path))
- throw new FileNotFoundException ("File not found: ", path);
+ throw new FileNotFoundException ($"File not found: {path}", path);
stream = new FileStream (path, FileMode.Open, FileAccess.Read);
}
return stream;
throw new Exception ("Resource not found: " + path);
} else {
if (!File.Exists (path))
- throw new FileNotFoundException ("File not found: ", path);
+ throw new FileNotFoundException ($"File not found: {path}", path);
stream = new FileStream (path, FileMode.Open, FileAccess.Read);
}
return stream;
/// - Drawing
/// Result: the Interface bitmap is drawn in memory (byte[] bmp) and a dirtyRect and bitmap are available
/// </summary>
- public void Update(){
+ public void Update(Context ctx = null){
CrowThread[] tmpThreads;
lock (CrowThreads) {
tmpThreads = new CrowThread[CrowThreads.Count];
clippingRegistration ();
- processDrawing ();
+ if (ctx == null) {
+ using (ctx = new Context (surf)) {
+ processDrawing (ctx);
+ }
+ }else
+ processDrawing (ctx);
- #if MEASURE_TIME
+#if MEASURE_TIME
updateMeasure.StopCycle();
- #endif
+#endif
Monitor.Exit (UpdateMutex);
}
}
/// <summary>Clipping Rectangles drive the drawing process. For compositing, each object under a clip rectangle should be
/// repainted. If it contains also clip rectangles, its cache will be update, or if not cached a full redraw will take place</summary>
- void processDrawing(){
+ void processDrawing(Context ctx){
#if MEASURE_TIME
drawingMeasure.StartCycle();
#endif
if (DragImage != null)
clipping.UnionRectangle(new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight));
//using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) {
- using (ctx = new Context (surf)){
if (!clipping.IsEmpty) {
IsDirty = true;
backend?.Flush ();
}
- }
+
/*#if DEBUG_LOG
DebugLog.AddEvent (DbgEvtType.IFaceEndDrawing);
#endif*/
/*surf.Dispose ();
surf = new Cairo.XlibSurface (xHandle, xwinHnd, xDefaultVisual, clientRectangle.Width, clientRectangle.Height);*/
- if (surf is XlibSurface)
- (surf as XlibSurface).SetSize (clientRectangle.Width, clientRectangle.Height);
- else if (surf is XcbSurface)
- (surf as XcbSurface).SetSize (clientRectangle.Width, clientRectangle.Height);
-
+ surf.SetSize (clientRectangle.Width, clientRectangle.Height);
foreach (Widget g in GraphicTree)
g.RegisterForLayouting (LayoutingType.All);
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum Antialias
-//
+//
// Cairo.cs - a simplistic binding of the Cairo API to C#.
//
// Authors: Duncan Mak (duncan@ximian.com)
using System;
using System.Runtime.InteropServices;
-namespace Cairo
+namespace Crow.Cairo
{
public static class CairoAPI {
static public int Version {
using System;
-namespace Cairo {
+namespace Crow.Cairo {
static class CairoDebug
{
using System;
-namespace Cairo
+namespace Crow.Cairo
{
//[Flags]
-//
+//
// Mono.Cairo.Context.cs
//
// Author:
using System.Text;
using Color = Crow.Color;
-namespace Cairo {
+namespace Crow.Cairo {
[Obsolete ("Renamed Cairo.Context per suggestion from cairo binding guidelines.")]
public class Graphics : Context {
//
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public class DRMDevice : Device
{
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class DRMSurface : Surface
{
//
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public class Device : IDisposable
{
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class DirectFBSurface : Surface
{
internal DirectFBSurface (IntPtr handle, bool owns) : base (handle, owns)
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-namespace Cairo {
+namespace Crow.Cairo {
public struct Distance
{
//
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public class EGLDevice : Device
{
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum Extend
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum FillRule
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum Filter
using System;
using System.Runtime.InteropServices;
-namespace Cairo
+namespace Crow.Cairo
{
[StructLayout (LayoutKind.Sequential)]
public struct FontExtents
//
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public class FontFace : IDisposable
{
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public class FontOptions : IDisposable
{
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum FontSlant
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public enum FontType
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum FontWeight
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum Format
-//
+//
// Mono.Cairo.GLSurface.cs
//
// Authors:
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class GLSurface : Surface
{
//
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public class GLXDevice : Device
{
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class GlitzSurface : Surface
{
internal GlitzSurface (IntPtr handle, bool owns) : base (handle, owns)
using System;
using System.Runtime.InteropServices;
-namespace Cairo
+namespace Crow.Cairo
{
[StructLayout(LayoutKind.Sequential)]
public struct Glyph
using System;
using Color = Crow.Color;
-namespace Cairo {
+namespace Crow.Cairo {
public class Gradient : Pattern
{
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum HintMetrics
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum HintStyle
-//
+//
// Mono.Cairo.ImageSurface.cs
//
// Authors:
using System;
using System.Runtime.InteropServices;
-namespace Cairo {
+namespace Crow.Cairo {
public class ImageSurface : Surface
{
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum LineCap
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum LineJoin
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class LinearGradient : Gradient
{
-//
+//
// Mono.Cairo.Matrix.cs
//
// Author: Duncan Mak
using System;
using System.Runtime.InteropServices;
-namespace Cairo {
+namespace Crow.Cairo {
[StructLayout(LayoutKind.Sequential)]
public class Matrix //: ICloneable
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class MeshPattern : Pattern
{
-//
+//
// Cairo.cs - a simplistic binding of the Cairo API to C#.
//
// Authors: Duncan Mak (duncan@ximian.com)
using System;
using System.Runtime.InteropServices;
-namespace Cairo
+namespace Crow.Cairo
{
// sort the functions like in the following page so it is easier to find what is missing
// http://cairographics.org/manual/index-all.html
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum Operator
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class PSSurface : Surface
{
using System;
using System.Runtime.InteropServices;
-using Cairo;
+using Crow.Cairo;
-namespace Cairo {
+namespace Crow.Cairo {
public class Path : IDisposable
{
using System;
using System.Collections;
-namespace Cairo {
+namespace Crow.Cairo {
public class Pattern : IDisposable
{
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public enum PatternType
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class PdfSurface : Surface
{
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-namespace Cairo {
+namespace Crow.Cairo {
public struct Point
{
public Point (int x, int y)
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-namespace Cairo {
+namespace Crow.Cairo {
public struct PointD
{
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class RadialGradient : Gradient
{
using System;
using System.Runtime.InteropServices;
-namespace Cairo
+namespace Crow.Cairo
{
[StructLayout(LayoutKind.Sequential)]
public struct RectangleList {
using System;
using System.Runtime.InteropServices;
-namespace Cairo {
+namespace Crow.Cairo {
public class ScaledFont : IDisposable
{
using System;
using Color = Crow.Color;
-namespace Cairo {
+namespace Crow.Cairo {
public class SolidPattern : Pattern
{
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum Status
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public enum SubpixelOrder
-//
+//
// Mono.Cairo.Surface.cs
//
// Authors:
using System;
using System.Collections;
-namespace Cairo {
+namespace Crow.Cairo {
public class Surface : IDisposable
{
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class SurfacePattern : Pattern
{
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public enum SurfaceType
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class SvgSurface : Surface
{
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public enum SvgVersion
using System;
using System.Runtime.InteropServices;
-namespace Cairo
+namespace Crow.Cairo
{
[StructLayout (LayoutKind.Sequential)]
public struct TextExtents
//
using System;
-namespace Cairo
+namespace Crow.Cairo
{
public class WGLDevice : Device
{
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class Win32Surface : Surface
{
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class XcbSurface : Surface
{
internal XcbSurface (IntPtr handle, bool owns) : base (handle, owns)
using System;
-namespace Cairo {
+namespace Crow.Cairo {
public class XlibSurface : Surface
{
NativeMethods.cairo_xlib_surface_set_drawable (Handle, drawable, width, height);
}
- public void SetSize (int width, int height)
+ public override void SetSize (int width, int height)
{
NativeMethods.cairo_xlib_surface_set_size (Handle, width, height);
}
using System;
using System.IO;
-using Cairo;
+using Crow.Cairo;
using System.Collections.Generic;
namespace Crow
using System.Xml.Serialization;
using System.Reflection;
using System.Diagnostics;
-using Cairo;
+using Crow.Cairo;
using System;
using System.IO;
-using Cairo;
+using Crow.Cairo;
namespace Crow
{
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
-using Cairo;
+using Crow.Cairo;
using System.Linq;
namespace Crow
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using Cairo;
+using Crow.Cairo;
#if DEBUG_LOG
namespace Crow
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
-using Cairo;
+using Crow.Cairo;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
-//Copyright GPL2
-using Cairo;
+//Copyright GPL2
+using Crow.Cairo;
namespace Rsvg {
[DllImport("rsvg-2")]
static extern void rsvg_handle_render_cairo_sub(IntPtr raw, IntPtr cr, string id);
- public void RenderCairoSub(Cairo.Context cr, string id) {
+ public void RenderCairoSub(Crow.Cairo.Context cr, string id) {
rsvg_handle_render_cairo_sub(Raw, cr == null ? IntPtr.Zero : cr.Handle, id);
}
-using Crow;
+using System;
+using Crow;
namespace HelloWorld
{
class Program : Interface {
+ Command CMDQuit;
static void Main (string[] args) {
using (Program vke = new Program ()) {
- vke.Load ("#HelloWorld.helloworld.crow");
vke.Run ();
}
}
+ protected override void Startup ()
+ {
+ CMDQuit = new Command (new Action (() => running = false)) { Caption = "Quit", Icon = new SvgPicture ("#Crow.Icons.exit-symbol.svg") };
+
+ Widget w = Load ("#HelloWorld.helloworld.crow");
+ w.KeyPress += W_KeyPress;
+ w.DataSource = this;
+ }
+
+ Color [] colors = { Color.Blue, Color.DarkGoldenRod, Color.Red, Color.Azure, Color.Brown, Color.Black, Color.White, Color.Pink };
+ int ptr = 0;
+
+ void W_KeyPress (object sender, KeyPressEventArgs e)
+ {
+ switch (e.KeyChar) {
+ case 'w':
+ LoadIMLFragment ($"<DockWindow Name='win{ptr}' Left='450' Top='450' Width='150' Height='150' Background='{colors [ptr]}'/>");
+ break;
+ case 'x':
+ LoadIMLFragment ($"<Window Name='win{ptr}' Left='450' Top='450' Width='150' Height='150' Background='{colors [ptr]}'/>");
+ break;
+ }
+
+ ptr++;
+ if (ptr == colors.Length)
+ ptr = 0;
+ }
+
}
}
using (Showcase app = new Showcase ()) {
//app.Keyboard.KeyDown += App_KeyboardKeyDown;
- Widget g = app.Load ("#ShowCase.showcase.crow");
- g.DataSource = app;
- app.crowContainer = g.FindByName ("CrowContainer") as Container;
- //I set an empty object as datasource at this level to force update when new
- //widgets are added to the interface
- app.crowContainer.DataSource = new object ();
- app.hideError ();
app.Run ();
}
}
+ protected override void Startup ()
+ {
+ Widget g = Load ("#ShowCase.showcase.crow");
+ g.DataSource = this;
+ crowContainer = g.FindByName ("CrowContainer") as Container;
+ //I set an empty object as datasource at this level to force update when new
+ //widgets are added to the interface
+ crowContainer.DataSource = new object ();
+ hideError ();
+ }
+
static void App_KeyboardKeyDown (object sender, KeyEventArgs e)
{
#if DEBUG_LOG
<?xml version="1.0"?>
-<Container Background="Yellow" Margin="10" Width="90%" Height="90%">
- <Widget Margin="10" Width="50%" Height="50%" Background="Yellow"
+<Container Background="Blue" Margin="1" Width="90%" Height="90%">
+ <Widget Margin="1" Width="50%" Height="50%" Background="Red"
MinimumSize="50,50"/>
</Container>
\ No newline at end of file
<?xml version="1.0"?>
-<Container Background="DimGrey" Margin="10" Fit="true">
- <Label Text="{fps}" Margin="10" Fit="true" Background="SeaGreen"/>
+<Container Background="Blue" Margin="10" Fit="true">
+ <Label Text="tes" Margin="10" Fit="true" Background="SeaGreen"/>
</Container>
\ No newline at end of file
<?xml version="1.0"?>
<VerticalStack Fit="true">
<TextBox Text="{Datas}" Width="100" />
- <Button Text="Set Text to Null" MouseClick="onSetDataToNull"/>
+ <Button Caption="Set Text to Null" MouseClick="onSetDataToNull"/>
</VerticalStack>
\ No newline at end of file
<Label Text="{Hover}" Background="DarkGreen"/>
<Button Caption="Clear" Width="Stretched" MouseClick="OnClear"/>
<ListBox Name="ColorList" Data="{TestList}" Width="200" Height="200"
- ItemTemplate="#Tests.Interfaces.colorItem.crow">
+ ItemTemplate="Interfaces/colorItem.crow">
</ListBox>
<Button Caption="Load list" Width="Stretched" MouseClick="OnLoadList"/>
</VerticalStack>
<?xml version="1.0"?>
<Container Background="DimGrey" Width="300">
- <ComboBox Data="{TestList}" ItemTemplate="#Tests.Interfaces.colorItem.crow"/>
+ <ComboBox Data="{TestList}" ItemTemplate="Interfaces/colorItem.crow"/>
</Container>
\ No newline at end of file