Skip to content

Commit c8e5568

Browse files
committed
Cherry-pick over native functions for docking / multi-viewport support.
1 parent f6cc3db commit c8e5568

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

src/ImGui.NET/Delegates.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Numerics;
3+
4+
namespace ImGuiNET
5+
{
6+
public delegate void Platform_CreateWindow(ImGuiViewportPtr vp); // Create a new platform window for the given viewport
7+
public delegate void Platform_DestroyWindow(ImGuiViewportPtr vp);
8+
public delegate void Platform_ShowWindow(ImGuiViewportPtr vp); // Newly created windows are initially hidden so SetWindowPos/Size/Title can be called on them first
9+
public delegate void Platform_SetWindowPos(ImGuiViewportPtr vp, Vector2 pos);
10+
public unsafe delegate void Platform_GetWindowPos(ImGuiViewportPtr vp, Vector2* outPos);
11+
public delegate void Platform_SetWindowSize(ImGuiViewportPtr vp, Vector2 size);
12+
public unsafe delegate void Platform_GetWindowSize(ImGuiViewportPtr vp, Vector2* outSize);
13+
public delegate void Platform_SetWindowFocus(ImGuiViewportPtr vp); // Move window to front and set input focus
14+
public delegate byte Platform_GetWindowFocus(ImGuiViewportPtr vp);
15+
public delegate byte Platform_GetWindowMinimized(ImGuiViewportPtr vp);
16+
public delegate void Platform_SetWindowTitle(ImGuiViewportPtr vp, IntPtr title);
17+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
4+
namespace ImGuiNET
5+
{
6+
public static unsafe partial class ImGuiNative
7+
{
8+
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]
9+
public static extern void ImGuiPlatformIO_Set_Platform_GetWindowPos(ImGuiPlatformIO* platform_io, IntPtr funcPtr);
10+
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]
11+
public static extern void ImGuiPlatformIO_Set_Platform_GetWindowSize(ImGuiPlatformIO* platform_io, IntPtr funcPtr);
12+
}
13+
}

src/ImGui.NET/ImVector.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ public unsafe struct ImVector
99
public readonly int Capacity;
1010
public readonly IntPtr Data;
1111

12+
public ImVector(int size, int capacity, IntPtr data)
13+
{
14+
Size = size;
15+
Capacity = capacity;
16+
Data = data;
17+
}
18+
1219
public ref T Ref<T>(int index)
1320
{
1421
return ref Unsafe.AsRef<T>((byte*)Data + index * Unsafe.SizeOf<T>());

0 commit comments

Comments
 (0)