PartyDamage/ImGuiHelper.cs

30 lines
664 B
C#

using ImGuiNET;
namespace PartyDamage;
public static class ImGuiHelper {
public static OnDispose? DisabledIf(bool disabled) {
if (disabled) {
ImGui.BeginDisabled();
return new OnDispose(ImGui.EndDisabled);
}
return null;
}
public static OnDispose? DisabledUnless(bool unless) {
return DisabledIf(!unless);
}
public static bool BeginComboVertical(
string label,
string id,
string preview,
float width = -1
) {
ImGui.TextUnformatted(label);
ImGui.SetNextItemWidth(width);
return ImGui.BeginCombo($"##{id}", preview);
}
}