]> O.S.I.I.S - jp/crow.git/commitdiff
new binding debug and new inherited sizing method
authorjpbruyere <jp.bruyere@hotmail.com>
Fri, 30 Dec 2016 15:23:50 +0000 (16:23 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Fri, 30 Dec 2016 23:48:36 +0000 (00:48 +0100)
73 files changed:
Crow.OpenTK.nuspec
Crow.csproj
Crow.sln
Default.style
Properties/AssemblyInfo.cs
Templates/ArrowButTemplate.crow
Templates/Button.template
Templates/CheckBox.template
Templates/ColorPicker.template [new file with mode: 0755]
Templates/ComboBox.template
Templates/DirectoryView.template
Templates/Expandable.template
Templates/FileDialog.template
Templates/GroupBox.template
Templates/ListBox.template
Templates/Menu.template
Templates/MenuItem.template
Templates/MessageBox.template
Templates/Popper.template
Templates/RadioButton.template
Templates/ScrollBar.template
Templates/ScrollingListBox.goml
Templates/Spinner.template
Templates/TabItem.template
Templates/TreeView.template
Templates/Window.template
Templates/treeList.crow
Tests/BasicTests.cs
Tests/Interfaces/Container/0.crow
Tests/Interfaces/Divers/0.crow
Tests/Interfaces/Divers/colorPicker.crow [new file with mode: 0755]
Tests/Interfaces/Divers/test2WayBinding.crow [new file with mode: 0755]
Tests/Interfaces/GraphicObject/2.crow
Tests/Interfaces/TemplatedContainer/testTreeView.crow
Tests/Interfaces/TemplatedContainer/test_Listbox.crow
Tests/Interfaces/TemplatedControl/testItemTemplateTag.crow
Tests/Interfaces/TemplatedControl/testScrollbar.crow [new file with mode: 0755]
Tests/Interfaces/TemplatedControl/testScrollbar.goml [deleted file]
Tests/Interfaces/TemplatedControl/testSpinner.crow [new file with mode: 0755]
Tests/Interfaces/TemplatedControl/testSpinner.goml [deleted file]
Tests/Interfaces/TmpExpandable.goml
Tests/Interfaces/Unsorted/testFileDialog.crow [new file with mode: 0644]
Tests/Interfaces/Unsorted/testFileDialog.goml [deleted file]
Tests/Interfaces/treeList.crow
Tests/Tests.csproj
Tests/test.style
Tests/ui/Popper.template
Tests/ui/tmpWindow.crow
crow.key [new file with mode: 0644]
src/Colors.cs
src/CompilerServices/CompilerServices.cs
src/Enums.cs
src/GraphicObjects/ColorPicker.cs [new file with mode: 0644]
src/GraphicObjects/ColorSelector.cs [new file with mode: 0644]
src/GraphicObjects/DataSourceChangeEventArgs.cs
src/GraphicObjects/DirectoryView.cs
src/GraphicObjects/Expandable.cs
src/GraphicObjects/FileDialog.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/HueSelector.cs [new file with mode: 0644]
src/GraphicObjects/Menu.cs
src/GraphicObjects/MenuItem.cs
src/GraphicObjects/Popper.cs
src/GraphicObjects/SaturationValueSelector.cs [new file with mode: 0644]
src/GraphicObjects/TemplatedGroup.cs
src/IML/Context.cs
src/IML/EventBinding.cs [new file with mode: 0644]
src/Instantiator.cs
src/Interface.cs
src/ItemTemplate.cs
src/LayoutingQueueItem.cs
src/Measure.cs
src/SolidColor.cs

index 1a6221f79395ce951b979aef1c14543b521bd881..40b76980eee8864bb11fe38391dbd7fe99cf832c 100644 (file)
@@ -2,7 +2,7 @@
 <package >
        <metadata>
                <id>Crow.OpenTK</id>
-               <version>0.4.8</version>
+               <version>0.4.10</version>
                <title>C# Rapid Open Widget Toolkit</title>
                <authors>JP Bruyere</authors>
                <owners>Grand Tetras Software</owners>
index fd5ed61213083cd72a6a56fe87bd150793d0a427..9d6743741db152cf3d1d73ee34c1611c1f89b647 100644 (file)
     <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
     <WarningLevel>4</WarningLevel>
     <NoWin32Manifest>False</NoWin32Manifest>
-    <SignAssembly>false</SignAssembly>
+    <SignAssembly>true</SignAssembly>
     <DelaySign>False</DelaySign>
     <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <Description>C# Rapid Open Widget</Description>
     <BaseAddress>4194304</BaseAddress>
-    <ReleaseVersion>0.4</ReleaseVersion>
+    <ReleaseVersion>0.5</ReleaseVersion>
     <ProductVersion>8.0.30703</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <OutputPath>$(SolutionDir)build\$(Configuration)</OutputPath>
     <IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
+    <AssemblyOriginatorKeyFile>crow.key</AssemblyOriginatorKeyFile>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -34,9 +35,8 @@
     <Optimize>false</Optimize>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <Optimize>True</Optimize>
-    <DebugType>None</DebugType>
-    <DefineConstants>__linux__;MEASURE_TIME</DefineConstants>
+    <Optimize>true</Optimize>
+    <DefineConstants>__linux__</DefineConstants>
   </PropertyGroup>
   <ItemGroup>
     <Compile Include="src\Colors.cs" />
     <Compile Include="src\IML\MemberAddress.cs" />
     <Compile Include="src\IML\NodeStack.cs" />
     <Compile Include="src\IML\BindingDefinition.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="src\GraphicObjects\ColorPicker.cs" />
+    <Compile Include="src\GraphicObjects\ColorSelector.cs" />
+    <Compile Include="src\GraphicObjects\HueSelector.cs" />
+    <Compile Include="src\GraphicObjects\SaturationValueSelector.cs" />
+    <Compile Include="src\IML\EventBinding.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
     <EmbeddedResource Include="Templates\Menu.template">
       <LogicalName>Crow.Menu.template</LogicalName>
     </EmbeddedResource>
+    <EmbeddedResource Include="Templates\ColorPicker.template">
+      <LogicalName>Crow.ColorPicker.template</LogicalName>
+    </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
     <None Include="README.md" />
index 725fe4ec0b05751aebacf2b1237a3409234bf6ca..42a17a0991ed88fa08d538ae37ed0dfa9160d6cd 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -48,6 +48,6 @@ Global
                $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.4
+               version = 0.5
        EndGlobalSection
 EndGlobal
index 933f89fea790969ea9c31f80c03e03d0ea71588d..553be982c176f70cb6932429b03e42cc3d62f440 100644 (file)
@@ -55,6 +55,7 @@ TextBox {
        Foreground = Black;
        Selectable = True;
        Text = TextBox;
+       Margin = 1;
 }
 Window {
        Focusable = true;
@@ -62,6 +63,12 @@ Window {
        Width = 150;
        Height = 150;
 }
+FileDialog {
+       Focusable = true;
+       MinimumSize=50,50;
+       Width = 500;
+       Height = 300;
+}
 Border {
        Foreground = Gray;
 }
@@ -80,4 +87,14 @@ Icon {
 Control {
        Margin=0;
        Spacing=3;
+}
+ColorSpinner {
+       Minimum = 0;
+       Maximum = 255;
+       SmallIncrement = 1;
+}
+HSVSpinner {
+       Minimum = 0;
+       Maximum = 1;
+       SmallIncrement = 0.01;
 }
\ No newline at end of file
index 277667d7d508a335406c2567adc067a894a17bb3..96e0ccecf5838c7fe3096a4f685ed4d2a19caf5e 100755 (executable)
@@ -1,36 +1,47 @@
-using System.Reflection;
+//
+//  AssemblyInfo.cs
+//
+//  Author:
+//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+//  Copyright (c) 2016 jp
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+using System.Reflection;
 using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
 
-// General Information about an assembly is controlled through the following 
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("golib")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("golib")]
-[assembly: AssemblyCopyright("Copyright ©  2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
 
-// Setting ComVisible to false makes the types in this assembly not visible 
-// to COM components.  If you need to access a type in this assembly from 
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
+[assembly: AssemblyTitle ("Crow")]
+[assembly: AssemblyDescription ("C# Rapid Open Widgets")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("Grand Tetra Software")]
+[assembly: AssemblyProduct ("Crow")]
+[assembly: AssemblyCopyright ("Copyright (c) 2016 - Jean-Philippe Bruyère <jp_bruyere@hotmail.com>")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("en-US")]
 
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("150376dc-e648-46a2-b692-6429d0a62362")]
+// 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 ("0.5.*")]
+
+// 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("crow.key")]
 
-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version 
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers 
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.1")]
-[assembly: AssemblyFileVersion("1.0.0.1")]
index 817c00d19fafa5afb03680f977126d7c2eec8b36..aa17d2f47de779f18f0bceb6a4a775c76b8f466e 100755 (executable)
@@ -1,10 +1,9 @@
 <?xml version="1.0"?>
 <Border Name="Content"
        Background="vgradient|0:White|0.1:LightGray|0.9:LightGray|1:Black" Foreground="DarkGray" 
-       Height="{./HeightPolicy}" Width="{./WidthPolicy}"
        MouseEnter="{Foreground=White}"
        MouseLeave="{Foreground=DarkGray}"
        MouseDown="{Background=vgradient|0:Black|0.1:LightGray|0.9:LightGray|1:White}"
        MouseUp="{Background=vgradient|0:White|0.1:LightGray|0.9:LightGray|1:Black}"
        >
-</Border>
\ No newline at end of file
+</Border>
index 648c127b87d7764927b9eac0a2923bb8c9725ab1..b1926443a34e74f1d5bac85d4d526dbf3584dbb1 100755 (executable)
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
-<Border Background="{./Background}" MinimumSize="50,20" Height="{./HeightPolicy}" Width="{./WidthPolicy}"
-               Foreground="Transparent" CornerRadius="{./CornerRadius}" BorderWidth="1"
+<Border Background="{./Background}" MinimumSize="50,20"
+       Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1"
        MouseEnter="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black;caption.Foreground=White}"
        MouseLeave="{Foreground=Transparent;caption.Foreground=LightGray}"
        MouseDown="{Foreground=vgradient|0:Black|0.05:Gray|0.85:Gray|1:White}"
        MouseUp="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black}"                  
        >
        <Label Font="{./Font}" Name="caption" Margin="3" Foreground="LightGray" Text="{./Caption}"/>
-</Border>
\ No newline at end of file
+</Border>
index a3c0f23d3a3093cf757910c70859d99f1d07403b..070f8e2e2fa546dc18830ed86e18c31d670819ae 100755 (executable)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
-<HorizontalStack Style="Control" Background="{./Background}" Height="{./HeightPolicy}" Width="{./WidthPolicy}">
+<HorizontalStack Style="Control" Background="{./Background}">
        <Image Style="Icon" Path="#Crow.Images.Icons.checkbox.svg"
                SvgSub="{./IsChecked}"/>
-       <Label Font="{./Font}" Text="{./Caption}" Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+       <Label Font="{./Font}" Text="{./Caption}"/>
 </HorizontalStack>
\ No newline at end of file
diff --git a/Templates/ColorPicker.template b/Templates/ColorPicker.template
new file mode 100755 (executable)
index 0000000..4c1e128
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<Border Background="{./Background}"    Foreground="{./Foreground}"
+               CornerRadius="{./CornerRadius}" BorderWidth="1">
+               <HorizontalStack Spacing="0">
+                       <VerticalStack Margin="10">
+                               <SaturationValueSelector S="{²./S}" V="{²./V}" Focusable="true" Name="colorSelector" Margin="0"
+                                       Foreground="{../hueSelector.HueColor}"
+                                       Width="140" Height="140" Background="DimGray"/>
+                               <HueSelector Hue="{²./H}" Focusable="true" Name="hueSelector" Margin="0" Width="140" Height="20" Background="DimGray"/>
+                       </VerticalStack>
+                       <VerticalStack Margin="5" Height="Stretched">
+                               <HorizontalStack Height="Fit" Width="Stretched">
+                                       <GraphicObject Width="40" Height="30" Background="{./SelectedColor}"/>
+                                       <VerticalStack Margin="2">
+                                               <Label Focusable="true" Selectable="true" Width="Stretched" Text="{./SelectedColor}" />
+                                               <Label Focusable="true" Selectable="true" Width="Stretched" Text="{./HexColor}" />
+                                       </VerticalStack>
+                               </HorizontalStack>
+                               <HorizontalStack Height="Fit">
+                                       <Label Text="Red:" Width="40"/>
+                                       <Spinner Style="ColorSpinner" Value="{²./R}" Width="60"  />
+                               </HorizontalStack>
+                               <HorizontalStack Height="Fit">
+                                       <Label Text="Green:" Width="40"/>
+                                       <Spinner Style="ColorSpinner" Value="{²./G}" Width="60"  />
+                               </HorizontalStack>
+                               <HorizontalStack Height="Fit">
+                                       <Label Text="Blue:" Width="40"/>
+                                       <Spinner Style="ColorSpinner" Value="{²./B}" Width="60"  />
+                               </HorizontalStack>
+                               <HorizontalStack Height="Fit">
+                                       <Label Text="Alpha:" Width="40"/>
+                                       <Spinner Style="ColorSpinner" Value="{²./A}" Width="60"  />
+                               </HorizontalStack>
+                               <HorizontalStack Height="Fit">
+                                       <Label Text="Hue:" Width="40"/>
+                                       <Spinner Style="HSVSpinner" Value="{²./H}" Width="60"  />
+                               </HorizontalStack>
+                               <HorizontalStack Height="Fit">
+                                       <Label Text="Sat:" Width="40"/>
+                                       <Spinner Style="HSVSpinner" Value="{²./S}" Width="60"  />
+                               </HorizontalStack>
+                               <HorizontalStack Height="Fit">
+                                       <Label Text="Val:" Width="40"/>
+                                       <Spinner Style="HSVSpinner" Value="{²./V}" Width="60"  />
+                               </HorizontalStack>
+                       </VerticalStack>
+               </HorizontalStack>
+</Border>
\ No newline at end of file
index d28a7b913758b76e6487ec45cc00cf9576ae56cb..314613b23109fd5c184949bbe8bdda4dcd5982d3 100755 (executable)
@@ -1,12 +1,10 @@
 <?xml version="1.0"?>
-<Popper Name="popper" PopDirection="Bottom" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
+<Popper Name="popper" PopDirection="Bottom">
        <Template>
-               <Border CornerRadius="0" Foreground="LightGray" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
-                       <HorizontalStack Margin="0
-                                               " Spacing="1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}">
+               <Border CornerRadius="0" Foreground="LightGray">
+                       <HorizontalStack Margin="0" Spacing="1">
                                <TextBox MinimumSize="80,10" Margin="1" Foreground="Black" Background="White"
-                                       Text="{../../../../SelectedItem}"
-                                       Height="{../../../../HeightPolicy}" Width="{../../../../WidthPolicy}"/>
+                                       Text="{../../../../SelectedItem}"/>
                                <Button Width="14" Height="14" Focusable="false"
                                        Template="#Crow.Templates.ArrowButTemplate.crow">
                                        <Image Margin="0"  Path="#Crow.Images.Icons.updown.svg" SvgSub="down"/>
                MinimumSize="{../../MinimumPopupSize}" Fit="true">
                <Scroller Name="scroller1" Margin="2" VerticalScrolling="true"
                        MaximumSize="0,200"
-                       Height="{../HeightPolicy}" Width="{../WidthPolicy}"
-                       HorizontalAlignment="Left"
-                       ValueChanged="../../../_scroller_ValueChanged">
-                       <VerticalStack LayoutChanged="../../../../_list_LayoutChanged"
-                               Height="Fit" Width="{../../WidthPolicy}" Name="ItemsContainer" Margin="0"
+                       HorizontalAlignment="Left">
+                       <VerticalStack
+                               Height="Fit" Name="ItemsContainer" Margin="0"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Top"/>
                </Scroller>
index 9b80c1e99f24a9f6027a881fb7383296af97b861..8f03e7d3a2d26fe66c0d93b0f92ff4889eeee886 100755 (executable)
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
-<TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}"
+<TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}" Background="{./Background}"
                SelectedItemChanged="./onSelectedItemChanged">
        <ItemTemplate DataType="System.IO.FileInfo">
-               <HorizontalStack Focusable="true"  Height="Fit" Width="Stretched" Background="{../Background}" >
+               <HorizontalStack Focusable="true"  Height="Fit" Width="Stretched" >
                        <Image Margin="2" Width="14" Height="14"
                                Path="#Crow.Images.Icons.file.svg"/>
                        <Label Text="{Name}" Width="Stretched"
        <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
                <Expandable Caption="{Name}" >
                        <Template>
-                               <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
-                                       <HorizontalStack Spacing="1" Height="Fit" Width="{./WidthPolicy}"
+                               <VerticalStack>
+                                       <HorizontalStack Spacing="1" Height="Fit" MouseDoubleClick="./onClickForExpand"
                                                        MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
                                                        MouseLeave="{Background=Transparent}">
-                                               <Image Margin="2" Width="12" Height="12"
-                                                       Path="{./Image}"
-                                                       SvgSub="{./IsExpanded}"/>
+                                               <Container Margin="1" Width="10" Height="10" Focusable="true" MouseClick="./onClickForExpand"
+                                                       MouseEnter="{Background=LightGray}"
+                                                       MouseLeave="{Background=Transparent}">
+                                                       <Image
+                                                               Path="{./Image}"
+                                                               Visible="{./IsExpandable}"
+                                                               SvgSub="{./IsExpanded}"/>
+                                               </Container>
                                                <Image Margin="2" Width="14" Height="14"
                                                        Path="#Crow.Images.Icons.folder.svg"/>
-                                               <Label Text="{./Caption}" Width="{./WidthPolicy}"/>
+                                               <Label Text="{./Caption}"/>
                                        </HorizontalStack>
-                                       <Container Name="Content" Visible="false"
-                                                       Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+                                       <Container Name="Content" Visible="false"/>
                                </VerticalStack>
                        </Template>
-                       <HorizontalStack Height="Fit" Width="{./WidthPolicy}">
+                       <HorizontalStack Height="Fit">
                                <GraphicObject Width="12" Height="10"/>
-                               <TreeView Name="List" Height="Fit" Width="{./WidthPolicy}"
+                               <TreeView Name="List" Height="Fit"
                                        Template="#Crow.Templates.treeList.crow" />
                        </HorizontalStack>
                </Expandable>
index 14a59dd9ed23a825860d362cf2436ffa335b375c..3d33fc8b61bc65bffa6b42f703bd4513f0bcf5c0 100755 (executable)
@@ -1,15 +1,17 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="{./Foreground}" Background="{./Background}"
-               Height="{./HeightPolicy}" Width="{./WidthPolicy}">
-       <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
-               <HorizontalStack Spacing="1" Height="Fit" Width="{./WidthPolicy}">
-                       <Image Style="Icon" Margin="2"
-                               Visible="{./HasContent}"
-                               Path="{./Image}" 
-                               SvgSub="{./IsExpanded}"/>
-                       <Label Text="{./Caption}" Width="{./WidthPolicy}"/>
+<Border BorderWidth="1" Foreground="{./Foreground}" Background="{./Background}">
+       <VerticalStack>
+               <HorizontalStack Spacing="1" Height="Fit" MouseDoubleClick="./onClickForExpand">
+                       <Container Margin="1" Width="10" Height="10" Focusable="true" MouseClick="./onClickForExpand"
+                                                                                                               MouseEnter="{Background=LightGray}"
+                                                                                                               MouseLeave="{Background=Transparent}">
+                               <Image
+                                       Path="{./Image}"
+                                       Visible="{./IsExpandable}"
+                                       SvgSub="{./IsExpanded}"/>
+                       </Container>
+                       <Label Text="{./Caption}"/>
                </HorizontalStack>
-               <Container Name="Content" Visible="false"
-                       Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+               <Container Name="Content" Visible="false"/>
        </VerticalStack>
 </Border>
\ No newline at end of file
index c8a10c8d7462ecbca6486e33abe0fc27991d90c8..883efd90902b7b504e43ebace67cb48342558abe 100644 (file)
@@ -1,24 +1,80 @@
 <?xml version="1.0"?>
-<Window Caption="OpenFile" Height="300" Width="500">
-       <VerticalStack Margin="5">
-               <TextBox Margin="1" Width="0" Height="-1" Text="{CurrentPath}"/>
-               <HorizontalStack >
-                       <ListBox Data="{Directories}" Width="-1" Height="0"
-                               Background="0.5,0.5,0.5,0.5"
-                               SelectedItemChanged="OnSelectedItemChanged"
-                               Template="#Crow.Templates.ScrollingListBox.goml" 
-                               ItemTemplate="#Crow.Templates.tmpDirItem.goml" >
-                       </ListBox>
-                       <ListBox Data="{Files}" Width="0" Height="0"
-                               Background="0.5,0.5,0.5,0.5"
-                               SelectedItemChanged="onFileListItemChanged"
-                               Template="#Crow.Templates.ScrollingListBox.goml" 
-                               ItemTemplate="#Crow.Templates.imgItemTemplate.goml">
-                       </ListBox>
-               </HorizontalStack>
-               <HorizontalStack Fit="true" HorizontalAlignment="Right">
-                       <Button Caption="Ok" MouseClick="onFileSelect"/>
-                       <Button Caption="Cancel"/>
+<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}"
+                               Background="{./Background}"
+                               MouseEnter="./onBorderMouseEnter"
+                               MouseLeave="./onBorderMouseLeave">
+       <VerticalStack Spacing="0">
+               <HorizontalStack Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9"
+                               Name="hs" Margin="2" Spacing="0" Height="Fit">
+                       <GraphicObject Width="5"/>
+                       <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
+                       <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Title}" />
+                       <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
+                               MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
+                               <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
+                                        MouseClick="./butQuitPress"/>
+                       </Border>
+                       <GraphicObject Width="5"/>
                </HorizontalStack>
+               <Container Name="Content" MinimumSize="50,50" Background="Onyx">
+                       <VerticalStack Margin="5">
+                               <TextBox Text="{²./CurrentDirectory}"/>
+                               <HorizontalStack>
+                                       <DirectoryView ShowFiles="false" Name="dv" CurrentDirectory="{²./CurrentDirectory}" SelectedItemChanged="./Tv_SelectedItemChanged"
+                                               Width="50%" Margin="1">
+                                               <Template>
+                                                       <TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}"
+                                                                       SelectedItemChanged="./onSelectedItemChanged">
+                                                               <ItemTemplate DataType="System.IO.FileInfo">
+                                                                       <HorizontalStack Focusable="true"  Height="Fit" Width="Stretched" Background="{../Background}" >
+                                                                               <Image Margin="2" Width="14" Height="14"
+                                                                                       Path="#Crow.Images.Icons.file.svg"/>
+                                                                               <Label Text="{Name}" Width="Stretched"
+                                                                                       MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+                                                                                       MouseLeave="{Background=Transparent}"/>
+                                                                       </HorizontalStack>
+                                                               </ItemTemplate>
+                                                               <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetDirectories">
+                                                                       <Expandable Caption="{Name}" >
+                                                                               <Template>
+                                                                                       <VerticalStack>
+                                                                                               <HorizontalStack Spacing="1" Height="Fit" MouseDoubleClick="./onClickForExpand"
+                                                                                                               MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+                                                                                                               MouseLeave="{Background=Transparent}">
+                                                                                                       <Container Margin="1" Width="10" Height="10" Focusable="true" MouseClick="./onClickForExpand"
+                                                                                                               MouseEnter="{Background=LightGray}"
+                                                                                                               MouseLeave="{Background=Transparent}">
+                                                                                                               <Image
+                                                                                                                       Path="{./Image}"
+                                                                                                                       Visible="{./IsExpandable}"
+                                                                                                                       SvgSub="{./IsExpanded}"/>
+                                                                                                       </Container>
+                                                                                                       <Image Margin="2" Width="14" Height="14"
+                                                                                                               Path="#Crow.Images.Icons.folder.svg"/>
+                                                                                                       <Label Text="{./Caption}"/>
+                                                                                               </HorizontalStack>
+                                                                                               <Container Name="Content" Visible="false"/>
+                                                                                       </VerticalStack>
+                                                                               </Template>
+                                                                               <HorizontalStack Height="Fit">
+                                                                                       <GraphicObject Width="12" Height="10"/>
+                                                                                       <TreeView Name="List" Height="Fit"
+                                                                                               Template="#Crow.Templates.treeList.crow" />
+                                                                               </HorizontalStack>
+                                                                       </Expandable>
+                                                               </ItemTemplate>
+                                                       </TreeView>
+                                               </Template>
+                                       </DirectoryView>
+                                       <Splitter/>
+
+                               </HorizontalStack>
+                               <TextBox Text="{../../dv.SelectedItem}"/>
+                               <HorizontalStack Fit="true" HorizontalAlignment="Right">
+                                       <Button Caption="Ok" MouseClick="onFileSelect"/>
+                                       <Button Caption="Cancel"/>
+                               </HorizontalStack>
+                       </VerticalStack>
+               </Container>
        </VerticalStack>
-</Window>
+</Border>
index 4e70ceae75cb5f0a13b0eefa712d777bbaf20ec9..199cfe9b938b3b336513d9814098832c3df4b3e8 100755 (executable)
@@ -1,13 +1,10 @@
 <?xml version="1.0"?>
-<Container Background="{./Background}" Height="{./HeightPolicy}" Width="{./WidthPolicy}">
-       <Group Height="{./HeightPolicy}" Width="{./WidthPolicy}">
-               <VerticalStack Spacing="0"
-                       Height="{./HeightPolicy}" Width="{./WidthPolicy}">
-                       <GraphicObject Height="6" Width="{./WidthPolicy}"/>
-                       <Border  CornerRadius="5" BorderWidth="1" Margin="10" Foreground="{./Foreground}"
-                               Height="{./HeightPolicy}" Width="{./WidthPolicy}">
-                               <Container Name="Content" Margin="0" MinimumSize="70,10"
-                                               Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
+<Container Background="{./Background}">
+       <Group>
+               <VerticalStack Spacing="0">
+                       <GraphicObject Height="6"/>
+                       <Border  CornerRadius="5" BorderWidth="1" Margin="10" Foreground="{./Foreground}">
+                               <Container Name="Content" Margin="0" MinimumSize="70,10"/>
                        </Border>
                </VerticalStack>
                <Label Text="{./Caption}" VerticalAlignment="Top" Left="8"
index 36f2f61e218e626d375f4edd00a2fabbb0db130a..f6d6214db11bfd5b41d1069e33dcef9f2c05041e 100755 (executable)
@@ -1,9 +1,7 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Margin="1" MinimumSize="10,10" Height="{./HeightPolicy}" Width="{./WidthPolicy}" >
-       <Scroller  Name="scroller1" Margin="1" VerticalScrolling="true"
-               Height="{./HeightPolicy}" Width="{./WidthPolicy}"
-               ValueChanged="./_scroller_ValueChanged">
-               <VerticalStack LayoutChanged="./_list_LayoutChanged"
-                       Height="Fit" Width="{./WidthPolicy}" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
+<Border BorderWidth="1" Margin="1" MinimumSize="10,10">
+       <Scroller  Name="scroller1" Margin="1" VerticalScrolling="true">
+               <VerticalStack
+                       Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
        </Scroller>
-</Border>
\ No newline at end of file
+</Border>
index d49e0b311b8e0ab9571fe4e60e7fdb48cee64576..c560043ccca50f69fd87eab617c284cf3b33886b 100644 (file)
@@ -1,3 +1,2 @@
 <?xml version="1.0"?>
-<HorizontalStack Name="ItemsContainer" Margin="0" Background="{./Background}"
-       Width="{./WidthPolicy}" Height="{./HeightPolicy}"/>
+<HorizontalStack Name="ItemsContainer" Margin="0" Background="{./Background}"/>
index c6c545f6d86de5c861013110baa4d1e92ce96306..b814e2c6b3178bc607c07d8ceb46849531edbc8c 100644 (file)
@@ -8,7 +8,6 @@
                                MouseLeave="{Foreground=Transparent}"
                                MouseDown="{Foreground=vgradient|0:Black|0.05:Gray|0.85:Gray|1:White}"
                                MouseUp="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black}"
-                               Height="{./HeightPolicy}" Width="{./WidthPolicy}"
                                MinimumSize = "60,0"
                                Foreground="Transparent"
                                Background="{./Background}">
index e9dc5148fc4c03788378801fb8642b153ebc9456..9c361ea691134bc57f5c777a703bfe7a6bdef5b6 100644 (file)
@@ -1,14 +1,14 @@
 <?xml version="1.0"?>
-<Border Height="{./HeightPolicy}" Width="{./WidthPolicy}" CornerRadius="0"
+<Border        CornerRadius="0"
                                MouseEnter="./onBorderMouseEnter"
                                MouseLeave="./onBorderMouseLeave">
-       <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}" Background="{./Background}">
-               <Border BorderWidth="0" Foreground="White" Width="{./WidthPolicy}" Height="Fit" 
+       <VerticalStack Background="{./Background}">
+               <Border BorderWidth="0" Foreground="White" Height="Fit" 
                                Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9">
-                       <HorizontalStack Name="hs" Margin="2" Spacing="1" Width="{./WidthPolicy}" Height="Fit" >
+                       <HorizontalStack Name="hs" Margin="2" Spacing="1" Height="Fit" >
                                <GraphicObject Width="5" Height="5"/>
                                <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
-                               <Label Foreground="White" Width="{./WidthPolicy}" Margin="1" TextAlignment="Center" Text="{./Title}" />
+                               <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Title}" />
                                <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
                                        MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                                        <Image Focusable="true" Name="Image" Path="#Crow.Images.Icons.exit2.svg"
@@ -17,9 +17,9 @@
                                <GraphicObject Width="5" Height="5"/>
                        </HorizontalStack>
                </Border>
-               <HorizontalStack Margin="5" Height="{./HeightPolicy}" Width="{./WidthPolicy}">
+               <HorizontalStack Margin="5">
                        <Image Name="Image" Width="20%" Height="20" Path="#Crow.Images.Icons.iconInfo.svg" />
-                       <Label Margin="5" Font="serif, 10" Height="{./HeightPolicy}" Width="80%" Text="{./Message}"
+                       <Label Margin="5" Font="serif, 10" Width="80%" Text="{./Message}"
                                TextAlignment="Left"
                                Multiline="true" />             
                </HorizontalStack>
index a36daaee367c465ceeb0a5ef4c79e36022ce1e0f..c473cecb291dab267410ba5fdf37ddce0af1a9e3 100755 (executable)
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
-<Border Background="{./Background}" BorderWidth="1" Foreground="{./Foreground}" Height="Fit" Width="{./WidthPolicy}">
-       <HorizontalStack Spacing="1" Height="Fit"  Width="{./WidthPolicy}">
+<Border Background="{./Background}" BorderWidth="1" Foreground="{./Foreground}" Height="Fit">
+       <HorizontalStack Spacing="1" Height="Fit">
                <Image Style="Icon" Margin="2"
                                Path="#Crow.Images.Icons.expandable.svg" SvgSub="{./IsPopped}"/>
-               <Label Text="{./Caption}"  Width="{./WidthPolicy}"/>
+               <Label Text="{./Caption}" />
        </HorizontalStack>
 </Border>
\ No newline at end of file
index 6d2e9de46f7a325ff99503e612f2aa23979431ea..b96eec2c550ff8e09670923fb0e9f03eeb6a0bf0 100755 (executable)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
-<HorizontalStack Style="Control" Background="{./Background}" Height="{./HeightPolicy}" Width="{./WidthPolicy}">
+<HorizontalStack Style="Control" Background="{./Background}">
        <Image Style="Icon" Path="#Crow.Images.Icons.radiobutton.svg"
                SvgSub="{./IsChecked}"/>
-       <Label Text="{./Caption}" Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+       <Label Text="{./Caption}"/>
 </HorizontalStack>
\ No newline at end of file
index 4164c30d11952173b16f2c17a1487a74d8d79f20..3cd4d0a4243541c151fbaaea3f614a64561bb145 100755 (executable)
@@ -1,7 +1,6 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="LightGray" Width="{./WidthPolicy}" Height="{./HeightPolicy}">
-       <GenericStack Orientation="{./Orientation}" Spacing="0"
-               Width="{./WidthPolicy}" Height="{./HeightPolicy}">
+<Border BorderWidth="1" Foreground="LightGray">
+       <GenericStack Orientation="{./Orientation}" Spacing="0">
                <Button MouseRepeat="true" Width="12" Height="12" MouseClick="./onScrollBack"
                        Template="#Crow.Templates.ArrowButTemplate.crow">
                        <Image Margin="1" Path="#Crow.Images.Icons.updown.svg" SvgSub="up"/>
                        Orientation="{./Orientation}"
                        Value="{./Value}"
                        Maximum="{./Maximum}"
+                       Height="{./HeightPolicy}" Width="{./WidthPolicy}"
                        LargeIncrement="{./LargeIncrement}"
                        SmallIncrement="{./SmallIncrement}"
                        Background="hgradient|0:DimGray|0.1:Gray|0.95:Gray|1:White"
