-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make more stuff async and show tasks/progress in UI
- Loading branch information
jupahe64
committed
Dec 6, 2023
1 parent
9d9dabd
commit 9351fd2
Showing
9 changed files
with
290 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Fushigi.util; | ||
using ImGuiNET; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Fushigi.ui.modal | ||
{ | ||
public abstract class OkDialog<TDialog> : IPopupModal<OkDialog<TDialog>.Void> | ||
where TDialog : OkDialog<TDialog>, new() | ||
{ | ||
private struct Void { } | ||
|
||
protected abstract string Title { get; } | ||
|
||
public static async Task ShowDialog(IPopupModalHost modalHost) | ||
{ | ||
var dialog = new TDialog(); | ||
await modalHost.ShowPopUp(dialog, dialog.Title, | ||
ImGuiWindowFlags.AlwaysAutoResize); | ||
} | ||
|
||
protected abstract void DrawBody(); | ||
|
||
void IPopupModal<Void>.DrawModalContent(Promise<Void> promise) | ||
{ | ||
DrawBody(); | ||
|
||
if (ImGui.Button("OK")) | ||
{ | ||
promise.SetResult(new Void()); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.