Update to imgui 1.53 (no native binary updates).

internals
Eric Mellino 6 years ago
parent 27e9bf5fc1
commit 9cfeed151d
  1. 2
      src/ImGui.NET.SampleProgram/MemoryEditor.cs
  2. 2
      src/ImGui.NET.SampleProgram/SampleWindow.cs
  3. 4
      src/ImGui.NET/ColorTarget.cs
  4. 27
      src/ImGui.NET/ComboFlags.cs
  5. 43
      src/ImGui.NET/DragDropFlags.cs
  6. 22
      src/ImGui.NET/DrawList.cs
  7. 71
      src/ImGui.NET/ImGui.cs
  8. 83
      src/ImGui.NET/ImGuiNative.cs
  9. 8
      src/ImGui.NET/InputTextFlags.cs
  10. 2
      src/ImGui.NET/NativeIO.cs
  11. 16
      src/ImGui.NET/NativePayload.cs
  12. 32
      src/ImGui.NET/NativeStyle.cs
  13. 13
      src/ImGui.NET/Payload.cs
  14. 104
      src/ImGui.NET/Style.cs
  15. 28
      src/ImGui.NET/StyleVar.cs
  16. 2
      src/ImGui.NET/TreeNodeFlags.cs
  17. 21
      src/ImGui.NET/WindowFlags.cs

@ -67,7 +67,7 @@ namespace ImGuiNET
int line_total_count = (mem_size + Rows - 1) / Rows;
ImGuiNative.igSetNextWindowContentSize(new Vector2(0.0f, line_total_count * line_height));
ImGui.BeginChild("##scrolling", new Vector2(0, -ImGuiNative.igGetItemsLineHeightWithSpacing()), false, 0);
ImGui.BeginChild("##scrolling", new Vector2(0, -ImGuiNative.igGetFrameHeightWithSpacing()), false, 0);
ImGui.PushStyleVar(StyleVar.FramePadding, new Vector2(0, 0));
ImGui.PushStyleVar(StyleVar.ItemSpacing, new Vector2(0, 0));

@ -224,6 +224,8 @@ namespace ImGuiNET
bool leftPressed = ImGui.GetIO().MouseDown[0];
ImGui.Text("Current mouse position: " + pos + ". Pressed=" + leftPressed);
ImGui.ShowStyleSelector("Select style");
if (ImGui.Button("Increment the counter."))
{
_pressCount += 1;

@ -8,7 +8,7 @@
Text,
TextDisabled,
WindowBg,
ChildWindowBg,
ChildBg,
PopupBg,
Border,
BorderShadow,
@ -26,7 +26,6 @@
ScrollbarGrab,
ScrollbarGrabHovered,
ScrollbarGrabActive,
ComboBg,
CheckMark,
SliderGrab,
SliderGrabActive,
@ -54,6 +53,7 @@
/// darken entire screen when a modal window is active
/// </summary>
ModalWindowDarkening,
DragDropTarget,
Count,
};
}

@ -0,0 +1,27 @@
namespace ImGuiNET
{
public enum ComboFlags
{
/// <summary>
/// Align the popup toward the left by default
/// </summary>
PopupAlignLeft = 1 << 0,
/// <summary>
/// Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo()
/// </summary>
HeightSmall = 1 << 1,
/// <summary>
/// Max ~8 items visible (default)
/// </summary>
HeightRegular = 1 << 2,
/// <summary>
/// Max ~20 items visible
/// </summary>
HeightLarge = 1 << 3,
/// <summary>
/// As many fitting items as possible
/// </summary>
HeightLargest = 1 << 4,
HeightMask_ = HeightSmall | HeightRegular | HeightLarge | HeightLargest
}
}