-                       Width="{./WidthPolicy}" Height="{./HeightPolicy}"
                        ValueChanged="./onSliderValueChange"/>
                <Button MouseRepeat="true" Width="12" Height="12" MouseClick="./onScrollForth"
                        Template="#Crow.Templates.ArrowButTemplate.crow">
index 54e3eb482c27494e71c849b4117b6b80aed0e4c9..142665dc602dd523158a65822e5e71a38b83d985 100644 (file)
@@ -1,15 +1,13 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Height="{./HeightPolicy}" Width="{./WidthPolicy}" Background="{./Background}">
-       <HorizontalStack Margin="1" Height="{./HeightPolicy}" Width="{./WidthPolicy}" >
-               <Scroller Name="scroller1" Height="{./HeightPolicy}" Width="{./WidthPolicy}" 
-                               Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
-                               ValueChanged="./_scroller_ValueChanged">
-                       <VerticalStack Width="{./WidthPolicy}" Height="-1" MinimumSize="10,10"
-                               Name="ItemsContainer" Margin="0" VerticalAlignment="Top"
-                               LayoutChanged="./_list_LayoutChanged"/>
+<Border BorderWidth="1" Background="{./Background}">
+       <HorizontalStack Margin="1">
+               <Scroller Name="scroller1" 
+                               Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}">
+                       <VerticalStack Height="Fit" MinimumSize="10,10"
+                               Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
                </Scroller>
                <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}" 
                        Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical" 
-                       Width="14" Height="{./HeightPolicy}" />
+                       Width="14" />
        </HorizontalStack>
-</Border>
\ No newline at end of file
+</Border>
index 604c88a0aa731fbe6381ca79bdea21bf26de9a14..1151fa8d13f4df17f7004a8f887099cf7ce143f2 100755 (executable)
@@ -1,9 +1,8 @@
 <?xml version="1.0"?>
-<HorizontalStack MinimumSize="40,10" Name="hstack" Margin="0" Spacing="0"
-               Height="{./HeightPolicy}" Width="{./WidthPolicy}">
-       <Border BorderWidth="1" Height="{./HeightPolicy}" Width="80%"  Background="White" 
+<HorizontalStack MinimumSize="40,10" Name="hstack" Margin="0" Spacing="0">
+       <Border BorderWidth="1" Width="80%"  Background="White" 
                Foreground="DimGray" Margin="0">
-               <Label Foreground="DimGray" Height="{./HeightPolicy}" Width="Stretched"
+               <Label Foreground="DimGray" Width="Stretched"
                        Text="{./Value}" TextAlignment="Right" Margin="0"/>
        </Border>
        <VerticalStack MinimumSize="8,10" Width="20%" Height="Stretched" Spacing="0" Margin="0" Background="Red">
index ce2a270e917230a57e7bbc15886e6085d4e462f5..f82b79c90c404f66586c4cbec4740af68820c137 100644 (file)
@@ -1,22 +1,20 @@
 <?xml version="1.0"?>
 <GenericStack Orientation="Vertical" Spacing="0"
-               Width="{./WidthPolicy}" Height="{./HeightPolicy}"
                Background="Onyx"
                MouseEnter="{caption.Foreground=White}"
                MouseLeave="{caption.Foreground=Gray}">
        <HorizontalStack Margin="2" Left="{./TabOffset}"
                Name="TabTitle"
                HorizontalAlignment="Left"
-               Height="{../../../TabThickness}"
+               Height="{./TabThickness}"
                Width="Fit">
                <Label Name="caption" Text="{./Caption}" Foreground="Gray"/>
                <Border CornerRadius="5" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
                                        MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                        <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
-                                MouseClick="../../../../butCloseTabClick"/>
+                                MouseClick="./butCloseTabClick"/>
                </Border>
        </HorizontalStack>
-       <Container
-               Name="Content" Width="{./WidthPolicy}" Height="{./HeightPolicy}"/>
+       <Container Name="Content"/>
 </GenericStack>
 
index 377de50cc6da730487f44f87b1914d1741c4c890..c29e34c5ae5bafe9b80e781ec877e97b537eec9c 100644 (file)
@@ -1,12 +1,10 @@
 <?xml version="1.0"?>
-<HorizontalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
+<HorizontalStack>
        <Scroller  Name="scroller1" Margin="1" VerticalScrolling="true"
                Background="{./Background}"
-               Height="{./HeightPolicy}" Width="{./WidthPolicy}"
-               ScrollY="{../scrollbar1.Value}"
-               ValueChanged="./_scroller_ValueChanged">
-               <VerticalStack LayoutChanged="./_list_LayoutChanged"
-                       Height="Fit" Width="{./WidthPolicy}" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
+               ScrollY="{../scrollbar1.Value}">
+               <VerticalStack
+                       Height="Fit" Name="ItemsContainer" Margin="0" VerticalAlignment="Top"/>
        </Scroller>
        <ScrollBar
                Name="scrollbar1"
index 6b3932c14c80d1beefc84ef8a6db8b10aa474fec..7325193c9018d867b14a603c2931c19f4401e840 100755 (executable)
@@ -1,17 +1,16 @@
 <?xml version="1.0"?>
 <Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}"
                                Background="{./Background}"
-                               Height="{./HeightPolicy}" Width="{./WidthPolicy}"
                                MouseEnter="./onBorderMouseEnter"
                                MouseLeave="./onBorderMouseLeave">
-       <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}" Spacing="0">
+       <VerticalStack Spacing="0">
 <!--           <Border Name="TitleBar" BorderWidth="1" Foreground="White" Width="{./WidthPolicy}" Height="Fit"
                                Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9">-->
                        <HorizontalStack Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9"
-                                       Name="hs" Margin="2" Spacing="0" Width="{./WidthPolicy}" Height="Fit">
+                                       Name="hs" Margin="2" Spacing="0" Height="Fit">
                                <GraphicObject Width="5"/>
                                <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
-                               <Label Foreground="White" Width="{./WidthPolicy}" Margin="1" TextAlignment="Center" Text="{./Title}" />
+                               <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Title}" />
                                <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent"  Height="12" Width="12"
                                        MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
                                        <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
@@ -20,6 +19,6 @@
                                <GraphicObject Width="5"/>
                        </HorizontalStack>
 <!--           </Border>-->
-               <Container Name="Content" MinimumSize="50,50" Height="{./HeightPolicy}" Width="{./WidthPolicy}" Background="0.5,0.5,0.5,0.5"/>
+               <Container Name="Content" MinimumSize="50,50" Background="0.5,0.5,0.5,0.5"/>
        </VerticalStack>
-</Border>
\ No newline at end of file
+</Border>
index bc8cbcfb310c37e3e9f516ec532550d511db9d29..d47621afab1a6b93ac93fccd97f8f2a5509a7343 100755 (executable)
@@ -1,3 +1,3 @@
 <?xml version="1.0"?>
 <VerticalStack
-       Height="Fit" Width="{./WidthPolicy}" Name="ItemsContainer"/>
\ No newline at end of file
+       Height="Fit" Name="ItemsContainer"/>
index bd177c6e8b795e60e036d02673af050c7e921db9..afbbad24144b32db60fb7367fa5de32f0882fae6 100644 (file)
@@ -12,6 +12,19 @@ namespace Tests
 {
        class BasicTests : OpenTKGameWindow
        {
+               #region IBindable implementation
+               public object DataSource {
+                       get { return null; }
+                       set {
+                               throw new NotImplementedException ();
+                       }
+               }
+               List<Binding> bindings = new List<Binding> ();
+               public List<Binding> Bindings {
+                       get { return bindings; }
+               }
+               #endregion
+
                public BasicTests ()
                        : base(800, 600,"test: press <F3> to toogle test files")
                {
@@ -21,8 +34,9 @@ namespace Tests
                string[] testFiles;
 
                #region Test values for Binding
-               public int intValue = 25;
+               public int intValue = 500;
                DirectoryInfo curDir = new DirectoryInfo (Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
+               //DirectoryInfo curDir = new DirectoryInfo (@"/mnt/data/Images");
                public FileSystemInfo[] CurDirectory {
                        get { return curDir.GetFileSystemInfos (); }
                }
@@ -51,19 +65,26 @@ namespace Tests
                                "string1",
                                "string2",
                                "string3",
-                               "string4",
-                               "string5",
-                               "string6",
-                               "string7",
-                               "string8",
-                               "string8",
-                               "string8",
-                               "string8",
-                               "string8",
-                               "string8",
-                               "string9"
+//                             "string4",
+//                             "string5",
+//                             "string6",
+//                             "string7",
+//                             "string8",
+//                             "string8",
+//                             "string8",
+//                             "string8",
+//                             "string8",
+//                             "string8",
+//                             "string9"
                        }
                );
+               public IList<String> TestList2 {
+                       set{
+                               List2 = value;
+                               NotifyValueChanged ("TestList2", testList);
+                       }
+                       get { return List2; }
+               }
                IList<Color> testList = Color.ColorDic.ToList();
                public IList<Color> TestList {
                        set{
@@ -82,6 +103,17 @@ namespace Tests
                                NotifyValueChanged ("CurSources", curSources);
                        }
                }
+               bool boolVal = true;
+               public bool BoolVal {
+                       get { return boolVal; }
+                       set {
+                               if (boolVal == value)
+                                       return;
+                               boolVal = value;
+                               NotifyValueChanged ("BoolVal", boolVal);
+                       }
+               }
+
                #endregion
 
                void OnClear (object sender, MouseButtonEventArgs e) => TestList = null;
@@ -94,19 +126,19 @@ namespace Tests
 
                        this.KeyDown += KeyboardKeyDown1;
 
+                       //testFiles = new string [] { @"Interfaces/Unsorted/testFileDialog.crow" };
+                       //testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" };
                        testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
+                       //testFiles = new string [] { @"Interfaces/Divers/test2WayBinding.crow" };
+                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Stack", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Wrapper", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray ();
-                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.crow")).ToArray ();
-                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedControl", "*.crow")).ToArray ();
-                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedContainer", "*.crow")).ToArray ();
-                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedGroup", "*.crow")).ToArray ();
 
-                       this.Title = testFiles [idx] + ". Press <F3> to switch example.";
+                       object tc = Color.AirForceBlueRaf;
                        CrowInterface.LoadInterface(testFiles[idx]).DataSource = this;
                }
                void KeyboardKeyDown1 (object sender, OpenTK.Input.KeyboardKeyEventArgs e)
@@ -137,15 +169,16 @@ namespace Tests
                        else
                                return;
                
-                       CrowInterface.ClearInterface ();
-
-                       if (idx == testFiles.Length)
-                               idx = 0;
-                       else if (idx < 0)
-                               idx = testFiles.Length - 1;
-                       
-                       this.Title = testFiles [idx] + ". Press <F3> to cycle examples.";
                        try {
+                               CrowInterface.ClearInterface ();
+
+                               if (idx == testFiles.Length)
+                                       idx = 0;
+                               else if (idx < 0)
+                                       idx = testFiles.Length - 1;
+                               
+                               this.Title = testFiles [idx] + ". Press <F3> to cycle examples.";
+
                                GraphicObject obj = CrowInterface.LoadInterface(testFiles[idx]);
                                obj.DataSource = this;
                        } catch (Exception ex) {
@@ -201,6 +234,9 @@ namespace Tests
                {
                        base.OnUpdateFrame (e);
                        string test = e.Time.ToString ();
+                       IntValue++;
+                       if (IntValue == 1000)
+                               IntValue = 0;
                        NotifyValueChanged ("PropertyLessBinding", test);
                }
                void onNew(object sender, EventArgs e){
index a69e6f6937a281157a4f0954033487602c70b5b7..be2e16e6c23dbebcc99e9526cf822e5588953516 100755 (executable)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
 <Container Background="Onyx" Margin="10" Width="90%" Height="90%">
-       <GraphicObject Margin="10" Width="Stretched" Height="Stretched" Background="Mantis"
+       <GraphicObject Margin="10"  Background="Mantis"
                        MinimumSize="50,50"/>
 </Container>
\ No newline at end of file
index a4436aae2d03e221b2ac5c98dcd46baacc8b3512..3c53ab0119257190c23812aaf5db9e5a856ee5a1 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <Window Title="Showcase" Height="90%" Width="90%">
        <HorizontalStack >
-               <VerticalStack Width="33%" Margin="5">
+               <VerticalStack Width="30%" Margin="5">
                        <GroupBox Caption="Performance" Height="Fit">
                                <VerticalStack Width="90%" Height="Fit" Spacing="2" >
                                        <HorizontalStack Height="Fit">
                        <TextBox Text="TextBox" Multiline="true" Margin="3"/>
                        <HorizontalStack Height="Fit" Margin="5" Background="Onyx" CornerRadius="10">
                                <VerticalStack Spacing="5" Width="50%">
+                                       <CheckBox Fit="true" Caption="test"/>
                                        <CheckBox Fit="true"/>
                                        <CheckBox Fit="true"/>
-                                       <CheckBox Fit="true"/>
-                                       <CheckBox Fit="true"/>
+                                       <CheckBox Fit="true" IsChecked="true"/>
                                </VerticalStack>
                                <VerticalStack Spacing="5" Width="50%">
                                        <RadioButton Fit="true"/>
-                                       <RadioButton Fit="true"/>
+                                       <RadioButton Fit="true" IsChecked="true"/>
                                        <RadioButton Fit="true"/>
                                        <RadioButton Fit="true"/>
                                </VerticalStack>
                        <GroupBox Caption="Templated controls" Height="Fit" Margin="5">
                                <HorizontalStack Height="Fit">
                                        <VerticalStack Width="50%">
-                                               <CheckBox Template="#Tests.Interfaces.CheckBox2.imlt" Style="CheckBox2"/>
-                                               <CheckBox  Template="#Tests.Interfaces.CheckBox2.imlt" Style="CheckBox2"/>
-                                               <CheckBox  Template="#Tests.Interfaces.CheckBox2.imlt" Style="CheckBox2"/>
-                                               <CheckBox  Template="#Tests.Interfaces.CheckBox2.imlt" Style="CheckBox2"/>
+                                               <CheckBox IsChecked="true" Style="CheckBox2"/>
+                                               <CheckBox Style="CheckBox2"/>
+                                               <CheckBox Style="CheckBox2"/>
+                                               <CheckBox Style="CheckBox2"/>
                                        </VerticalStack>
                                        <Splitter/>
                                        <VerticalStack Width="50%">
-                                               <RadioButton  Template="#Tests.Interfaces.CheckBox2.imlt" Style="RadioButton2"/>
-                                               <RadioButton  Template="#Tests.Interfaces.CheckBox2.imlt" Style="RadioButton2"/>
-                                               <RadioButton  Template="#Tests.Interfaces.CheckBox2.imlt" Style="RadioButton2"/>
-                                               <RadioButton  Template="#Tests.Interfaces.CheckBox2.imlt" Style="RadioButton2"/>
+                                               <RadioButton Style="RadioButton2"/>
+                                               <RadioButton Style="RadioButton2"/>
+                                               <RadioButton Style="RadioButton2"/>
+                                               <RadioButton Style="RadioButton2"/>
                                        </VerticalStack>
                                </HorizontalStack>
                        </GroupBox>
                        </HorizontalStack>
                </VerticalStack>
                <Splitter/>
-               <VerticalStack Width="33%" Margin="5" Spacing="5">
+               <VerticalStack Width="40%" Margin="5" Spacing="5">
                        <Expandable Background="DimGray">
                                <Image Path="#Crow.Images.Icons.crow.svg"/>
                        </Expandable>
-                       <Popper Background="DimGray" PopDirection="Bottom">
+                       <Popper Background="DimGray" >
                                <Border Fit="True" Background="DimGray" CornerRadius="0" BorderWidth="1">
                                        <Image Path="#Crow.Images.Icons.crow.svg" Width="100" Height="100" Margin="10"
                                                MouseEnter="{Background=LightGray}"
                                </Border>
                        </Popper>
                        <Slider Height="10" Width="90%"/>
-                       <Container Height="Fit" Background="Onyx" Margin="2" CornerRadius="5">
+                       <Container Height="Fit" Width="200" Background="Onyx" Margin="2" CornerRadius="5">
                                <ProgressBar Background="DimGray" Height="10" Value="50"/>
                        </Container>
                        <Image Path="#Crow.Images.Icons.crow.svg" Width="60" Height="60" Background="LightGray" />
-                       <TabView Name="tabview1"
+<!--                   <TabView Name="tabview1"
                                Height="120" Orientation="Horizontal" Spacing="15">
                                <TabItem Name="TabItem1" Caption="Tab 1" Margin="0">
                                        <VerticalStack Fit="true">
                                                <TextBox Height="Stretched" Margin="5" Multiline="true" TextAlignment="TopLeft"/>
                                        </Container>
                                </TabItem>
-                       </TabView>
+                       </TabView>-->
                        <MessageBox Movable="false"/>
+                       <ColorPicker SelectedColor="{²../go.Background}" Name="colorPicker" Background="Onyx" Margin="5" Fit="True" />
+                       <GraphicObject Name="go" Width="100" Height="60" Background="DarkBlue"/>
                </VerticalStack>
                <Splitter/>
-               <VerticalStack Width="33%" Margin="5">
+               <VerticalStack Width="30%" Margin="5">
                        <Border Margin="5" Height="Fit">
                                <Label Width="Stretched" Margin="1" Text="{../../dv.SelectedItem}"/>
                        </Border>
-                       <Border Margin="5" Height="50%">
-                               <DirectoryView Name="dv" CurrentDirectory="./" Margin="1"/>
+                       <Border Margin="5" Height="30%">
+                               <DirectoryView Name="dv" CurrentDirectory="/" Margin="1"/>
                        </Border>
                        <Splitter/>
                        <ListBox Data="{TestList}" Margin="5"
                                         ItemTemplate="#Tests.Interfaces.colorItem.crow"
-                                        Template="#Crow.Templates.ScrollingListBox.goml"/>
+                                        Template="#Crow.Templates.ScrollingListBox.goml"
+                                        />
                </VerticalStack>
        </HorizontalStack>
 </Window>
\ No newline at end of file
diff --git a/Tests/Interfaces/Divers/colorPicker.crow b/Tests/Interfaces/Divers/colorPicker.crow
new file mode 100755 (executable)
index 0000000..7a0f280
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<VerticalStack>
+       <ColorPicker SelectedColor="{²../go.Background}" Name="colorPicker" Background="Onyx" Margin="5" Fit="True" />
+       <GraphicObject Name="go" Width="100" Height="60" Background="DarkBlue"/>
+       <GraphicObject Name="go" Width="100" Height="60" Background="{../colorPicker.SelectedColor}"/>
+
+</VerticalStack>
\ No newline at end of file
diff --git a/Tests/Interfaces/Divers/test2WayBinding.crow b/Tests/Interfaces/Divers/test2WayBinding.crow
new file mode 100755 (executable)
index 0000000..cf76f72
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<VerticalStack Fit="true">
+       <CheckBox IsChecked="{²BoolVal}"/>
+       <CheckBox Caption="second" IsChecked="{²BoolVal}"/>
+</VerticalStack>
\ No newline at end of file
index 74075b288f02501889badabe614f7db5e57a34df..696cd44f32e4e6f8bdb20016d243856fda0133b7 100755 (executable)
@@ -1,3 +1,4 @@
 <?xml version="1.0"?>
-<GraphicObject Margin="10" Width="50%" Height="50%" Background="Mantis"
+<GraphicObject Margin="10" Width="50%" Height="50%"
+               Background="hgradient|0:Red|0.25:Blue|0.5:Green|0.75:Yellow|1:Red"
                MinimumSize="50,50"/>
\ No newline at end of file
index e8e7164516887d041631e4959625dab7ab1762d2..9d58cda6dc5e7834de3e984cea8496a2dcb1a47b 100755 (executable)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <TreeView IsRoot="true" Name="treeView" Data="{CurDirectory}" Background="DimGray">
        <ItemTemplate DataType="System.IO.FileInfo">
-               <HorizontalStack Focusable="true"  Height="Fit" Width="Stretched" Background="{../Background}" >
+               <HorizontalStack Focusable="true"  Height="Fit" Width="Stretched"  >
                        <Image Margin="2" Width="14" Height="14"
                                Path="#Crow.Images.Icons.file.svg"/>
                        <Label Text="{Name}" Width="Stretched"
@@ -12,8 +12,8 @@
        <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos">
                <Expandable Caption="{Name}" >
                        <Template>
-                               <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
-                                       <HorizontalStack Spacing="1" Height="Fit" Width="{./WidthPolicy}"
+                               <VerticalStack>
+                                       <HorizontalStack Spacing="1" Height="Fit"
                                                        MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
                                                        MouseLeave="{Background=Transparent}">
                                                <Image Margin="2" Width="12" Height="12"
                                                        SvgSub="{./IsExpanded}"/>
                                                <Image Margin="2" Width="14" Height="14"
                                                        Path="#Crow.Images.Icons.folder.svg"/>
-                                               <Label Text="{./Caption}" Width="{./WidthPolicy}"/>
+                                               <Label Text="{./Caption}"/>
                                        </HorizontalStack>
-                                       <Container Name="Content" Visible="false"
-                                                       Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+                                       <Container Name="Content" Visible="false"/>
                                </VerticalStack>
                        </Template>
-                       <HorizontalStack Height="Fit" Width="{./WidthPolicy}">
+                       <HorizontalStack Height="Fit">
                                <GraphicObject Width="12" Height="10"/>
-                               <TreeView Name="List" Height="Fit" Width="{./WidthPolicy}">
+                               <TreeView Name="List" Height="Fit">
                                        <Template>
-                                               <VerticalStack Height="Fit" Width="{../WidthPolicy}" Name="ItemsContainer"/>
+                                               <VerticalStack Height="Fit" Name="ItemsContainer"/>
                                        </Template>
                                </TreeView>
                        </HorizontalStack>
index 8b12cb8cca65a525d925f540c90d947acbf52735..e24b399db94ccf5fdefbabedbee50cbe77597c7c 100755 (executable)
@@ -5,27 +5,9 @@
                <Label Text="{../ColorList.SelectedItem}" Background="DarkGreen"/>
                <Label Text="{Hover}" Background="DarkGreen"/>
                <Button Caption="Clear" Width="Stretched" MouseClick="OnClear"/>
-               <ListBox Name="ColorList" Data="{TestList}" Background="0.5,0.5,0.5,0.5"
-                                        HorizontalAlignment="Center" Width="Fit" Height="200" Margin="0"
-                                        ItemTemplate="#Tests.Interfaces.colorItem.crow"
-                                        Template="#Crow.Templates.ScrollingListBox.goml">
-<!--                   <Template>
-                               <Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
-                                       <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
-                                               <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
-                                                               Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
-                                                               ValueChanged="../../../_scroller_ValueChanged">
-                                                       <VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="100,100"
-                                                               Name="List" Margin="0" VerticalAlignment="Top"
-                                                               LayoutChanged="../../../../_list_LayoutChanged"/>
-                                               </Scroller>
-                                               <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
-                                                       Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
-                                                       Width="12" Height="{../../../HeightPolicy}" />
-                                       </HorizontalStack>
-                               </Border>
-                       </Template>-->
+<!--           <ListBox Name="ColorList" Data="{TestList}"  Width="200" Height="200" 
+                                        ItemTemplate="#Tests.Interfaces.colorItem.crow">                       
                </ListBox>
-               <Button Caption="Load list" Width="Stretched" MouseClick="../../../OnLoadList"/>
+               <Button Caption="Load list" Width="Stretched" MouseClick="OnLoadList"/>-->
        </VerticalStack>
 </Border>
\ No newline at end of file
index 94625915349917515fe5ac53dda9bb8e9ff9bb72..65b77d7945b78329cd351efba848fb8c214a6ab5 100755 (executable)
@@ -4,20 +4,18 @@
                <ListBox Data="{TestList}" Background="0.5,0.5,0.5,0.7"
                                         HorizontalAlignment="Center" Width="200" Height="200" Margin="5">
                        <Template>
-                               <Border BorderWidth="1" Height="{../HeightPolicy}" Width="{../WidthPolicy}">
-                                       <HorizontalStack Margin="1" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}" >
-                                               <Scroller Name="scroller1" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"
-                                                               Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
-                                                               ValueChanged="../../../_scroller_ValueChanged">
-                                                       <VerticalStack Width="{../../../../WidthPolicy}" Height="Fit" MinimumSize="10,10"
+                               <Border BorderWidth="1">
+                                       <HorizontalStack Margin="1">
+                                               <Scroller Name="scroller1"
+                                                               Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}">
+                                                       <VerticalStack Height="Fit" MinimumSize="10,10"
                                                                Name="ItemsContainer" Margin="0"
                                                                VerticalAlignment="Top"
-                                                               HorizontalAlignment="Left"
-                                                               LayoutChanged="../../../../_list_LayoutChanged"/>
+                                                               HorizontalAlignment="Left"/>
                                                </Scroller>
                                                <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}"
                                                        Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
