diff --git a/Terminal.Gui/Core/Trees/Branch.cs b/Terminal.Gui/Core/Trees/Branch.cs index 2ee5fb77f..ce699af6b 100644 --- a/Terminal.Gui/Core/Trees/Branch.cs +++ b/Terminal.Gui/Core/Trees/Branch.cs @@ -121,7 +121,11 @@ namespace Terminal.Gui.Trees { Attribute color = symbolColor; if (tree.Style.ColorExpandSymbol) { - color = isSelected ? (tree.Style.HighlightModelTextOnly ? colorScheme.HotNormal : tree.ColorScheme.HotFocus) : tree.ColorScheme.HotNormal; + if (isSelected) { + color = tree.Style.HighlightModelTextOnly ? colorScheme.HotNormal : (tree.HasFocus ? tree.ColorScheme.HotFocus : tree.ColorScheme.HotNormal); + } else { + color = tree.ColorScheme.HotNormal; + } } else { color = symbolColor; } @@ -416,7 +420,7 @@ namespace Terminal.Gui.Trees { /// Expands the current branch and all children branches. /// internal void ExpandAll () - { + { Expand (); if (ChildBranches != null) { diff --git a/UICatalog/Scenarios/TreeViewFileSystem.cs b/UICatalog/Scenarios/TreeViewFileSystem.cs index 4ca3b8525..03441f2d4 100644 --- a/UICatalog/Scenarios/TreeViewFileSystem.cs +++ b/UICatalog/Scenarios/TreeViewFileSystem.cs @@ -78,14 +78,13 @@ namespace UICatalog.Scenarios { }; detailsFrame = new DetailsFrame () { - X = Pos.Right (treeViewFiles) + 1, + X = Pos.Right (treeViewFiles), Y = 0, Width = Dim.Fill (), Height = Dim.Fill (), }; Win.Add (detailsFrame); - treeViewFiles.ObjectActivated += TreeViewFiles_ObjectActivated; treeViewFiles.MouseClick += TreeViewFiles_MouseClick; treeViewFiles.KeyPress += TreeViewFiles_KeyPress; treeViewFiles.SelectionChanged += TreeViewFiles_SelectionChanged; @@ -160,23 +159,12 @@ namespace UICatalog.Scenarios { class DetailsFrame : FrameView { private FileSystemInfo fileInfo; - TextView details = new TextView () { - X = 1, - Y = 0, - Width = Dim.Fill (), - Height = Dim.Fill (), - ColorScheme = Colors.Base, - WordWrap = true, - ReadOnly = true - }; public DetailsFrame () { Title = "Details"; - ColorScheme = Colors.Dialog; Visible = true; CanFocus = true; - Add (details); } public FileSystemInfo FileInfo { @@ -186,20 +174,20 @@ namespace UICatalog.Scenarios { if (fileInfo is FileInfo f) { Title = $"File: {f.Name}"; sb = new System.Text.StringBuilder (); - sb.AppendLine ($"Path: {f.DirectoryName}"); - sb.AppendLine ($"Size: {f.Length:N0} bytes"); - sb.AppendLine ($"Modified: {f.LastWriteTime}"); - sb.AppendLine ($"Created: {f.CreationTime}"); + sb.AppendLine ($"Path:\n {f.FullName}\n"); + sb.AppendLine ($"Size:\n {f.Length:N0} bytes\n"); + sb.AppendLine ($"Modified:\n {f.LastWriteTime}\n"); + sb.AppendLine ($"Created:\n {f.CreationTime}"); } if (fileInfo is DirectoryInfo dir) { Title = $"Directory: {dir.Name}"; sb = new System.Text.StringBuilder (); - sb.AppendLine ($"Path: {dir?.FullName}"); - sb.AppendLine ($"Modified: {dir.LastWriteTime}"); - sb.AppendLine ($"Created: {dir.CreationTime}"); + sb.AppendLine ($"Path:\n {dir?.FullName}\n"); + sb.AppendLine ($"Modified:\n {dir.LastWriteTime}\n"); + sb.AppendLine ($"Created:\n {dir.CreationTime}\n"); } - details.Text = sb.ToString (); + Text = sb.ToString (); } } } @@ -207,25 +195,6 @@ namespace UICatalog.Scenarios { private void ShowPropertiesOf (FileSystemInfo fileSystemInfo) { detailsFrame.FileInfo = fileSystemInfo; - //if (fileSystemInfo is FileInfo f) { - // System.Text.StringBuilder sb = new System.Text.StringBuilder (); - // sb.AppendLine ($"Path:{f.DirectoryName}"); - // sb.AppendLine ($"Size:{f.Length:N0} bytes"); - // sb.AppendLine ($"Modified:{f.LastWriteTime}"); - // sb.AppendLine ($"Created:{f.CreationTime}"); - - // MessageBox.Query (f.Name, sb.ToString (), "Close"); - //} - - //if (fileSystemInfo is DirectoryInfo dir) { - - // System.Text.StringBuilder sb = new System.Text.StringBuilder (); - // sb.AppendLine ($"Path:{dir.Parent?.FullName}"); - // sb.AppendLine ($"Modified:{dir.LastWriteTime}"); - // sb.AppendLine ($"Created:{dir.CreationTime}"); - - // MessageBox.Query (dir.Name, sb.ToString (), "Close"); - //} } private void SetupScrollBar () @@ -278,11 +247,6 @@ namespace UICatalog.Scenarios { treeViewFiles.AddObjects (DriveInfo.GetDrives ().Select (d => d.RootDirectory)); } - private void TreeViewFiles_ObjectActivated (ObjectActivatedEventArgs obj) - { - ShowPropertiesOf (obj.ActivatedObject); - } - private void ShowLines () { miShowLines.Checked = !miShowLines.Checked;