]> O.S.I.I.S - jp/crow.git/commitdiff
CrowIDE WIP, context commands, tooltips, PointIsIn(ref point), configuration no longe...
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 15 Feb 2018 13:58:36 +0000 (14:58 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 15 Feb 2018 13:58:36 +0000 (14:58 +0100)
also:
- remove default null value for datasource
- dschange sender changed in group and privateContainer
- try closing menuItem, should debug
- Contains search also template in TemplatedContainer
- change in nodeAddress: expresion starting with '/' means current node
- MouseEventArgs CTOR with one source button
- RemoveWidget trigger check HoverWidget
- Orientation binding in Menu template

28 files changed:
Crow.csproj
Default.style
Icons/Icon_no.svg [new file with mode: 0644]
Icons/compiler_error.svg [new file with mode: 0644]
Icons/compiler_warning.svg [new file with mode: 0644]
Icons/compiler_warning_orange.svg [new file with mode: 0644]
Icons/project.svg [new file with mode: 0644]
Icons/projectRef.svg [new file with mode: 0644]
Icons/warning_construction.svg [new file with mode: 0644]
Templates/ContextMenu.template [new file with mode: 0644]
Templates/Menu.template
Templates/MenuItem.template
Tests/BasicTests.cs
Tests/Interfaces/GraphicObject/testCtxMenu.crow [new file with mode: 0755]
Tests/Tests.csproj
src/Configuration.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/ILayoutable.cs
src/GraphicObjects/MenuItem.cs
src/GraphicObjects/Popper.cs
src/GraphicObjects/PrivateContainer.cs
src/GraphicObjects/Scroller.cs
src/GraphicObjects/TemplatedContainer.cs
src/GraphicObjects/TemplatedGroup.cs
src/IML/NodeAddress.cs
src/Input/MouseEventArgs.cs
src/Interface.cs

index 4de640dd190ca5d47864cfd94220c9c7b6fcc72b..a061ae54e995fddba548c2808925398534e4f611 100644 (file)
@@ -30,7 +30,7 @@
     <DebugSymbols>true</DebugSymbols>
     <DebugType>full</DebugType>
     <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
-    <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+    <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
     <Optimize>false</Optimize>
     <OutputPath>$(SolutionDir)build\Debug</OutputPath>
   </PropertyGroup>
     <EmbeddedResource Include="Templates\Tooltip.template">
       <LogicalName>Crow.Tooltip.template</LogicalName>
     </EmbeddedResource>
+    <EmbeddedResource Include="Templates\ContextMenu.template">
+      <LogicalName>Crow.ContextMenu.template</LogicalName>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Icons\compiler_error.svg" />
+    <EmbeddedResource Include="Icons\project.svg" />
+    <EmbeddedResource Include="Icons\projectRef.svg" />
   </ItemGroup>
   <ItemGroup>
     <None Include="Crow.dll.config">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Icons\compiler_warning.svg" />
+    <None Include="Icons\compiler_warning_orange.svg" />
   </ItemGroup>
 </Project>
index 9a0f3f54fbae8cb6e5b90e68c458a0f01062eaaa..4eaabf4ca6c070351048aa953b39057719c20280 100644 (file)
@@ -29,6 +29,7 @@ Menu {
        Height = Fit;
        Width = Stretched;
        VerticalAlignment = Top;
+       SelectionBackground = Transparent;
 }
 MenuItem {
        Caption = MenuItem;
@@ -38,6 +39,7 @@ MenuItem {
        Foreground = LightGray;
        MouseEnter = {Background = vgradient|0:UnitedNationsBlue|1:Onyx;Foreground=White;}
        MouseLeave = {Foreground=LightGray;Background=Transparent;}
+       SelectionBackground = Transparent;
 }
 MessageBox {
        Background = 0.3,0.3,0.3,0.3;
diff --git a/Icons/Icon_no.svg b/Icons/Icon_no.svg
new file mode 100644 (file)
index 0000000..c7613fb
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
+<path d="M1,1H15V15H1zM3.5,3.5 12.5,12.5M12.5,3.5 3.5,12.5" fill="none" stroke="#f00" stroke-width="2"/>
+</svg>
\ No newline at end of file
diff --git a/Icons/compiler_error.svg b/Icons/compiler_error.svg
new file mode 100644 (file)
index 0000000..1b50568
--- /dev/null
@@ -0,0 +1,13 @@
+<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg">
+ <!-- Created with Method Draw - http://github.com/duopixel/Method-Draw/ -->
+ <g id="False">
+  <title>Layer 1</title>
+  <rect id="svg_1" height="27" width="27" y="2.5" x="2.5" stroke-width="5" stroke="#bf0000" fill="#fff"/>
+  <text font-weight="bold" xml:space="preserve" text-anchor="start" font-family="Helvetica, Arial, sans-serif" font-size="24" id="svg_2" y="24.84615" x="7.82692" stroke-width="0" stroke="#bf0000" fill="#000000">X</text>
+ </g>
+  <g id="True">
+  <title>Layer 2</title>
+  <path id="svg_1" d="m16.28846,3.46154l13.78846,26.61539l-27.57692,0l13.78846,-26.61539z" stroke-linecap="null" stroke-linejoin="null" stroke-width="3" stroke="#d1d100" fill-opacity="null" fill="#fff"/>
+  <text font-weight="bold" xml:space="preserve" text-anchor="start" font-family="Georgia, Times, 'Times New Roman', serif" font-size="24" id="svg_3" y="27.15385" x="12.44231" stroke-width="0" stroke="#bf0000" fill="#000000">!</text>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/Icons/compiler_warning.svg b/Icons/compiler_warning.svg
new file mode 100644 (file)
index 0000000..9dac377
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="378.30496" height="326.05325" id="svg2" sodipodi:version="0.32" inkscape:version="0.46" version="1.0" sodipodi:docbase="C:\Documents and Settings\KevinDuke\Desktop" sodipodi:docname="Ambox_warning_yellow.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape">
+  <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" gridtolerance="10000" guidetolerance="10" objecttolerance="10" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="1.4225" inkscape:cx="90.333919" inkscape:cy="200" inkscape:document-units="px" inkscape:current-layer="layer1" width="400px" height="400px" showgrid="false" inkscape:window-width="1280" inkscape:window-height="750" inkscape:window-x="-8" inkscape:window-y="-8"/>
+  <defs id="defs4">
+    <linearGradient id="linearGradient3149">
+      <stop id="stop3151" style="stop-color:#f6eb71;stop-opacity:1;" offset="0"/>
+      <stop offset="0.5138889" style="stop-color:#ffeb00;stop-opacity:1;" id="stop3271"/>
+      <stop offset="1" style="stop-color:#f4c930;stop-opacity:1;" id="stop3153"/>
+    </linearGradient>
+    <linearGradient id="linearGradient3134">
+      <stop offset="0" style="stop-color:#ffb300;stop-opacity:1;" id="stop3136"/>
+      <stop id="stop3165" style="stop-color:#ff9900;stop-opacity:1;" offset="1"/>
+    </linearGradient>
+    <linearGradient id="linearGradient3140" gradientUnits="userSpaceOnUse" inkscape:collect="always" x1="57.553783" x2="142.16243" xlink:href="#linearGradient3149" y1="-7.0170116" y2="123.27175"/>
+    <linearGradient id="linearGradient3148" gradientUnits="userSpaceOnUse" inkscape:collect="always" x1="57.553783" x2="142.16243" xlink:href="#linearGradient3149" y1="-7.0170116" y2="123.27175"/>
+    <filter inkscape:collect="always" id="filter3172">
+      <feGaussianBlur inkscape:collect="always" stdDeviation="5.0924795" id="feGaussianBlur3174"/>
+    </filter>
+    <linearGradient inkscape:collect="always" xlink:href="#linearGradient3134" id="linearGradient2184" gradientUnits="userSpaceOnUse" x1="-49.164131" y1="-82.266502" x2="227.38515" y2="216.95886" gradientTransform="matrix(1.2084425,0,0,1.2084425,89.669573,106.93911)"/>
+  </defs>
+  <metadata id="metadata7">
+    <rdf:RDF>
+      <cc:Work rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+        <dc:title>3D effect warning triangle</dc:title>
+        <dc:date>18/9/07</dc:date>
+        <dc:creator>
+          <cc:Agent>
+            <dc:title>Tim O'Ryan</dc:title>
+          </cc:Agent>
+        </dc:creator>
+        <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/"/>
+      </cc:Work>
+      <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/">
+        <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+        <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+        <cc:requires rdf:resource="http://web.resource.org/cc/Notice"/>
+        <cc:requires rdf:resource="http://web.resource.org/cc/Attribution"/>
+        <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+        <cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike"/>
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+  <g inkscape:label="Layer 1" id="layer1" inkscape:groupmode="layer" transform="translate(-15.90328,-38.352144)">
+    <path style="opacity:1;fill:#777777;fill-opacity:0.79729728;stroke:none;stroke-width:20.6877861;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter3172)" d="M 213.05399,47.37801 C 208.83955,47.5955 205.01929,49.92458 202.89552,53.57127 L 33.940149,345.10803 C 31.700749,348.97294 31.693669,353.73905 33.921559,357.61061 C 36.149459,361.48217 40.273789,363.87084 44.740599,363.87665 L 381.66948,364.40534 C 386.13811,364.41875 390.27406,362.04591 392.51793,358.18147 C 394.7618,354.31704 394.77229,349.54876 392.54546,345.67448 L 224.53419,53.60904 C 222.18314,49.53899 217.74782,47.13166 213.05399,47.37801 L 213.05399,47.37801 z M 213.65821,84.83972 L 360.06857,339.36792 L 66.417039,338.91476 L 213.65821,84.83972 z" id="path3152"/>
+    <path style="opacity:1;fill:url(#linearGradient2184);fill-opacity:1;stroke:#a37900;stroke-width:6.25;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 199.82666,41.494396 C 195.61222,41.711894 191.79197,44.040971 189.66819,47.687664 L 20.712823,339.22442 C 18.473424,343.08933 18.466339,347.85544 20.694238,351.727 C 22.922136,355.59856 27.04646,357.98723 31.513278,357.99304 L 368.44215,358.52173 C 372.91078,358.53514 377.04674,356.1623 379.2906,352.29786 C 381.53447,348.43343 381.54497,343.66515 379.31813,339.79087 L 211.30686,47.725427 C 208.95581,43.655381 204.52049,41.248051 199.82666,41.494396 L 199.82666,41.494396 z M 200.43088,78.956113 L 346.84124,333.48431 L 53.189715,333.03115 L 200.43088,78.956113 z" id="path2178"/>
+    <path sodipodi:arg2="1.5723975" style="opacity:1;fill:url(#linearGradient3140);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3148);stroke-width:20.6877861;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path2160" sodipodi:cx="91.428574" sodipodi:cy="117.14286" sodipodi:arg1="0.52519998" sodipodi:type="star" d="M 230.71429,197.85715 L -48.114905,197.41068 L 91.686339,-43.839248 L 230.71429,197.85715 z" sodipodi:r2="80.491158" sodipodi:sides="3" inkscape:randomized="0" transform="matrix(1.2084425,0,0,1.2084425,89.669573,106.93911)" inkscape:rounded="0" sodipodi:r1="160.98232" inkscape:flatsided="true"/>
+    <path sodipodi:nodetypes="cccsccscccc" d="M 199.89464,117.765 C 197.29017,117.9016 194.92932,119.3644 193.61684,121.65473 L 89.204984,304.75655 C 87.82107,307.18391 87.81669,310.17731 89.193499,312.60887 C 90.570306,315.04044 93.119077,316.54066 95.879504,316.54431 L 304.09647,316.87636 C 306.85801,316.88477 309.41397,315.39449 310.80064,312.96739 C 312.18732,310.54032 312.1938,307.54558 310.81766,305.1123 L 206.98922,121.67846 C 205.53631,119.12222 202.79534,117.61029 199.89464,117.765 L 199.89464,117.765 z" style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:20.6877861;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" id="path19491"/>
+    <path style="font-size:333.22640991px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Angsana New" d="M 203.68708,256.44083 L 198.35371,256.44083 C 197.80195,246.98576 195.96287,235.6645 192.83645,222.47702 L 186.4916,195.60456 C 182.6908,179.49366 180.79042,167.95467 180.79043,160.9876 C 180.79042,146.92949 187.50308,139.90034 200.92845,139.90018 C 206.81347,139.90034 211.67173,141.84424 215.50321,145.73187 C 219.33458,149.61982 221.25031,154.58066 221.25036,160.61436 C 221.25031,167.0216 219.22731,178.685 215.18136,195.60456 L 208.74456,222.47702 C 206.47631,231.93222 204.79048,243.25347 203.68708,256.44083 L 203.68708,256.44083 z M 201.20431,274.07588 C 207.45715,274.07593 212.30007,276.20643 215.7331,280.46742 C 219.166,284.72848 220.88248,289.28498 220.88254,294.13692 C 220.88248,300.54403 218.79818,305.47375 214.62964,308.92611 C 210.461,312.37848 205.98588,314.10466 201.20431,314.10466 C 194.89007,314.10466 190.03183,311.98969 186.62953,307.75978 C 183.22721,303.52985 181.52605,298.9889 181.52607,294.13692 C 181.52605,288.47632 183.41112,283.71765 187.18126,279.86093 C 190.95137,276.00427 195.6257,274.07593 201.20431,274.07588 L 201.20431,274.07588 z" id="text2171"/>
+  </g>
+</svg>
\ No newline at end of file
diff --git a/Icons/compiler_warning_orange.svg b/Icons/compiler_warning_orange.svg
new file mode 100644 (file)
index 0000000..233437f
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="378.30496" height="326.05325" id="svg2" sodipodi:version="0.32" inkscape:version="0.46" version="1.0" sodipodi:docbase="C:\Documents and Settings\KevinDuke\Desktop" sodipodi:docname="Ambox_warning_orange.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape">
+  <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" gridtolerance="10000" guidetolerance="10" objecttolerance="10" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.64877047" inkscape:cx="107.30042" inkscape:cy="95.503105" inkscape:document-units="px" inkscape:current-layer="layer1" width="400px" height="400px" showgrid="false" inkscape:window-width="1280" inkscape:window-height="750" inkscape:window-x="-8" inkscape:window-y="-8"/>
+  <defs id="defs4">
+    <linearGradient id="linearGradient3149">
+      <stop id="stop3151" style="stop-color:#f3c381;stop-opacity:1;" offset="0"/>
+      <stop offset="0.25" style="stop-color:#f4b24e;stop-opacity:1;" id="stop3172"/>
+      <stop offset="0.5" style="stop-color:#f39502;stop-opacity:1;" id="stop3171"/>
+      <stop offset="1" style="stop-color:#f67805;stop-opacity:1;" id="stop3153"/>
+    </linearGradient>
+    <linearGradient id="linearGradient3134">
+      <stop offset="0" style="stop-color:#ffb300;stop-opacity:1;" id="stop3136"/>
+      <stop id="stop3165" style="stop-color:#ff9900;stop-opacity:1;" offset="1"/>
+    </linearGradient>
+    <linearGradient id="linearGradient3140" gradientUnits="userSpaceOnUse" inkscape:collect="always" x1="15.087464" x2="120.05667" xlink:href="#linearGradient3149" y1="9.8531685" y2="108.72849"/>
+    <linearGradient id="linearGradient3148" gradientUnits="userSpaceOnUse" inkscape:collect="always" x1="15.087464" x2="120.05667" xlink:href="#linearGradient3149" y1="9.8531685" y2="108.72849"/>
+    <filter inkscape:collect="always" id="filter3172">
+      <feGaussianBlur inkscape:collect="always" stdDeviation="5.0924795" id="feGaussianBlur3174"/>
+    </filter>
+    <linearGradient inkscape:collect="always" xlink:href="#linearGradient3134" id="linearGradient2184" gradientUnits="userSpaceOnUse" x1="-49.164131" y1="-82.266502" x2="227.38515" y2="216.95886" gradientTransform="matrix(1.2084425,0,0,1.2084425,89.669573,106.93911)"/>
+  </defs>
+  <metadata id="metadata7">
+    <rdf:RDF>
+      <cc:Work rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+        <dc:title>3D effect warning triangle</dc:title>
+        <dc:date>18/9/07</dc:date>
+        <dc:creator>
+          <cc:Agent>
+            <dc:title>Tim O'Ryan</dc:title>
+          </cc:Agent>
+        </dc:creator>
+        <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/"/>
+      </cc:Work>
+      <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/">
+        <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+        <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+        <cc:requires rdf:resource="http://web.resource.org/cc/Notice"/>
+        <cc:requires rdf:resource="http://web.resource.org/cc/Attribution"/>
+        <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+        <cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike"/>
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+  <g inkscape:label="Layer 1" id="layer1" inkscape:groupmode="layer" transform="translate(-15.90328,-38.352144)">
+    <path style="opacity:1;fill:#777777;fill-opacity:0.79729728;stroke:none;stroke-width:20.6877861;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter3172)" d="M 213.05399,47.37801 C 208.83955,47.5955 205.01929,49.92458 202.89552,53.57127 L 33.940149,345.10803 C 31.700749,348.97294 31.693669,353.73905 33.921559,357.61061 C 36.149459,361.48217 40.273789,363.87084 44.740599,363.87665 L 381.66948,364.40534 C 386.13811,364.41875 390.27406,362.04591 392.51793,358.18147 C 394.7618,354.31704 394.77229,349.54876 392.54546,345.67448 L 224.53419,53.60904 C 222.18314,49.53899 217.74782,47.13166 213.05399,47.37801 L 213.05399,47.37801 z M 213.65821,84.83972 L 360.06857,339.36792 L 66.417039,338.91476 L 213.65821,84.83972 z" id="path3152"/>
+    <path style="opacity:1;fill:url(#linearGradient2184);fill-opacity:1;stroke:#a37900;stroke-width:6.25;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 199.82666,41.494396 C 195.61222,41.711894 191.79197,44.040971 189.66819,47.687664 L 20.712823,339.22442 C 18.473424,343.08933 18.466339,347.85544 20.694238,351.727 C 22.922136,355.59856 27.04646,357.98723 31.513278,357.99304 L 368.44215,358.52173 C 372.91078,358.53514 377.04674,356.1623 379.2906,352.29786 C 381.53447,348.43343 381.54497,343.66515 379.31813,339.79087 L 211.30686,47.725427 C 208.95581,43.655381 204.52049,41.248051 199.82666,41.494396 L 199.82666,41.494396 z M 200.43088,78.956113 L 346.84124,333.48431 L 53.189715,333.03115 L 200.43088,78.956113 z" id="path2178"/>
+    <path sodipodi:arg2="1.5723975" style="opacity:1;fill:url(#linearGradient3140);fill-opacity:1.0;fill-rule:nonzero;stroke:url(#linearGradient3148);stroke-width:20.68778610000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path2160" sodipodi:cx="91.428574" sodipodi:cy="117.14286" sodipodi:arg1="0.52519998" sodipodi:type="star" d="M 230.71429,197.85715 L -48.114905,197.41068 L 91.686339,-43.839248 L 230.71429,197.85715 z" sodipodi:r2="80.491158" sodipodi:sides="3" inkscape:randomized="0" transform="matrix(1.2084425,0,0,1.2084425,89.669573,106.93911)" inkscape:rounded="0" sodipodi:r1="160.98232" inkscape:flatsided="true"/>
+    <path sodipodi:nodetypes="cccsccscccc" d="M 199.89464,117.765 C 197.29017,117.9016 194.92932,119.3644 193.61684,121.65473 L 89.204984,304.75655 C 87.82107,307.18391 87.81669,310.17731 89.193499,312.60887 C 90.570306,315.04044 93.119077,316.54066 95.879504,316.54431 L 304.09647,316.87636 C 306.85801,316.88477 309.41397,315.39449 310.80064,312.96739 C 312.18732,310.54032 312.1938,307.54558 310.81766,305.1123 L 206.98922,121.67846 C 205.53631,119.12222 202.79534,117.61029 199.89464,117.765 L 199.89464,117.765 z" style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:20.6877861;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" id="path19491"/>
+    <path style="font-size:333.22640991px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Angsana New" d="M 203.68708,256.44083 L 198.35371,256.44083 C 197.80195,246.98576 195.96287,235.6645 192.83645,222.47702 L 186.4916,195.60456 C 182.6908,179.49366 180.79042,167.95467 180.79043,160.9876 C 180.79042,146.92949 187.50308,139.90034 200.92845,139.90018 C 206.81347,139.90034 211.67173,141.84424 215.50321,145.73187 C 219.33458,149.61982 221.25031,154.58066 221.25036,160.61436 C 221.25031,167.0216 219.22731,178.685 215.18136,195.60456 L 208.74456,222.47702 C 206.47631,231.93222 204.79048,243.25347 203.68708,256.44083 L 203.68708,256.44083 z M 201.20431,274.07588 C 207.45715,274.07593 212.30007,276.20643 215.7331,280.46742 C 219.166,284.72848 220.88248,289.28498 220.88254,294.13692 C 220.88248,300.54403 218.79818,305.47375 214.62964,308.92611 C 210.461,312.37848 205.98588,314.10466 201.20431,314.10466 C 194.89007,314.10466 190.03183,311.98969 186.62953,307.75978 C 183.22721,303.52985 181.52605,298.9889 181.52607,294.13692 C 181.52605,288.47632 183.41112,283.71765 187.18126,279.86093 C 190.95137,276.00427 195.6257,274.07593 201.20431,274.07588 L 201.20431,274.07588 z" id="text2171"/>
+  </g>
+</svg>
\ No newline at end of file
diff --git a/Icons/project.svg b/Icons/project.svg
new file mode 100644 (file)
index 0000000..1f9a1f1
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+   viewBox="0 0 64 64"
+   height="64"
+   width="64">  
+  <g>
+   <path fill="#007fff" stroke="#111111" stroke-width="2" d="m1.655043,19.482317l17.905939,-17.913175l25.323143,0l17.905937,17.913175l0,25.333551l-17.905937,17.913147l-25.323143,0l-17.905939,-17.913147l0,-25.333551z" id="svg_2"/>
+  </g>
+</svg>
diff --git a/Icons/projectRef.svg b/Icons/projectRef.svg
new file mode 100644 (file)
index 0000000..3ebd7b5
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   viewBox="0 0 64 64"
+   height="64"
+   width="64"
+   id="svg2"
+   version="1.1">  
+  <defs id="defs6" />
+  <g>
+          <path fill="#007fff" stroke="#111111" stroke-width="2" d="m1.655043,19.482317l17.905939,-17.913175l25.323143,0l17.905937,17.913175l0,25.333551l-17.905937,17.913147l-25.323143,0l-17.905939,-17.913147l0,-25.333551z" id="svg_2"/>
+         <path
+            d="M 15,33.964845 A 6.2543149,5.8551034 0 0 1 8.7456846,39.819949 6.2543149,5.8551034 0 0 1 2.4913703,33.964845 6.2543149,5.8551034 0 0 1 8.7456846,28.109741 6.2543149,5.8551034 0 0 1 15,33.964845 Z M 30.205524,19.726298 h 24.484978 c 3.833495,0 6.919666,3.88699 6.919666,8.715226 v 11.046641 c 0,4.828235 -3.086171,8.715225 -6.919666,8.715225 H 30.205524 c -3.833494,0 -6.919665,-3.88699 -6.919665,-8.715225 V 28.441524 c 0,-4.828236 3.086171,-8.715226 6.919665,-8.715226 z M 15,33.964845 h 8.285859"
+            style="opacity:1;fill:#a0a8ab;fill-opacity:1;stroke:#181818;stroke-width:2;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+            id="path819" />
+  </g>
+</svg>
diff --git a/Icons/warning_construction.svg b/Icons/warning_construction.svg
new file mode 100644 (file)
index 0000000..4c101ec
--- /dev/null
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="378.30496" height="326.05325" id="svg2" sodipodi:version="0.32" inkscape:version="0.46" version="1.0" sodipodi:docbase="C:\Documents and Settings\KevinDuke\Desktop" sodipodi:docname="Ambox_warning_blue_construction.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape">
+  <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" gridtolerance="10000" guidetolerance="10" objecttolerance="10" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.64877047" inkscape:cx="-125.04673" inkscape:cy="39.346892" inkscape:document-units="px" inkscape:current-layer="layer1" width="400px" height="400px" showgrid="false" inkscape:window-width="1264" inkscape:window-height="764" inkscape:window-x="0" inkscape:window-y="0"/>
+  <defs id="defs4">
+    <linearGradient id="linearGradient3134">
+      <stop offset="0" style="stop-color:#4c99f5;stop-opacity:1;" id="stop3136"/>
+      <stop id="stop3165" style="stop-color:#1361ba;stop-opacity:1;" offset="0.5"/>
+      <stop offset="1" style="stop-color:#194c9a;stop-opacity:1;" id="stop3138"/>
+    </linearGradient>
+    <linearGradient id="linearGradient3140" gradientUnits="userSpaceOnUse" inkscape:collect="always" x1="91.29969" x2="244.97258" xlink:href="#linearGradient3134" y1="4.3178039" y2="237.70302"/>
+    <linearGradient id="linearGradient3148" gradientUnits="userSpaceOnUse" inkscape:collect="always" x1="91.29969" x2="244.97258" xlink:href="#linearGradient3134" y1="4.3178039" y2="237.70302"/>
+    <filter inkscape:collect="always" id="filter3172">
+      <feGaussianBlur inkscape:collect="always" stdDeviation="5.0924795" id="feGaussianBlur3174"/>
+    </filter>
+    <linearGradient inkscape:collect="always" xlink:href="#linearGradient3134" id="linearGradient2184" gradientUnits="userSpaceOnUse" x1="29.753853" y1="-13.269632" x2="202.58235" y2="183.58783" gradientTransform="matrix(1.2084425,0,0,1.2084425,89.669573,106.93911)"/>
+  </defs>
+  <metadata id="metadata7">
+    <rdf:RDF>
+      <cc:Work rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+        <dc:title>3D effect warning triangle</dc:title>
+        <dc:date>18/9/07</dc:date>
+        <dc:creator>
+          <cc:Agent>
+            <dc:title>Tim O'Ryan</dc:title>
+          </cc:Agent>
+        </dc:creator>
+        <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/"/>
+      </cc:Work>
+      <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/">
+        <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+        <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+        <cc:requires rdf:resource="http://web.resource.org/cc/Notice"/>
+        <cc:requires rdf:resource="http://web.resource.org/cc/Attribution"/>
+        <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+        <cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike"/>
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+  <g inkscape:label="Layer 1" id="layer1" inkscape:groupmode="layer" transform="translate(-15.90328,-38.352144)">
+    <path style="opacity:1;fill:#777777;fill-opacity:0.79729728;stroke:none;stroke-width:20.6877861;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter3172)" d="M 213.05399,47.37801 C 208.83955,47.5955 205.01929,49.92458 202.89552,53.57127 L 33.940149,345.10803 C 31.700749,348.97294 31.693669,353.73905 33.921559,357.61061 C 36.149459,361.48217 40.273789,363.87084 44.740599,363.87665 L 381.66948,364.40534 C 386.13811,364.41875 390.27406,362.04591 392.51793,358.18147 C 394.7618,354.31704 394.77229,349.54876 392.54546,345.67448 L 224.53419,53.60904 C 222.18314,49.53899 217.74782,47.13166 213.05399,47.37801 L 213.05399,47.37801 z M 213.65821,84.83972 L 360.06857,339.36792 L 66.417039,338.91476 L 213.65821,84.83972 z" id="path3152"/>
+    <path style="opacity:1;fill:url(#linearGradient2184);fill-opacity:1;stroke:#001387;stroke-width:6.25;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" d="M 199.82666,41.494396 C 195.61222,41.711894 191.79197,44.040971 189.66819,47.687664 L 20.712823,339.22442 C 18.473424,343.08933 18.466339,347.85544 20.694238,351.727 C 22.922136,355.59856 27.04646,357.98723 31.513278,357.99304 L 368.44215,358.52173 C 372.91078,358.53514 377.04674,356.1623 379.2906,352.29786 C 381.53447,348.43343 381.54497,343.66515 379.31813,339.79087 L 211.30686,47.725427 C 208.95581,43.655381 204.52049,41.248051 199.82666,41.494396 L 199.82666,41.494396 z M 200.43088,78.956113 L 346.84124,333.48431 L 53.189715,333.03115 L 200.43088,78.956113 z" id="path2178"/>
+    <path sodipodi:arg2="1.5723975" style="opacity:1;fill:url(#linearGradient3140);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient3148);stroke-width:20.6877861;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path2160" sodipodi:cx="91.428574" sodipodi:cy="117.14286" sodipodi:arg1="0.52519998" sodipodi:type="star" d="M 230.71429,197.85715 L -48.114905,197.41068 L 91.686339,-43.839248 L 230.71429,197.85715 z" sodipodi:r2="80.491158" sodipodi:sides="3" inkscape:randomized="0" transform="matrix(1.2084425,0,0,1.2084425,89.669573,106.93911)" inkscape:rounded="0" sodipodi:r1="160.98232" inkscape:flatsided="true"/>
+    <path sodipodi:nodetypes="cccsccscccc" d="M 199.89464,117.765 C 197.29017,117.9016 194.92932,119.3644 193.61684,121.65473 L 89.204984,304.75655 C 87.82107,307.18391 87.81669,310.17731 89.193499,312.60887 C 90.570306,315.04044 93.119077,316.54066 95.879504,316.54431 L 304.09647,316.87636 C 306.85801,316.88477 309.41397,315.39449 310.80064,312.96739 C 312.18732,310.54032 312.1938,307.54558 310.81766,305.1123 L 206.98922,121.67846 C 205.53631,119.12222 202.79534,117.61029 199.89464,117.765 L 199.89464,117.765 z" style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:20.6877861;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" id="path19491"/>
+    <g id="g2689" transform="matrix(0.4429717,0,0,0.4429717,130.45212,176.47068)">
+      <path id="path633" style="font-size:12px;fill-rule:evenodd" d="M 385.98026,297.1542 L 140.36506,297.47 C 138.14026,297.2692 136.52876,296.7617 137.37106,294.1072 L 227.62156,178.4191 C 230.74276,173.9958 235.45166,171.6041 240.18906,171.7401 L 285.54036,171.6433 C 292.89546,171.6399 295.73166,173.769 299.77886,178.8507 L 388.15426,292.9709 C 388.96306,294.9787 388.23836,296.9865 385.98026,297.1542 z"/>
+      <rect id="rect613" style="font-size:12px;fill:#000002;fill-rule:evenodd" transform="matrix(0.8854492,0.4647361,-0.4080531,0.9129582,0,0)" y="-14.842998" x="123.87642" ry="11.816919" rx="11.204546" height="124.68408" width="62.141693"/>
+      <rect id="rect615" style="font-size:12px;fill-rule:evenodd" y="46.624874" x="62.235527" ry="8" rx="9.4117651" height="32.5" width="100.00001"/>
+      <rect id="rect616" style="font-size:12px;fill-rule:evenodd" transform="matrix(0.4686899,-0.8833628,0.7446349,0.6674719,0,0)" y="81.759407" x="-81.341789" ry="6.8044353" rx="8.770999" height="27.643017" width="93.191841"/>
+      <rect id="rect617" style="font-size:12px;fill-rule:evenodd" transform="matrix(0.8845854,0.4663782,-0.4366812,0.8996163,0,0)" y="83.646034" x="80.548698" ry="3.8168414" rx="27.532589" height="15.505919" width="292.53378"/>
+      <rect id="rect618" style="font-size:12px;fill-rule:evenodd" transform="matrix(-5.7205843e-2,-0.9983624,0.9970356,-7.6942184e-2,0,0)" y="144.00377" x="-203.17215" ry="6.6537714" rx="12.701341" height="27.030947" width="134.95171"/>
+      <ellipse sodipodi:ry="32.5" sodipodi:rx="31.25" sodipodi:cy="467.36218" sodipodi:cx="418.75" id="path619" style="font-size:12px;fill-rule:evenodd;stroke-width:1" transform="matrix(0.957573,0,0,0.972804,-219.55633,-423.0267)" ry="32.5" rx="31.25" cy="467.36218" cx="418.75"/>
+      <rect id="rect621" style="font-size:12px;fill-rule:evenodd" transform="matrix(-0.2340079,-0.9722347,0.9856452,-0.16883,0,0)" y="45.608078" x="-250.27161" ry="7.6888905" rx="7.3474178" height="31.236115" width="78.066315"/>
+      <rect id="rect622" style="font-size:12px;fill-rule:evenodd" transform="matrix(-7.5698648e-3,-0.9999713,0.9970336,7.6967061e-2,0,0)" y="100.42473" x="-287.73053" ry="7.6912837" rx="7.3637767" height="31.245834" width="78.240143"/>
+      <rect id="rect623" style="font-size:12px;fill-rule:evenodd" transform="matrix(0.4947081,-0.8690592,0.8178671,0.5754071,0,0)" y="135.70329" x="-232.42075" ry="7.8654013" rx="14.748785" height="31.953188" width="156.70583"/>
+    </g>
+  </g>
+</svg>
\ No newline at end of file
diff --git a/Templates/ContextMenu.template b/Templates/ContextMenu.template
new file mode 100644 (file)
index 0000000..3fb2955
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<MenuItem MinimumSize="20,20" Fit="true" Caption="Context Menu" Data="{ContextCommands}" Orientation="Vertical"
+       IsOpened ="true" Visible="{/IsOpened}" SelectionBackground="Transparent"
+       Background="Red">
+       <Template>
+               <HorizontalStack>
+                       <Border Background="DimGray" Foreground="Jet" CornerRadius="5">
+                       <GenericStack Orientation="{./Orientation}" Name="ItemsContainer"
+                               Margin="2"/>
+                       </Border>
+               </HorizontalStack>
+       </Template>
+       <ItemTemplate>
+               <MenuItem Command="{}" Width="150" PopWidth="120" SelectionBackground="Transparent">
+                       <Template>
+                               <Popper Font="{./Font}" Caption="{./Caption}"  Background="{./Background}" PopDirection="{./PopDirection}"
+                                       Foreground = "{./Foreground}" CanPop="{./HasChildren}" MouseClick="./onMI_Click"
+                                       IsPopped="{²./IsOpened}" PopWidth="{./PopWidth}" PopHeight="{./PopHeight}">
+                                       <Template>
+                                               <Border Name="border1"
+                                                               CornerRadius="2"
+                                                               MouseEnter="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black}"
+                                                               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}"
+                                                               MinimumSize = "60,0"
+                                                               Foreground="Transparent"
+                                                               Background="{./Background}">
+                                                               <Label Text="{./Caption}"
+                                                                       Foreground="{./Foreground}"
+                                                                       Margin="3" HorizontalAlignment="Left"
+                                                                       Font="{./Font}" />
+                                               </Border>
+                                       </Template>
+                                       <Border Foreground="DimGray" Width="{../PopWidth}" Height="{../PopHeight}" Background="Onyx">
+                                               <VerticalStack Name="ItemsContainer"/>
+                                       </Border>
+                               </Popper>
+                       </Template>
+               </MenuItem>
+       </ItemTemplate>
+</MenuItem>
+
index c560043ccca50f69fd87eab617c284cf3b33886b..99ae554564f6b3ed1282e24845e1e45fd114c8c4 100644 (file)
@@ -1,2 +1,2 @@
 <?xml version="1.0"?>
-<HorizontalStack Name="ItemsContainer" Margin="0" Background="{./Background}"/>
+<GenericStack Orientation="{./Orientation}" Name="ItemsContainer" Margin="0" Background="{./Background}"/>
index 0f93b20c859efca12744c579a48f137afbe6f8ef..511c52657310593bc97276c6a9bdef0d999b4898 100644 (file)
@@ -13,7 +13,7 @@
                                Background="{./Background}">
                                <Label Text="{./Caption}"
                                        Foreground="{./Foreground}"
-                                       Margin="1" HorizontalAlignment="Left"
+                                       Margin="2" HorizontalAlignment="Left"
                                        Font="{./Font}" />
                </Border>
        </Template>
index a33470b00ac849e349eaad31cc07dce43c239aa3..9327a11253059c75e70a3d5dfb3521446f88a570 100644 (file)
@@ -47,6 +47,7 @@ namespace Tests
                string[] testFiles;
 
                #region Test values for Binding
+               public List<Crow.Command> Commands;
                public int intValue = 500;
                DirectoryInfo curDir = new DirectoryInfo (Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
                //DirectoryInfo curDir = new DirectoryInfo (@"/mnt/data/Images");
@@ -135,17 +136,40 @@ namespace Tests
 
                void OnLoadList (object sender, MouseButtonEventArgs e) => TestList = Color.ColorDic.Values.ToList();
 
+               void command1(){
+                       Console.WriteLine("command1 triggered");
+               }
+               void command2(){
+                       Console.WriteLine("command2 triggered");
+               }
+               void command3(){
+                       Console.WriteLine("command3 triggered");
+               }
+               void command4(){
+                       Console.WriteLine("command4 triggered");
+               }
+
                protected override void OnLoad (EventArgs e)
                {
                        base.OnLoad (e);
 
+                       Commands = new List<Crow.Command> (new Crow.Command[] {
+                               new Crow.Command(new Action(() => command1())) { Caption = "command1"},
+                               new Crow.Command(new Action(() => command2())) { Caption = "command2"},
+                               new Crow.Command(new Action(() => command3())) { Caption = "command3"},
+                               new Crow.Command(new Action(() => command4())) { Caption = "command4"},
+                       });
+
                        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/TemplatedContainer/testTabView.crow" };
-                       testFiles = new string [] { @"Interfaces/TemplatedControl/testSpinner.crow" };
+                       //testFiles = new string [] { @"Interfaces/TemplatedControl/testSpinner.crow" };
+                       //testFiles = new string [] { @"Interfaces/GraphicObject/testCtxMenu.crow" };
+                       testFiles = new string [] { @"Interfaces/TemplatedControl/testItemTemplateTag.crow" };
+                       testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.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 ();
@@ -155,7 +179,6 @@ namespace Tests
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedGroup", "*.crow")).ToArray ();
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.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/Unsorted", "*.crow")).ToArray ();
 
                        Load(testFiles[idx]).DataSource = this;
diff --git a/Tests/Interfaces/GraphicObject/testCtxMenu.crow b/Tests/Interfaces/GraphicObject/testCtxMenu.crow
new file mode 100755 (executable)
index 0000000..86ebcf2
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<GraphicObject MouseEnter="{Background=Red}" MouseLeave="{Background=Green}" Margin="10" Width="50%" Height="50%" Focusable="true"
+               Background="hgradient|0:Red|0.25:Blue|0.5:Green|0.75:Yellow|1:Red"
+               MinimumSize="50,50" ContextCommands="{Commands}"/>
\ No newline at end of file
index 5016b0ee01c276ec109afc1b34f7b0ab42fa375e..fb384de9b2b3e9c6c47423697b94dfb29a531c9e 100644 (file)
     <None Include="Interfaces\Divers\testShape.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="Interfaces\GraphicObject\testCtxMenu.crow">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />
index 39c3c9cb9c11e3b3e3baf15329c179f04bf27d97..a6b0f0b0b5e4d75ba9c0d8bb8f8d1c05a509df77 100644 (file)
@@ -71,9 +71,9 @@ namespace Crow
        /// 
        /// ```csharp\n
        ///     //storing\n
-       ///     Configuration.Set ("Option1", 42);\n
+       ///     Configuration.Global.Set ("Option1", 42);\n
        ///     //loading\n
-       ///     int op1 = Configuration.Get<int> ("Option1");\n
+       ///     int op1 = Configuration.Global.Get<int> ("Option1");\n
        /// ```\n
        /// </summary>
        /// 
@@ -82,15 +82,28 @@ namespace Crow
        /// 
        /// When running the application for the first time, some default options may be necessary. Their can be defined
        /// in a special embedded resource text file with the key '**appname.default.config**'
-       public static class Configuration
+       public class Configuration
        {
-               volatile static bool isDirty = false;
-               static string configPath, configFileName = "app.config";
-               static Dictionary<string, ConfigItem> items;
+               volatile bool isDirty = false;
+               string configPath;
+               Dictionary<string, ConfigItem> items = new Dictionary<string, ConfigItem> ();
+               static Configuration  globalConfig;
 
+               public static Configuration Global { get { return globalConfig; } }
+
+               public Configuration (string path, Stream defaultConf = null) {
+                       configPath = path;
+                       if (File.Exists (configPath)) {
+                               using (Stream s = new FileStream (configPath, FileMode.Open))
+                                       load (s);
+                               
+                       } else if (defaultConf != null) {                               
+                               load (defaultConf);
+                       }
+                       startSavingThread ();
+               }
                static Configuration ()
                {
-                       items = new Dictionary<string, ConfigItem> ();
                        string configRoot =
                                Path.Combine(
                                        Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
@@ -98,39 +111,29 @@ namespace Crow
 
                        Assembly a = Assembly.GetEntryAssembly ();
                        string appName = a.GetName().Name;
+                       string globalConfigPath = Path.Combine (configRoot, appName);
 
-                       configPath = Path.Combine (configRoot, appName);
+                       if (!Directory.Exists (globalConfigPath))
+                               Directory.CreateDirectory (globalConfigPath);
 
-                       if (!Directory.Exists(configPath))
-                               Directory.CreateDirectory (configPath);
+                       globalConfigPath = Path.Combine (globalConfigPath, "global.config");
 
-                       string path = Path.Combine(configPath, configFileName);
-
-                       if (File.Exists (path)) {
-                               using (Stream s = new FileStream (path, FileMode.Open))
-                                       load (s);
-                       } else {
-                               string defaultConfigResID = appName + ".default.config";
-                               bool found = false;
-                               foreach (string resIds in a.GetManifestResourceNames()) {
-                                       if (string.Equals (defaultConfigResID, resIds, StringComparison.OrdinalIgnoreCase)) {
-                                               using (Stream s = a.GetManifestResourceStream (defaultConfigResID))
-                                                       load (s);
-                                               found = true;
-                                               break;
-                                       }
+                       string defaultConfigResID = appName + ".default.config";
+                       foreach (string resIds in a.GetManifestResourceNames()) {
+                               if (string.Equals (defaultConfigResID, resIds, StringComparison.OrdinalIgnoreCase)) {
+                               using (Stream s = a.GetManifestResourceStream (defaultConfigResID))
+                                       globalConfig = new Configuration (globalConfigPath, s);
+                                       return;
                                }
-                               if (!found)
-                                       Console.WriteLine ("No Default Config found. ({0})", defaultConfigResID);
                        }
-                       startSavingThread ();
+                       globalConfig = new Configuration (globalConfigPath);
                }
-               static void startSavingThread(){
+               void startSavingThread(){
                        Thread t = new Thread (savingThread);
                        t.IsBackground = true;
                        t.Start ();
                }
-               static void savingThread(){
+               void savingThread(){
                        while(true){
                                if (isDirty) {
                                        save ();
@@ -143,7 +146,7 @@ namespace Crow
                /// retrive the value of the configuration key given in parameter
                /// </summary>
                /// <param name="key">option name</param>
-               public static T Get<T>(string key)
+               public T Get<T>(string key)
                {
                        return !items.ContainsKey (key) ? default(T) : items [key].GetValue<T> ();
                }
@@ -152,7 +155,7 @@ namespace Crow
                /// </summary>
                /// <param name="key">option name</param>
                /// <param name="value">value for that option</param>
-               public static void Set<T>(string key, T value)
+               public void Set<T>(string key, T value)
                {
                        if (!items.ContainsKey (key)) {
                                lock(items)
@@ -161,8 +164,8 @@ namespace Crow
                                items[key].Set (value);
                        isDirty = true;
                }
-               static void save(){
-                       using (Stream s = new FileStream(Path.Combine(configPath, configFileName),FileMode.Create)){
+               void save(){
+                       using (Stream s = new FileStream(configPath,FileMode.Create)){
                                using (StreamWriter sw = new StreamWriter (s)) {
                                        lock (items) {
                                                foreach (string key in items.Keys) {
@@ -172,7 +175,7 @@ namespace Crow
                                }
                        }
                }
-               static void load(Stream s){
+               void load(Stream s){
                        using (StreamReader sr = new StreamReader (s)) {
                                while (!sr.EndOfStream) {
                                        string l = sr.ReadLine();
index ad02a54430dc0fcf7a2b06352e33eb65d2ad9bde..ad9392b0cf410b97133eb7df943246e19ec66172 100644 (file)
@@ -190,7 +190,8 @@ namespace Crow
                bool isDragged;
                bool allowDrag;
                bool allowDrop;
-
+               string tooltip;
+               IList<Command> contextCommands;
                #endregion
 
                #region public fields
@@ -764,7 +765,7 @@ namespace Crow
                /// Seek first logical tree upward if logicalParent is set, or seek graphic tree for
                /// a not null dataSource that will be active for all descendants having dataSource=null
                /// </summary>
-               [XmlAttributeAttribute][DefaultValue(null)]
+               [XmlAttributeAttribute]//[DefaultValue(null)]
                public virtual object DataSource {
                        set {
                                if (DataSource == value)
@@ -774,6 +775,10 @@ namespace Crow
                                dataSource = value;
                                dse.NewDataSource = DataSource;
 
+                               //prevent setting null causing stack overflow in specific case
+                               if (dse.NewDataSource == dse.OldDataSource)
+                                       return;
+
                                OnDataSourceChanged (this, dse);
 
                                NotifyValueChanged ("DataSource", DataSource);
@@ -813,7 +818,6 @@ namespace Crow
                                NotifyValueChanged ("Style", style);
                        }
                }
-               string tooltip;
                [XmlAttributeAttribute]
                public virtual string Tooltip {
                        get { return tooltip; }
@@ -824,6 +828,16 @@ namespace Crow
                                NotifyValueChanged("Tooltip", tooltip);
                        }
                }
+               [XmlAttributeAttribute]
+               public IList<Command> ContextCommands {
+                       get { return contextCommands; }
+                       set {
+                               if (contextCommands == value)
+                                       return;
+                               contextCommands = value;
+                               NotifyValueChanged("ContextCommands", contextCommands);
+                       }
+               }
                #endregion
 
                #region Default and Style Values loading
@@ -1499,24 +1513,45 @@ namespace Crow
         #endregion
 
                #region Mouse handling
+               public virtual bool PointIsIn(ref Point m)
+               {                       
+                       if (!(Visible & isEnabled)||IsDragged)
+                               return false;                           
+                       ILayoutable tmp = Parent;
+                       //while (tmp != null){
+                       if (!parent.PointIsIn(ref m))
+                               return false;
+                       m -= (parent.getSlot().Position + parent.ClientRectangle.Position) ;
+
+                       return Slot.ContainsOrIsEqual (m);                                      
+               }
                public virtual bool MouseIsIn(Point m)
                {
-                       try {
-                               if (!(Visible & isEnabled)||IsDragged)
-                                       return false;
-                               if (ScreenCoordinates (Slot).ContainsOrIsEqual (m)) {
-                                       Scroller scr = Parent as Scroller;
-                                       if (scr == null) {
-                                               if (Parent is GraphicObject)
-                                                       return (Parent as GraphicObject).MouseIsIn (m);
-                                               else return true;
-                                       }
-                                       return scr.MouseIsIn (scr.savedMousePos);
-                               }
-                       } catch (Exception ex) {
-                               return false;
-                       }
-                       return false;
+                       Point p = m;
+                       return PointIsIn (ref m);
+//                     try {
+//                             if (!(Visible & isEnabled)||IsDragged)
+//                                     return false;                           
+//                             ILayoutable tmp = Parent;
+//                             //while (tmp != null){
+//                             if (!parent.MouseIsIn(m))
+//                                     return false;
+//                             m -= (parent.getSlot().Position + parent.ClientRectangle.Position) ;
+//
+//                             return slot.ContainsOrIsEqual (m);
+////                                   Scroller scr = tmp as Scroller;                                         
+////                                   if (scr != null) {
+////                                           m.Y += scr.ScrollY;
+////                                           m.X += scr.ScrollX;
+////                                   }                                       
+////                                   tmp = tmp.Parent;
+//                             //}
+//
+//                             //}
+//                     } catch (Exception ex) {
+//                             return false;
+//                     }
+                       //return false;
                }
                public virtual void checkHoverWidget(MouseMoveEventArgs e)
                {
@@ -1525,7 +1560,7 @@ namespace Crow
                                onMouseEnter (this, e);
                        }
 
-                       this.onMouseMove (this, e);//without this, window border doesn't work, should be removed
+                       //this.onMouseMove (this, e);//without this, window border doesn't work, should be removed
                }
                public virtual void onMouseMove(object sender, MouseMoveEventArgs e)
                {
@@ -1553,6 +1588,8 @@ namespace Crow
                                if (be.Focused == null) {
                                        be.Focused = this;
                                        CurrentInterface.FocusedWidget = this;
+                                       if (e.Button == MouseButton.Right && this.ContextCommands != null)
+                                               CurrentInterface.ShowContextMenu (this);                                        
                                }
                        }
                        //bubble event to the top
index c944eba256dc78d6897cda59d71ae22c6e030a05..3802a4d993bef98386ad69fd3128e7e95eb6a017 100644 (file)
@@ -147,7 +147,7 @@ namespace Crow
                        lock (children) {
                                foreach (GraphicObject g in children)
                                        if (g.localDataSourceIsNull & g.localLogicalParentIsNull)
-                                               g.OnDataSourceChanged (sender, e);
+                                               g.OnDataSourceChanged (g, e);
                        }
                }
                public override GraphicObject FindByName (string nameToFind)
index c0c1cf5cfd2cf0f06dcbef65e9070e14d882c188..c8aa38fbf1d88730755d2d56d843b79d70f5f00a 100644 (file)
@@ -45,7 +45,7 @@ namespace Crow
                void RegisterForLayouting(LayoutingType layoutType);
                void RegisterClip(Rectangle clip);
                bool UpdateLayout(LayoutingType layoutType);
-
+               bool PointIsIn(ref Point m);
 
                Rectangle ContextCoordinates(Rectangle r);
                Rectangle ScreenCoordinates (Rectangle r);
index ae27b0136dc9447157f79f9d60e48e1d1454d961..5c9665fb4ae9784d31d4749af625387cdf8057e1 100644 (file)
@@ -40,7 +40,6 @@ namespace Crow
                public event EventHandler Open;
                public event EventHandler Close;
 
-               string caption;
                Command command;
                Picture icon;
                bool isOpened;
@@ -58,7 +57,8 @@ namespace Crow
 
                                if (isOpened) {
                                        onOpen (this, null);
-                                       (LogicalParent as Menu).AutomaticOpenning = true;
+                                       if (LogicalParent is Menu)
+                                               (LogicalParent as Menu).AutomaticOpenning = true;
                                }else
                                        onClose (this, null);
                        }
@@ -143,8 +143,10 @@ namespace Crow
                }
                void onMI_Click (object sender, MouseButtonEventArgs e)
                {
-                       if (command != null)
+                       if (command != null) {
                                command.Execute ();
+                               closeMenu ();
+                       }
                        if(!IsOpened)
                                (LogicalParent as Menu).AutomaticOpenning = false;
                }
@@ -152,6 +154,7 @@ namespace Crow
                        Open.Raise (this, null);
                }
                protected virtual void onClose (object sender, EventArgs e){
+                       System.Diagnostics.Debug.WriteLine ("close: " + this.ToString());
                        Close.Raise (this, null);
                }
                public override bool MouseIsIn (Point m)
@@ -170,6 +173,14 @@ namespace Crow
                                IsOpened = false;
                        base.onMouseLeave (this, e);
                }
+
+               void closeMenu () {
+                       MenuItem tmp = LogicalParent as MenuItem;
+                       while (tmp != null) {
+                               tmp.IsOpened = false;
+                               tmp = tmp.LogicalParent as MenuItem;
+                       }
+               }
        }
 }
 
index 41210dc56cadf394904591c15dad92bfa59514ff..be4a19b88c6a4865cbb6078c071cbdc8880ef3e7 100644 (file)
@@ -192,6 +192,12 @@ namespace Crow
                        base.onMouseLeave (this, e);
                        IsPopped = false;
                }
+//             public override bool PointIsIn (ref Point m)
+//             {
+//                     if (!base.PointIsIn (ref m))
+//                             return false;
+//                     
+//             }
                public override bool MouseIsIn (Point m)
                {
                        bool isInContent = false;
index e76b57a828debf8e2a52ec3b7cede086a873d009..8383a274865ffeb62a3f1d8d4b52f194b7b0a0f5 100644 (file)
@@ -92,7 +92,7 @@ namespace Crow
                        base.OnDataSourceChanged (this, e);
                        if (child != null)
                        if (child.localDataSourceIsNull & child.localLogicalParentIsNull)
-                                       child.OnDataSourceChanged (sender, e);
+                               child.OnDataSourceChanged (child, e);
                }
                public override bool UpdateLayout (LayoutingType layoutType)
                {
index ec3bc47d47cc10d660d9b31a525d39fe821ed78d..a4e1b8164380467540da080c0919a68eb0281548 100644 (file)
@@ -219,17 +219,39 @@ namespace Crow
                }
 
                #region Mouse handling
-               internal Point savedMousePos;
-               public override bool MouseIsIn (Point m)
-               {
-                       return Visible ? base.ScreenCoordinates(Slot).ContainsOrIsEqual (m) : false;
-               }
-               public override void checkHoverWidget (MouseMoveEventArgs e)
+               //internal Point savedMousePos;
+
+               public override bool PointIsIn (ref Point m)
                {
-                       savedMousePos = e.Position;
-                       Point m = e.Position - new Point (ScrollX, ScrollY);
-                       base.checkHoverWidget (new MouseMoveEventArgs(m.X,m.Y,e.XDelta,e.YDelta));
+//                     if (!(Visible & IsEnabled)||IsDragged)
+//                             return false;                           
+//                     ILayoutable tmp = Parent;
+//                     //while (tmp != null){
+//                     if (!Parent.PointIsIn(ref m))
+//                             return false;
+//                     m -= (Parent.getSlot().Position + Parent.ClientRectangle.Position);
+//                     if (!Slot.ContainsOrIsEqual (m) || child==null)
+//                             return false;
+//                     m += new Point (ScrollX, ScrollY);
+//                     return true;
+                       if (!base.PointIsIn(ref m))
+                               return false;
+                       //m -= (Parent.getSlot().Position + Parent.ClientRectangle.Position);
+                       if (!Slot.ContainsOrIsEqual (m) || child==null)
+                               return false;
+                       m += new Point (ScrollX, ScrollY);
+                       return true;
                }
+//             public override bool MouseIsIn (Point m)
+//             {
+//                     return Visible ? base.ScreenCoordinates(Slot).ContainsOrIsEqual (m) : false;
+//             }
+//             public override void checkHoverWidget (MouseMoveEventArgs e)
+//             {
+//                     savedMousePos = e.Position;
+//                     Point m = e.Position - new Point (ScrollX, ScrollY);
+//                     base.checkHoverWidget (new MouseMoveEventArgs(m.X,m.Y,e.XDelta,e.YDelta));
+//             }
                public override void onMouseWheel (object sender, MouseWheelEventArgs e)
                {
                        if (Child == null)
@@ -240,12 +262,12 @@ namespace Crow
                        if (HorizontalScrolling )
                                ScrollX -= e.Delta * ScrollSpeed;
                }
-               public override void onMouseMove (object sender, MouseMoveEventArgs e)
-               {
-                       savedMousePos.X += e.XDelta;
-                       savedMousePos.Y += e.YDelta;
-                       base.onMouseMove (sender, new MouseMoveEventArgs(savedMousePos.X,savedMousePos.Y,e.XDelta,e.YDelta));
-               }
+//             public override void onMouseMove (object sender, MouseMoveEventArgs e)
+//             {
+//                     savedMousePos.X += e.XDelta;
+//                     savedMousePos.Y += e.YDelta;
+//                     base.onMouseMove (sender, new MouseMoveEventArgs(savedMousePos.X,savedMousePos.Y,e.XDelta,e.YDelta));
+//             }
                public override void RegisterClip (Rectangle clip)
                {
                        base.RegisterClip (clip - new Point(ScrollX,ScrollY));
index 31bbc4368d41ce77694b5a1c9eef481afd403151..3e0dd801fcbea1d0e9713f61ad2296aa2a9f21cb 100644 (file)
@@ -77,12 +77,11 @@ namespace Crow
                }
                public override bool Contains (GraphicObject goToFind)
                {
-                       if (Content == null)
-                               return base.Contains (goToFind);
-
                        if (Content == goToFind)
                                return true;
-                       return Content.Contains (goToFind);
+                       if (Content?.Contains (goToFind) == true)
+                               return true;
+                       return base.Contains (goToFind);
                }
                #endregion
        }
index 069303dd0114f2097eda4956fdcbd0833a93472d..ef099f933a4b3590cee225c3d4d16cde4508fda5 100644 (file)
@@ -344,7 +344,9 @@ namespace Crow
                        #endif
 
                        Group page;
-                       if (typeof(TabView).IsAssignableFrom (items.GetType ())||typeof(Wrapper).IsAssignableFrom (items.GetType ())) {
+                       if (typeof(TabView).IsAssignableFrom (items.GetType ())||
+                               typeof(Menu).IsAssignableFrom (this.GetType())||
+                               typeof(Wrapper).IsAssignableFrom (items.GetType ())) {
                                page = items;
                                itemPerPage = int.MaxValue;
                        } else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) {
@@ -425,7 +427,8 @@ namespace Crow
                        lock (CurrentInterface.LayoutMutex) {
                                g = iTemp.CreateInstance(CurrentInterface);
                                page.AddChild (g);
-                               //g.LogicalParent = this;
+//                             if (isPaged)
+//                                     g.LogicalParent = this;
                                registerItemClick (g);
                        }
 
index b9f8b902a1ecd7fe42bbbe32cb16e2666fb5cfca..450a9d2d454b60f1fdb37d0874df6484ea9e41c9 100644 (file)
@@ -54,18 +54,21 @@ namespace Crow.IML
                        if (splitedExp.Length < 2)//dataSource binding
                                return null;
 
-                       if (string.IsNullOrEmpty (splitedExp [0]) || splitedExp [0] == ".") {//search template root
-                               ptr--;
-                               while (ptr >= 0) {
-                                       if (typeof(TemplatedControl).IsAssignableFrom (this [ptr].CrowType))
-                                               break;
+                       if (!string.IsNullOrEmpty (splitedExp [0])) {//else bind on current node
+                               //return new NodeAddress (this.Take(ptr+1).ToArray());
+                               if (splitedExp [0] == ".") {//search template root
                                        ptr--;
+                                       while (ptr >= 0) {
+                                               if (typeof(TemplatedControl).IsAssignableFrom (this [ptr].CrowType))
+                                                       break;
+                                               ptr--;
+                                       }
+                               } else if (splitedExp [0] == "..") { //search starting at current node
+                                       int levelUp = splitedExp.Length - 1;
+                                       if (levelUp > ptr + 1)
+                                               throw new Exception ("Binding error: try to bind outside IML source");
+                                       ptr -= levelUp;
                                }
-                       } else if (splitedExp [0] == "..") { //search starting at current node
-                               int levelUp = splitedExp.Length - 1;
-                               if (levelUp > ptr + 1)
-                                       throw new Exception ("Binding error: try to bind outside IML source");
-                               ptr -= levelUp;
                        }
                        expression = splitedExp [splitedExp.Length - 1];
                        //TODO:change Template special address identified with Nodecount = 0 to something not using array count to 0,
index e1f7ae2acfa3752712c4b925a3cf00959df2f0b4..cf883f13b4f4088047ca5982103d7c313b1e6c2a 100644 (file)
@@ -257,6 +257,12 @@ namespace Crow
            this.IsPressed = pressed;
        }
 
+       public MouseButtonEventArgs(MouseButton button)
+               : base()
+       {
+               this.button = button;
+       }
+
        /// <summary>
        /// Constructs a new <see cref="MouseButtonEventArgs"/> instance.
        /// </summary>
index 03ea9308af626b5034b9d322f3dd7cc892314338..0393fbc8cd320595fa70f536d9f3f162f6ef899e 100644 (file)
@@ -75,6 +75,15 @@ namespace Crow
                        if (!Directory.Exists (CrowConfigRoot))
                                Directory.CreateDirectory (CrowConfigRoot);
 
+                       //ensure all assemblies are loaded, because IML could contains classes not instanciated in source
+//                     foreach (string af in Directory.GetFiles (AppDomain.CurrentDomain.BaseDirectory, "*.dll")){
+//                             try {
+//                                     Assembly.LoadFrom (af); 
+//                             } catch (Exception ex) {
+//                                     Console.WriteLine ("{0} not loaded as assembly.", af);
+//                             }
+//                     }
+
                        loadCursors ();
                        findAvailableTemplates ();
 
@@ -89,6 +98,7 @@ namespace Crow
                        CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                        loadStyling ();
                        initTooltip ();
+                       initContextMenus ();
                }
                #endregion
 
@@ -676,6 +686,12 @@ namespace Crow
                /// <summary>Set visible state of widget to false and remove if from the graphic tree</summary>
                public void RemoveWidget(GraphicObject g)
                {
+                       if (g.Contains(HoverWidget)) {
+                               while (HoverWidget != g.LogicalParent) {
+                                       HoverWidget.onMouseLeave (HoverWidget, null);
+                                       HoverWidget = HoverWidget.LogicalParent as GraphicObject;
+                               }
+                       }
                        lock (UpdateMutex) {
                                RegisterClip (g.ScreenCoordinates (g.LastPaintedSlot));
                                GraphicTree.Remove (g);
@@ -861,7 +877,7 @@ namespace Crow
                public bool ProcessMouseButtonUp(int button)
                {
                        Mouse.DisableBit (button);
-                       MouseButtonEventArgs e = new MouseButtonEventArgs () { Mouse = Mouse };
+                       MouseButtonEventArgs e = new MouseButtonEventArgs ((Crow.MouseButton)button) { Mouse = Mouse };
 
                        if (_activeWidget == null)
                                return false;
@@ -888,7 +904,7 @@ namespace Crow
                public bool ProcessMouseButtonDown(int button)
                {
                        Mouse.EnableBit (button);
-                       MouseButtonEventArgs e = new MouseButtonEventArgs () { Mouse = Mouse };
+                       MouseButtonEventArgs e = new MouseButtonEventArgs ((Crow.MouseButton)button) { Mouse = Mouse };
 
                        if (HoverWidget == null)
                                return false;
@@ -1016,6 +1032,31 @@ namespace Crow
                }
                #endregion
 
+               #region Contextual menu
+               MenuItem ctxMenuContainer;
+               void initContextMenus (){
+                       ctxMenuContainer = Load  ("#Crow.ContextMenu.template") as MenuItem;
+               }
+
+               public void ShowContextMenu (GraphicObject go) {
+
+                       if (ctxMenuContainer.Parent == null)
+                               this.AddWidget (ctxMenuContainer);
+                       else
+                               ctxMenuContainer.IsOpened = true;
+                       
+                       ctxMenuContainer.LogicalParent = go;
+                       ctxMenuContainer.DataSource = go;
+
+                       PutOnTop (ctxMenuContainer, true);
+                       ctxMenuContainer.Left = Mouse.X - 5;
+                       ctxMenuContainer.Top = Mouse.Y - 5;
+
+                       HoverWidget = ctxMenuContainer;
+                       ctxMenuContainer.onMouseEnter (ctxMenuContainer, new MouseMoveEventArgs (Mouse.X, Mouse.Y, 0, 0));
+               }
+               #endregion
+
                #region Device Repeat Events
                volatile bool mouseRepeatOn, keyboardRepeatOn;
                volatile int mouseRepeatCount, keyboardRepeatCount;
@@ -1044,6 +1085,10 @@ namespace Crow
                #endregion
 
                #region ILayoutable implementation
+               public virtual bool PointIsIn(ref Point m)
+               {
+                       return true;
+               }
                public void RegisterClip(Rectangle r){
                        clipping.UnionRectangle (r);
                }