--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <config>
+ <add key="repositoryPath" value="../packages" />
+ </config>
+</configuration>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6E48BD3D-7B33-4368-AA8A-D878427DAC83}</ProjectGuid>
- <OutputType>Exe</OutputType>
+ <OutputType>Library</OutputType>
<RootNamespace>Crow.ControlsLib</RootNamespace>
<AssemblyName>Crow.ControlsLib</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <ReleaseVersion>0.5</ReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+<!-- <Reference Include="System.Data" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Drawing" />-->
+ <Reference Include="System.Xml" />
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<EmbeddedResource Include="Default.style" />
<Compile Include="DockingView.cs" />
<Compile Include="DocksView.cs" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Crow.csproj">
+ <Project>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</Project>
+ <Name>Crow</Name>
+ </ProjectReference>
+ </ItemGroup>
</Project>
\ No newline at end of file
foreach (string s in tests) {
string fileName = Path.Combine ("Interfaces", s + ".crow");
- iface.LoadInterface (fileName);
+ iface.AddWidget (fileName);
iface.Update ();
iface.Update ();
<EmbeddedResource Include="Templates\ArrowBut.template" />
<EmbeddedResource Include="Templates\treeList.template" />
<EmbeddedResource Include="Templates\CheckBox2.template" />
+ <EmbeddedResource Include="Icons\assembly.svg" />
+ <EmbeddedResource Include="Templates\Tooltip.template">
+ <LogicalName>Crow.Tooltip.template</LogicalName>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Crow.dll.config">
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow.Test", "Crow.Test\Crow.Test.csproj", "{42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow.ControlsLib", "Crow.ControlsLib\Crow.ControlsLib.csproj", "{6E48BD3D-7B33-4368-AA8A-D878427DAC83}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowIDE", "CrowIDE\CrowIDE.csproj", "{B6D911CD-1D09-42FC-B300-9187190F2AE1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
{42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}.Release|Any CPU.Build.0 = Release|Any CPU
- {6E48BD3D-7B33-4368-AA8A-D878427DAC83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6E48BD3D-7B33-4368-AA8A-D878427DAC83}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6E48BD3D-7B33-4368-AA8A-D878427DAC83}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6E48BD3D-7B33-4368-AA8A-D878427DAC83}.Release|Any CPU.Build.0 = Release|Any CPU
{74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.Build.0 = Release|Any CPU
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
Title=MessageBox;
Font = serif, 12;
MinimumSize = 200,120;
+ AlwaysOnTop = true;
}
Slider {
Background = vgradient|0:Black|0.1:Gray|0.9:Gray|1:LightGray;
}
FileDialog {
Template = #Crow.FileDialog.template;
+ AlwaysOnTop = true;
Focusable = true;
MinimumSize=50,50;
Width = 500;
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 64 64"
+ height="64"
+ width="64"
+ id="svg2"
+ version="1.1">
+ <metadata
+ id="metadata8">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs6" />
+ <path
+ d="M 15,33.964845 A 6.2543149,5.8551034 0 0 1 8.7456846,39.819949 6.2543149,5.8551034 0 0 1 2.4913703,33.964845 6.2543149,5.8551034 0 0 1 8.7456846,28.109741 6.2543149,5.8551034 0 0 1 15,33.964845 Z M 30.205524,19.726298 h 24.484978 c 3.833495,0 6.919666,3.88699 6.919666,8.715226 v 11.046641 c 0,4.828235 -3.086171,8.715225 -6.919666,8.715225 H 30.205524 c -3.833494,0 -6.919665,-3.88699 -6.919665,-8.715225 V 28.441524 c 0,-4.828236 3.086171,-8.715226 6.919665,-8.715226 z M 15,33.964845 h 8.285859"
+ style="opacity:1;fill:#a0a8ab;fill-opacity:1;stroke:#181818;stroke-width:2;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+ id="path819" />
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<Border Fit="true" Foreground="Jet" Background="ArylideYellow">
+ <Label Margin="3" Foreground="Jet" Multiline="true" Text="{Tooltip}"/>
+</Border>
}
get { return List2; }
}
- IList<Color> testList = Color.ColorDic.Values.ToList();
+ IList<Color> testList = Color.ColorDic.Values.OrderBy(c=>c.Hue)
+ .ThenBy(c=>c.Value).ThenBy(c=>c.Saturation)
+ .ToList();
public IList<Color> TestList {
set{
testList = value;
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Unsorted", "*.crow")).ToArray ();
- object tc = Color.AirForceBlueRaf;
Load(testFiles[idx]).DataSource = this;
}
void KeyboardKeyDown1 (object sender, OpenTK.Input.KeyboardKeyEventArgs e)
GraphicObject obj = Load (testFiles[idx]);
obj.DataSource = this;
- } catch (Exception ex) {
- Debug.WriteLine (ex.Message + ex.InnerException);
+ } catch (Exception ex) {
+ MessageBox.Show (MessageBox.Type.Error, ex.Message + "\n" + ex.InnerException);
}
}
// void Tv_SelectedItemChanged (object sender, SelectionChangeEventArgs e)
[STAThread]
static void Main ()
{
- TextWriterTraceListener listener = new TextWriterTraceListener ("listen.txt");
+ #if DEBUG
+ TextWriterTraceListener listener = new TextWriterTraceListener ("debug.log");
Debug.Listeners.Add (listener);
+ #endif
+
Console.WriteLine ("starting example");
BasicTests win = new BasicTests ();
win.VSync = OpenTK.VSyncMode.Adaptive;
win.Run (30);
+ #if DEBUG
listener.Dispose ();
+ #endif
}
protected override void OnUpdateFrame (OpenTK.FrameEventArgs e)
{
/// <param name="interfaceIdx">interface index to bind to, a default one is created if none exists</param>
public GraphicObject Load (string path, int interfaceIdx = 0){
checkDefaultIFace();
- return ifaceControl [interfaceIdx].CrowInterface.LoadInterface (path);
+ return ifaceControl [interfaceIdx].CrowInterface.AddWidget (path);
}
/// <summary>
/// Load the content of the IML string passed as first argument and add it to the current interface
void initGL(){
GL.Enable (EnableCap.CullFace);
GL.Enable (EnableCap.Blend);
- GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
+ GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
cube = vaoMesh.CreateCube ();
texture = new Texture ("image/textest.png");
using System;
using Crow;
+using Tutorials;
namespace Tests
{
protected override void OnLoad (EventArgs e)
{
base.OnLoad (e);
- AddWidget (new Label (CurrentInterface) { Text = "Hello World" });
+ LoadIMLFragment (@"<SimpleGauge Level='40' Margin='5' Background='Jet' Foreground='Gray' Width='30' Height='50%'/>");
}
[STAThread]
<VerticalStack Width="30%" Margin="5">
<GroupBox Caption="Performance" Height="Fit">
<VerticalStack Width="90%" Height="Fit" Spacing="2" >
- <HorizontalStack Height="Fit">
+ <HorizontalStack Height="Fit" Tooltip="Frame per second">
<Label Text="Fps:" Style="FpsLabel"/>
<Label Text="{fps}" Style="FpsDisp"/>
</HorizontalStack>
- <HorizontalStack Height="Fit">
+ <HorizontalStack Height="Fit" Tooltip="Minimum Frame per second">
<Label Text="Min:" Style="FpsLabel"/>
<Label Text="{fpsMin}" Style="FpsDisp"/>
</HorizontalStack>
- <HorizontalStack Height="Fit">
+ <HorizontalStack Height="Fit" Tooltip="Maximum Frame per second">
<Label Text="Max:" Style="FpsLabel"/>
<Label Text="{fpsMax}" Style="FpsDisp"/>
</HorizontalStack>
- <HorizontalStack Height="Fit">
+ <HorizontalStack Height="Fit" Tooltip="Update loop duration">
<Label Text="Update:" Style="FpsLabel"/>
<Label Text="{update}" Style="FpsDisp"/>
</HorizontalStack>
- <HorizontalStack Height="Fit">
+ <HorizontalStack Height="Fit" Tooltip="Layouting process duration">
<Label Text="Layouting:" Style="FpsLabel"/>
<Label Text="{layouting}" Style="FpsDisp"/>
</HorizontalStack>
- <HorizontalStack Height="Fit">
+ <HorizontalStack Height="Fit" Tooltip="Clipping duration">
<Label Text="Clipping:" Style="FpsLabel"/>
<Label Text="{clipping}" Style="FpsDisp"/>
</HorizontalStack>
<?xml version="1.0"?>
-<Container Fit="true" >
+<Container Fit="true" Background="Red" Tooltip="test tooltip" >
<Shape Foreground="Transparent" Background="Onyx" Path="M 5.5,0.5 L 10.5,10.5 L 0.5,10.5 Z"
MouseEnter="{Background=hgradient|0:Jet|0.5:BlueCrayola|1:Black}"
MouseLeave="{Background=Onyx}"/>
namespace Crow
{
- public static class Extensions {
+ public static partial class Extensions {
public static Vector4 ToVector4(this Color c){
float[] f = c.floatArray;
return new Vector4 (f [0], f [1], f [2], f [3]);
<OutputType>Exe</OutputType>
<RootNamespace>Tests</RootNamespace>
<AssemblyName>Tests</AssemblyName>
- <StartupObject>Tests.Showcase</StartupObject>
+ <StartupObject>Tests.BasicTests</StartupObject>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReleaseVersion>0.5</ReleaseVersion>
<StartWorkingDirectory>%24{SolutionDir}\build\%24{ProjectConfigName}</StartWorkingDirectory>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(RunConfiguration)' == 'Custom Command' ">
+ <StartAction>Program</StartAction>
+ <StartProgram>%24{TargetName}</StartProgram>
+ <StartWorkingDirectory>%24{SolutionDir}\build\%24{ProjectConfigName}</StartWorkingDirectory>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
<Reference Include="OpenTK">
- <HintPath>..\packages\OpenTK.3.0.0-git00041\lib\net20\OpenTK.dll</HintPath>
+ <HintPath>..\packages\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
GL.Enable (EnableCap.CullFace);
GL.Enable (EnableCap.Blend);
- GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
+ GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
cube = vaoMesh.CreateCube ();
texture = new Texture ("image/textest.png");
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="OpenTK" version="3.0.0-git00041" targetFramework="net45" />
+ <package id="OpenTK" version="2.0.0" targetFramework="net45" />
</packages>
\ No newline at end of file
internal static MethodInfo miGetValWithRefx = typeof(CompilerServices).GetMethod("getValueWithReflexion", BindingFlags.Static | BindingFlags.NonPublic);
internal static MethodInfo miCreateDel = typeof(CompilerServices).GetMethod ("createDel", BindingFlags.Static | BindingFlags.NonPublic);
internal static MethodInfo miGetImplOp = typeof(CompilerServices).GetMethod ("getImplicitOp", BindingFlags.Static | BindingFlags.NonPublic);
+ internal static MethodInfo miGetDataTypeAndFetch = typeof(CompilerServices).GetMethod("getDataTypeAndFetch", BindingFlags.Static | BindingFlags.NonPublic);
internal static MethodInfo miGoUpLevels = typeof(CompilerServices).GetMethod("goUpNbLevels", BindingFlags.Static | BindingFlags.NonPublic);
internal static MethodInfo miGetITempFromDic = typeof(Dictionary<string, ItemTemplate>).GetMethod ("get_Item", new Type[] { typeof(string) });
internal static FieldInfo fldItemTemplates = typeof(TemplatedGroup).GetField("ItemTemplates");
internal static MethodInfo miCreateExpDel = typeof(ItemTemplate).GetMethod ("CreateExpandDelegate");
-
+ internal static FieldInfo fiFetchMethodName = typeof(ItemTemplate).GetField("fetchMethodName", BindingFlags.Instance | BindingFlags.NonPublic);
#region tree handling methods
internal static FieldInfo fiChild = typeof(PrivateContainer).GetField ("child", BindingFlags.Instance | BindingFlags.NonPublic);
internal static MethodInfo miSetChild = typeof (Container).GetMethod ("SetChild");
Type dstType = null;
if (mi == null)
return null;
- if (mi.MemberType == MemberTypes.Property) {
- PropertyInfo pi = mi as PropertyInfo;
- tmp = pi.GetValue (instance);
- dstType = pi.PropertyType;
- }
- if (mi.MemberType == MemberTypes.Field) {
- FieldInfo fi = mi as FieldInfo;
- tmp = fi.GetValue (instance);
- dstType = fi.FieldType;
- }
- if (tmp != null)
- return tmp;
- if (dstType == typeof(string) || dstType == CompilerServices.TObject)//TODO:object should be allowed to return null and not ""
+ try {
+ if (mi.MemberType == MemberTypes.Property) {
+ PropertyInfo pi = mi as PropertyInfo;
+ tmp = pi.GetValue (instance);
+ dstType = pi.PropertyType;
+ }
+ if (mi.MemberType == MemberTypes.Field) {
+ FieldInfo fi = mi as FieldInfo;
+ tmp = fi.GetValue (instance);
+ dstType = fi.FieldType;
+ }
+ if (tmp != null)
+ return tmp;
+ if (dstType == typeof(string) || dstType == CompilerServices.TObject)//TODO:object should be allowed to return null and not ""
+ return "";
+ if (dstType.IsValueType)
+ return Activator.CreateInstance (dstType);
+ } catch (Exception ex) {
+ Debug.WriteLine (ex.ToString ());
return "";
- if (dstType.IsValueType)
- return Activator.CreateInstance (dstType);
+ }
return null;
}
}
return null;
}
+
+ internal static object getDataTypeAndFetch (object data, string fetchMethod){
+ Type dataType = data.GetType();
+ MethodInfo miGetDatas = dataType.GetMethod (fetchMethod, new Type[] {});
+ if (miGetDatas == null)
+ miGetDatas = CompilerServices.SearchExtMethod (dataType, fetchMethod);
+
+ if (miGetDatas == null) {//in last resort, search among properties
+ PropertyInfo piDatas = dataType.GetProperty (fetchMethod);
+ if (piDatas == null) {
+ FieldInfo fiDatas = dataType.GetField (fetchMethod);
+ if (fiDatas == null)//and among fields
+ throw new Exception ("Fetch data member not found in ItemTemplate: " + fetchMethod);
+ return fiDatas.GetValue (data);
+ }
+ miGetDatas = piDatas.GetGetMethod ();
+ if (miGetDatas == null)
+ throw new Exception ("Read only property for fetching data in ItemTemplate: " + fetchMethod);
+ }
+ object tmp = miGetDatas.Invoke (data, null);
+ return tmp;
+ }
}
}
public event EventHandler OkClicked;
#endregion
+ public string SelectedFileFullPath {
+ get { return Path.Combine (SelectedDirectory, SelectedFile); }
+ }
[XmlAttributeAttribute][DefaultValue("/home")]
public virtual string CurrentDirectory {
get { return curDir; }
NotifyValueChanged ("Style", style);
}
}
+ string tooltip;
+ [XmlAttributeAttribute]
+ public virtual string Tooltip {
+ get { return tooltip; }
+ set {
+ if (tooltip == value)
+ return;
+ tooltip = value;
+ NotifyValueChanged("Tooltip", tooltip);
+ }
+ }
#endregion
#region Default and Style Values loading
NotifyValueChanged ("MsgIcon", "#Crow.Images.Icons.exit.svg");
Caption = "Error";
OkMessage = "Ok";
- CancelMessage = "Cancel";
break;
}
}
close ();
}
public static MessageBox Show (Type msgBoxType, string message, string okMsg = "", string cancelMsg = ""){
- lock (Interface.CurrentInterface.UpdateMutex) {
+ //lock (Interface.CurrentInterface.UpdateMutex) {
MessageBox mb = new MessageBox (Interface.CurrentInterface);
mb.CurrentInterface.AddWidget (mb);
mb.MsgType = msgBoxType;
if (!string.IsNullOrEmpty(cancelMsg))
mb.CancelMessage = cancelMsg;
return mb;
- }
+ //}
}
}
}
if (Content != null) {
Content.Visible = true;
if (Content.Parent == null)
- CurrentInterface.AddWidget (Content, true);
+ CurrentInterface.AddWidget (Content);
if (Content.LogicalParent != this)
Content.LogicalParent = this;
CurrentInterface.PutOnTop (Content, true);
System.Reflection.Emit.Label finish = il.DefineLabel ();
il.Emit (OpCodes.Br, finish);
il.MarkLabel (cancel);
- il.EmitWriteLine (string.Format ("Handler method '{0}' for '{1}' not found in new dataSource ", bindingDef.TargetMember, sourceEvent.Name));
+ il.EmitWriteLine (string.Format ("Handler method '{0}' for '{1}' not found in new dataSource", bindingDef.TargetMember, sourceEvent.Name));
il.MarkLabel (finish);
il.Emit (OpCodes.Ret);
public Interface(){
CurrentInterface = this;
CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
+
+ initTooltip ();
}
#endregion
public static bool FocusOnHover = false;
/// <summary> Threshold to catch borders for sizing </summary>
public static int BorderThreshold = 5;
+ /// <summary> delay before tooltip appear </summary>
+ public static int ToolTipDelay = 500;
/// <summary>Double click threshold in milisecond</summary>
public static int DoubleClick = 200;//max duration between two mouse_down evt for a dbl clk in milisec.
/// <summary> Time to wait in millisecond before starting repeat loop</summary>
return tmp;
}
}
- /// <summary>Create an instance of a GraphicObject and add it to the GraphicTree
- /// of this Interface</summary>
- public GraphicObject LoadInterface (string path)
+ /// <summary>
+ /// Create an instance of a GraphicObject and add it to the GraphicTree of this Interface
+ /// </summary>
+ /// <returns>new instance of graphic object created</returns>
+ /// <param name="path">path of the iml file to load</param>
+ public GraphicObject AddWidget (string path)
{
lock (UpdateMutex) {
GraphicObject tmp = Load (path);
return tmp;
}
}
- /// <summary>Create an instance of a GraphicObject linked to this interface but
- /// not added to the GraphicTree</summary>
+ /// <summary>
+ /// Create an instance of a GraphicObject linked to this interface but not added to the GraphicTree
+ /// </summary>
+ /// <returns>new instance of graphic object created</returns>
+ /// <param name="path">path of the iml file to load</param>
public GraphicObject Load (string path)
{
try {
throw new Exception ("Error loading <" + path + ">:", ex);
}
}
- /// <summary>Fetch instantiator it from cache or create it</summary>
+ /// <summary>
+ /// Fetch instantiator from cache or create it.
+ /// </summary>
+ /// <returns>new Instantiator</returns>
+ /// <param name="path">path of the iml file to load</param>
public static Instantiator GetInstantiator(string path){
if (!Instantiators.ContainsKey(path))
Instantiators [path] = new Instantiator(path);
#region GraphicTree handling
/// <summary>Add widget to the Graphic tree of this interface and register it for layouting</summary>
- public void AddWidget(GraphicObject g, bool isOverlay = false)
+ public void AddWidget(GraphicObject g)
{
g.Parent = this;
int ptr = 0;
g.RegisteredLayoutings = LayoutingType.None;
g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
}
- /// <summary>Set visible state of widget to false and remove if from the graphic tree</summary>
+ /// <summary>Set visible state of widget to false and delete if from the graphic tree</summary>
public void DeleteWidget(GraphicObject g)
{
lock (UpdateMutex) {
g.Dispose ();
}
}
+ /// <summary>Set visible state of widget to false and remove if from the graphic tree</summary>
+ public void RemoveWidget(GraphicObject g)
+ {
+ lock (UpdateMutex) {
+ RegisterClip (g.ScreenCoordinates (g.LastPaintedSlot));
+ GraphicTree.Remove (g);
+ g.Parent = null;
+ }
+ }
/// <summary> Remove all Graphic objects from top container </summary>
public void ClearInterface()
{
}
if (HoverWidget != null) {
+ resetTooltip ();
//check topmost graphicobject first
GraphicObject tmp = HoverWidget;
GraphicObject topc = null;
}
#endregion
+ #region Tooltip handling
+ Stopwatch tooltipTimer = new Stopwatch();
+ GraphicObject ToolTipContainer = null;
+ volatile bool tooltipVisible = false;
+
+ void initTooltip () {
+ ToolTipContainer = Load ("#Crow.Tooltip.template");
+ Thread t = new Thread (toolTipThreadFunc);
+ t.IsBackground = true;
+ t.Start ();
+ }
+ void toolTipThreadFunc ()
+ {
+ while(true) {
+ if (tooltipTimer.ElapsedMilliseconds > ToolTipDelay) {
+ if (!tooltipVisible) {
+ GraphicObject g = _hoverWidget;
+ while (g != null) {
+ if (!string.IsNullOrEmpty (g.Tooltip)) {
+ AddWidget (ToolTipContainer);
+ ToolTipContainer.DataSource = g;
+ ToolTipContainer.Top = Mouse.Y + 10;
+ ToolTipContainer.Left = Mouse.X + 10;
+ tooltipVisible = true;
+ break;
+ }
+ g = g.LogicalParent as GraphicObject;
+ }
+ }
+ }
+ Thread.Sleep (200);
+ }
+
+ }
+ void resetTooltip () {
+ if (tooltipVisible) {
+ //ToolTipContainer.DataSource = null;
+ RemoveWidget (ToolTipContainer);
+ tooltipVisible = false;
+ }
+ tooltipTimer.Restart ();
+ }
+ #endregion
+
#region Device Repeat Events
volatile bool mouseRepeatOn, keyboardRepeatOn;
volatile int mouseRepeatCount, keyboardRepeatCount;
/// </summary>
/// <param name="host">Host.</param>
public void CreateExpandDelegate (TemplatedGroup host){
- Type dataType = CompilerServices.tryGetType(strDataType);
- if (dataType == null) {
- Debug.WriteLine ("ItemTemplate error: DataType not found: {0}.", strDataType);
- return;
- }
+ Type dataType = null;
+ //if (host.DataTest == "TypeOf"){
+ dataType = CompilerServices.tryGetType(strDataType);
+// if (dataType == null) {
+// Debug.WriteLine ("ItemTemplate error: DataType not found: {0}.", strDataType);
+// return;
+// }
+// }
Type tmpGrpType = typeof(TemplatedGroup);
Type evtType = typeof(EventHandler);
il.Emit (OpCodes.Ldarg_1);//get the dataSource of the sender
il.Emit (OpCodes.Callvirt, CompilerServices.miGetDataSource);
- if (fetchMethodName != "self")//special keyword self allows the use of recurent list<<<
- emitGetSubData(il, dataType);
+ if (fetchMethodName != "self") {//special keyword self allows the use of recurent list<<<
+ if (dataType == null) {
+ //dataTest was not = TypeOF, so we have to get the type of data
+ //dynamically and fetch
+ il.Emit (OpCodes.Ldstr, fetchMethodName);
+ il.Emit (OpCodes.Callvirt, CompilerServices.miGetDataTypeAndFetch);
+ }else
+ emitGetSubData(il, dataType);
+ }
//set 'return' from the fetch method as 'data' of the list
il.Emit (OpCodes.Callvirt, piData.GetSetMethod ());
il.Emit (OpCodes.Ldarg_0);
il.Emit (OpCodes.Callvirt, CompilerServices.miGetDataSource);
- if (fetchMethodName != "self")
- emitGetSubData(il, dataType);
+ if (fetchMethodName != "self") {//special keyword self allows the use of recurent list<<<
+ if (dataType == null) {
+ //dataTest was not = TypeOF, so we have to get the type of data
+ //dynamically and fetch
+
+ il.Emit (OpCodes.Ldstr, fetchMethodName);
+ il.Emit (OpCodes.Callvirt, CompilerServices.miGetDataTypeAndFetch);
+ }else
+ emitGetSubData(il, dataType);
+ }
il.Emit (OpCodes.Callvirt, CompilerServices.miGetColCount);
il.Emit (OpCodes.Ldc_I4_0);
HasSubItems = (BooleanTestOnInstance)dm.CreateDelegate (typeof(BooleanTestOnInstance));
#endregion
}
+
+ //data is on the stack
void emitGetSubData(ILGenerator il, Type dataType){
MethodInfo miGetDatas = dataType.GetMethod (fetchMethodName, new Type[] {});
if (miGetDatas == null)