]> O.S.I.I.S - jp/crow.git/commitdiff
add missing files in previous commit
authorjpbruyere <jp.bruyere@hotmail.com>
Sun, 7 Aug 2016 00:43:45 +0000 (02:43 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Sun, 7 Aug 2016 00:43:45 +0000 (02:43 +0200)
Templates/DirectoryView.crow [new file with mode: 0755]
Tests/Interfaces/Divers/imlEditor.crow [new file with mode: 0644]
Tests/Interfaces/Divers/testDirViewer2.crow [new file with mode: 0644]
Tests/Interfaces/Divers/testPropLess.crow [new file with mode: 0755]
src/GraphicObjects/DirectoryView.cs [new file with mode: 0644]

diff --git a/Templates/DirectoryView.crow b/Templates/DirectoryView.crow
new file mode 100755 (executable)
index 0000000..e861ef8
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<TreeView IsRoot="true" Name="treeView" Data="{./CurrentDirectory}"
+               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="GetFileSystemInfos">             
+               <Expandable Caption="{Name}" >
+                       <Template>
+                               <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}">
+                                       <HorizontalStack Spacing="1" Height="Fit" Width="{./WidthPolicy}"
+                                                       MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+                                                       MouseLeave="{Background=Transparent}">
+                                               <Image Margin="2" Width="12" Height="12"
+                                                       Visible="{./HasContent}"
+                                                       Path="{./Image}" 
+                                                       SvgSub="{./IsExpanded}"/>
+                                               <Image Margin="2" Width="14" Height="14"
+                                                       Path="#Crow.Images.Icons.folder.svg"/>
+                                               <Label Text="{./Caption}" Width="{./WidthPolicy}"/>
+                                       </HorizontalStack>
+                                       <Container Name="Content" Visible="false"
+                                                       Height="{./HeightPolicy}" Width="{./WidthPolicy}"/>
+                               </VerticalStack>
+                       </Template>
+                       <HorizontalStack Height="Fit" Width="{./WidthPolicy}">
+                               <GraphicObject Width="12" Height="10"/>
+                               <TreeView Name="List" Height="Fit" Width="{./WidthPolicy}"
+                                       Template="#Tests.Interfaces.treeList.crow" />
+                       </HorizontalStack>
+               </Expandable>
+       </ItemTemplate>
+</TreeView>
\ No newline at end of file
diff --git a/Tests/Interfaces/Divers/imlEditor.crow b/Tests/Interfaces/Divers/imlEditor.crow
new file mode 100644 (file)
index 0000000..527745c
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<Window Height="80%" Width="80%">
+       <HorizontalStack>
+               <DirectoryView Name="dv" Root="./" SelectedItemChanged="Tv_SelectedItemChanged"
+                       Width="20%" Height="100%" Margin="10"/>
+               <Splitter/>
+               <VerticalStack Width="80%" Height="100%">
+                       <Container Height="50%" Margin="10" MinimumSize="10,1"
+                                       Name="crowContainer"/>
+                       <Splitter/>
+                       <HorizontalStack Height="50%" Margin="10" MinimumSize="10,1">
+                               <Scroller Name="scroller1" Background="White" 
+                                               Margin="2" VerticalScrolling="true" ScrollY="{../scrollbar1.Value}"
+                                               ValueChanged="./_scroller_ValueChanged">
+                                       <TextBox Background="White" Height="Fit"
+                                                       VerticalAlignment="Top"
+                                                       TextAlignment="TopLeft" Font="mono, 10"
+                                                       Text="{CurSources}" Multiline="true"/>
+                               </Scroller>
+                               <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollY}" 
+                                       Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical" 
+                                       Width="14" />
+                       </HorizontalStack>
+               </VerticalStack>
+       </HorizontalStack>
+</Window>
diff --git a/Tests/Interfaces/Divers/testDirViewer2.crow b/Tests/Interfaces/Divers/testDirViewer2.crow
new file mode 100644 (file)
index 0000000..c4f0904
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<HorizontalStack>
+       <Window Resizable="false" Focusable="true" Title="Open File..." Width="20%" Height="100%"
+                       MinimumSize="10,1">
+               <DirectoryView Name="dv" Margin="10" Root="./" SelectedItemChanged="Tv_SelectedItemChanged"/>
+       </Window>
+       <Splitter/>
+       <VerticalStack Width="80%" Height="100%">
+               <Window Resizable="false" Focusable="true" Title="{../dv.SelectedItem}"
+                               Height="50%" Width="Stretched"
+                               MinimumSize="10,1">
+                       <Container Margin="10" Name="crowContainer"/>
+               </Window>
+               <Splitter/>
+               <Window Resizable="false" Focusable="true" Title="{../dv.SelectedItem}"
+                               Height="50%" Width="Stretched"
+                               MinimumSize="10,1">
+                       <TextBox Multiline="true" Margin="10" Height="Stretched"
+                               Text="{CurSources}"/>
+               </Window>
+       </VerticalStack>
+</HorizontalStack>
diff --git a/Tests/Interfaces/Divers/testPropLess.crow b/Tests/Interfaces/Divers/testPropLess.crow
new file mode 100755 (executable)
index 0000000..aa283bf
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<Label Margin="50" MinimumSize="10,10" Background="Onyx" Text="{PropertyLessBinding}"/>
\ No newline at end of file
diff --git a/src/GraphicObjects/DirectoryView.cs b/src/GraphicObjects/DirectoryView.cs
new file mode 100644 (file)
index 0000000..e9a9ef9
--- /dev/null
@@ -0,0 +1,73 @@
+//
+//  DirectoryView.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 System.IO;
+
+namespace Crow
+{
+       [DefaultTemplate("#Crow.Templates.DirectoryView.crow")]
+       public class DirectoryView : TemplatedControl
+       {
+               #region CTOR
+               public DirectoryView ()
+                       : base()
+               {}
+               #endregion
+
+               #region events
+               public event EventHandler<SelectionChangeEventArgs> SelectedItemChanged;
+               #endregion
+
+               string _root = "/";
+               bool _showFiles;
+
+               [XmlAttributeAttribute()][DefaultValue(true)]
+               public virtual bool ShowFiles {
+                       get { return _showFiles; }
+                       set {
+                               if (_showFiles == value)
+                                       return;
+                               _showFiles = value;
+                               NotifyValueChanged ("ShowFiles", _showFiles);
+                       }
+               }
+               [XmlAttributeAttribute][DefaultValue("/")]
+               public virtual string Root {
+                       get { return _root; }
+                       set {
+                               if (_root == value)
+                                       return;
+                               _root = value;
+                               NotifyValueChanged ("Root", _root);
+                               NotifyValueChanged ("CurrentDirectory", CurrentDirectory);
+                       }
+               }
+               [XmlIgnore]public FileSystemInfo[] CurrentDirectory {
+                       get { return new DirectoryInfo (Root).GetFileSystemInfos (); }
+               }
+               public void onSelectedItemChanged (object sender, SelectionChangeEventArgs e){
+                       SelectedItemChanged.Raise (this, e);
+               }
+       }
+}
+