owo
This commit is contained in:
parent
dfb50aae2d
commit
a85f0b5d40
|
@ -4,19 +4,27 @@ using ImGuiNET;
|
|||
namespace OrangeGuidanceTomestone.Ui;
|
||||
|
||||
internal static class ImGuiExt {
|
||||
internal static bool SmallIconButton(FontAwesomeIcon icon, string? id = null) {
|
||||
private static bool InternalIconButton(Func<string, bool> func, FontAwesomeIcon icon, string? id = null) {
|
||||
var label = icon.ToIconString();
|
||||
if (id != null) {
|
||||
label += $"##{id}";
|
||||
}
|
||||
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
var ret = ImGui.SmallButton(label);
|
||||
var ret = func(label);
|
||||
ImGui.PopFont();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal static bool SmallIconButton(FontAwesomeIcon icon, string? id = null) {
|
||||
return InternalIconButton(ImGui.SmallButton, icon, id);
|
||||
}
|
||||
|
||||
internal static bool IconButton(FontAwesomeIcon icon, string? id = null) {
|
||||
return InternalIconButton(ImGui.Button, icon, id);
|
||||
}
|
||||
|
||||
internal static void HelpIcon(string text) {
|
||||
var colour = ImGui.GetStyle().Colors[(int) ImGuiCol.TextDisabled];
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, colour);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System.Numerics;
|
||||
using ImGuiNET;
|
||||
using OrangeGuidanceTomestone.Helpers;
|
||||
|
||||
|
@ -40,6 +41,7 @@ internal class Settings : ITab {
|
|||
.Max();
|
||||
|
||||
var leftOver = ImGui.GetContentRegionAvail().X - widestTabName - ImGui.GetStyle().ItemSpacing.X - ImGui.GetStyle().FrameBorderSize;
|
||||
var childHeight = ImGui.GetContentRegionAvail().Y - ImGui.GetStyle().ItemSpacing.Y * 2;
|
||||
if (ImGui.BeginTable("##settings-tabs", 2)) {
|
||||
ImGui.TableSetupColumn("##names", ImGuiTableColumnFlags.None, widestTabName + ImGui.GetStyle().ItemSpacing.X);
|
||||
ImGui.TableSetupColumn("##content", ImGuiTableColumnFlags.None, leftOver);
|
||||
|
@ -56,7 +58,7 @@ internal class Settings : ITab {
|
|||
}
|
||||
|
||||
if (ImGui.TableSetColumnIndex(1)) {
|
||||
if (ImGui.BeginChild("##tab-content-child")) {
|
||||
if (ImGui.BeginChild("##tab-content-child", new Vector2(-1, childHeight))) {
|
||||
var (_, draw) = this.Tabs[this._tab];
|
||||
draw(ref anyChanged, ref vfx);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ internal class Viewer {
|
|||
ImGui.BeginDisabled();
|
||||
}
|
||||
|
||||
if (ImGui.Button("<")) {
|
||||
if (ImGuiExt.IconButton(FontAwesomeIcon.AngleLeft)) {
|
||||
this._idx -= 1;
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ internal class Viewer {
|
|||
ImGui.BeginDisabled();
|
||||
}
|
||||
|
||||
if (ImGui.Button(">")) {
|
||||
if (ImGuiExt.IconButton(FontAwesomeIcon.AngleRight)) {
|
||||
this._idx += 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue