mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Added two new helpers, one for PushItemWidth and the other for PushTextWrapPos.
This commit is contained in:
parent
fdfdee1fcb
commit
0acab6935a
1 changed files with 25 additions and 1 deletions
|
|
@ -77,6 +77,30 @@ public static partial class ImRaii
|
||||||
return new EndUnconditionally(ImGui.EndTooltip, true);
|
return new EndUnconditionally(ImGui.EndTooltip, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pushes the item width for the next widget and returns an <c>IDisposable</c> that pops
|
||||||
|
/// the width when done.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="width">The width to set the next widget to.</param>
|
||||||
|
/// <returns>An <see cref="IDisposable"/> for use in a <c>using</c> statement.</returns>
|
||||||
|
public static IEndObject ItemWidth(float width)
|
||||||
|
{
|
||||||
|
ImGui.PushItemWidth(width);
|
||||||
|
return new EndUnconditionally(ImGui.PopItemWidth, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pushes the item wrapping width for the next string written and returns an <c>IDisposable</c>
|
||||||
|
/// that pops the wrap width when done.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pos">The wrap width to set the next text written to.</param>
|
||||||
|
/// <returns>An <see cref="IDisposable"/> for use in a <c>using</c> statement.</returns>
|
||||||
|
public static IEndObject TextWrapPos(float pos)
|
||||||
|
{
|
||||||
|
ImGui.PushTextWrapPos(pos);
|
||||||
|
return new EndUnconditionally(ImGui.PopTextWrapPos, true);
|
||||||
|
}
|
||||||
|
|
||||||
public static IEndObject ListBox(string label)
|
public static IEndObject ListBox(string label)
|
||||||
=> new EndConditionally(ImGui.EndListBox, ImGui.BeginListBox(label));
|
=> new EndConditionally(ImGui.EndListBox, ImGui.BeginListBox(label));
|
||||||
|
|
||||||
|
|
@ -110,7 +134,7 @@ public static partial class ImRaii
|
||||||
public static unsafe IEndObject TabItem(string label, ImGuiTabItemFlags flags)
|
public static unsafe IEndObject TabItem(string label, ImGuiTabItemFlags flags)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(label);
|
ArgumentNullException.ThrowIfNull(label);
|
||||||
|
|
||||||
// One-off for now, we should make this into a generic solution if we need it more often
|
// One-off for now, we should make this into a generic solution if we need it more often
|
||||||
const int labelMaxAlloc = 2048;
|
const int labelMaxAlloc = 2048;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue