This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f79092
commit 3955323
Showing
10 changed files
with
240 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<img src="https://github-readme-stats.vercel.app/api/pin/?username=ArchiDog1998&repo=RotationSolver&theme=dark"> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -336,5 +336,7 @@ | |
30450, | ||
30955, | ||
30447, | ||
30798 | ||
30798, | ||
5150, | ||
25147 | ||
] |
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,75 @@ | ||
using Dalamud.Logging; | ||
|
||
namespace RotationSolver.UI; | ||
|
||
internal class CollapsingHeaderGroup | ||
{ | ||
private Dictionary<Func<string>, Action> _headers = new Dictionary<Func<string>, Action>(); | ||
private int _openedIndex = -1; | ||
|
||
public CollapsingHeaderGroup() | ||
{ | ||
|
||
} | ||
|
||
public CollapsingHeaderGroup(Dictionary<Func<string>, Action> headers) | ||
{ | ||
_headers = headers; | ||
} | ||
|
||
public void AddCollapsingHeader(Func<string> name, Action action) | ||
{ | ||
_headers.Add(name, action); | ||
} | ||
|
||
public void RemoveCollapsingHeader(Func<string> name) | ||
{ | ||
_headers.Remove(name); | ||
} | ||
|
||
public void ClearCollapsingHeader() | ||
{ | ||
_headers.Clear(); | ||
} | ||
|
||
public void Draw() | ||
{ | ||
var index = -1; | ||
foreach (var header in _headers) | ||
{ | ||
index++; | ||
|
||
if (header.Key == null) continue; | ||
if (header.Value == null) continue; | ||
|
||
var name = header.Key(); | ||
if(string.IsNullOrEmpty(name)) continue; | ||
|
||
try | ||
{ | ||
ImGui.Separator(); | ||
var selected = index == _openedIndex; | ||
ImGui.PushFont(ImGuiHelper.GetFont(24)); | ||
var changed = ImGui.Selectable(name, selected); | ||
ImGui.PopFont(); | ||
if (ImGui.IsItemHovered()) | ||
{ | ||
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand); | ||
} | ||
if (changed) | ||
{ | ||
_openedIndex = selected ? -1 : index; | ||
} | ||
if (selected) | ||
{ | ||
header.Value(); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
PluginLog.Warning(ex, "Something wrong with header drawing."); | ||
} | ||
|
||
} | ||
} | ||
} |
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