@ -0,0 +1,43 @@
namespace ImGuiNET
{
public enum DragDropFlags
{
// BeginDragDropSource() flags
/// <summary>
/// By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior.
/// </summary>
SourceNoPreviewTooltip = 1 << 0,
/// <summary>
/// By default, when dragging we clear data so that IsItemHovered() will return true, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item.
/// </summary>
SourceNoDisableHover = 1 << 1,
/// <summary>
/// Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item.
/// </summary>
SourceNoHoldToOpenOthers = 1 << 2,
/// <summary>
/// Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.
/// </summary>
SourceAllowNullID = 1 << 3,
/// <summary>
/// External source (from outside of imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously.
/// </summary>
SourceExtern = 1 << 4,
// AcceptDragDropPayload() flags
/// <summary>
/// AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.
/// </summary>
AcceptBeforeDelivery = 1 << 10,
/// <summary>
/// Do not draw the default highlight rectangle when hovering over target.
/// </summary>
AcceptNoDrawDefaultRect = 1 << 11,
/// <summary>
/// For peeking ahead and inspecting the payload before delivery.
/// </summary>
AcceptPeekOnly = AcceptBeforeDelivery | AcceptNoDrawDefaultRect
}
}

@ -70,6 +70,28 @@ namespace ImGuiNET
ArrayPool<byte>.Shared.Return(tempBytes);
}
public unsafe void AddImageRounded(
IntPtr userTextureID,
Vector2 a,
Vector2 b,
Vector2 uvA,
Vector2 uvB,
uint color,
float rounding,
int roundingCorners)
{
ImGuiNative.ImDrawList_AddImageRounded(
_nativeDrawList,
userTextureID.ToPointer(),
a,
b,
uvA,
uvB,
color,
rounding,
roundingCorners);
}
public void PushClipRect(Vector2 min, Vector2 max, bool intersectWithCurrentClipRect)
{
ImGuiNative.ImDrawList_PushClipRect(_nativeDrawList, min, max, intersectWithCurrentClipRect ? (byte)1 : (byte)0);

@ -35,17 +35,17 @@ namespace ImGuiNET
public static void PushID(string id)
{
ImGuiNative.igPushIdStr(id);
ImGuiNative.igPushIDStr(id);
}
public static void PushID(int id)
{
ImGuiNative.igPushIdInt(id);
ImGuiNative.igPushIDInt(id);
}
public static void PushIDRange(string idBegin, string idEnd)
{
ImGuiNative.igPushIdStrRange(idBegin, idEnd);
ImGuiNative.igPushIDStrRange(idBegin, idEnd);
}
public static void PushItemWidth(float width)
@ -60,17 +60,17 @@ namespace ImGuiNET
public static void PopID()
{
ImGuiNative.igPopId();
ImGuiNative.igPopID();
}
public static uint GetID(string id)
{
return ImGuiNative.igGetIdStr(id);
return ImGuiNative.igGetIDStr(id);
}
public static uint GetID(string idBegin, string idEnd)
{
return ImGuiNative.igGetIdStrRange(idBegin, idEnd);
return ImGuiNative.igGetIDStrRange(idBegin, idEnd);
}
public static void Text(string message)
@ -171,6 +171,11 @@ namespace ImGuiNET
return ImGuiNative.igRadioButtonBool(label, active);
}
public static bool BeginCombo(string label, string previewValue, ComboFlags flags)
=> ImGuiNative.igBeginCombo(label, previewValue, flags);
public static void EndCombo() => ImGuiNative.igEndCombo();
public unsafe static bool Combo(string label, ref int current_item, string[] items)
{
return ImGuiNative.igCombo(label, ref current_item, items, items.Length, 5);
@ -286,6 +291,16 @@ namespace ImGuiNET
}
}
public static void ShowStyleSelector(string label)
{
ImGuiNative.igShowStyleSelector(label);
}
public static void ShowFontSelector(string label)
{
ImGuiNative.igShowFontSelector(label);
}
public unsafe static void PlotHistogram(string label, float[] values, int valuesOffset, string overlayText, float scaleMin, float scaleMax, Vector2 graphSize, int stride)
{
fixed (float* valuesBasePtr = values)
@ -821,6 +836,11 @@ namespace ImGuiNET
ImGuiNative.igSetCursorScreenPos(pos);
}
public static float GetFrameHeightWithSpacing()
{
return ImGuiNative.igGetFrameHeightWithSpacing();
}
public static void AlignTextToFramePadding()
{
ImGuiNative.igAlignTextToFramePadding();
@ -1009,6 +1029,8 @@ namespace ImGuiNET
ImGuiNative.igSpacing();
}
public static float GetFrameHeight() => ImGuiNative.igGetFrameHeight();
public static void Columns(int count, string id, bool border)
{
ImGuiNative.igColumns(count, id, border);
@ -1059,6 +1081,21 @@ namespace ImGuiNET
ImGuiNative.igSameLine(localPositionX, spacingW);
}
public static bool BeginDragDropSource(DragDropFlags flags, int mouseButton)
=> ImGuiNative.igBeginDragDropSource(flags, mouseButton);
public static unsafe bool SetDragDropPayload(string type, IntPtr data, uint size, Condition cond)
=> ImGuiNative.igSetDragDropPayload(type, data.ToPointer(), size, cond);
public static void EndDragDropSource() => ImGuiNative.igEndDragDropSource();
public static bool BeginDragDropTarget() => ImGuiNative.igBeginDragDropTarget();
public static unsafe Payload AcceptDragDropPayload(string type, DragDropFlags flags)
=> new Payload(ImGuiNative.igAcceptDragDropPayload(type, flags));
public static void EndDragDropTarget() => ImGuiNative.igEndDragDropTarget();
public static void PushClipRect(Vector2 min, Vector2 max, bool intersectWithCurrentCliRect)
{
ImGuiNative.igPushClipRect(min, max, intersectWithCurrentCliRect ? (byte)1 : (byte)0);
@ -1069,6 +1106,21 @@ namespace ImGuiNET
ImGuiNative.igPopClipRect();
}
public static unsafe void StyleColorsClassic(Style style)
{
ImGuiNative.igStyleColorsClassic(style.NativePtr);
}
public static unsafe void StyleColorsDark(Style style)
{
ImGuiNative.igStyleColorsDark(style.NativePtr);
}
public static unsafe void StyleColorsLight(Style style)
{
ImGuiNative.igStyleColorsLight(style.NativePtr);
}
public static bool IsItemHovered(HoveredFlags flags)
{
return ImGuiNative.igIsItemHovered(flags);
@ -1094,6 +1146,8 @@ namespace ImGuiNET
return ImGuiNative.igIsAnyItemActive();
}
public static unsafe DrawList GetOverlayDrawList() => new DrawList(ImGuiNative.igGetOverlayDrawList());
public static void SetTooltip(string text)
{
ImGuiNative.igSetTooltip(text);
@ -1160,6 +1214,11 @@ namespace ImGuiNET
ImGuiNative.igSetScrollHere();
}
public static void SetItemDefaultFocus()
{
ImGuiNative.igSetItemDefaultFocus();
}
public static void SetScrollHere(float centerYRatio)
{
ImGuiNative.igSetScrollHere(centerYRatio);

@ -34,10 +34,16 @@ namespace ImGuiNET
public static extern void igShowStyleEditor(ref NativeStyle @ref);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igShowTestWindow(ref bool opened);
public static extern void igShowDemoWindow(ref bool opened);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igShowMetricsWindow(ref bool opened);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igShowStyleSelector(string label);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igShowFontSelector(string label);
// Window
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
@ -98,8 +104,6 @@ namespace ImGuiNET
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetNextWindowContentSize(Vector2 size);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetNextWindowContentWidth(float width);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetNextWindowCollapsed(bool collapsed, Condition cond);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetNextWindowFocus();
@ -137,6 +141,9 @@ namespace ImGuiNET
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetItemDefaultFocus();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetKeyboardFocusHere(int offset);
@ -234,7 +241,9 @@ namespace ImGuiNET
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern float igGetTextLineHeightWithSpacing();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern float igGetItemsLineHeightWithSpacing();
public static extern float igGetFrameHeight();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern float igGetFrameHeightWithSpacing();
// Columns
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
@ -259,21 +268,21 @@ namespace ImGuiNET
// If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them
// You can also use "##extra" within your widget name to distinguish them from each others (see 'Programmer Guide')
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igPushIdStr(string str_id);
public static extern void igPushIDStr(string str_id);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igPushIdStrRange(string str_begin, string str_end);
public static extern void igPushIDStrRange(string str_begin, string str_end);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igPushIdPtr(void* ptr_id);
public static extern void igPushIDPtr(void* ptr_id);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igPushIdInt(int int_id);
public static extern void igPushIDInt(int int_id);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igPopId();
public static extern void igPopID();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern uint igGetIdStr(string str_id);
public static extern uint igGetIDStr(string str_id);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern uint igGetIdStrRange(string str_begin, string str_end);
public static extern uint igGetIDStrRange(string str_begin, string str_end);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern uint igGetIdPtr(void* ptr_id);
public static extern uint igGetIDPtr(void* ptr_id);
// Widgets
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
@ -324,6 +333,13 @@ namespace ImGuiNET
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igRadioButton(string label, int* v, int v_button);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igBeginCombo(string label, string preview_value, ComboFlags flags);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igEndCombo();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igCombo(string label, ref int current_item, string[] items, int items_count, int height_in_items);
@ -624,12 +640,38 @@ namespace ImGuiNET
//public static extern void igLogText(string fmt, ...);
public static extern void igLogText(string fmt);
// Drag-drop
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igBeginDragDropSource(DragDropFlags flags, int mouse_button);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igSetDragDropPayload(string type, void* data, uint size, Condition cond);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igEndDragDropSource();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igBeginDragDropTarget();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern NativePayload* igAcceptDragDropPayload(string type, DragDropFlags flags);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igEndDragDropTarget();
// Clipping
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igPushClipRect(Vector2 clip_rect_min, Vector2 clip_rect_max, byte intersect_with_current_clip_rect);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igPopClipRect();
// Built-in Styles
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igStyleColorsClassic(NativeStyle* dst);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igStyleColorsDark(NativeStyle* dst);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igStyleColorsLight(NativeStyle* dst);
// Utilities
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
@ -666,15 +708,6 @@ namespace ImGuiNET
public static extern bool igIsWindowFocused(FocusedFlags flags);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsRootWindowFocused();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsRootWindowOrAnyChildFocused();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsRootWindowOrAnyChildHovered();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsRectVisible(Vector2 item_size);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
@ -684,6 +717,8 @@ namespace ImGuiNET
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern int igGetFrameCount();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern NativeDrawList* igGetOverlayDrawList();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern string igGetStyleColorName(ColorTarget idx);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igCalcItemRectClosestPoint(out Vector2 pOut, Vector2 pos, bool on_edge, float outward);
@ -892,9 +927,11 @@ namespace ImGuiNET
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImDrawList_AddImageQuad(NativeDrawList* list, void* user_texture_id, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 uv_a, Vector2 uv_b, Vector2 uv_c, Vector2 uv_d, uint col);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImDrawList_AddPolyline(NativeDrawList* list, Vector2* points, int num_points, uint col, byte closed, float thickness, byte anti_aliased);
public static extern void ImDrawList_AddImageRounded(NativeDrawList* list, void* user_texture_id, Vector2 a, Vector2 b, Vector2 uv_a, Vector2 uv_b, uint col, float rounding, int rounding_corners);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImDrawList_AddPolyline(NativeDrawList* list, Vector2* points, int num_points, uint col, byte closed, float thickness);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImDrawList_AddConvexPolyFilled(NativeDrawList* list, Vector2* points, int num_points, uint col, byte anti_aliased);
public static extern void ImDrawList_AddConvexPolyFilled(NativeDrawList* list, Vector2* points, int num_points, uint col);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void ImDrawList_AddBezierCurve(NativeDrawList* list, Vector2 pos0, Vector2 cp0, Vector2 cp1, Vector2 pos1, uint col, float thickness, int num_segments);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]

@ -67,6 +67,14 @@
/// </summary>
ReadOnly = 1 << 14,
/// <summary>
/// Password mode, display all characters as '*'
/// </summary>
Password,
/// <summary>
/// Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().
/// </summary>
NoUndoRedo,
/// <summary>
/// For internal use by InputTextMultiline()
/// </summary>
Multiline = 1 << 20

@ -117,7 +117,7 @@ namespace ImGuiNET
/// Multi-selection in lists uses Cmd/Super instead of Ctrl
/// Default value: True on OSX; false otherwise.
/// </summary>
public byte OSXBehaviors;
public byte OptMacOSXBehaviors;
/// <summary>
/// Enable blinking cursor, for users who consider it annoying.
/// Default value: true.

@ -0,0 +1,16 @@
namespace ImGuiNET
{
public unsafe struct NativePayload
{
public void* Data;
public int DataSize;
// Internal
private uint SourceId;
private uint SourceParentId;
private int DataFrameCount;
private fixed byte DataType[8 + 1];
private byte Preview;
private byte Delivery;
}
}

@ -15,21 +15,37 @@ namespace ImGuiNET
/// </summary>
public Vector2 WindowPadding;
/// <summary>
/// Minimum window size.
/// </summary>
public Vector2 WindowMinSize;
/// <summary>
/// Radius of window corners rounding. Set to 0.0f to have rectangular windows.
/// </summary>
public float WindowRounding;
/// <summary>
/// Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly)
/// </summary>
public float WindowBorderSize;
/// <summary>
/// Minimum window size.
/// </summary>
public Vector2 WindowMinSize;
/// <summary>
/// Alignment for title bar text.
/// </summary>
public Vector2 WindowTitleAlign;
/// <summary>
/// Radius of child window corners rounding. Set to 0.0f to have rectangular windows.
/// </summary>
public float ChildWindowRounding;
public float ChildRounding;
/// <summary>
/// Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly)
/// </summary>
public float ChildBorderSize;
/// <summary>
/// Radius of popup window corners rounding.
/// </summary>
public float PopupRounding;
/// <summary>
/// Thickness of border around popup windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly)
/// </summary>
public float PopupBorderSize;
/// <summary>
/// Padding within a framed rectangle (used by most widgets).
/// </summary>
@ -39,6 +55,10 @@ namespace ImGuiNET
/// </summary>
public float FrameRounding;
/// <summary>
/// Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly)
/// </summary>
public float FrameBorderSize;
/// <summary>
/// Horizontal and vertical spacing between widgets/lines.
/// </summary>
public Vector2 ItemSpacing;
@ -93,7 +113,7 @@ namespace ImGuiNET
/// <summary>
/// Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
/// </summary>
public byte AntiAliasedShapes;
public byte AntiAliasedFill;
/// <summary>
/// Tessellation tolerance. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
/// </summary>

@ -0,0 +1,13 @@
using System;
namespace ImGuiNET
{
public unsafe struct Payload
{
public readonly NativePayload* NativePtr;
public Payload(NativePayload* ptr) => NativePtr = ptr;
public IntPtr Data => (IntPtr)NativePtr->Data;
public int DataSize => NativePtr->DataSize;
}
}

@ -4,11 +4,11 @@ namespace ImGuiNET
{
public unsafe class Style
{
private readonly NativeStyle* _stylePtr;
public readonly NativeStyle* NativePtr;
public Style(NativeStyle* style)
{
_stylePtr = style;
NativePtr = style;
}
/// <summary>
@ -16,8 +16,8 @@ namespace ImGuiNET
/// </summary>
public float Alpha
{
get { return _stylePtr->Alpha; }
set { _stylePtr->Alpha = value; }
get { return NativePtr->Alpha; }
set { NativePtr->Alpha = value; }
}
/// <summary>
@ -25,8 +25,8 @@ namespace ImGuiNET
/// </summary>
public Vector2 WindowPadding
{
get { return _stylePtr->WindowPadding; }
set { _stylePtr->WindowPadding = value; }
get { return NativePtr->WindowPadding; }
set { NativePtr->WindowPadding = value; }
}
/// <summary>
@ -34,8 +34,8 @@ namespace ImGuiNET
/// </summary>
public Vector2 WindowMinSize
{
get { return _stylePtr->WindowMinSize; }
set { _stylePtr->WindowMinSize = value; }
get { return NativePtr->WindowMinSize; }
set { NativePtr->WindowMinSize = value; }
}
/// <summary>
@ -43,8 +43,8 @@ namespace ImGuiNET
/// </summary>
public float WindowRounding
{
get { return _stylePtr->WindowRounding; }
set { _stylePtr->WindowRounding = value; }
get { return NativePtr->WindowRounding; }
set { NativePtr->WindowRounding = value; }
}
/// <summary>
@ -52,8 +52,8 @@ namespace ImGuiNET
/// </summary>
public Vector2 WindowTitleAlign
{
get { return _stylePtr->WindowTitleAlign; }
set { _stylePtr->WindowTitleAlign = value; }
get { return NativePtr->WindowTitleAlign; }
set { NativePtr->WindowTitleAlign = value; }
}
/// <summary>
@ -61,8 +61,8 @@ namespace ImGuiNET
/// </summary>
public float ChildWindowRounding
{
get { return _stylePtr->ChildWindowRounding; }
set { _stylePtr->ChildWindowRounding = value; }
get { return NativePtr->ChildRounding; }
set { NativePtr->ChildRounding = value; }
}
/// <summary>
@ -70,8 +70,8 @@ namespace ImGuiNET
/// </summary>
public Vector2 FramePadding
{
get { return _stylePtr->FramePadding; }
set { _stylePtr->FramePadding = value; }
get { return NativePtr->FramePadding; }
set { NativePtr->FramePadding = value; }
}
/// <summary>
@ -79,8 +79,8 @@ namespace ImGuiNET
/// </summary>
public float FrameRounding
{
get { return _stylePtr->FrameRounding; }
set { _stylePtr->FrameRounding = value; }
get { return NativePtr->FrameRounding; }
set { NativePtr->FrameRounding = value; }
}
/// <summary>
@ -88,8 +88,8 @@ namespace ImGuiNET
/// </summary>
public Vector2 ItemSpacing
{
get { return _stylePtr->ItemSpacing; }
set { _stylePtr->ItemSpacing = value; }
get { return NativePtr->ItemSpacing; }
set { NativePtr->ItemSpacing = value; }
}
/// <summary>
@ -97,8 +97,8 @@ namespace ImGuiNET
/// </summary>
public Vector2 ItemInnerSpacing
{
get { return _stylePtr->ItemInnerSpacing; }
set { _stylePtr->ItemInnerSpacing = value; }
get { return NativePtr->ItemInnerSpacing; }
set { NativePtr->ItemInnerSpacing = value; }
}
/// <summary>
@ -106,8 +106,8 @@ namespace ImGuiNET
/// </summary>
public Vector2 TouchExtraPadding
{
get { return _stylePtr->TouchExtraPadding; }
set { _stylePtr->TouchExtraPadding = value; }
get { return NativePtr->TouchExtraPadding; }
set { NativePtr->TouchExtraPadding = value; }
}
/// <summary>
@ -115,8 +115,8 @@ namespace ImGuiNET
/// </summary>
public float IndentSpacing
{
get { return _stylePtr->IndentSpacing; }
set { _stylePtr->IndentSpacing = value; }
get { return NativePtr->IndentSpacing; }
set { NativePtr->IndentSpacing = value; }
}
/// <summary>
@ -124,8 +124,8 @@ namespace ImGuiNET
/// </summary>
public float ColumnsMinSpacing
{
get { return _stylePtr->ColumnsMinSpacing; }
set { _stylePtr->ColumnsMinSpacing = value; }
get { return NativePtr->ColumnsMinSpacing; }
set { NativePtr->ColumnsMinSpacing = value; }
}
/// <summary>
@ -133,8 +133,8 @@ namespace ImGuiNET
/// </summary>
public float ScrollbarSize
{
get { return _stylePtr->ScrollbarSize; }
set { _stylePtr->ScrollbarSize = value; }
get { return NativePtr->ScrollbarSize; }
set { NativePtr->ScrollbarSize = value; }
}
/// <summary>
@ -142,8 +142,8 @@ namespace ImGuiNET
/// </summary>
public float ScrollbarRounding
{
get { return _stylePtr->ScrollbarRounding; }
set { _stylePtr->ScrollbarRounding = value; }
get { return NativePtr->ScrollbarRounding; }
set { NativePtr->ScrollbarRounding = value; }
}
/// <summary>
@ -151,8 +151,8 @@ namespace ImGuiNET
/// </summary>
public float GrabMinSize
{
get { return _stylePtr->GrabMinSize; }
set { _stylePtr->GrabMinSize = value; }
get { return NativePtr->GrabMinSize; }
set { NativePtr->GrabMinSize = value; }
}
/// <summary>
@ -160,8 +160,8 @@ namespace ImGuiNET
/// </summary>
public float GrabRounding
{
get { return _stylePtr->GrabRounding; }
set { _stylePtr->GrabRounding = value; }
get { return NativePtr->GrabRounding; }
set { NativePtr->GrabRounding = value; }
}
/// <summary>
@ -169,8 +169,8 @@ namespace ImGuiNET
/// </summary>
public Vector2 DisplayWindowPadding
{
get { return _stylePtr->DisplayWindowPadding; }
set { _stylePtr->DisplayWindowPadding = value; }
get { return NativePtr->DisplayWindowPadding; }
set { NativePtr->DisplayWindowPadding = value; }
}
/// <summary>
@ -178,8 +178,8 @@ namespace ImGuiNET
/// </summary>
public Vector2 DisplaySafeAreaPadding
{
get { return _stylePtr->DisplaySafeAreaPadding; }
set { _stylePtr->DisplaySafeAreaPadding = value; }
get { return NativePtr->DisplaySafeAreaPadding; }
set { NativePtr->DisplaySafeAreaPadding = value; }
}
/// <summary>
@ -187,17 +187,17 @@ namespace ImGuiNET
/// </summary>
public bool AntiAliasedLines
{
get { return _stylePtr->AntiAliasedLines == 1; }
set { _stylePtr->AntiAliasedLines = value ? (byte)1 : (byte)0; }
get { return NativePtr->AntiAliasedLines == 1; }
set { NativePtr->AntiAliasedLines = value ? (byte)1 : (byte)0; }
}
/// <summary>
/// Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)
/// </summary>
public bool AntiAliasedShapes
public bool AntiAliasedFill
{
get { return _stylePtr->AntiAliasedShapes == 1; }
set { _stylePtr->AntiAliasedShapes = value ? (byte)1 : (byte)0; }
get { return NativePtr->AntiAliasedFill == 1; }
set { NativePtr->AntiAliasedFill = value ? (byte)1 : (byte)0; }
}
/// <summary>
@ -205,8 +205,8 @@ namespace ImGuiNET
/// </summary>
public float CurveTessellationTolerance
{
get { return _stylePtr->CurveTessellationTol; }
set { _stylePtr->CurveTessellationTol = value; }
get { return NativePtr->CurveTessellationTol; }
set { NativePtr->CurveTessellationTol = value; }
}
/// <summary>
@ -214,7 +214,7 @@ namespace ImGuiNET
/// </summary>
/// <param name="target">The type of UI element.</param>
/// <returns>The element's color as currently configured.</returns>
public Vector4 GetColor(ColorTarget target) => *(Vector4*)&_stylePtr->Colors[(int)target * 4];
public Vector4 GetColor(ColorTarget target) => *(Vector4*)&NativePtr->Colors[(int)target * 4];
/// <summary>
/// Sets the style color for a particular UI element type.
@ -223,10 +223,10 @@ namespace ImGuiNET
/// <param name="value">The new color.</param>
public void SetColor(ColorTarget target, Vector4 value)
{
_stylePtr->Colors[(int)target * 4 + 0] = value.X;
_stylePtr->Colors[(int)target * 4 + 1] = value.Y;
_stylePtr->Colors[(int)target * 4 + 2] = value.Z;
_stylePtr->Colors[(int)target * 4 + 3] = value.W;
NativePtr->Colors[(int)target * 4 + 0] = value.X;
NativePtr->Colors[(int)target * 4 + 1] = value.Y;
NativePtr->Colors[(int)target * 4 + 2] = value.Z;
NativePtr->Colors[(int)target * 4 + 3] = value.W;
}
}
}

@ -19,13 +19,29 @@
/// </summary>
WindowRounding,
/// <summary>
/// float
/// </summary>
WindowBorderSize,
/// <summary>
/// System.Numerics.Vector2
/// </summary>
WindowMinSize,
/// <summary>
/// float
/// </summary>
ChildWindowRounding,
ChildRounding,
/// <summary>
/// float
/// </summary>
ChildBorderSize,
/// <summary>
/// float
/// </summary>
PopupRounding,
/// <summary>
/// float
/// </summary>
PopupBorderSize,
/// <summary>
/// System.Numerics.Vector2
/// </summary>
@ -35,6 +51,10 @@
/// </summary>
FrameRounding,
/// <summary>
/// float
/// </summary>
FrameBorderSize,
/// <summary>
/// System.Numerics.Vector2
/// </summary>
ItemSpacing,
@ -49,6 +69,10 @@
/// <summary>
/// float
/// </summary>
GrabMinSize
GrabMinSize,
/// <summary>
/// System.Numerics.Vector2
/// </summary>
ButtonTextAlign,
};
}

@ -16,7 +16,7 @@ namespace ImGuiNET
/// <summary>
/// Hit testing to allow subsequent widgets to overlap this one
/// </summary>
AllowOverlapMode = 1 << 2,
AllowItemOverlap = 1 << 2,
/// <summary>
/// Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack
/// </summary>

@ -35,10 +35,6 @@
/// </summary>
AlwaysAutoResize = 1 << 6,
/// <summary>
/// Show borders around windows and items
/// </summary>
ShowBorders = 1 << 7,
/// <summary>
/// Never load/save settings in .ini file
/// </summary>
NoSavedSettings = 1 << 8,
@ -63,5 +59,22 @@
/// Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus)
/// </summary>
NoBringToFrontOnFocus = 1 << 13,
/// <summary>
/// Always show vertical scrollbar (even if ContentSize.y < Size.y)
/// </summary>
AlwaysVerticalScrollbar = 1 << 14,
/// <summary>
/// Always show horizontal scrollbar (even if ContentSize.x < Size.x)
/// </summary>
AlwaysHorizontalScrollbar = 1 << 15,
/// <summary>
/// Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)
/// </summary>
AlwaysUseWindowPadding = 1 << 16,
/// <summary>
/// Enable resize from any corners and borders. Your back-end needs to honor the different values of io.MouseCursor set by imgui.
/// </summary>
ResizeFromAnySide = 1 << 17,
}
}

Loading…
Cancel
Save