diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-09-02 12:44:36 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-09-02 12:44:36 +0200 |
| commit | 004ab2dee65d4b18e20d8999ff644dd197aa1cd8 (patch) | |
| tree | 5aacdac61be546b7411a2b0be804663221dd048c | |
| parent | 906de17554fd6f9e83d08ff2b1c5fa7113b8ed8e (diff) | |
rename Root to CurrentDirectory, et CurrentDirectory to
FileSystemEntries
modifié : CrowIDE/ui/imlEditor.crow
modifié : Templates/DirectoryView.template
modifié : Tests/Interfaces/Divers/0.crow
modifié : src/GraphicObjects/DirectoryView.cs
thiner menu
modifié : Templates/Menu.template
modifié : Templates/MenuItem.template
| -rwxr-xr-x | Templates/DirectoryView.template | 6 | ||||
| -rw-r--r-- | Templates/Menu.template | 2 | ||||
| -rw-r--r-- | Templates/MenuItem.template | 2 | ||||
| -rwxr-xr-x | Tests/Interfaces/Divers/0.crow | 2 | ||||
| -rw-r--r-- | src/GraphicObjects/DirectoryView.cs | 34 |
5 files changed, 25 insertions, 21 deletions
diff --git a/Templates/DirectoryView.template b/Templates/DirectoryView.template index 44ee0600..e866f036 100755 --- a/Templates/DirectoryView.template +++ b/Templates/DirectoryView.template @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<TreeView IsRoot="true" Name="treeView" Data="{./CurrentDirectory}" +<TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}" SelectedItemChanged="./onSelectedItemChanged"> <ItemTemplate DataType="System.IO.FileInfo"> <HorizontalStack Focusable="true" Height="Fit" Width="Stretched" Background="{../Background}" > @@ -10,7 +10,7 @@ MouseLeave="{Background=Transparent}"/> </HorizontalStack> </ItemTemplate> - <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetFileSystemInfos"> + <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetDirectories"> <Expandable Caption="{Name}" > <Template> <VerticalStack Height="{./HeightPolicy}" Width="{./WidthPolicy}"> @@ -18,7 +18,7 @@ MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}" MouseLeave="{Background=Transparent}"> <Image Margin="2" Width="12" Height="12" - Visible="{./HasContent}" + Visible="{./HasChildren}" Path="{./Image}" SvgSub="{./IsExpanded}"/> <Image Margin="2" Width="14" Height="14" diff --git a/Templates/Menu.template b/Templates/Menu.template index facc1892..d49e0b31 100644 --- a/Templates/Menu.template +++ b/Templates/Menu.template @@ -1,3 +1,3 @@ <?xml version="1.0"?> -<HorizontalStack Name="ItemsContainer" Margin="2" Background="{./Background}" +<HorizontalStack Name="ItemsContainer" Margin="0" Background="{./Background}" Width="{./WidthPolicy}" Height="{./HeightPolicy}"/> diff --git a/Templates/MenuItem.template b/Templates/MenuItem.template index c03cc27d..c6c545f6 100644 --- a/Templates/MenuItem.template +++ b/Templates/MenuItem.template @@ -14,7 +14,7 @@ Background="{./Background}"> <Label Text="{./Caption}" Foreground="{./Foreground}" - Margin="3" HorizontalAlignment="Left" + Margin="1" HorizontalAlignment="Left" Font="{./Font}" /> </Border> </Template> diff --git a/Tests/Interfaces/Divers/0.crow b/Tests/Interfaces/Divers/0.crow index 18b06910..c1b06aff 100755 --- a/Tests/Interfaces/Divers/0.crow +++ b/Tests/Interfaces/Divers/0.crow @@ -143,7 +143,7 @@ <Label Width="Stretched" Margin="1" Text="{../../dv.SelectedItem}"/> </Border> <Border Margin="5" Background="Onyx" Height="50%"> - <DirectoryView Name="dv" Root="./" Margin="1"/> + <DirectoryView Name="dv" CurrentDirectory="./" Margin="1"/> </Border> <Splitter/> <ListBox Data="{TestList}" Background="Onyx" Margin="5" diff --git a/src/GraphicObjects/DirectoryView.cs b/src/GraphicObjects/DirectoryView.cs index dbb0c212..4e29621e 100644 --- a/src/GraphicObjects/DirectoryView.cs +++ b/src/GraphicObjects/DirectoryView.cs @@ -37,8 +37,8 @@ namespace Crow public event EventHandler<SelectionChangeEventArgs> SelectedItemChanged; #endregion - string _root = "/"; - bool _showFiles; + string currentDirectory = "/"; + bool showFiles; object _selectedItem; [XmlIgnore]public object SelectedItem { @@ -52,29 +52,33 @@ namespace Crow NotifyValueChanged ("SelectedItem", _selectedItem); } } - [XmlAttributeAttribute()][DefaultValue(true)] + [XmlAttributeAttribute()][DefaultValue(false)] public virtual bool ShowFiles { - get { return _showFiles; } + get { return showFiles; } set { - if (_showFiles == value) + if (showFiles == value) return; - _showFiles = value; - NotifyValueChanged ("ShowFiles", _showFiles); + showFiles = value; + NotifyValueChanged ("ShowFiles", showFiles); + NotifyValueChanged ("FileSystemEntries", FileSystemEntries); } } [XmlAttributeAttribute][DefaultValue("/")] - public virtual string Root { - get { return _root; } + public virtual string CurrentDirectory { + get { return currentDirectory; } set { - if (_root == value) + if (currentDirectory == value) return; - _root = value; - NotifyValueChanged ("Root", _root); - NotifyValueChanged ("CurrentDirectory", CurrentDirectory); + currentDirectory = value; + NotifyValueChanged ("CurrentDirectory", currentDirectory); + NotifyValueChanged ("FileSystemEntries", FileSystemEntries); } } - [XmlIgnore]public FileSystemInfo[] CurrentDirectory { - get { return new DirectoryInfo (Root).GetFileSystemInfos (); } + [XmlIgnore]public FileSystemInfo[] FileSystemEntries { + get { + return showFiles ? new DirectoryInfo (CurrentDirectory).GetFileSystemInfos (): + new DirectoryInfo(currentDirectory).GetDirectories(); + } } public void onSelectedItemChanged (object sender, SelectionChangeEventArgs e){ if (e.NewValue == SelectedItem) |