From 66a57d415aad9962fc8d819a8008d03d910f7cb1 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Sun, 8 Sep 2024 17:22:47 +0100 Subject: [PATCH] Add dummy sort function --- project/code/TMV/UI/TextureBrowser.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/project/code/TMV/UI/TextureBrowser.cs b/project/code/TMV/UI/TextureBrowser.cs index 84088d1..9578285 100644 --- a/project/code/TMV/UI/TextureBrowser.cs +++ b/project/code/TMV/UI/TextureBrowser.cs @@ -1,3 +1,4 @@ +using System.Linq; using System.Text.RegularExpressions; using Godot; @@ -5,6 +6,14 @@ namespace KeepersCompound.TMV.UI; public partial class TextureBrowser : Node { + enum SortMode + { + Name, + Family, + Index, + Count, + } + private Tree _folderTree; private LineEdit _searchBar; private MenuButton _sortMenu; @@ -30,6 +39,7 @@ public partial class TextureBrowser : Node _texturePath = GetNode("%PathBox"); _searchBar.TextChanged += ApplySearchFilter; + _sortMenu.GetPopup().IdPressed += ApplySortMode; BuildFolderTree(); BuildTextureList(); // TODO: This should be triggered on folder change @@ -102,4 +112,15 @@ public partial class TextureBrowser : Node panel.Visible = Regex.IsMatch(panel.Name.ToString(), regexString); } } + + private void ApplySortMode(long id) + { + var popup = _sortMenu.GetPopup(); + for (var i = 0; i < popup.ItemCount; i++) + { + popup.SetItemChecked(i, popup.GetItemId(i) == id); + } + + // TODO: Actualy sort + } }