mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-13 11:27:42 +01:00
Init
This commit is contained in:
parent
33a7cdefa8
commit
78912c1552
3 changed files with 17 additions and 0 deletions
|
|
@ -648,6 +648,7 @@ public partial class FileDialog
|
|||
private void AddFileNameInSelection(string name, bool setLastSelection)
|
||||
{
|
||||
this.selectedFileNames.Add(name);
|
||||
this.SelectionChanged(this, this.GetFilePathName());
|
||||
if (this.selectedFileNames.Count == 1)
|
||||
{
|
||||
this.fileNameBuffer = name;
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ public partial class FileDialog
|
|||
this.SetupSideBar();
|
||||
}
|
||||
|
||||
public event EventHandler<string>? SelectionChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Shows the dialog.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ using System.Collections.Generic;
|
|||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
using FFXIVClientStructs;
|
||||
|
||||
namespace Dalamud.Interface.ImGuiFileDialog;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -25,11 +27,13 @@ public class FileDialogManager
|
|||
#pragma warning restore SA1401
|
||||
#pragma warning restore SA1201
|
||||
|
||||
public event EventHandler<string>? SelectionChanged;
|
||||
private FileDialog? dialog;
|
||||
private Action<bool, string>? callback;
|
||||
private Action<bool, List<string>>? multiCallback;
|
||||
private string savedPath = ".";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create a dialog which selects an already existing folder.
|
||||
/// </summary>
|
||||
|
|
@ -175,6 +179,13 @@ public class FileDialogManager
|
|||
this.multiCallback = null;
|
||||
}
|
||||
|
||||
public string? GetCurrentPath()
|
||||
{
|
||||
return this.dialog?.GetCurrentPath();
|
||||
}
|
||||
|
||||
private void OnSelectionChange(object sender, string path) => this.SelectionChanged(sender, path);
|
||||
|
||||
private void SetDialog(
|
||||
string id,
|
||||
string title,
|
||||
|
|
@ -200,9 +211,11 @@ public class FileDialogManager
|
|||
if (this.dialog is not null)
|
||||
{
|
||||
this.dialog.SortOrderChanged -= this.OnSortOrderChange;
|
||||
this.dialog.SelectionChanged -= this.OnSelectionChange;
|
||||
}
|
||||
|
||||
this.dialog = new FileDialog(id, title, filters, path, defaultFileName, defaultExtension, selectionCountMax, isModal, flags);
|
||||
|
||||
if (this.GetDefaultSortOrder is not null)
|
||||
{
|
||||
try
|
||||
|
|
@ -217,6 +230,7 @@ public class FileDialogManager
|
|||
}
|
||||
|
||||
this.dialog.SortOrderChanged += this.OnSortOrderChange;
|
||||
this.dialog.SelectionChanged += this.OnSelectionChange;
|
||||
this.dialog.WindowFlags |= this.AddedWindowFlags;
|
||||
foreach (var (name, location, icon, position) in this.CustomSideBarItems)
|
||||
this.dialog.SetQuickAccess(name, location, icon, position);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue