// ------------------------------------------------------------------------------
//
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
// ------------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using HexaGen.Runtime;
using System.Numerics;
namespace Dalamud.Bindings.ImGui
{
///
/// Helper: Manually clip large list of items.
/// If you have lots evenly spaced items and you have random access to the list, you can perform coarse
/// clipping based on visibility to only submit items that are in view.
/// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped.
/// (Dear ImGui already clip items based on their bounds but: it needs to first layout the item to do so, and generally
/// fetchingsubmitting your own data incurs additional cost. Coarse clipping using ImGuiListClipper allows you to easily
/// scale using lists with tens of thousands of items without a problem)
/// Usage:
/// ImGuiListClipper clipper;
/// clipper.Begin(1000); We have 1000 elements, evenly spaced.
/// while (clipper.Step())
/// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
/// ImGui::Text("line number %d", i);
/// Generally what happens is:
/// - Clipper lets you process the first element (DisplayStart = 0, DisplayEnd = 1) regardless of it being visible or not.
/// - User code submit that one element.
/// - Clipper can measure the height of the first element
/// - Clipper calculate the actual range of elements to display based on the current clipping rectangle, position the cursor before the first visible element.
/// - User code submit visible elements.
/// - The clipper also handles various subtleties related to keyboardgamepad navigation, wrapping etc.
///
[StructLayout(LayoutKind.Sequential)]
public partial struct ImGuiListClipper
{
///
/// To be documented.
///
public int DisplayStart;
///
/// To be documented.
///
public int DisplayEnd;
///
/// To be documented.
///
public int ItemsCount;
///
/// To be documented.
///
public float ItemsHeight;
///
/// To be documented.
///
public float StartPosY;
///
/// To be documented.
///
public unsafe void* TempData;
///
/// To be documented.
///
public unsafe ImGuiListClipper(int displayStart = default, int displayEnd = default, int itemsCount = default, float itemsHeight = default, float startPosY = default, void* tempData = default)
{
DisplayStart = displayStart;
DisplayEnd = displayEnd;
ItemsCount = itemsCount;
ItemsHeight = itemsHeight;
StartPosY = startPosY;
TempData = tempData;
}
///
/// To be documented.
///
public unsafe void Begin(int itemsCount, float itemsHeight)
{
fixed (ImGuiListClipper* @this = &this)
{
ImGui.BeginNative(@this, itemsCount, itemsHeight);
}
}
///
/// To be documented.
///
public unsafe void Begin(int itemsCount)
{
fixed (ImGuiListClipper* @this = &this)
{
ImGui.BeginNative(@this, itemsCount, (float)(-1.0f));
}
}
///
/// To be documented.
///
public unsafe void Destroy()
{
fixed (ImGuiListClipper* @this = &this)
{
ImGui.DestroyNative(@this);
}
}
///
/// To be documented.
///
public unsafe void End()
{
fixed (ImGuiListClipper* @this = &this)
{
ImGui.EndNative(@this);
}
}
///
/// To be documented.
///
public unsafe void ForceDisplayRangeByIndices(int itemMin, int itemMax)
{
fixed (ImGuiListClipper* @this = &this)
{
ImGui.ForceDisplayRangeByIndicesNative(@this, itemMin, itemMax);
}
}
///
/// To be documented.
///
public unsafe bool Step()
{
fixed (ImGuiListClipper* @this = &this)
{
byte ret = ImGui.StepNative(@this);
return ret != 0;
}
}
}
///
/// To be documented.
///
#if NET5_0_OR_GREATER
[DebuggerDisplay("{DebuggerDisplay,nq}")]
#endif
public unsafe struct ImGuiListClipperPtr : IEquatable
{
public ImGuiListClipperPtr(ImGuiListClipper* handle) { Handle = handle; }
public ImGuiListClipper* Handle;
public bool IsNull => Handle == null;
public static ImGuiListClipperPtr Null => new ImGuiListClipperPtr(null);
public ImGuiListClipper this[int index] { get => Handle[index]; set => Handle[index] = value; }
public static implicit operator ImGuiListClipperPtr(ImGuiListClipper* handle) => new ImGuiListClipperPtr(handle);
public static implicit operator ImGuiListClipper*(ImGuiListClipperPtr handle) => handle.Handle;
public static bool operator ==(ImGuiListClipperPtr left, ImGuiListClipperPtr right) => left.Handle == right.Handle;
public static bool operator !=(ImGuiListClipperPtr left, ImGuiListClipperPtr right) => left.Handle != right.Handle;
public static bool operator ==(ImGuiListClipperPtr left, ImGuiListClipper* right) => left.Handle == right;
public static bool operator !=(ImGuiListClipperPtr left, ImGuiListClipper* right) => left.Handle != right;
public bool Equals(ImGuiListClipperPtr other) => Handle == other.Handle;
///
public override bool Equals(object obj) => obj is ImGuiListClipperPtr handle && Equals(handle);
///
public override int GetHashCode() => ((nuint)Handle).GetHashCode();
#if NET5_0_OR_GREATER
private string DebuggerDisplay => string.Format("ImGuiListClipperPtr [0x{0}]", ((nuint)Handle).ToString("X"));
#endif
///
/// To be documented.
///
public ref int DisplayStart => ref Unsafe.AsRef(&Handle->DisplayStart);
///
/// To be documented.
///
public ref int DisplayEnd => ref Unsafe.AsRef(&Handle->DisplayEnd);
///
/// To be documented.
///
public ref int ItemsCount => ref Unsafe.AsRef(&Handle->ItemsCount);
///
/// To be documented.
///
public ref float ItemsHeight => ref Unsafe.AsRef(&Handle->ItemsHeight);
///
/// To be documented.
///
public ref float StartPosY => ref Unsafe.AsRef(&Handle->StartPosY);
///
/// To be documented.
///
public void* TempData { get => Handle->TempData; set => Handle->TempData = value; }
///
/// To be documented.
///
public unsafe void Begin(int itemsCount, float itemsHeight)
{
ImGui.BeginNative(Handle, itemsCount, itemsHeight);
}
///
/// To be documented.
///
public unsafe void Begin(int itemsCount)
{
ImGui.BeginNative(Handle, itemsCount, (float)(-1.0f));
}
///
/// To be documented.
///
public unsafe void Destroy()
{
ImGui.DestroyNative(Handle);
}
///
/// To be documented.
///
public unsafe void End()
{
ImGui.EndNative(Handle);
}
///
/// To be documented.
///
public unsafe void ForceDisplayRangeByIndices(int itemMin, int itemMax)
{
ImGui.ForceDisplayRangeByIndicesNative(Handle, itemMin, itemMax);
}
///
/// To be documented.
///
public unsafe bool Step()
{
byte ret = ImGui.StepNative(Handle);
return ret != 0;
}
}
}