-                                                       Width="14" Height="{../../../HeightPolicy}" />
+                                                       Width="14"/>
                                        </HorizontalStack>
                                </Border>
                        </Template>
@@ -28,7 +26,7 @@
                                                        MouseEnter="{Background=hgradient|0:DarkRed|1:Transparent}"
                                                        MouseLeave="{Background=Transparent}">
                                        <GraphicObject Height="12" Width="20" Background="{}" Margin="0" CornerRadius="3"/>
-                                       <Label Text="{Name}" Margin="0" Width="Stretched"/>
+                                       <Label Text="{}" Margin="0" Width="Stretched"/>
                                </HorizontalStack>
                        </ItemTemplate>
                </ListBox>
@@ -37,4 +35,4 @@
                        <Button Caption="Clear" MouseClick="OnClear"/>
                </HorizontalStack>
        </VerticalStack>
-</Border>
\ No newline at end of file
+</Border>
diff --git a/Tests/Interfaces/TemplatedControl/testScrollbar.crow b/Tests/Interfaces/TemplatedControl/testScrollbar.crow
new file mode 100755 (executable)
index 0000000..c494e34
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<Group Name="TopContainer" Width="400" Height="400"
+       Focusable="True" Background="Gray">
+       <ScrollBar Height="Stretched" Orientation="Vertical" Width="16" Maximum="100"/>
+</Group>
\ No newline at end of file
diff --git a/Tests/Interfaces/TemplatedControl/testScrollbar.goml b/Tests/Interfaces/TemplatedControl/testScrollbar.goml
deleted file mode 100755 (executable)
index c494e34..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<Group Name="TopContainer" Width="400" Height="400"
-       Focusable="True" Background="Gray">
-       <ScrollBar Height="Stretched" Orientation="Vertical" Width="16" Maximum="100"/>
-</Group>
\ No newline at end of file
diff --git a/Tests/Interfaces/TemplatedControl/testSpinner.crow b/Tests/Interfaces/TemplatedControl/testSpinner.crow
new file mode 100755 (executable)
index 0000000..4efd587
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<VerticalStack Name="TopContainer" Width="400" Height="Fit"
+       Margin="20" Background="DarkGray">
+
+       <HorizontalStack Fit="true" Margin="5" Background="SkyBlue">
+               <Spinner Value="{IntValue}" ValueChanged="onSpinnerValueChange"/>
+               <Spinner Value="5"/>
+               <Spinner Value="5"/>
+               <Button/>
+       </HorizontalStack>
+</VerticalStack>
\ No newline at end of file
diff --git a/Tests/Interfaces/TemplatedControl/testSpinner.goml b/Tests/Interfaces/TemplatedControl/testSpinner.goml
deleted file mode 100755 (executable)
index 4efd587..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<VerticalStack Name="TopContainer" Width="400" Height="Fit"
-       Margin="20" Background="DarkGray">
-
-       <HorizontalStack Fit="true" Margin="5" Background="SkyBlue">
-               <Spinner Value="{IntValue}" ValueChanged="onSpinnerValueChange"/>
-               <Spinner Value="5"/>
-               <Spinner Value="5"/>
-               <Button/>
-       </HorizontalStack>
-</VerticalStack>
\ No newline at end of file
index 1cd05fd74790842f108d1a352476fc0acbc9daf6..9dddcebb1eceb396d307b5b634e8be06fb6251a7 100755 (executable)
@@ -3,10 +3,10 @@
        <Label Text="{../../Caption}" Width="{../../WidthPolicy}"/>
        <Container Name="Content" Visible="false" Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"/>
 </VerticalStack>-->
-<Group BorderWidth="1" Foreground="LightGray" Height="{../HeightPolicy}" Width="{../WidthPolicy}" 
+<Group BorderWidth="1" Foreground="LightGray" 
                MouseClick="../onMouseClick">
-       <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
-               <Label Text="{../../../Caption}" Width="{../../../WidthPolicy}"/>
-               <Container Name="Content" Visible="false" Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
+       <VerticalStack>
+               <Label Text="{../../../Caption}"/>
+               <Container Name="Content" Visible="false"/>
        </VerticalStack>
 </Group>
\ No newline at end of file
diff --git a/Tests/Interfaces/Unsorted/testFileDialog.crow b/Tests/Interfaces/Unsorted/testFileDialog.crow
new file mode 100644 (file)
index 0000000..fd54b55
--- /dev/null
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<FileDialog Title="Open File" CurrentDirectory="/"/>
+
diff --git a/Tests/Interfaces/Unsorted/testFileDialog.goml b/Tests/Interfaces/Unsorted/testFileDialog.goml
deleted file mode 100644 (file)
index 715ff2f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0"?>
-<FileDialog Width="500" Height="300"/>
-
index 61ee12a44d01d5c15b1bb979017005673b2ed2f9..ca59c17feb74fcd309edbe17de8330bf793d1589 100755 (executable)
@@ -1,3 +1,2 @@
 <?xml version="1.0"?>
-<VerticalStack
-       Height="Fit" Width="{../WidthPolicy}" Name="List"/>
\ No newline at end of file
+<VerticalStack Height="Fit" Name="List"/>
\ No newline at end of file
index 1095bd6a233f2f52f94bd1e96182810f47358e71..6e460322e919253a39507a51b5792e2e7a02b0ce 100644 (file)
@@ -11,7 +11,7 @@
     <StartupObject>Tests.BasicTests</StartupObject>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ReleaseVersion>0.4</ReleaseVersion>
+    <ReleaseVersion>0.5</ReleaseVersion>
     <OutputPath>$(SolutionDir)build/$(Configuration)</OutputPath>
     <IntermediateOutputPath>$(SolutionDir)build/obj/$(Configuration)</IntermediateOutputPath>
     <CustomCommands>
@@ -19,7 +19,6 @@
         <Command type="Execute" command="${TargetName}" workingdir="${SolutionDir}/build/${ProjectConfigName}" />
       </CustomCommands>
     </CustomCommands>
-    <SynchReleaseVersion>false</SynchReleaseVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="packages.config" />
-    <None Include="Interfaces\Unsorted\testFileDialog.goml">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
     <None Include="Interfaces\Unsorted\testTypeViewer.goml">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="Interfaces\TemplatedControl\testRadioButton.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
-    <None Include="Interfaces\TemplatedControl\testScrollbar.goml">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
-    <None Include="Interfaces\TemplatedControl\testSpinner.goml">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
     <None Include="Interfaces\TemplatedContainer\test_Listbox.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="Interfaces\TemplatedGroup\2.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\TemplatedControl\testScrollbar.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\TemplatedControl\testSpinner.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\Divers\colorPicker.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\Divers\test2WayBinding.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="Interfaces\Unsorted\testFileDialog.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />
index a270b40e21eb07bffad823eca4e1b1d7c1a5545d..6eb186026ef8767369a46fe74476e107da45b968 100644 (file)
@@ -12,11 +12,13 @@ FpsDisp {
        Background = Teal;
 }
 CheckBox2 {
+       Template= #Tests.Interfaces.CheckBox2.imlt;
        Background = Onyx;
        Checked={Background=Mantis;Font=droid bold, 10};
        Unchecked = {Background=Onyx;Font=droid,10};
 }
 RadioButton2 {
+       Template=#Tests.Interfaces.CheckBox2.imlt;
        Background = Onyx;
        Checked = {Background=Mantis;Font=droid bold, 10};
        Unchecked = {Background=Onyx;Font=droid,10};
index ffcd8d45a73582b4dfbbfd70a6b49c38142e2d6e..ae8c63c26f223a7b4ae4d5977d1709b33ca56650 100755 (executable)
@@ -1,3 +1,3 @@
 <?xml version="1.0"?>
 <Label Text="{../Caption}" Style="#Tests.ui.LabelButton.style"
-       Height="Fit" Width="{../WidthPolicy}"/>
+       Height="Fit"/>
index 824ad7042abb844779194cf8bc10e6dcaf2c3d00..64c97d55e63cab523334f419feb42d27883f71e0 100755 (executable)
@@ -1,11 +1,10 @@
 <?xml version="1.0"?>
-<Border BorderWidth="1" Foreground="White" CornerRadius="15"   
-       Height="{../HeightPolicy}" Width="{../WidthPolicy}"
+<Border BorderWidth="1" Foreground="White" CornerRadius="15"
        MouseEnter="../onBorderMouseEnter"
        MouseLeave="../onBorderMouseLeave"
        Background="vgradient|0:0.6,0.6,0.6,0.9|1:0.4,0.4,0.4,0.6">
-       <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}">
-               <HorizontalStack Height="Fit" Width="{../../../WidthPolicy}">
+       <VerticalStack>
+               <HorizontalStack Height="Fit">
                        <Label Margin="2" Font="{../../../../Font}" Text="{../../../../Title}" Width="Stretched"/>
                        <Border HorizontalAlignment="Right" Margin="0" VerticalAlignment="Top"
                                CornerRadius="6" BorderWidth="1" Foreground="Transparent"
@@ -15,7 +14,6 @@
                                         MouseClick="../../../../../butQuitPress"/>
                        </Border>
                </HorizontalStack>
-               <Container Name="Content"
-                       Height="{../../../HeightPolicy}" Width="{../../../WidthPolicy}"/>
+               <Container Name="Content"/>
        </VerticalStack>
 </Border>
\ No newline at end of file
diff --git a/crow.key b/crow.key
new file mode 100644 (file)
index 0000000..b69aa3e
Binary files /dev/null and b/crow.key differ
index e928f37722e8cfb7ed93e3aa2a43ea0f85b528a3..b76de6235e118145963bc458d3140cd05874c369 100644 (file)
@@ -10,6 +10,9 @@ using System.Diagnostics;
 
 namespace Crow
 {
+       /// <summary>
+       /// Universal Color structure
+       /// </summary>
        public struct Color
     {
                #region CTOR
@@ -1068,5 +1071,34 @@ namespace Crow
         {
             return (Color)s;
         }
+               public static Color FromHSV(double _h, double _v = 1.0, double _s = 1.0){
+                       Color c = Color.Black;
+
+                       if (_s == 0) {//HSV from 0 to 1
+                               c.R = _v;
+                               c.G = _v;
+                               c.B = _v;
+                       }else{
+                               double var_h = _h * 6.0;
+
+                               if (var_h == 6.0)
+                                       var_h = 0;      //H must be < 1
+                               double var_i = Math.Floor( var_h );     //Or ... var_i = floor( var_h )
+                               double var_1 = _v * ( 1.0 - _s );
+                               double var_2 = _v * (1.0 - _s * (var_h - var_i));
+                               double var_3 = _v * (1.0 - _s * (1.0 - (var_h - var_i)));
+
+                               if (var_i == 0.0) {
+                                       c.R = _v;
+                                       c.G = var_3;
+                                       c.B = var_1;
+                               }else if ( var_i == 1.0 ) { c.R = var_2 ; c.G = _v     ; c.B = var_1; }
+                               else if ( var_i == 2 ) { c.R = var_1 ; c.G = _v     ; c.B = var_3; }
+                               else if ( var_i == 3 ) { c.R = var_1 ; c.G = var_2 ; c.B = _v;     }
+                               else if ( var_i == 4 ) { c.R = var_3 ; c.G = var_1 ; c.B = _v;    }
+                               else                   { c.R = _v     ; c.G = var_1 ; c.B = var_2; }
+                       }
+                       return c;
+               }
     }
 }
index 2a472f3ce81ea322525652d7a3652f94b06cf5d1..f837e484e796867c0cda0f4ec50e2a1bfb14bca5 100644 (file)
@@ -56,7 +56,6 @@ namespace Crow
                        GetMethod("CreateDelegate", new Type[] { typeof(Type), typeof(object)});
                internal static MethodInfo miObjToString = typeof(object).GetMethod("ToString");
 
-
                internal static Type ehTypeDSChange = eiDSChange.EventHandlerType;
                internal static FieldInfo fi_ehTypeDSChange  = typeof(CompilerServices).GetField("ehTypeDSChange", BindingFlags.Static | BindingFlags.NonPublic);
 
@@ -338,7 +337,7 @@ namespace Crow
                                        if (b.Target.Member != null)
                                                il.Emit (OpCodes.Ldstr, b.Target.Member.Name);
                                        else
-                                               il.Emit (OpCodes.Ldstr, b.Expression.Split ('/').LastOrDefault ());
+                                               il.Emit (OpCodes.Ldstr, b.Expression.Split ('/').LastOrDefault ().Split('.').LastOrDefault());
                                        il.Emit (OpCodes.Ldc_I4_4);//StringComparison.Ordinal
                                        il.Emit (OpCodes.Callvirt, stringEquals);
                                        il.Emit (OpCodes.Brtrue, jumpTable [i]);
@@ -392,7 +391,7 @@ namespace Crow
                                                il.Emit (OpCodes.Callvirt, tostring.Method);
                                        } else if (!sourceValueType.IsValueType)
                                                il.Emit (OpCodes.Castclass, sourceValueType);
-                                       else if (b.Source.Property.PropertyType != sourceValueType) {
+                                       else if (b.Source.Property.PropertyType != sourceValueType && b.Source.Property.PropertyType != typeof(object)) {
                                                il.Emit (OpCodes.Callvirt, CompilerServices.GetConvertMethod (b.Source.Property.PropertyType));
                                        } else
                                                il.Emit (OpCodes.Unbox_Any, b.Source.Property.PropertyType);
@@ -411,8 +410,13 @@ namespace Crow
                                il.Emit (OpCodes.Pop);
                                il.Emit (OpCodes.Ret);
 
-                               Delegate del = dm.CreateDelegate (eiValueChange.EventHandlerType, Bindings [0].Source.Instance);
-                               miValueChangeAdd.Invoke (grouped [0].Target.Instance, new object [] { del });
+                               try {
+                                       Delegate del = dm.CreateDelegate (eiValueChange.EventHandlerType, Bindings [0].Source.Instance);
+                                       miValueChangeAdd.Invoke (grouped [0].Target.Instance, new object [] { del });
+
+                               } catch (Exception ex) {                                        
+                                       Debug.WriteLine ("Binding Delegate error for {0}: \n{1}", Bindings [0].Source.Instance, ex.ToString ());
+                               }
                        }
                }
 
@@ -692,10 +696,11 @@ namespace Crow
                        }
                        if (tmp != null)
                                return tmp;
-                       if (dstType == typeof(string))
+                       if (dstType == typeof(string) || dstType == typeof(object))//TODO:object should be allowed to return null and not ""
                                return "";
                        if (dstType.IsValueType)
                                return Activator.CreateInstance (dstType);
+                       
                        return null;
                }
                public static void emitGetInstance (ILGenerator il, NodeAddress orig, NodeAddress dest){
@@ -744,9 +749,20 @@ namespace Crow
                /// Emit conversion from orig type to dest type
                /// </summary>
                public static void emitConvert(ILGenerator il, Type origType, Type destType){
-                       if (destType == typeof(string))
+                       if (destType == typeof(object))
+                               return;
+                       if (destType == typeof(string)) {
+                               System.Reflection.Emit.Label emitNullStr = il.DefineLabel ();
+                               System.Reflection.Emit.Label endConvert = il.DefineLabel ();
+                               il.Emit (OpCodes.Dup);
+                               il.Emit (OpCodes.Brfalse, emitNullStr);
                                il.Emit (OpCodes.Callvirt, CompilerServices.miObjToString);
-                       else if (origType.IsValueType) {
+                               il.Emit (OpCodes.Br, endConvert);
+                               il.MarkLabel (emitNullStr);
+                               il.Emit (OpCodes.Pop);//remove null string from stack
+                               il.Emit (OpCodes.Ldstr, "");//replace with empty string
+                               il.MarkLabel (endConvert);
+                       }else if (origType.IsValueType) {
                                if (destType != origType) {
                                        il.Emit (OpCodes.Callvirt, CompilerServices.GetConvertMethod (destType));
                                }else
@@ -840,6 +856,10 @@ namespace Crow
                public static void RemoveEventHandlerByName(object instance, string eventName, string delegateName){
                        Type t = instance.GetType ();
                        FieldInfo fiEvt = CompilerServices.GetEventHandlerField (t, eventName);
+                       if (fiEvt == null) {
+                               Debug.WriteLine ("RemoveHandlerByName: Event '" + eventName + "' not found in " + instance);
+                               return;
+                       }
                        EventInfo eiEvt = t.GetEvent (eventName);
                        MulticastDelegate multiDel = fiEvt.GetValue (instance) as MulticastDelegate;
                        if (multiDel != null) {
@@ -872,7 +892,13 @@ namespace Crow
                                }
                        }
                }
-
+               internal static Delegate createDel(Type eventType, object instance, string method){
+                       Type t = instance.GetType ();
+                       MethodInfo mi = t.GetMethod (method);
+                       if (mi == null)
+                               return null;
+                       return Delegate.CreateDelegate (eventType, instance, mi);
+               }
                public static Delegate compileDynEventHandler(EventInfo sourceEvent, string expression, NodeAddress currentNode = null){
                        #if DEBUG_BINDING
                        Debug.WriteLine ("\tCompile Event {0}: {1}", sourceEvent.Name, expression);
@@ -1040,9 +1066,12 @@ namespace Crow
                                        throw new Exception ("Binding error: try to bind outside IML source");
                                ptr -= levelUp;
                        }
-                       Node[] targetNode = new Node[ptr+1];
-                       Array.Copy (sourceAddr.ToArray (), targetNode, ptr + 1);
-                       return new NodeAddress (targetNode);
+                       //TODO:change Template special address identified with Nodecount = 0 to something not using array count to 0,
+                       //here linq is working without limits checking in compile option
+                       //but defining a 0 capacity array with limits cheking enabled, cause 'out of memory' error
+                       return new NodeAddress (sourceAddr.Take(ptr+1).ToArray());//[ptr+1];
+                       //Array.Copy (sourceAddr.ToArray (), targetNode, ptr + 1);
+                       //return new NodeAddress (targetNode);
                }
 
        }
index aac12e16c2dfb9f73d9c965851c5d06ea51f6f82..46f8cdab6d0ce7056305fe45f717a6cf5abb5d41 100644 (file)
@@ -11,7 +11,7 @@ namespace Crow
         Vertical
     }
 
-       public enum Alignment : byte
+       public enum Alignment 
     {
         Top = 0x01,
         Left = 0x02,
diff --git a/src/GraphicObjects/ColorPicker.cs b/src/GraphicObjects/ColorPicker.cs
new file mode 100644 (file)
index 0000000..cc8dfac
--- /dev/null
@@ -0,0 +1,223 @@
+//
+//  ColorPicker.cs
+//
+//  Author:
+//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+//  Copyright (c) 2016 jp
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace Crow
+{
+       public class ColorPicker : TemplatedControl
+       {
+               public ColorPicker () : base ()
+               {
+               }
+
+               const double div = 255.0;
+               const double colDiv = 1.0 / div;
+
+               Color curColor;
+               double h,s,v;
+
+               [XmlAttributeAttribute()]
+               public virtual double R {
+                       get { return Math.Round(curColor.R * div); }
+                       set {
+                               if (R == value)
+                                       return;                         
+                               curColor.R = value * colDiv;
+                               NotifyValueChanged ("R", R);
+                               hsvFromRGB ();
+                               notifyCurColorHasChanged ();
+                       }
+               }
+               [XmlAttributeAttribute()]
+               public virtual double G {
+                       get { return Math.Round(curColor.G * div); }
+                       set {
+                               if (G == value)
+                                       return;
+                               curColor.G = value * colDiv;
+                               NotifyValueChanged ("G", G);
+                               notifyCurColorHasChanged ();
+                               hsvFromRGB ();
+                       }
+               }
+               [XmlAttributeAttribute()]
+               public virtual double B {
+                       get { return Math.Round(curColor.B * div); }
+                       set {
+                               if (B == value)
+                                       return;
+                               curColor.B = value * colDiv;
+                               NotifyValueChanged ("B", B);
+                               notifyCurColorHasChanged ();
+                               hsvFromRGB ();
+                       }
+               }
+               [XmlAttributeAttribute()]
+               public virtual double A {
+                       get { return Math.Round(curColor.A * div); }
+                       set {
+                               if (A == value)
+                                       return;
+                               curColor.A = value * colDiv;
+                               NotifyValueChanged ("A", A);
+                               notifyCurColorHasChanged ();
+                               hsvFromRGB ();
+                       }
+               }
+               [XmlAttributeAttribute()]
+               public virtual double H {
+                       get { return Math.Round (h, 3); }
+                       set {
+                               if (H == value)
+                                       return;
+                               h = value;
+                               NotifyValueChanged ("H", H);
+                               rgbFromHSV ();
+                       }
+               }
+               [XmlAttributeAttribute()]
+               public virtual double S {
+                       get { return Math.Round (s, 2); }
+                       set {
+                               if (s == value)
+                                       return;
+                               s = value;
+                               NotifyValueChanged ("S", S);
+                               rgbFromHSV ();
+                       }
+               }
+               [XmlAttributeAttribute()]
+               public virtual double V {
+                       get { return Math.Round (v, 2); }
+                       set {
+                               if (v == value)
+                                       return;
+                               v = value;
+                               NotifyValueChanged ("V", V);
+                               rgbFromHSV ();
+                       }
+               }
+
+               [XmlAttributeAttribute]
+               public virtual Fill SelectedColor {
+                       get { return new SolidColor(curColor); }
+                       set {
+                               Color c = (value as SolidColor).color;
+                               if (curColor == c)
+                                       return;
+                               curColor = c;
+                               notifyCurColorHasChanged ();
+                               notifyRGBAHasChanged ();
+                               hsvFromRGB ();
+                       }
+               }
+
+               void notifyCurColorHasChanged(){
+                       NotifyValueChanged ("SelectedColor", SelectedColor);
+                       string n = curColor.ToString ();
+                       if (char.IsLetter(n[0]))
+                               NotifyValueChanged ("SelectedColorName", n);
+                       else
+                               NotifyValueChanged ("SelectedColorName", "-");
+                       NotifyValueChanged ("HexColor", ((int)R).ToString ("X2") + ((int)G).ToString ("X2") + ((int)B).ToString ("X2") + ((int)A).ToString ("X2"));
+               }
+               void notifyRGBAHasChanged(){
+                       NotifyValueChanged ("R", R);
+                       NotifyValueChanged ("G", G);
+                       NotifyValueChanged ("B", B);
+                       NotifyValueChanged ("A", A);
+               }
+               void notifyHSVHasChanged(){
+                       NotifyValueChanged ("H", H);
+                       NotifyValueChanged ("S", S);
+                       NotifyValueChanged ("V", V);
+               }
+               void hsvFromRGB(){
+                       Color c = curColor;
+                       double min = Math.Min (c.R, Math.Min (c.G, c.B));       //Min. value of RGB
+                       double max = Math.Max (c.R, Math.Max (c.G, c.B));       //Max. value of RGB
+                       double diff = max - min;                                                        //Delta RGB value
+
+                       v = max;
+
+                       if ( diff == 0 )//This is a gray, no chroma...
+                       {
+                               h = 0;
+                               s = 0;
+                       }else{//Chromatic data...                               
+                               s = diff / max;
+
+                               double diffR = (((max - c.R) / 6.0) + (diff / 2.0)) / diff;
+                               double diffG = (((max - c.G) / 6.0) + (diff / 2.0)) / diff;
+                               double diffB = (((max - c.B) / 6.0) + (diff / 2.0)) / diff;
+
+                               if (c.R == max)
+                                       h = diffB - diffG;
+                               else if (c.G == max)
+                                       h = (1.0 / 3.0) + diffR - diffB;
+                               else if (c.B == max)
+                                       h = (2.0 / 3.0) + diffG - diffR;
+
+                               if (h < 0)
+                                       h += 1;
+                               if (h > 1)
+                                       h -= 1;
+
+                       }
+                       notifyHSVHasChanged ();
+               }
+               void rgbFromHSV(){
+                       Color c = Color.Black;
+
+                       if (s == 0) {//HSV from 0 to 1
+                               c.R = v;
+                               c.G = v;
+                               c.B = v;
+                       }else{
+                               double var_h = h * 6.0;
+
+                               if (var_h == 6.0)
+                                       var_h = 0;      //H must be < 1
+                               double var_i = Math.Floor( var_h );     //Or ... var_i = floor( var_h )
+                               double var_1 = v * ( 1.0 - s );
+                               double var_2 = v * (1.0 - s * (var_h - var_i));
+                               double var_3 = v * (1.0 - s * (1.0 - (var_h - var_i)));
+
+                               if (var_i == 0.0) {
+                                       c.R = v;
+                                       c.G = var_3;
+                                       c.B = var_1;
+                               }else if ( var_i == 1.0 ) { c.R = var_2 ; c.G = v     ; c.B = var_1; }
+                               else if ( var_i == 2 ) { c.R = var_1 ; c.G = v     ; c.B = var_3; }
+                               else if ( var_i == 3 ) { c.R = var_1 ; c.G = var_2 ; c.B = v;     }
+                               else if ( var_i == 4 ) { c.R = var_3 ; c.G = var_1 ; c.B = v;    }
+                               else                   { c.R = v     ; c.G = var_1 ; c.B = var_2; }
+                       }
+                               
+                       curColor = c;
+                       notifyCurColorHasChanged ();
+                       notifyRGBAHasChanged ();
+               }
+       }
+}
+
diff --git a/src/GraphicObjects/ColorSelector.cs b/src/GraphicObjects/ColorSelector.cs
new file mode 100644 (file)
index 0000000..13a588c
--- /dev/null
@@ -0,0 +1,89 @@
+//
+//  ColorPicker.cs
+//
+//  Author:
+//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+//  Copyright (c) 2016 jp
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace Crow
+{
+       public class ColorSelector : GraphicObject
+       {
+               public ColorSelector (): base()
+               {
+               }
+
+               const double div = 255.0;
+               const double colDiv = 1.0 / div;
+               protected Point mousePos;
+
+               public override void onMouseMove (object sender, MouseMoveEventArgs e)
+               {
+                       base.onMouseMove (sender, e);
+                       if (CurrentInterface.Mouse.LeftButton == ButtonState.Released)
+                               return;
+                       updateMouseLocalPos (e.Position);
+               }
+               public override void onMouseDown (object sender, MouseButtonEventArgs e)
+               {
+                       base.onMouseDown (sender, e);
+                       if (e.Button == MouseButton.Left)
+                               updateMouseLocalPos (e.Position);
+               }
+
+               protected virtual void updateMouseLocalPos(Point mPos){
+                       Rectangle r = ScreenCoordinates (Slot);
+                       Rectangle cb = ClientRectangle;
+                       mousePos = mPos - r.Position;
+
+                       mousePos.X = Math.Max(cb.X, mousePos.X);
+                       mousePos.X = Math.Min(cb.Right-1, mousePos.X);
+                       mousePos.Y = Math.Max(cb.Y, mousePos.Y);
+                       mousePos.Y = Math.Min(cb.Bottom-1, mousePos.Y);
+               }
+//             virtual protected void updateColorFromPicking(bool redraw = true){
+//                     SelectedColor = new SolidColor(getPixelAt(mousePos.X, mousePos.Y));
+//
+//                     updateHSV ();
+//
+//                     NotifyValueChanged ("R", R);
+//                     NotifyValueChanged ("G", G);
+//                     NotifyValueChanged ("B", B);
+//                     NotifyValueChanged ("A", A);
+//
+//                     if (redraw)
+//                             RegisterForRedraw ();
+//             }
+//
+//             protected Color getPixelAt(int x, int y){
+//                     if (bmp == null)
+//                             return Color.Transparent;
+//
+//                     int ptr = y * Slot.Width * 4 + x * 4;
+//
+//                     return new Color(
+//                             (double)bmp[ptr + 2] * colDiv,
+//                             (double)bmp[ptr + 1] * colDiv,
+//                             (double)bmp[ptr] * colDiv,
+//                             (double)bmp[ptr + 3] * colDiv);
+//             }
+       }
+}
+
index 78a81f3fa606f6c3bfa510fd3e6c2ae2c8669c47..56d44428414826c9f91102913116c7270937a757 100644 (file)
@@ -32,6 +32,10 @@ namespace Crow
                        OldDataSource = oldDataSource;
                        NewDataSource = newDataSource;
                }
+               public override string ToString ()
+               {
+                       return string.Format ("DSChangeEA: {0} => {1}", OldDataSource, NewDataSource);
+               }
        }
 }
 
index 4e29621ef09213f31beb52c1c5936da57e560db6..5ed46f3e12710fc21f183475ad6e11988e38dc28 100644 (file)
@@ -52,7 +52,7 @@ namespace Crow
                                NotifyValueChanged ("SelectedItem", _selectedItem);
                        }
                }
-               [XmlAttributeAttribute()][DefaultValue(false)]
+               [XmlAttributeAttribute()][DefaultValue(true)]
                public virtual bool ShowFiles {
                        get { return showFiles; }
                        set {
@@ -76,8 +76,10 @@ namespace Crow
                }
                [XmlIgnore]public FileSystemInfo[] FileSystemEntries {
                        get { 
-                               return showFiles ? new DirectoryInfo (CurrentDirectory).GetFileSystemInfos ():
-                                       new DirectoryInfo(currentDirectory).GetDirectories(); 
+                               return string.IsNullOrEmpty(CurrentDirectory) ? null :
+                                       showFiles ?                                     
+                                       new DirectoryInfo (CurrentDirectory).GetFileSystemInfos () :
+                                       new DirectoryInfo(CurrentDirectory).GetDirectories(); 
                        }
                }
                public void onSelectedItemChanged (object sender, SelectionChangeEventArgs e){
index fe9519afe47cb2c0ffd21b060662a2290ed614b0..38506de8404488bc943d95cffb2a13a3bd5e9316 100644 (file)
@@ -45,14 +45,12 @@ namespace Crow
                public event EventHandler Collapse;
                #endregion
 
-               #region GraphicObject overrides
-               public override void onMouseClick (object sender, MouseButtonEventArgs e)
+               public BooleanTestOnInstance GetIsExpandable;
+
+               public void onClickForExpand (object sender, MouseButtonEventArgs e)
                {
-                       if (this.HasFocus)
-                               IsExpanded = !IsExpanded;
-                       base.onMouseClick (sender, e);
+                       IsExpanded = !IsExpanded;
                }
-               #endregion
 
                public override GraphicObject Content {
                        get {
@@ -72,7 +70,7 @@ namespace Crow
                }
 
                #region Public properties
-               [XmlAttributeAttribute()][DefaultValue("Expandable")]
+               [XmlAttributeAttribute][DefaultValue("Expandable")]
                public string Caption {
                        get { return caption; } 
                        set {
@@ -82,7 +80,7 @@ namespace Crow
                                NotifyValueChanged ("Caption", caption);
                        }
                }        
-               [XmlAttributeAttribute()][DefaultValue("#Crow.Images.Icons.expandable.svg")]
+               [XmlAttributeAttribute][DefaultValue("#Crow.Images.Icons.expandable.svg")]
                public string Image {
                        get { return image; } 
                        set {
@@ -92,7 +90,7 @@ namespace Crow
                                NotifyValueChanged ("Image", image);
                        }
                }     
-               [XmlAttributeAttribute()][DefaultValue(false)]
+               [XmlAttributeAttribute][DefaultValue(false)]
         public bool IsExpanded
         {
                        get { return _isExpanded; }
@@ -103,7 +101,9 @@ namespace Crow
 
                                _isExpanded = value;
 
-                               if (!HasContent)
+                               bool isExp = IsExpandable;
+                               NotifyValueChanged ("IsExpandable", isExp);
+                               if (!(HasContent & isExp))
                                        _isExpanded = false;
 
                                NotifyValueChanged ("IsExpanded", _isExpanded);
@@ -117,7 +117,16 @@ namespace Crow
                [XmlIgnore]public bool HasContent {
                        get { return _contentContainer == null ? false : _contentContainer.Child != null; }
                }
-
+               [XmlIgnore]public bool IsExpandable {
+                       get {
+                               try {
+                                       return GetIsExpandable == null ? true : GetIsExpandable (this); 
+                               } catch (Exception ex) {
+                                       System.Diagnostics.Debug.WriteLine ("Not Expandable error: " + ex.ToString ());
+                                       return false;
+                               }               
+                       }
+               }
                #endregion
 
                public virtual void onExpand(object sender, EventArgs e)
index 16a60a4f0f62c59437b5030b36b821f08bf279ec..543b27cc218d7ddb0edd21172e856ddff4e1d56c 100644 (file)
@@ -29,112 +29,103 @@ using System.Text.RegularExpressions;
 
 namespace Crow
 {
-       public class FileDialog: IValueChange
+       public class FileDialog: Window
        {
-               #region IValueChange implementation
-               public event EventHandler<ValueChangeEventArgs> ValueChanged;
-               public virtual void NotifyValueChanged(string MemberName, object _value)
-               {
-                       ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value));                 
-               }
-               #endregion
-
-               Window window;
-               DirectoryInfo currentDir;
-               FileInfo selectedFile;
-               string searchPattern = "*";
+               string searchPattern, curDirectory;
 
                #region CTOR
-               public FileDialog ()
+               public FileDialog () : base()
                {
-                       currentDir = new DirectoryInfo (Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
-                       //window = Interface..Load("#Crow.Templates.FileDialog.goml") as Window;
-                       window.DataSource = this;
                }
                #endregion
-
-               public string CurrentPath {
-                       get { return currentDir.FullName; }
+               //[DefaultValue(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))]
+               [XmlAttributeAttribute][DefaultValue("/home")]
+               public virtual string CurrentDirectory {
+                       get { return curDirectory; }
                        set {
-                               currentDir = new DirectoryInfo (value);
-                               NotifyValueChanged ("CurrentPath", CurrentPath);
+                               if (curDirectory == value)
+                                       return;
+                               curDirectory = value; 
+                               NotifyValueChanged ("CurrentDirectory", curDirectory);
+
                        }
-               }
-               public string SearchPattern {
+               } 
+
+               [XmlAttributeAttribute()][DefaultValue("*")]
+               public virtual string SearchPattern {
                        get { return searchPattern; }
                        set {
-                               searchPattern = value;
-                               NotifyValueChanged ("Files", Files);
-                       }
-               }
+                               if (searchPattern == value)
+                                       return;
+                               searchPattern = value; 
+                               NotifyValueChanged ("SearchPattern", searchPattern);
 
-               public DirectoryInfo[] Directories
-               {
-                       get {
-                               //currentDir.GetDirectories
-                               List<DirectoryInfo> tmp = currentDir.GetDirectories ().Where(fi => !fi.Attributes.HasFlag(FileAttributes.Hidden)).ToList();
-                               if (currentDir.Parent != null)
-                                       tmp.Insert (0, currentDir.Parent);
-                               return tmp.ToArray ();
                        }
-               }
-               public FileInfo[] Files
-               {
-                       get {
-                               string[] exts = searchPattern.Replace("*","").Split ('|');
-                               //return currentDir.GetFiles (searchPattern).Where(fi => !fi.Attributes.HasFlag(FileAttributes.Hidden)).ToArray();
-                               return currentDir.GetFiles().Where(f => exts.Any
-                                       (x => f.Name.EndsWith (x, StringComparison.InvariantCultureIgnoreCase))).ToArray();
-                       }
-               }
-
-               public void Show(){
-                        //.AddWidget(window);
-               }
-
-               void OnSelectedItemChanged (object sender, SelectionChangeEventArgs e)
-               {
-                       currentDir = e.NewValue as DirectoryInfo;
-                       NotifyValueChanged ("CurrentPath", CurrentPath);
-                       NotifyValueChanged ("Directories", Directories);
-                       NotifyValueChanged ("Files", Files);
-
-               }
-               void onFileListItemChanged (object sender, SelectionChangeEventArgs e)
-               {
-                       selectedFile = e.NewValue as FileInfo;
-               }
-               void onFileSelect(object sender, MouseButtonEventArgs e){
-                       //OpenTKGameWindow.currentWindow.DeleteWidget(window);
-               }
-       }
-       public class DirContainer: IValueChange
-       {
-               #region IValueChange implementation
-               public event EventHandler<ValueChangeEventArgs> ValueChanged;
-               public void NotifyValueChanged(string name, object value)
-               {
-                       ValueChanged.Raise (this, new ValueChangeEventArgs (name, value));
-               }
-               #endregion
+               } 
 
-               public DirectoryInfo CurDir;
-               public DirContainer(DirectoryInfo _dir){
-                       CurDir = _dir;
-               }
-               public string Name {
-                       get { return CurDir.Name; }
-               }
-
-               void onDirUp(object sender, MouseButtonEventArgs e)
-               {
-
-               }
-               public void onMouseDown(object sender, MouseButtonEventArgs e)
-               {
-                       Debug.WriteLine (sender.ToString ());
-               }
+//             public DirectoryInfo[] Directories
+//             {
+//                     get {
+//                             //currentDir.GetDirectories
+//                             List<DirectoryInfo> tmp = currentDir.GetDirectories ().Where(fi => !fi.Attributes.HasFlag(FileAttributes.Hidden)).ToList();
+//                             if (currentDir.Parent != null)
+//                                     tmp.Insert (0, currentDir.Parent);
+//                             return tmp.ToArray ();
+//                     }
+//             }
+//             public FileInfo[] Files
+//             {
+//                     get {
+//                             string[] exts = searchPattern.Replace("*","").Split ('|');
+//                             //return currentDir.GetFiles (searchPattern).Where(fi => !fi.Attributes.HasFlag(FileAttributes.Hidden)).ToArray();
+//                             return currentDir.GetFiles().Where(f => exts.Any
+//                                     (x => f.Name.EndsWith (x, StringComparison.InvariantCultureIgnoreCase))).ToArray();
+//                     }
+//             }
 
+//             void OnSelectedItemChanged (object sender, SelectionChangeEventArgs e)
+//             {
+//                     currentDir = e.NewValue as DirectoryInfo;
+//                     NotifyValueChanged ("CurrentPath", CurrentPath);
+//                     NotifyValueChanged ("Directories", Directories);
+//                     NotifyValueChanged ("Files", Files);
+//
+//             }
+//             void onFileListItemChanged (object sender, SelectionChangeEventArgs e)
+//             {
+//                     selectedFile = e.NewValue as FileInfo;
+//             }
+//             void onFileSelect(object sender, MouseButtonEventArgs e){
+//                     //OpenTKGameWindow.currentWindow.DeleteWidget(window);
+//             }
        }
+//     public class DirContainer: IValueChange
+//     {
+//             #region IValueChange implementation
+//             public event EventHandler<ValueChangeEventArgs> ValueChanged;
+//             public void NotifyValueChanged(string name, object value)
+//             {
+//                     ValueChanged.Raise (this, new ValueChangeEventArgs (name, value));
+//             }
+//             #endregion
+//
+//             public DirectoryInfo CurDir;
+//             public DirContainer(DirectoryInfo _dir){
+//                     CurDir = _dir;
+//             }
+//             public string Name {
+//                     get { return CurDir.Name; }
+//             }
+//
+//             void onDirUp(object sender, MouseButtonEventArgs e)
+//             {
+//
+//             }
+//             public void onMouseDown(object sender, MouseButtonEventArgs e)
+//             {
+//                     Debug.WriteLine (sender.ToString ());
+//             }
+//
+//     }
 }
 
index 1be9d4cfd658506520d19378c5855ec99493c812..61baa267a6b5b1e5ab407b39b8e47eefc614eaaa 100644 (file)
@@ -19,7 +19,7 @@ namespace Crow
 
                Interface currentInterface = null;
 
-               public Interface CurrentInterface {
+               [XmlIgnore]public Interface CurrentInterface {
                        get {
                                if (currentInterface == null) {
                                        currentInterface = Interface.CurrentInterface;
@@ -39,6 +39,7 @@ namespace Crow
                public event EventHandler<ValueChangeEventArgs> ValueChanged;
                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));
                }
                #endregion
@@ -239,6 +240,7 @@ namespace Crow
 
                                verticalAlignment = value;
                                NotifyValueChanged("VerticalAlignment", verticalAlignment);
+                               RegisterForLayouting (LayoutingType.Y);
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(HorizontalAlignment.Center)]
@@ -250,6 +252,7 @@ namespace Crow
 
                                horizontalAlignment = value;
                                NotifyValueChanged("HorizontalAlignment", horizontalAlignment);
+                               RegisterForLayouting (LayoutingType.X);
                        }
                }
                [XmlAttributeAttribute()][DefaultValue(0)]
@@ -289,9 +292,13 @@ namespace Crow
                                Width = Height = Measure.Fit;
                        }
                }
-               [XmlAttributeAttribute()][DefaultValue("Stretched")]
+               [XmlAttributeAttribute()][DefaultValue("Inherit")]
                public virtual Measure Width {
-                       get { return width; }
+                       get {
+                               return width.Units == Unit.Inherit ?
+                                       Parent is GraphicObject ? (Parent as GraphicObject).WidthPolicy :
+                                       Measure.Stretched : width;
+                       }
                        set {
                                if (width == value)
                                        return;
@@ -321,9 +328,13 @@ namespace Crow
                                this.RegisterForLayouting (LayoutingType.Width);
                        }
                }
-               [XmlAttributeAttribute()][DefaultValue("Stretched")]
+               [XmlAttributeAttribute()][DefaultValue("Inherit")]
                public virtual Measure Height {
-                       get { return height; }
+                       get {
+                               return height.Units == Unit.Inherit ?
+                                       Parent is GraphicObject ? (Parent as GraphicObject).HeightPolicy :
+                                       Measure.Stretched : height;
+                       }
                        set {
                                if (height == value)
                                        return;
@@ -411,6 +422,8 @@ namespace Crow
                        set {
                                if (background == value)
                                        return;
+                               if (value == null)
+                                       return;
                                background = value;
                                NotifyValueChanged ("Background", background);
                                RegisterForRedraw ();
@@ -1161,6 +1174,12 @@ namespace Crow
                        MouseMove.Raise (sender, e);
                }
                public virtual void onMouseDown(object sender, MouseButtonEventArgs e){
+                       if (CurrentInterface.eligibleForDoubleClick == this && CurrentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick)
+                               onMouseDoubleClick (this, e);
+                       else
+                               currentInterface.clickTimer.Restart();
+                       CurrentInterface.eligibleForDoubleClick = null;
+                       
                        if (CurrentInterface.activeWidget == null)
                                CurrentInterface.activeWidget = this;
                        if (this.Focusable && !Interface.FocusOnHover) {
@@ -1185,19 +1204,13 @@ namespace Crow
 
                        MouseUp.Raise (this, e);
 
-                       if (MouseIsIn (e.Position) && IsActive)
+                       if (MouseIsIn (e.Position) && IsActive) {
+                               if (CurrentInterface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick)
+                                       CurrentInterface.eligibleForDoubleClick = this;
                                onMouseClick (this, e);
+                       }
                }
                public virtual void onMouseClick(object sender, MouseButtonEventArgs e){
-
-                       if (Interface.clickTimer.ElapsedMilliseconds > 0 &&
-                           Interface.clickTimer.ElapsedMilliseconds < Interface.DoubleClick) {
-                               Interface.clickTimer.Reset ();
-                               onMouseDoubleClick (this, e);
-                               return;
-                       } else
-                               Interface.clickTimer.Restart ();
-
                        GraphicObject p = Parent as GraphicObject;
                        if (p != null)
                                p.onMouseClick(sender,e);
diff --git a/src/GraphicObjects/HueSelector.cs b/src/GraphicObjects/HueSelector.cs
new file mode 100644 (file)
index 0000000..ec0a6f2
--- /dev/null
@@ -0,0 +1,143 @@
+//
+//  HueSelector.cs
+//
+//  Author:
+//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+//  Copyright (c) 2016 jp
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+using Cairo;
+
+namespace Crow
+{
+       public class HueSelector : ColorSelector
+       {
+               public HueSelector () : base()
+               {
+               }
+
+               Orientation _orientation;
+               double hue;
+
+               [XmlAttributeAttribute][DefaultValue(Orientation.Horizontal)]
+               public virtual Orientation Orientation
+               {
+                       get { return _orientation; }
+                       set {
+                               if (_orientation == value)
+                                       return;
+                               _orientation = value;
+                               NotifyValueChanged ("Orientation", _orientation);
+                               RegisterForGraphicUpdate ();
+                       }
+               }
+               [XmlAttributeAttribute()]
+               public virtual double Hue {
+                       get { return hue; }
+                       set {
+                               if (hue == value)
+                                       return;
+                               hue = value;
+
+                               notifyHueChanged ();
+                               updateMousePosFromHue ();
+                       }
+               }
+               protected override void onDraw (Cairo.Context gr)
+               {
+                       base.onDraw (gr);
+
+                       Rectangle r = ClientRectangle;
+
+                       Gradient.Type gt = Gradient.Type.Horizontal;
+                       if (Orientation == Orientation.Vertical)
+                               gt = Gradient.Type.Vertical;
+
+                       Crow.Gradient grad = new Gradient (gt);
+
+                       grad.Stops.Add (new Gradient.ColorStop (0,     new Color (1, 0, 0, 1)));
+                       grad.Stops.Add (new Gradient.ColorStop (0.167, new Color (1, 1, 0, 1)));
+                       grad.Stops.Add (new Gradient.ColorStop (0.333, new Color (0, 1, 0, 1)));
+                       grad.Stops.Add (new Gradient.ColorStop (0.5,   new Color (0, 1, 1, 1)));
+                       grad.Stops.Add (new Gradient.ColorStop (0.667, new Color (0, 0, 1, 1)));
+                       grad.Stops.Add (new Gradient.ColorStop (0.833, new Color (1, 0, 1, 1)));
+                       grad.Stops.Add (new Gradient.ColorStop (1,     new Color (1, 0, 0, 1)));
+
+                       grad.SetAsSource (gr, r);
+                       CairoHelpers.CairoRectangle (gr, r, CornerRadius);
+                       gr.Fill();
+               }
+
+               public override void Paint (ref Context ctx)
+               {
+                       base.Paint (ref ctx);
+
+                       Rectangle rb = Slot + Parent.ClientRectangle.Position;
+                       ctx.Save ();
+
+                       ctx.Translate (rb.X, rb.Y);
+
+                       ctx.SetSourceColor (Color.White);
+                       Rectangle r = ClientRectangle;
+                       if (Orientation == Orientation.Horizontal) {
+                               r.Width = 5;
+                               r.X = mousePos.X;
+                       } else {
+                               r.Height = 5;
+                               r.Y = mousePos.Y;
+                       }
+
+                       CairoHelpers.CairoRectangle (ctx, r, 2);
+                       ctx.SetSourceColor (Color.White);
+                       ctx.LineWidth = 2.0;
+                       ctx.Stroke();
+                       ctx.Restore ();
+               }
+               public override void OnLayoutChanges (LayoutingType layoutType)
+               {
+                       base.OnLayoutChanges (layoutType);
+
+                       if (Orientation == Orientation.Horizontal) {
+                               if (layoutType == LayoutingType.Width)
+                                       updateMousePosFromHue ();
+                       } else if (layoutType == LayoutingType.Height)
+                               updateMousePosFromHue ();
+               }
+               protected override void updateMouseLocalPos (Point mPos)
+               {
+                       base.updateMouseLocalPos (mPos);
+                       if (Orientation == Orientation.Horizontal)
+                               hue = (double)mousePos.X / (double)ClientRectangle.Width;
+                       else
+                               hue = (double)mousePos.Y / (double)ClientRectangle.Height;
+                       notifyHueChanged ();
+               }
+               void updateMousePosFromHue(){
+                       if (Orientation == Orientation.Horizontal)
+                               mousePos.X = (int)Math.Floor(hue * (double)ClientRectangle.Width);
+                       else
+                               mousePos.Y = (int)Math.Floor(hue * (double)ClientRectangle.Height);
+                       CurrentInterface.EnqueueForRepaint (this);
+               }
+               void notifyHueChanged(){
+                       NotifyValueChanged ("Hue", hue);
+                       NotifyValueChanged ("HueColor", new SolidColor (Color.FromHSV (hue)));
+               }
+       }
+}
+
index 765925e960df4541a8d7e5307eeb501b3e6a022a..5726afdfb07cde3c4e102f09ffcafccdc1f22320 100644 (file)
@@ -65,7 +65,7 @@ namespace Crow
                public override void onMouseLeave (object sender, MouseMoveEventArgs e)
                {
                        base.onMouseLeave (sender, e);
-                       IsOpened = false;
+                       //IsOpened = false;
                }
        }
 }
index 78162fbbd567fb8986c119612db4b81b22e18745..9fc0b226ad1729f61ea2d5148d0add215d564b3a 100644 (file)
@@ -50,8 +50,8 @@ namespace Crow
 
                                if (isOpened) {
                                        onOpen (this, null);
-                                       if (MenuRoot != null)
-                                               MenuRoot.IsOpened = true;
+//                                     if (MenuRoot != null)
+//                                             MenuRoot.IsOpened = true;
                                }else
                                        onClose (this, null);
                        }
@@ -102,7 +102,7 @@ namespace Crow
                        Execute.Raise (this, null);
                }
                protected virtual void onOpen (object sender, EventArgs e){
-                       MenuRoot.IsOpened = true;
+                       //MenuRoot.IsOpened = true;
                        Open.Raise (this, null);
                }
                protected virtual void onClose (object sender, EventArgs e){
index e4cde7ed550eb475e9e80586a39c571f22692632..1b8c0d95c713556129ab9163e4c28f250239d725 100644 (file)
@@ -119,7 +119,7 @@ namespace Crow
 
                protected void _content_LayoutChanged (object sender, LayoutingEventArgs e)
                {
-                       ILayoutable tc = Content.Parent as ILayoutable;
+                       ILayoutable tc = Content.Parent;
                        if (tc == null)
                                return;
                        Rectangle r = this.ScreenCoordinates (this.Slot);
@@ -186,13 +186,11 @@ namespace Crow
                {
                        if (!_isPopped || _content == null) {
                                base.onMouseLeave (sender, e);
-                               System.Diagnostics.Debug.WriteLine ("NotPopped***popper mouse leave:"+ this.ToString());
                                return;
                        }
 
                        if (!_content.MouseIsIn (e.Position)) {
                                base.onMouseLeave (sender, e);
-                               System.Diagnostics.Debug.WriteLine ("***popper mouse leave:"+ this.ToString());
                                IsPopped = false;
                                return;
                        }
diff --git a/src/GraphicObjects/SaturationValueSelector.cs b/src/GraphicObjects/SaturationValueSelector.cs
new file mode 100644 (file)
index 0000000..b71fa7e
--- /dev/null
@@ -0,0 +1,129 @@
+//
+//  SaturationValueSelector.cs
+//
+//  Author:
+//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+//  Copyright (c) 2016 jp
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+using System;
+using Cairo;
+using System.Xml.Serialization;
+
+namespace Crow
+{
+       public class SaturationValueSelector : ColorSelector
+       {
+               public SaturationValueSelector () : base()
+               {
+               }
+
+               double v, s;
+
+               [XmlAttributeAttribute()]
+               public virtual double V {
+                       get { return v; }
+                       set {
+                               if (v == value)
+                                       return;
+                               v = value;
+                               NotifyValueChanged ("V", v);
+                               mousePos.Y = (int)Math.Floor((1.0-v) * (double)ClientRectangle.Height);
+
+                               CurrentInterface.EnqueueForRepaint (this);
+                       }
+               }
+               [XmlAttributeAttribute()]
+               public virtual double S {
+                       get { return s; }
+                       set {
+                               if (s == value)
+                                       return;
+                               s = value;
+                               NotifyValueChanged ("S", s);
+                               mousePos.X = (int)Math.Floor(s * (double)ClientRectangle.Width);
+                               CurrentInterface.EnqueueForRepaint (this);
+                       }
+               }
+               protected override void onDraw (Cairo.Context gr)
+               {
+                       base.onDraw (gr);
+
+                       Rectangle r = ClientRectangle;
+                       Rectangle rGrad = r;
+                       rGrad.Inflate (-1);
+
+                       if (Foreground != null) {//TODO:test if null should be removed
+                               Foreground.SetAsSource (gr, r);
+                               CairoHelpers.CairoRectangle (gr, r, CornerRadius);
+                               gr.Fill ();
+                       }
+
+                       Crow.Gradient grad = new Gradient (Gradient.Type.Horizontal);
+                       grad.Stops.Add (new Gradient.ColorStop (0, new Color (1, 1, 1, 1)));
+                       grad.Stops.Add (new Gradient.ColorStop (1, new Color (1, 1, 1, 0)));
+                       grad.SetAsSource (gr, rGrad);
+                       CairoHelpers.CairoRectangle (gr, r, CornerRadius);
+                       gr.Fill();
+                       grad = new Gradient (Gradient.Type.Vertical);
+                       grad.Stops.Add (new Gradient.ColorStop (0, new Color (0, 0, 0, 0)));
+                       grad.Stops.Add (new Gradient.ColorStop (1, new Color (0, 0, 0, 1)));
+                       grad.SetAsSource (gr, rGrad);
+                       CairoHelpers.CairoRectangle (gr, r, CornerRadius);
+                       gr.Fill();
+               }
+
+               public override void Paint (ref Context ctx)
+               {
+                       base.Paint (ref ctx);
+
+                       Rectangle rb = Slot + Parent.ClientRectangle.Position;
+                       ctx.Save ();
+
+                       ctx.Translate (rb.X, rb.Y);
+
+                       ctx.SetSourceColor (Color.White);
+                       ctx.Arc (mousePos.X, mousePos.Y, 3.0, 0, Math.PI * 2.0);
+                       ctx.LineWidth = 1.0;
+                       ctx.Stroke ();
+
+                       ctx.Restore ();
+               }
+
+               protected override void updateMouseLocalPos (Point mPos)
+               {
+                       base.updateMouseLocalPos (mPos);
+
+                       Rectangle cb = ClientRectangle;
+                       s = (double)mousePos.X / (double)cb.Width;
+                       v = 1.0 - (double)mousePos.Y / (double)cb.Height;
+                       NotifyValueChanged ("S", s);
+                       NotifyValueChanged ("V", v);
+               }
+               public override void OnLayoutChanges (LayoutingType layoutType)
+               {
+                       base.OnLayoutChanges (layoutType);
+                       switch (layoutType) {
+                       case LayoutingType.Width:
+                               mousePos.X = (int)Math.Floor(s * (double)ClientRectangle.Width);
+                               break;
+                       case LayoutingType.Height:
+                               mousePos.Y = (int)Math.Floor((1.0-v) * (double)ClientRectangle.Height);
+                               break;
+                       }
+               }
+       }
+}
+
index 1664f67134c0e5f97c1c1ba7ea7f9a08d5dba49d..1801c0e83b9fd1707c5851238c892965228458a1 100644 (file)
@@ -36,7 +36,7 @@ namespace Crow
                #endregion
 
                protected Group items;
-               string _itemTemplate;
+               string _itemTemplate, _dataTest;
 
                #region events
                public event EventHandler<SelectionChangeEventArgs> SelectedItemChanged;
@@ -55,6 +55,9 @@ namespace Crow
                //but then i should test if null in msil gen
                public Dictionary<string, ItemTemplate> ItemTemplates = new Dictionary<string, Crow.ItemTemplate>();
 
+               /// <summary>
+               /// Default item template
+               /// </summary>
                [XmlAttributeAttribute][DefaultValue("#Crow.Templates.ItemTemplate.goml")]
                public string ItemTemplate {
                        get { return _itemTemplate; }
@@ -80,6 +83,24 @@ namespace Crow
                        else
                                NotifyValueChanged ("HasChildren", true);
                }
+               /// <summary>
+               /// Use to define condition on Data item for selecting among ItemTemplates.
+               /// Default value is 'TypeOf' for selecting Template depending on Type of Data.
+               /// Other possible values are properties of Data
+               /// </summary>
+               /// <value>The data property test.</value>
+               [XmlAttributeAttribute][DefaultValue("TypeOf")]
+               public string DataTest {
+                       get { return _dataTest; }
+                       set {
+                               if (value == _dataTest)
+                                       return;
+
+                               _dataTest = value;
+
+                               NotifyValueChanged("DataTest", _dataTest);
+                       }
+               }
                #endregion
 
                public virtual List<GraphicObject> Items{ get { return items.Children; }}
@@ -99,7 +120,9 @@ namespace Crow
                [XmlIgnore]public virtual object SelectedItem{
                        get { return data == null ? null : _selectedIndex < 0 ? null : data[_selectedIndex]; }
                }
-
+               [XmlIgnore]public bool HasItems {
+                       get { return Items.Count > 0; }
+               }
                [XmlAttributeAttribute]public IList Data {
                        get { return data; }
                        set {
@@ -112,7 +135,7 @@ namespace Crow
 
                                NotifyValueChanged ("Data", data);
 
-                               lock (CurrentInterface.UpdateMutex)
+                               //lock (CurrentInterface.UpdateMutex)
                                        ClearItems ();
 
                                if (data == null)
@@ -126,6 +149,7 @@ namespace Crow
                                NotifyValueChanged ("SelectedIndex", _selectedIndex);
                                NotifyValueChanged ("SelectedItem", SelectedItem);
                                SelectedItemChanged.Raise (this, new SelectionChangeEventArgs (SelectedItem));
+                               NotifyValueChanged ("HasItems", HasItems);
                        }
                }
 
@@ -304,17 +328,6 @@ namespace Crow
 
                        page.Name = "page" + pageNum;
 
-//                     //reset size to fit in the dir of the stacking
-//                     //because items total size is forced to approx size
-//                     if (_gsList.Orientation == Orientation.Horizontal) {
-//                             page.Width = Measure.Fit;
-                               //page.BindMember ("Height", "../HeightPolicy");
-                               //page.BindMember ("Width", "../WidthPolicy");
-//                     } else {
-//                             page.Height = Measure.Fit;
-//                             page.BindMember ("Width", "../WidthPolicy");
-//                     }
-
                        for (int i = (pageNum - 1) * itemPerPage; i < pageNum * itemPerPage; i++) {
                                if (i >= data.Count)
                                        break;
@@ -322,8 +335,6 @@ namespace Crow
                                        return;
 
                                loadItem (i, page);
-
-                               //g.LogicalParent = this;
                        }
 
                        lock (CurrentInterface.LayoutMutex)
@@ -336,27 +347,41 @@ namespace Crow
                        loadingTime.ElapsedMilliseconds, this.ToString());
                        #endif
                }
+               string getItempKey(Type dataType, object o){
+                       try {
+                               return dataType.GetProperty (_dataTest).GetGetMethod ().Invoke (o, null).ToString();
+                       } catch (Exception ex) {
+                               return dataType.FullName;
+                       }
+               }
                protected void loadItem(int i, Group page){
                        GraphicObject g = null;
                        ItemTemplate iTemp = null;
                        Type dataType = data [i].GetType ();
+                       string itempKey = dataType.FullName;
+
+                       if (_dataTest != "TypeOf")
+                               itempKey = getItempKey (dataType, data [i]);
 
-                       if (ItemTemplates.ContainsKey (dataType.FullName))
-                               iTemp = ItemTemplates [dataType.FullName];
+                       if (ItemTemplates.ContainsKey (itempKey))
+                                       iTemp = ItemTemplates [itempKey];
                        else
                                iTemp = ItemTemplates ["default"];
 
                        lock (CurrentInterface.LayoutMutex) {
                                g = iTemp.CreateInstance(CurrentInterface);
                                page.AddChild (g);
-                               g.DataSource = data [i];
+                               registerItemClick (g);
                        }
 
-                       registerItemClick (g);
-
                        if (iTemp.Expand != null && g is Expandable) {
                                (g as Expandable).Expand += iTemp.Expand;
-                       }                       
+                               (g as Expandable).GetIsExpandable = iTemp.HasSubItems;
+                       }
+                       //g.LogicalParent = this;
+
+
+                       g.DataSource = data [i];
                }
                protected virtual void registerItemClick(GraphicObject g){
                        g.MouseClick += itemClick;
index e08eea1f2f7fd69c1fa7f878e7811cbe6df3a9ce..0739dc4214aa038038924a9c605758623f8b7cbb 100644 (file)
@@ -110,14 +110,16 @@ namespace Crow.IML
                                                continue;
                                        }
                                }
-                               
+
+                               if (bd is EventBinding) {
+                                       emitHandlerMethodAddition (bd as EventBinding);
+                                       continue;
+                               }
+
                                MemberInfo miSource = bd.SourceMemberAddress.member;
                                if (miSource == null)
                                        throw new Exception ("Source member '" + bd.SourceMember + "' not found");
-                               if (miSource.MemberType == MemberTypes.Event)
-                                       emitHandlerMethodAddition (bd, miSource as EventInfo);
-                               else
-                                       StorePropertyBinding (bd);
+                               StorePropertyBinding (bd);
                        }
                }
                public void ResolveName (BindingDefinition bd){
@@ -173,25 +175,31 @@ namespace Crow.IML
                /// </summary>
                /// <param name="bd">Bd.</param>
                /// <param name="evt">passed as arg to prevent refetching it for the 3rd time</param>
-               public void emitHandlerMethodAddition(BindingDefinition bd, EventInfo evt){                     
+               public void emitHandlerMethodAddition(EventBinding bd){
                        //fetch source instance with address for handler addition (as 1st arg of handler.add)
                        il.Emit (OpCodes.Ldloc_0);//push root
                        CompilerServices.emitGetInstance (il, bd.SourceNA);
 
                        //load handlerType of sourceEvent to create handler delegate (1st arg)
-                       il.Emit (OpCodes.Ldtoken, evt.EventHandlerType);
+                       il.Emit (OpCodes.Ldtoken, bd.SourceEvent.EventHandlerType);
                        il.Emit (OpCodes.Call, CompilerServices.miGetTypeFromHandle);
                        //load target the where the method is defined (2nd arg)
                        il.Emit (OpCodes.Ldloc_0);
                        CompilerServices.emitGetInstance (il, bd.TargetNA);
                        //load methodInfo (3rd arg)
-                       il.Emit (OpCodes.Ldtoken, bd.TargetMemberAddress.member as MethodInfo);
-                       il.Emit (OpCodes.Call, CompilerServices.miGetTypeFromHandle);
-
-                       il.Emit (OpCodes.Callvirt, typeof(Delegate).GetMethod ("CreateDelegate",
-                               new Type[] { typeof(Type), typeof(object), typeof(MethodInfo) }));//create bound delegate
+                       il.Emit (OpCodes.Ldstr, bd.TargetMember);
+                       //il.Emit (OpCodes.Call, CompilerServices.miGetTypeFromHandle);
+
+                       //il.Emit (OpCodes.Pop);
+                       //il.Emit (OpCodes.Pop);
+                       //il.Emit (OpCodes.Pop);
+                       //il.Emit (OpCodes.Pop);
+                       il.Emit (OpCodes.Callvirt, typeof(CompilerServices).GetMethod ("createDel", BindingFlags.Static | BindingFlags.NonPublic));
+                       //il.Emit (OpCodes.Callvirt, typeof(Delegate).GetMethod ("CreateDelegate",
+                       //      new Type[] { typeof(Type), typeof(object), typeof(MethodInfo) }));//create bound delegate
                        
-                       il.Emit (OpCodes.Callvirt, evt.AddMethod);//call add event
+                       il.Emit (OpCodes.Callvirt, bd.SourceEvent.AddMethod);//call add event
                }
+
        }
 }
\ No newline at end of file
diff --git a/src/IML/EventBinding.cs b/src/IML/EventBinding.cs
new file mode 100644 (file)
index 0000000..90a797e
--- /dev/null
@@ -0,0 +1,39 @@
+//
+//  EventBinding.cs
+//
+//  Author:
+//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+//  Copyright (c) 2016 jp
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Reflection;
+
+namespace Crow.IML
+{
+       public class EventBinding : BindingDefinition
+       {
+               public EventInfo SourceEvent;
+
+               #region CTOR
+               public EventBinding (NodeAddress _sourceNA, EventInfo _sourceEvt, NodeAddress _targetNA, string _targetMember, string _targetName = "")
+                       : base (_sourceNA, _sourceEvt.Name, _targetNA, _targetMember, _targetName)
+               {
+                       SourceEvent = _sourceEvt;
+               }
+               #endregion
+       }
+}
+
index 4415609b0630242ad10f315b11bc2ef59e420592..dfc585ab98ccb33c112bfa3b80682a99136651b8 100644 (file)
@@ -474,7 +474,7 @@ namespace Crow
                                System.Reflection.Emit.Label finish = il.DefineLabel ();
                                il.Emit (OpCodes.Br, finish);
                                il.MarkLabel (cancel);
-                               il.EmitWriteLine (string.Format ("Handler method '{0}' not found. {1}={2} ", bindingDef.TargetMember, sourceEvent.Name, expression));
+                               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);
 
@@ -487,7 +487,9 @@ namespace Crow
                                else //template handler binding, will be added to root parentChanged
                                        templateCachedDelegateIndices.Add (delDSIndex);
                        } else {//normal in tree handler binding, store until tree is complete (end of parse)
-
+                               ctx.UnresolvedTargets.Add (new EventBinding (
+                                       bindingDef.SourceNA, sourceEvent,
+                                       bindingDef.TargetNA, bindingDef.TargetMember, bindingDef.TargetName));
                        }
                }
                #endregion
@@ -866,7 +868,7 @@ namespace Crow
                                il.Emit (OpCodes.Call, typeof(CompilerServices).GetMethod("getMemberInfoWithReflexion", BindingFlags.Static | BindingFlags.Public));
                                il.Emit (OpCodes.Stloc_1);//save memberInfo
                                il.Emit (OpCodes.Ldloc_1);//push mi for test if null
-                               il.Emit (OpCodes.Brfalse, cancelInit);
+                               il.Emit (OpCodes.Brfalse, cancel);
                        }
 
                        il.Emit (OpCodes.Ldarg_1);//load source of dataSourceChanged which is the dest instance
@@ -882,6 +884,11 @@ namespace Crow
 
                        if (!string.IsNullOrEmpty(bindingDef.TargetMember)){
                                il.MarkLabel(cancelInit);
+                               //check if new dataSource implement IValueChange
+                               il.Emit (OpCodes.Ldarg_2);//load new datasource
+                               il.Emit (OpCodes.Ldfld, CompilerServices.fiDSCNewDS);
+                               il.Emit (OpCodes.Isinst, typeof(IValueChange));
+                               il.Emit (OpCodes.Brfalse, cancel);
 
                                il.Emit(OpCodes.Ldarg_0);//load ref to this instanciator onto the stack
                                il.Emit (OpCodes.Ldarg_1);//load datasource change source
index 6547b0e5f7d964bcd0360b27e7b00a831e0bc559..b90f2ac995ce1214b33aeedb9b7339124e4b2e71 100644 (file)
@@ -63,7 +63,8 @@ namespace Crow
 
                #region Static and constants
                public static int DoubleClick = 200;//ms
-               internal static Stopwatch clickTimer = new Stopwatch();
+               internal Stopwatch clickTimer = new Stopwatch();
+               internal GraphicObject eligibleForDoubleClick = null; 
                public static int TabSize = 4;
                public static string LineBreak = "\r\n";
                //TODO: shold be declared in graphicObject
index 3ce2490625e15111d35e6e4e83d3537a26c9829f..bd717f22ae299d1d457c91ca2333a64a4832e147 100644 (file)
@@ -31,8 +31,11 @@ using System.Linq;
 
 namespace Crow
 {
+       public delegate bool BooleanTestOnInstance(object instance);
+
        public class ItemTemplate : Instantiator {              
                public EventHandler Expand;
+               public BooleanTestOnInstance HasSubItems;
                string strDataType;
                string fetchMethodName;
 
@@ -54,7 +57,6 @@ namespace Crow
                public void CreateExpandDelegate (TemplatedGroup host){
                        Type dataType = Type.GetType(strDataType);
                        Type tmpGrpType = typeof(TemplatedGroup);
-                       Type hostType = tmpGrpType;//not sure is the best place to put the dyn method
                        Type evtType = typeof(EventHandler);
 
                        PropertyInfo piData = tmpGrpType.GetProperty ("Data");
@@ -64,13 +66,13 @@ namespace Crow
                        Type handlerArgsType = evtParams [1].ParameterType;
 
                        Type [] args = { typeof (object), typeof (object), handlerArgsType };
-                       DynamicMethod dm = new DynamicMethod ("dyn_expand_" + fetchMethodName,
-                               typeof (void),
-                               args,
-                               hostType);
 
+                       #region Expand dyn meth
+                       //DM is bound to templatedGroup root (arg0)
+                       //arg1 is the sender of the expand event
+                       DynamicMethod dm = new DynamicMethod ("dyn_expand_" + fetchMethodName,
+                               typeof (void), args, true);
 
-                       #region IL generation
                        System.Reflection.Emit.Label gotoEnd;
                        System.Reflection.Emit.Label ifDataIsNull;
 
@@ -82,9 +84,8 @@ namespace Crow
 
                        il.Emit (OpCodes.Ldarg_1);//load sender of expand event
 
-                       MethodInfo miFindByName = typeof(GraphicObject).GetMethod("FindByName");
                        il.Emit(OpCodes.Ldstr, "List");
-                       il.Emit (OpCodes.Callvirt, miFindByName);
+                       il.Emit (OpCodes.Callvirt, typeof(GraphicObject).GetMethod("FindByName"));
                        il.Emit (OpCodes.Stloc_0);
 
                        //check that 'Data' of list is not already set
@@ -106,9 +107,8 @@ namespace Crow
                        il.Emit (OpCodes.Ldarg_1);//get the dataSource of the sender
                        il.Emit (OpCodes.Callvirt, typeof(GraphicObject).GetProperty("DataSource").GetGetMethod ());
 
-                       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<<<
+                               emitGetSubData(il, dataType);                   
 
                        //set 'return' from the fetch method as 'data' of the list
                        il.Emit (OpCodes.Callvirt, piData.GetSetMethod ());
@@ -116,9 +116,28 @@ namespace Crow
                        il.MarkLabel(gotoEnd);
                        il.Emit (OpCodes.Ret);
 
+                       Expand = (EventHandler)dm.CreateDelegate (evtType, host);
                        #endregion
 
-                       Expand = (EventHandler)dm.CreateDelegate (evtType, host);
+                       #region Items counting dyn method
+                       //dm is unbound, arg0 is instance of Item container to expand
+                       dm = new DynamicMethod ("dyn_count_" + fetchMethodName,
+                               typeof (bool), new Type[] {typeof(object)}, true);
+                       il = dm.GetILGenerator (256);
+
+                       //get the dataSource of the arg0
+                       il.Emit (OpCodes.Ldarg_0);
+                       il.Emit (OpCodes.Callvirt, typeof(GraphicObject).GetProperty("DataSource").GetGetMethod ());
+
+                       if (fetchMethodName != "self")
+                               emitGetSubData(il, dataType);
+                       
+                       il.Emit (OpCodes.Callvirt, typeof(System.Collections.ICollection).GetProperty("Count").GetGetMethod());
+                       il.Emit (OpCodes.Ldc_I4_0);
+                       il.Emit (OpCodes.Cgt);
+                       il.Emit (OpCodes.Ret);
+                       HasSubItems = (BooleanTestOnInstance)dm.CreateDelegate (typeof(BooleanTestOnInstance));
+                       #endregion
                }
                void emitGetSubData(ILGenerator il, Type dataType){
                        MethodInfo miGetDatas = dataType.GetMethod (fetchMethodName, new Type[] {});
index 3b19efc9866bd30d798569e2d0f6c67687ba93d6..2257ae8eb231e6987f08f13c602f4466018c9da0 100644 (file)
@@ -96,7 +96,9 @@ namespace Crow
                        if (Layoutable.Parent == null) {//TODO:improve this
                                //cancel layouting for object without parent, maybe some were in queue when
                                //removed from a listbox
+                               #if DEBUG_LAYOUTING
                                Debug.WriteLine ("ERROR: processLayouting, no parent for: " + this.ToString ());
+                               #endif
                                return;
                        }
                        #if DEBUG_LAYOUTING
index c9b08f228e35c4da50759b2a589d6d7938305ac2..26c3bfdeef2b74e6bc87cebcff5cb7832fdc6633 100644 (file)
@@ -25,7 +25,7 @@ namespace Crow
        /// <summary>
        /// Measurement unit
        /// </summary>
-       public enum Unit { Pixel, Percent }
+       public enum Unit { Pixel, Percent, Inherit }
        /// <summary>
        /// Measure class allow proportional sizes as well as stretched and fit on content.
        /// </summary>
@@ -49,7 +49,7 @@ namespace Crow
                /// set to 100 Percents
                /// </summary>
                public static Measure Stretched = new Measure(100, Unit.Percent);
-
+               public static Measure Inherit = new Measure (0, Unit.Inherit);
                #region CTOR
                public Measure (int _value, Unit _units = Unit.Pixel)
                {
@@ -98,7 +98,8 @@ namespace Crow
                }
                public override string ToString ()
                {
-                       return Value == -1 ? "Fit" :
+                       return Units == Unit.Inherit ? "Inherit" :
+                               Value == -1 ? "Fit" :
                                Units == Unit.Percent ? Value == 100 ? "Stretched" :
                                Value.ToString () + "%" : Value.ToString ();
                }
@@ -111,10 +112,12 @@ namespace Crow
                        string st = s.Trim ();
                        int tmp = 0;
 
-                       if (string.Equals ("Fit", st, StringComparison.Ordinal))
+                       if (string.Equals ("Inherit", st, StringComparison.Ordinal))
+                               return Measure.Inherit;
+                       else if (string.Equals ("Fit", st, StringComparison.Ordinal))
                                return Measure.Fit;
                        else if (string.Equals ("Stretched", s, StringComparison.Ordinal))
-                               return Measure.Stretched;
+                               return Measure.Stretched;                       
                        else {
                                if (st.EndsWith ("%", StringComparison.Ordinal)) {
                                        if (int.TryParse (s.Substring(0, st.Length - 1), out tmp))
index 2b6f7e71b52797545cac0ffb36ff11ace918623d..d214f592fc05311e1db5eefdf150926c63c86bfd 100644 (file)
@@ -12,7 +12,7 @@ namespace Crow
 {
        public class SolidColor : Fill
     {
-               Color color = Color.Transparent;
+               public Color color = Color.Transparent;
                #region CTOR
                public SolidColor(Color c)
                {