diff --git a/src/ImGui.NET/ImGui.NET.Net46.csproj b/src/ImGui.NET/ImGui.NET.Net46.csproj index 9fcb15d..b3d3970 100644 --- a/src/ImGui.NET/ImGui.NET.Net46.csproj +++ b/src/ImGui.NET/ImGui.NET.Net46.csproj @@ -15,6 +15,7 @@ + diff --git a/src/ImGui.NET/ImGui.NET.csproj b/src/ImGui.NET/ImGui.NET.csproj index e8c992e..288d36e 100644 --- a/src/ImGui.NET/ImGui.NET.csproj +++ b/src/ImGui.NET/ImGui.NET.csproj @@ -13,6 +13,7 @@ + diff --git a/src/ImGui.NET/ImGui.cs b/src/ImGui.NET/ImGui.cs index 9684e2b..a6d5d5d 100644 --- a/src/ImGui.NET/ImGui.cs +++ b/src/ImGui.NET/ImGui.cs @@ -142,12 +142,12 @@ namespace ImGuiNET //obsolete! public static bool CollapsingHeader(string label, string id, bool displayFrame, bool defaultOpen) - { - int default_open_flags = 1 << 5; + { + TreeNodeFlags default_open_flags = TreeNodeFlags.DefaultOpen; return ImGuiNative.igCollapsingHeader(label, (defaultOpen ? default_open_flags : 0)); } - public static bool CollapsingHeader(string label, int flags) + public static bool CollapsingHeader(string label, TreeNodeFlags flags) { return ImGuiNative.igCollapsingHeader(label, flags); } diff --git a/src/ImGui.NET/ImGuiNative.cs b/src/ImGui.NET/ImGuiNative.cs index 63b751d..0552238 100644 --- a/src/ImGui.NET/ImGuiNative.cs +++ b/src/ImGui.NET/ImGuiNative.cs @@ -473,10 +473,10 @@ namespace ImGuiNET public static extern void igSetNextTreeNodeOpened(bool opened, SetCondition cond); [DllImport(cimguiLib)] [return: MarshalAs(UnmanagedType.I1)] - public static extern bool igCollapsingHeader(string label, int flags); //ImGuiTreeNodeFlags + public static extern bool igCollapsingHeader(string label, TreeNodeFlags flags = 0); [DllImport(cimguiLib)] [return: MarshalAs(UnmanagedType.I1)] - public static extern bool igCollapsingHeader(string label, ref bool p_open, int flags); //ImGuiTreeNodeFlags + public static extern bool igCollapsingHeader(string label, ref bool p_open, TreeNodeFlags flags = 0); // Widgets: Selectable / Lists [DllImport(cimguiLib)] diff --git a/src/ImGui.NET/TreeNodeFlags.cs b/src/ImGui.NET/TreeNodeFlags.cs new file mode 100644 index 0000000..933a683 --- /dev/null +++ b/src/ImGui.NET/TreeNodeFlags.cs @@ -0,0 +1,51 @@ +using System; + +namespace ImGuiNET +{ + [Flags] + public enum TreeNodeFlags : int + { + /// + /// Draw as selected + /// + Selected = 1 << 0, + /// + /// Full colored frame (e.g. for CollapsingHeader) + /// + Framed = 1 << 1, + /// + /// Hit testing to allow subsequent widgets to overlap this one + /// + AllowOverlapMode = 1 << 2, + /// + /// Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack + /// + NoTreePushOnOpen = 1 << 3, + /// + /// Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack + /// + NoAutoOpenOnLog = 1 << 4, + /// + /// Default node to be open + /// + DefaultOpen = 1 << 5, + /// + /// Need double-click to open node + /// + OpenOnDoubleClick = 1 << 6, + /// + /// Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open. + /// + OpenOnArrow = 1 << 7, + /// + /// No collapsing, no arrow (use as a convenience for leaf nodes). + /// + Leaf = 1 << 8, + /// + /// Display a bullet instead of arrow + /// + Bullet = 1 << 9, + + CollapsingHeader = Framed | NoAutoOpenOnLog + }; +}