diff --git a/3rdparty/cimgui b/3rdparty/cimgui index ad92997..1bb9cd7 160000 --- a/3rdparty/cimgui +++ b/3rdparty/cimgui @@ -1 +1 @@ -Subproject commit ad929978e99dc77ead8d72a9fa494d721f591761 +Subproject commit 1bb9cd73470f1fcdedf6c3f2e8dc1765463f2ad0 diff --git a/Sources/AutoWrapper/Assets/definitions.json b/Sources/AutoWrapper/Assets/definitions.json index f7f5fb1..2c63a7f 100644 --- a/Sources/AutoWrapper/Assets/definitions.json +++ b/Sources/AutoWrapper/Assets/definitions.json @@ -13,7 +13,7 @@ "cimguiname": "ImBitArray_ClearAllBits", "defaults": {}, "funcname": "ClearAllBits", - "location": "imgui_internal:548", + "location": "imgui_internal:570", "ov_cimguiname": "ImBitArray_ClearAllBits", "ret": "void", "signature": "()", @@ -39,7 +39,7 @@ "cimguiname": "ImBitArray_ClearBit", "defaults": {}, "funcname": "ClearBit", - "location": "imgui_internal:552", + "location": "imgui_internal:574", "ov_cimguiname": "ImBitArray_ClearBit", "ret": "void", "signature": "(int)", @@ -57,7 +57,7 @@ "constructor": true, "defaults": {}, "funcname": "ImBitArray", - "location": "imgui_internal:547", + "location": "imgui_internal:569", "ov_cimguiname": "ImBitArray_ImBitArray", "signature": "()", "stname": "ImBitArray", @@ -78,7 +78,7 @@ "cimguiname": "ImBitArray_SetAllBits", "defaults": {}, "funcname": "SetAllBits", - "location": "imgui_internal:549", + "location": "imgui_internal:571", "ov_cimguiname": "ImBitArray_SetAllBits", "ret": "void", "signature": "()", @@ -104,7 +104,7 @@ "cimguiname": "ImBitArray_SetBit", "defaults": {}, "funcname": "SetBit", - "location": "imgui_internal:551", + "location": "imgui_internal:573", "ov_cimguiname": "ImBitArray_SetBit", "ret": "void", "signature": "(int)", @@ -134,7 +134,7 @@ "cimguiname": "ImBitArray_SetBitRange", "defaults": {}, "funcname": "SetBitRange", - "location": "imgui_internal:553", + "location": "imgui_internal:575", "ov_cimguiname": "ImBitArray_SetBitRange", "ret": "void", "signature": "(int,int)", @@ -160,7 +160,7 @@ "cimguiname": "ImBitArray_TestBit", "defaults": {}, "funcname": "TestBit", - "location": "imgui_internal:550", + "location": "imgui_internal:572", "ov_cimguiname": "ImBitArray_TestBit", "ret": "bool", "signature": "(int)const", @@ -202,7 +202,7 @@ "cimguiname": "ImBitVector_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui_internal:562", + "location": "imgui_internal:585", "ov_cimguiname": "ImBitVector_Clear", "ret": "void", "signature": "()", @@ -227,7 +227,7 @@ "cimguiname": "ImBitVector_ClearBit", "defaults": {}, "funcname": "ClearBit", - "location": "imgui_internal:565", + "location": "imgui_internal:588", "ov_cimguiname": "ImBitVector_ClearBit", "ret": "void", "signature": "(int)", @@ -252,7 +252,7 @@ "cimguiname": "ImBitVector_Create", "defaults": {}, "funcname": "Create", - "location": "imgui_internal:561", + "location": "imgui_internal:584", "ov_cimguiname": "ImBitVector_Create", "ret": "void", "signature": "(int)", @@ -277,7 +277,7 @@ "cimguiname": "ImBitVector_SetBit", "defaults": {}, "funcname": "SetBit", - "location": "imgui_internal:564", + "location": "imgui_internal:587", "ov_cimguiname": "ImBitVector_SetBit", "ret": "void", "signature": "(int)", @@ -302,7 +302,7 @@ "cimguiname": "ImBitVector_TestBit", "defaults": {}, "funcname": "TestBit", - "location": "imgui_internal:563", + "location": "imgui_internal:586", "ov_cimguiname": "ImBitVector_TestBit", "ret": "bool", "signature": "(int)const", @@ -327,7 +327,7 @@ "cimguiname": "ImChunkStream_alloc_chunk", "defaults": {}, "funcname": "alloc_chunk", - "location": "imgui_internal:668", + "location": "imgui_internal:692", "ov_cimguiname": "ImChunkStream_alloc_chunk", "ret": "T*", "signature": "(size_t)", @@ -349,7 +349,7 @@ "cimguiname": "ImChunkStream_begin", "defaults": {}, "funcname": "begin", - "location": "imgui_internal:669", + "location": "imgui_internal:693", "ov_cimguiname": "ImChunkStream_begin", "ret": "T*", "signature": "()", @@ -375,7 +375,7 @@ "cimguiname": "ImChunkStream_chunk_size", "defaults": {}, "funcname": "chunk_size", - "location": "imgui_internal:671", + "location": "imgui_internal:695", "ov_cimguiname": "ImChunkStream_chunk_size", "ret": "int", "signature": "(const T*)", @@ -397,7 +397,7 @@ "cimguiname": "ImChunkStream_clear", "defaults": {}, "funcname": "clear", - "location": "imgui_internal:665", + "location": "imgui_internal:689", "ov_cimguiname": "ImChunkStream_clear", "ret": "void", "signature": "()", @@ -419,7 +419,7 @@ "cimguiname": "ImChunkStream_empty", "defaults": {}, "funcname": "empty", - "location": "imgui_internal:666", + "location": "imgui_internal:690", "ov_cimguiname": "ImChunkStream_empty", "ret": "bool", "signature": "()const", @@ -441,7 +441,7 @@ "cimguiname": "ImChunkStream_end", "defaults": {}, "funcname": "end", - "location": "imgui_internal:672", + "location": "imgui_internal:696", "ov_cimguiname": "ImChunkStream_end", "ret": "T*", "signature": "()", @@ -467,7 +467,7 @@ "cimguiname": "ImChunkStream_next_chunk", "defaults": {}, "funcname": "next_chunk", - "location": "imgui_internal:670", + "location": "imgui_internal:694", "ov_cimguiname": "ImChunkStream_next_chunk", "ret": "T*", "signature": "(T*)", @@ -493,7 +493,7 @@ "cimguiname": "ImChunkStream_offset_from_ptr", "defaults": {}, "funcname": "offset_from_ptr", - "location": "imgui_internal:673", + "location": "imgui_internal:697", "ov_cimguiname": "ImChunkStream_offset_from_ptr", "ret": "int", "signature": "(const T*)", @@ -519,7 +519,7 @@ "cimguiname": "ImChunkStream_ptr_from_offset", "defaults": {}, "funcname": "ptr_from_offset", - "location": "imgui_internal:674", + "location": "imgui_internal:698", "ov_cimguiname": "ImChunkStream_ptr_from_offset", "ret": "T*", "signature": "(int)", @@ -541,7 +541,7 @@ "cimguiname": "ImChunkStream_size", "defaults": {}, "funcname": "size", - "location": "imgui_internal:667", + "location": "imgui_internal:691", "ov_cimguiname": "ImChunkStream_size", "ret": "int", "signature": "()const", @@ -551,7 +551,7 @@ ], "ImChunkStream_swap": [ { - "args": "(ImChunkStream* self,ImChunkStream* rhs)", + "args": "(ImChunkStream* self,ImChunkStream_T * rhs)", "argsT": [ { "name": "self", @@ -560,7 +560,7 @@ { "name": "rhs", "reftoptr": true, - "type": "ImChunkStream*" + "type": "ImChunkStream_T *" } ], "argsoriginal": "(ImChunkStream& rhs)", @@ -568,10 +568,10 @@ "cimguiname": "ImChunkStream_swap", "defaults": {}, "funcname": "swap", - "location": "imgui_internal:675", + "location": "imgui_internal:699", "ov_cimguiname": "ImChunkStream_swap", "ret": "void", - "signature": "(ImChunkStream*)", + "signature": "(ImChunkStream_T *)", "stname": "ImChunkStream", "templated": true } @@ -609,7 +609,7 @@ }, "funcname": "HSV", "is_static_function": true, - "location": "imgui:2255", + "location": "imgui:2417", "nonUDT": 1, "ov_cimguiname": "ImColor_HSV", "ret": "void", @@ -627,113 +627,113 @@ "constructor": true, "defaults": {}, "funcname": "ImColor", - "location": "imgui:2245", + "location": "imgui:2407", "ov_cimguiname": "ImColor_ImColor_Nil", "signature": "()", "stname": "ImColor" }, { - "args": "(int r,int g,int b,int a)", + "args": "(float r,float g,float b,float a)", "argsT": [ { "name": "r", - "type": "int" + "type": "float" }, { "name": "g", - "type": "int" + "type": "float" }, { "name": "b", - "type": "int" + "type": "float" }, { "name": "a", - "type": "int" + "type": "float" } ], - "argsoriginal": "(int r,int g,int b,int a=255)", + "argsoriginal": "(float r,float g,float b,float a=1.0f)", "call_args": "(r,g,b,a)", "cimguiname": "ImColor_ImColor", "constructor": true, "defaults": { - "a": "255" + "a": "1.0f" }, "funcname": "ImColor", - "location": "imgui:2246", - "ov_cimguiname": "ImColor_ImColor_Int", - "signature": "(int,int,int,int)", + "location": "imgui:2408", + "ov_cimguiname": "ImColor_ImColor_Float", + "signature": "(float,float,float,float)", "stname": "ImColor" }, { - "args": "(ImU32 rgba)", + "args": "(const ImVec4 col)", "argsT": [ { - "name": "rgba", - "type": "ImU32" + "name": "col", + "type": "const ImVec4" } ], - "argsoriginal": "(ImU32 rgba)", - "call_args": "(rgba)", + "argsoriginal": "(const ImVec4& col)", + "call_args": "(col)", "cimguiname": "ImColor_ImColor", "constructor": true, "defaults": {}, "funcname": "ImColor", - "location": "imgui:2247", - "ov_cimguiname": "ImColor_ImColor_U32", - "signature": "(ImU32)", + "location": "imgui:2409", + "ov_cimguiname": "ImColor_ImColor_Vec4", + "signature": "(const ImVec4)", "stname": "ImColor" }, { - "args": "(float r,float g,float b,float a)", + "args": "(int r,int g,int b,int a)", "argsT": [ { "name": "r", - "type": "float" + "type": "int" }, { "name": "g", - "type": "float" + "type": "int" }, { "name": "b", - "type": "float" + "type": "int" }, { "name": "a", - "type": "float" + "type": "int" } ], - "argsoriginal": "(float r,float g,float b,float a=1.0f)", + "argsoriginal": "(int r,int g,int b,int a=255)", "call_args": "(r,g,b,a)", "cimguiname": "ImColor_ImColor", "constructor": true, "defaults": { - "a": "1.0f" + "a": "255" }, "funcname": "ImColor", - "location": "imgui:2248", - "ov_cimguiname": "ImColor_ImColor_Float", - "signature": "(float,float,float,float)", + "location": "imgui:2410", + "ov_cimguiname": "ImColor_ImColor_Int", + "signature": "(int,int,int,int)", "stname": "ImColor" }, { - "args": "(const ImVec4 col)", + "args": "(ImU32 rgba)", "argsT": [ { - "name": "col", - "type": "const ImVec4" + "name": "rgba", + "type": "ImU32" } ], - "argsoriginal": "(const ImVec4& col)", - "call_args": "(col)", + "argsoriginal": "(ImU32 rgba)", + "call_args": "(rgba)", "cimguiname": "ImColor_ImColor", "constructor": true, "defaults": {}, "funcname": "ImColor", - "location": "imgui:2249", - "ov_cimguiname": "ImColor_ImColor_Vec4", - "signature": "(const ImVec4)", + "location": "imgui:2411", + "ov_cimguiname": "ImColor_ImColor_U32", + "signature": "(ImU32)", "stname": "ImColor" } ], @@ -769,7 +769,7 @@ "a": "1.0f" }, "funcname": "SetHSV", - "location": "imgui:2254", + "location": "imgui:2416", "ov_cimguiname": "ImColor_SetHSV", "ret": "void", "signature": "(float,float,float,float)", @@ -809,7 +809,7 @@ "cimguiname": "ImDrawCmd_GetTexID", "defaults": {}, "funcname": "GetTexID", - "location": "imgui:2303", + "location": "imgui:2465", "ov_cimguiname": "ImDrawCmd_GetTexID", "ret": "ImTextureID", "signature": "()const", @@ -826,7 +826,7 @@ "constructor": true, "defaults": {}, "funcname": "ImDrawCmd", - "location": "imgui:2300", + "location": "imgui:2462", "ov_cimguiname": "ImDrawCmd_ImDrawCmd", "signature": "()", "stname": "ImDrawCmd" @@ -865,7 +865,7 @@ "cimguiname": "ImDrawDataBuilder_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui_internal:735", + "location": "imgui_internal:775", "ov_cimguiname": "ImDrawDataBuilder_Clear", "ret": "void", "signature": "()", @@ -886,7 +886,7 @@ "cimguiname": "ImDrawDataBuilder_ClearFreeMemory", "defaults": {}, "funcname": "ClearFreeMemory", - "location": "imgui_internal:736", + "location": "imgui_internal:776", "ov_cimguiname": "ImDrawDataBuilder_ClearFreeMemory", "ret": "void", "signature": "()", @@ -907,7 +907,7 @@ "cimguiname": "ImDrawDataBuilder_FlattenIntoSingleLayer", "defaults": {}, "funcname": "FlattenIntoSingleLayer", - "location": "imgui_internal:738", + "location": "imgui_internal:778", "ov_cimguiname": "ImDrawDataBuilder_FlattenIntoSingleLayer", "ret": "void", "signature": "()", @@ -928,7 +928,7 @@ "cimguiname": "ImDrawDataBuilder_GetDrawListCount", "defaults": {}, "funcname": "GetDrawListCount", - "location": "imgui_internal:737", + "location": "imgui_internal:777", "ov_cimguiname": "ImDrawDataBuilder_GetDrawListCount", "ret": "int", "signature": "()const", @@ -949,7 +949,7 @@ "cimguiname": "ImDrawData_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui:2534", + "location": "imgui:2697", "ov_cimguiname": "ImDrawData_Clear", "ret": "void", "signature": "()", @@ -970,7 +970,7 @@ "cimguiname": "ImDrawData_DeIndexAllBuffers", "defaults": {}, "funcname": "DeIndexAllBuffers", - "location": "imgui:2535", + "location": "imgui:2698", "ov_cimguiname": "ImDrawData_DeIndexAllBuffers", "ret": "void", "signature": "()", @@ -987,7 +987,7 @@ "constructor": true, "defaults": {}, "funcname": "ImDrawData", - "location": "imgui:2533", + "location": "imgui:2696", "ov_cimguiname": "ImDrawData_ImDrawData", "signature": "()", "stname": "ImDrawData" @@ -1011,7 +1011,7 @@ "cimguiname": "ImDrawData_ScaleClipRects", "defaults": {}, "funcname": "ScaleClipRects", - "location": "imgui:2536", + "location": "imgui:2699", "ov_cimguiname": "ImDrawData_ScaleClipRects", "ret": "void", "signature": "(const ImVec2)", @@ -1047,7 +1047,7 @@ "constructor": true, "defaults": {}, "funcname": "ImDrawListSharedData", - "location": "imgui_internal:727", + "location": "imgui_internal:767", "ov_cimguiname": "ImDrawListSharedData_ImDrawListSharedData", "signature": "()", "stname": "ImDrawListSharedData" @@ -1071,7 +1071,7 @@ "cimguiname": "ImDrawListSharedData_SetCircleTessellationMaxError", "defaults": {}, "funcname": "SetCircleTessellationMaxError", - "location": "imgui_internal:728", + "location": "imgui_internal:768", "ov_cimguiname": "ImDrawListSharedData_SetCircleTessellationMaxError", "ret": "void", "signature": "(float)", @@ -1111,7 +1111,7 @@ "cimguiname": "ImDrawListSplitter_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui:2348", + "location": "imgui:2510", "ov_cimguiname": "ImDrawListSplitter_Clear", "ret": "void", "signature": "()", @@ -1132,7 +1132,7 @@ "cimguiname": "ImDrawListSplitter_ClearFreeMemory", "defaults": {}, "funcname": "ClearFreeMemory", - "location": "imgui:2349", + "location": "imgui:2511", "ov_cimguiname": "ImDrawListSplitter_ClearFreeMemory", "ret": "void", "signature": "()", @@ -1149,7 +1149,7 @@ "constructor": true, "defaults": {}, "funcname": "ImDrawListSplitter", - "location": "imgui:2346", + "location": "imgui:2508", "ov_cimguiname": "ImDrawListSplitter_ImDrawListSplitter", "signature": "()", "stname": "ImDrawListSplitter" @@ -1173,7 +1173,7 @@ "cimguiname": "ImDrawListSplitter_Merge", "defaults": {}, "funcname": "Merge", - "location": "imgui:2351", + "location": "imgui:2513", "ov_cimguiname": "ImDrawListSplitter_Merge", "ret": "void", "signature": "(ImDrawList*)", @@ -1202,7 +1202,7 @@ "cimguiname": "ImDrawListSplitter_SetCurrentChannel", "defaults": {}, "funcname": "SetCurrentChannel", - "location": "imgui:2352", + "location": "imgui:2514", "ov_cimguiname": "ImDrawListSplitter_SetCurrentChannel", "ret": "void", "signature": "(ImDrawList*,int)", @@ -1231,7 +1231,7 @@ "cimguiname": "ImDrawListSplitter_Split", "defaults": {}, "funcname": "Split", - "location": "imgui:2350", + "location": "imgui:2512", "ov_cimguiname": "ImDrawListSplitter_Split", "ret": "void", "signature": "(ImDrawList*,int)", @@ -1251,7 +1251,7 @@ "cimguiname": "ImDrawListSplitter_destroy", "defaults": {}, "destructor": true, - "location": "imgui:2347", + "location": "imgui:2509", "ov_cimguiname": "ImDrawListSplitter_destroy", "realdestructor": true, "ret": "void", @@ -1303,7 +1303,7 @@ "num_segments": "0" }, "funcname": "AddBezierCubic", - "location": "imgui:2450", + "location": "imgui:2613", "ov_cimguiname": "ImDrawList_AddBezierCubic", "ret": "void", "signature": "(const ImVec2,const ImVec2,const ImVec2,const ImVec2,ImU32,float,int)", @@ -1350,7 +1350,7 @@ "num_segments": "0" }, "funcname": "AddBezierQuadratic", - "location": "imgui:2451", + "location": "imgui:2614", "ov_cimguiname": "ImDrawList_AddBezierQuadratic", "ret": "void", "signature": "(const ImVec2,const ImVec2,const ImVec2,ImU32,float,int)", @@ -1379,7 +1379,7 @@ "cimguiname": "ImDrawList_AddCallback", "defaults": {}, "funcname": "AddCallback", - "location": "imgui:2474", + "location": "imgui:2638", "ov_cimguiname": "ImDrawList_AddCallback", "ret": "void", "signature": "(ImDrawCallback,void*)", @@ -1423,7 +1423,7 @@ "thickness": "1.0f" }, "funcname": "AddCircle", - "location": "imgui:2442", + "location": "imgui:2605", "ov_cimguiname": "ImDrawList_AddCircle", "ret": "void", "signature": "(const ImVec2,float,ImU32,int,float)", @@ -1462,7 +1462,7 @@ "num_segments": "0" }, "funcname": "AddCircleFilled", - "location": "imgui:2443", + "location": "imgui:2606", "ov_cimguiname": "ImDrawList_AddCircleFilled", "ret": "void", "signature": "(const ImVec2,float,ImU32,int)", @@ -1495,7 +1495,7 @@ "cimguiname": "ImDrawList_AddConvexPolyFilled", "defaults": {}, "funcname": "AddConvexPolyFilled", - "location": "imgui:2449", + "location": "imgui:2612", "ov_cimguiname": "ImDrawList_AddConvexPolyFilled", "ret": "void", "signature": "(const ImVec2*,int,ImU32)", @@ -1516,7 +1516,7 @@ "cimguiname": "ImDrawList_AddDrawCmd", "defaults": {}, "funcname": "AddDrawCmd", - "location": "imgui:2475", + "location": "imgui:2639", "ov_cimguiname": "ImDrawList_AddDrawCmd", "ret": "void", "signature": "()", @@ -1565,7 +1565,7 @@ "uv_min": "ImVec2(0,0)" }, "funcname": "AddImage", - "location": "imgui:2457", + "location": "imgui:2620", "ov_cimguiname": "ImDrawList_AddImage", "ret": "void", "signature": "(ImTextureID,const ImVec2,const ImVec2,const ImVec2,const ImVec2,ImU32)", @@ -1632,7 +1632,7 @@ "uv4": "ImVec2(0,1)" }, "funcname": "AddImageQuad", - "location": "imgui:2458", + "location": "imgui:2621", "ov_cimguiname": "ImDrawList_AddImageQuad", "ret": "void", "signature": "(ImTextureID,const ImVec2,const ImVec2,const ImVec2,const ImVec2,const ImVec2,const ImVec2,const ImVec2,const ImVec2,ImU32)", @@ -1687,7 +1687,7 @@ "flags": "0" }, "funcname": "AddImageRounded", - "location": "imgui:2459", + "location": "imgui:2622", "ov_cimguiname": "ImDrawList_AddImageRounded", "ret": "void", "signature": "(ImTextureID,const ImVec2,const ImVec2,const ImVec2,const ImVec2,ImU32,float,ImDrawFlags)", @@ -1726,7 +1726,7 @@ "thickness": "1.0f" }, "funcname": "AddLine", - "location": "imgui:2434", + "location": "imgui:2597", "ov_cimguiname": "ImDrawList_AddLine", "ret": "void", "signature": "(const ImVec2,const ImVec2,ImU32,float)", @@ -1769,7 +1769,7 @@ "thickness": "1.0f" }, "funcname": "AddNgon", - "location": "imgui:2444", + "location": "imgui:2607", "ov_cimguiname": "ImDrawList_AddNgon", "ret": "void", "signature": "(const ImVec2,float,ImU32,int,float)", @@ -1806,7 +1806,7 @@ "cimguiname": "ImDrawList_AddNgonFilled", "defaults": {}, "funcname": "AddNgonFilled", - "location": "imgui:2445", + "location": "imgui:2608", "ov_cimguiname": "ImDrawList_AddNgonFilled", "ret": "void", "signature": "(const ImVec2,float,ImU32,int)", @@ -1847,7 +1847,7 @@ "cimguiname": "ImDrawList_AddPolyline", "defaults": {}, "funcname": "AddPolyline", - "location": "imgui:2448", + "location": "imgui:2611", "ov_cimguiname": "ImDrawList_AddPolyline", "ret": "void", "signature": "(const ImVec2*,int,ImU32,ImDrawFlags,float)", @@ -1894,7 +1894,7 @@ "thickness": "1.0f" }, "funcname": "AddQuad", - "location": "imgui:2438", + "location": "imgui:2601", "ov_cimguiname": "ImDrawList_AddQuad", "ret": "void", "signature": "(const ImVec2,const ImVec2,const ImVec2,const ImVec2,ImU32,float)", @@ -1935,7 +1935,7 @@ "cimguiname": "ImDrawList_AddQuadFilled", "defaults": {}, "funcname": "AddQuadFilled", - "location": "imgui:2439", + "location": "imgui:2602", "ov_cimguiname": "ImDrawList_AddQuadFilled", "ret": "void", "signature": "(const ImVec2,const ImVec2,const ImVec2,const ImVec2,ImU32)", @@ -1984,7 +1984,7 @@ "thickness": "1.0f" }, "funcname": "AddRect", - "location": "imgui:2435", + "location": "imgui:2598", "ov_cimguiname": "ImDrawList_AddRect", "ret": "void", "signature": "(const ImVec2,const ImVec2,ImU32,float,ImDrawFlags,float)", @@ -2028,7 +2028,7 @@ "rounding": "0.0f" }, "funcname": "AddRectFilled", - "location": "imgui:2436", + "location": "imgui:2599", "ov_cimguiname": "ImDrawList_AddRectFilled", "ret": "void", "signature": "(const ImVec2,const ImVec2,ImU32,float,ImDrawFlags)", @@ -2073,7 +2073,7 @@ "cimguiname": "ImDrawList_AddRectFilledMultiColor", "defaults": {}, "funcname": "AddRectFilledMultiColor", - "location": "imgui:2437", + "location": "imgui:2600", "ov_cimguiname": "ImDrawList_AddRectFilledMultiColor", "ret": "void", "signature": "(const ImVec2,const ImVec2,ImU32,ImU32,ImU32,ImU32)", @@ -2112,7 +2112,7 @@ "text_end": "NULL" }, "funcname": "AddText", - "location": "imgui:2446", + "location": "imgui:2609", "ov_cimguiname": "ImDrawList_AddText_Vec2", "ret": "void", "signature": "(const ImVec2,ImU32,const char*,const char*)", @@ -2167,7 +2167,7 @@ "wrap_width": "0.0f" }, "funcname": "AddText", - "location": "imgui:2447", + "location": "imgui:2610", "ov_cimguiname": "ImDrawList_AddText_FontPtr", "ret": "void", "signature": "(const ImFont*,float,const ImVec2,ImU32,const char*,const char*,float,const ImVec4*)", @@ -2210,7 +2210,7 @@ "thickness": "1.0f" }, "funcname": "AddTriangle", - "location": "imgui:2440", + "location": "imgui:2603", "ov_cimguiname": "ImDrawList_AddTriangle", "ret": "void", "signature": "(const ImVec2,const ImVec2,const ImVec2,ImU32,float)", @@ -2247,7 +2247,7 @@ "cimguiname": "ImDrawList_AddTriangleFilled", "defaults": {}, "funcname": "AddTriangleFilled", - "location": "imgui:2441", + "location": "imgui:2604", "ov_cimguiname": "ImDrawList_AddTriangleFilled", "ret": "void", "signature": "(const ImVec2,const ImVec2,const ImVec2,ImU32)", @@ -2268,7 +2268,7 @@ "cimguiname": "ImDrawList_ChannelsMerge", "defaults": {}, "funcname": "ChannelsMerge", - "location": "imgui:2485", + "location": "imgui:2649", "ov_cimguiname": "ImDrawList_ChannelsMerge", "ret": "void", "signature": "()", @@ -2293,7 +2293,7 @@ "cimguiname": "ImDrawList_ChannelsSetCurrent", "defaults": {}, "funcname": "ChannelsSetCurrent", - "location": "imgui:2486", + "location": "imgui:2650", "ov_cimguiname": "ImDrawList_ChannelsSetCurrent", "ret": "void", "signature": "(int)", @@ -2318,7 +2318,7 @@ "cimguiname": "ImDrawList_ChannelsSplit", "defaults": {}, "funcname": "ChannelsSplit", - "location": "imgui:2484", + "location": "imgui:2648", "ov_cimguiname": "ImDrawList_ChannelsSplit", "ret": "void", "signature": "(int)", @@ -2339,7 +2339,7 @@ "cimguiname": "ImDrawList_CloneOutput", "defaults": {}, "funcname": "CloneOutput", - "location": "imgui:2476", + "location": "imgui:2640", "ov_cimguiname": "ImDrawList_CloneOutput", "ret": "ImDrawList*", "signature": "()const", @@ -2364,7 +2364,7 @@ "cimguiname": "ImDrawList_GetClipRectMax", "defaults": {}, "funcname": "GetClipRectMax", - "location": "imgui:2426", + "location": "imgui:2588", "nonUDT": 1, "ov_cimguiname": "ImDrawList_GetClipRectMax", "ret": "void", @@ -2390,7 +2390,7 @@ "cimguiname": "ImDrawList_GetClipRectMin", "defaults": {}, "funcname": "GetClipRectMin", - "location": "imgui:2425", + "location": "imgui:2587", "nonUDT": 1, "ov_cimguiname": "ImDrawList_GetClipRectMin", "ret": "void", @@ -2400,22 +2400,22 @@ ], "ImDrawList_ImDrawList": [ { - "args": "(const ImDrawListSharedData* shared_data)", + "args": "(ImDrawListSharedData* shared_data)", "argsT": [ { "name": "shared_data", - "type": "const ImDrawListSharedData*" + "type": "ImDrawListSharedData*" } ], - "argsoriginal": "(const ImDrawListSharedData* shared_data)", + "argsoriginal": "(ImDrawListSharedData* shared_data)", "call_args": "(shared_data)", "cimguiname": "ImDrawList_ImDrawList", "constructor": true, "defaults": {}, "funcname": "ImDrawList", - "location": "imgui:2417", + "location": "imgui:2579", "ov_cimguiname": "ImDrawList_ImDrawList", - "signature": "(const ImDrawListSharedData*)", + "signature": "(ImDrawListSharedData*)", "stname": "ImDrawList" } ], @@ -2455,7 +2455,7 @@ "num_segments": "0" }, "funcname": "PathArcTo", - "location": "imgui:2467", + "location": "imgui:2631", "ov_cimguiname": "ImDrawList_PathArcTo", "ret": "void", "signature": "(const ImVec2,float,float,float,int)", @@ -2492,7 +2492,7 @@ "cimguiname": "ImDrawList_PathArcToFast", "defaults": {}, "funcname": "PathArcToFast", - "location": "imgui:2468", + "location": "imgui:2632", "ov_cimguiname": "ImDrawList_PathArcToFast", "ret": "void", "signature": "(const ImVec2,float,int,int)", @@ -2531,7 +2531,7 @@ "num_segments": "0" }, "funcname": "PathBezierCubicCurveTo", - "location": "imgui:2469", + "location": "imgui:2633", "ov_cimguiname": "ImDrawList_PathBezierCubicCurveTo", "ret": "void", "signature": "(const ImVec2,const ImVec2,const ImVec2,int)", @@ -2566,7 +2566,7 @@ "num_segments": "0" }, "funcname": "PathBezierQuadraticCurveTo", - "location": "imgui:2470", + "location": "imgui:2634", "ov_cimguiname": "ImDrawList_PathBezierQuadraticCurveTo", "ret": "void", "signature": "(const ImVec2,const ImVec2,int)", @@ -2587,7 +2587,7 @@ "cimguiname": "ImDrawList_PathClear", "defaults": {}, "funcname": "PathClear", - "location": "imgui:2462", + "location": "imgui:2626", "ov_cimguiname": "ImDrawList_PathClear", "ret": "void", "signature": "()", @@ -2612,7 +2612,7 @@ "cimguiname": "ImDrawList_PathFillConvex", "defaults": {}, "funcname": "PathFillConvex", - "location": "imgui:2465", + "location": "imgui:2629", "ov_cimguiname": "ImDrawList_PathFillConvex", "ret": "void", "signature": "(ImU32)", @@ -2637,7 +2637,7 @@ "cimguiname": "ImDrawList_PathLineTo", "defaults": {}, "funcname": "PathLineTo", - "location": "imgui:2463", + "location": "imgui:2627", "ov_cimguiname": "ImDrawList_PathLineTo", "ret": "void", "signature": "(const ImVec2)", @@ -2662,7 +2662,7 @@ "cimguiname": "ImDrawList_PathLineToMergeDuplicate", "defaults": {}, "funcname": "PathLineToMergeDuplicate", - "location": "imgui:2464", + "location": "imgui:2628", "ov_cimguiname": "ImDrawList_PathLineToMergeDuplicate", "ret": "void", "signature": "(const ImVec2)", @@ -2702,7 +2702,7 @@ "rounding": "0.0f" }, "funcname": "PathRect", - "location": "imgui:2471", + "location": "imgui:2635", "ov_cimguiname": "ImDrawList_PathRect", "ret": "void", "signature": "(const ImVec2,const ImVec2,float,ImDrawFlags)", @@ -2738,7 +2738,7 @@ "thickness": "1.0f" }, "funcname": "PathStroke", - "location": "imgui:2466", + "location": "imgui:2630", "ov_cimguiname": "ImDrawList_PathStroke", "ret": "void", "signature": "(ImU32,ImDrawFlags,float)", @@ -2759,7 +2759,7 @@ "cimguiname": "ImDrawList_PopClipRect", "defaults": {}, "funcname": "PopClipRect", - "location": "imgui:2422", + "location": "imgui:2584", "ov_cimguiname": "ImDrawList_PopClipRect", "ret": "void", "signature": "()", @@ -2780,7 +2780,7 @@ "cimguiname": "ImDrawList_PopTextureID", "defaults": {}, "funcname": "PopTextureID", - "location": "imgui:2424", + "location": "imgui:2586", "ov_cimguiname": "ImDrawList_PopTextureID", "ret": "void", "signature": "()", @@ -2837,7 +2837,7 @@ "cimguiname": "ImDrawList_PrimQuadUV", "defaults": {}, "funcname": "PrimQuadUV", - "location": "imgui:2495", + "location": "imgui:2659", "ov_cimguiname": "ImDrawList_PrimQuadUV", "ret": "void", "signature": "(const ImVec2,const ImVec2,const ImVec2,const ImVec2,const ImVec2,const ImVec2,const ImVec2,const ImVec2,ImU32)", @@ -2870,7 +2870,7 @@ "cimguiname": "ImDrawList_PrimRect", "defaults": {}, "funcname": "PrimRect", - "location": "imgui:2493", + "location": "imgui:2657", "ov_cimguiname": "ImDrawList_PrimRect", "ret": "void", "signature": "(const ImVec2,const ImVec2,ImU32)", @@ -2911,7 +2911,7 @@ "cimguiname": "ImDrawList_PrimRectUV", "defaults": {}, "funcname": "PrimRectUV", - "location": "imgui:2494", + "location": "imgui:2658", "ov_cimguiname": "ImDrawList_PrimRectUV", "ret": "void", "signature": "(const ImVec2,const ImVec2,const ImVec2,const ImVec2,ImU32)", @@ -2940,7 +2940,7 @@ "cimguiname": "ImDrawList_PrimReserve", "defaults": {}, "funcname": "PrimReserve", - "location": "imgui:2491", + "location": "imgui:2655", "ov_cimguiname": "ImDrawList_PrimReserve", "ret": "void", "signature": "(int,int)", @@ -2969,7 +2969,7 @@ "cimguiname": "ImDrawList_PrimUnreserve", "defaults": {}, "funcname": "PrimUnreserve", - "location": "imgui:2492", + "location": "imgui:2656", "ov_cimguiname": "ImDrawList_PrimUnreserve", "ret": "void", "signature": "(int,int)", @@ -3002,7 +3002,7 @@ "cimguiname": "ImDrawList_PrimVtx", "defaults": {}, "funcname": "PrimVtx", - "location": "imgui:2498", + "location": "imgui:2662", "ov_cimguiname": "ImDrawList_PrimVtx", "ret": "void", "signature": "(const ImVec2,const ImVec2,ImU32)", @@ -3027,7 +3027,7 @@ "cimguiname": "ImDrawList_PrimWriteIdx", "defaults": {}, "funcname": "PrimWriteIdx", - "location": "imgui:2497", + "location": "imgui:2661", "ov_cimguiname": "ImDrawList_PrimWriteIdx", "ret": "void", "signature": "(ImDrawIdx)", @@ -3060,7 +3060,7 @@ "cimguiname": "ImDrawList_PrimWriteVtx", "defaults": {}, "funcname": "PrimWriteVtx", - "location": "imgui:2496", + "location": "imgui:2660", "ov_cimguiname": "ImDrawList_PrimWriteVtx", "ret": "void", "signature": "(const ImVec2,const ImVec2,ImU32)", @@ -3069,7 +3069,7 @@ ], "ImDrawList_PushClipRect": [ { - "args": "(ImDrawList* self,ImVec2 clip_rect_min,ImVec2 clip_rect_max,bool intersect_with_current_clip_rect)", + "args": "(ImDrawList* self,const ImVec2 clip_rect_min,const ImVec2 clip_rect_max,bool intersect_with_current_clip_rect)", "argsT": [ { "name": "self", @@ -3077,28 +3077,28 @@ }, { "name": "clip_rect_min", - "type": "ImVec2" + "type": "const ImVec2" }, { "name": "clip_rect_max", - "type": "ImVec2" + "type": "const ImVec2" }, { "name": "intersect_with_current_clip_rect", "type": "bool" } ], - "argsoriginal": "(ImVec2 clip_rect_min,ImVec2 clip_rect_max,bool intersect_with_current_clip_rect=false)", + "argsoriginal": "(const ImVec2& clip_rect_min,const ImVec2& clip_rect_max,bool intersect_with_current_clip_rect=false)", "call_args": "(clip_rect_min,clip_rect_max,intersect_with_current_clip_rect)", "cimguiname": "ImDrawList_PushClipRect", "defaults": { "intersect_with_current_clip_rect": "false" }, "funcname": "PushClipRect", - "location": "imgui:2420", + "location": "imgui:2582", "ov_cimguiname": "ImDrawList_PushClipRect", "ret": "void", - "signature": "(ImVec2,ImVec2,bool)", + "signature": "(const ImVec2,const ImVec2,bool)", "stname": "ImDrawList" } ], @@ -3116,7 +3116,7 @@ "cimguiname": "ImDrawList_PushClipRectFullScreen", "defaults": {}, "funcname": "PushClipRectFullScreen", - "location": "imgui:2421", + "location": "imgui:2583", "ov_cimguiname": "ImDrawList_PushClipRectFullScreen", "ret": "void", "signature": "()", @@ -3141,7 +3141,7 @@ "cimguiname": "ImDrawList_PushTextureID", "defaults": {}, "funcname": "PushTextureID", - "location": "imgui:2423", + "location": "imgui:2585", "ov_cimguiname": "ImDrawList_PushTextureID", "ret": "void", "signature": "(ImTextureID)", @@ -3166,7 +3166,7 @@ "cimguiname": "ImDrawList__CalcCircleAutoSegmentCount", "defaults": {}, "funcname": "_CalcCircleAutoSegmentCount", - "location": "imgui:2513", + "location": "imgui:2676", "ov_cimguiname": "ImDrawList__CalcCircleAutoSegmentCount", "ret": "int", "signature": "(float)const", @@ -3187,7 +3187,7 @@ "cimguiname": "ImDrawList__ClearFreeMemory", "defaults": {}, "funcname": "_ClearFreeMemory", - "location": "imgui:2507", + "location": "imgui:2670", "ov_cimguiname": "ImDrawList__ClearFreeMemory", "ret": "void", "signature": "()", @@ -3208,7 +3208,7 @@ "cimguiname": "ImDrawList__OnChangedClipRect", "defaults": {}, "funcname": "_OnChangedClipRect", - "location": "imgui:2510", + "location": "imgui:2673", "ov_cimguiname": "ImDrawList__OnChangedClipRect", "ret": "void", "signature": "()", @@ -3229,7 +3229,7 @@ "cimguiname": "ImDrawList__OnChangedTextureID", "defaults": {}, "funcname": "_OnChangedTextureID", - "location": "imgui:2511", + "location": "imgui:2674", "ov_cimguiname": "ImDrawList__OnChangedTextureID", "ret": "void", "signature": "()", @@ -3250,7 +3250,7 @@ "cimguiname": "ImDrawList__OnChangedVtxOffset", "defaults": {}, "funcname": "_OnChangedVtxOffset", - "location": "imgui:2512", + "location": "imgui:2675", "ov_cimguiname": "ImDrawList__OnChangedVtxOffset", "ret": "void", "signature": "()", @@ -3291,7 +3291,7 @@ "cimguiname": "ImDrawList__PathArcToFastEx", "defaults": {}, "funcname": "_PathArcToFastEx", - "location": "imgui:2514", + "location": "imgui:2677", "ov_cimguiname": "ImDrawList__PathArcToFastEx", "ret": "void", "signature": "(const ImVec2,float,int,int,int)", @@ -3332,7 +3332,7 @@ "cimguiname": "ImDrawList__PathArcToN", "defaults": {}, "funcname": "_PathArcToN", - "location": "imgui:2515", + "location": "imgui:2678", "ov_cimguiname": "ImDrawList__PathArcToN", "ret": "void", "signature": "(const ImVec2,float,float,float,int)", @@ -3353,7 +3353,7 @@ "cimguiname": "ImDrawList__PopUnusedDrawCmd", "defaults": {}, "funcname": "_PopUnusedDrawCmd", - "location": "imgui:2508", + "location": "imgui:2671", "ov_cimguiname": "ImDrawList__PopUnusedDrawCmd", "ret": "void", "signature": "()", @@ -3374,7 +3374,7 @@ "cimguiname": "ImDrawList__ResetForNewFrame", "defaults": {}, "funcname": "_ResetForNewFrame", - "location": "imgui:2506", + "location": "imgui:2669", "ov_cimguiname": "ImDrawList__ResetForNewFrame", "ret": "void", "signature": "()", @@ -3395,7 +3395,7 @@ "cimguiname": "ImDrawList__TryMergeDrawCmds", "defaults": {}, "funcname": "_TryMergeDrawCmds", - "location": "imgui:2509", + "location": "imgui:2672", "ov_cimguiname": "ImDrawList__TryMergeDrawCmds", "ret": "void", "signature": "()", @@ -3415,7 +3415,7 @@ "cimguiname": "ImDrawList_destroy", "defaults": {}, "destructor": true, - "location": "imgui:2419", + "location": "imgui:2581", "ov_cimguiname": "ImDrawList_destroy", "realdestructor": true, "ret": "void", @@ -3433,7 +3433,7 @@ "constructor": true, "defaults": {}, "funcname": "ImFontAtlasCustomRect", - "location": "imgui:2607", + "location": "imgui:2770", "ov_cimguiname": "ImFontAtlasCustomRect_ImFontAtlasCustomRect", "signature": "()", "stname": "ImFontAtlasCustomRect" @@ -3453,7 +3453,7 @@ "cimguiname": "ImFontAtlasCustomRect_IsPacked", "defaults": {}, "funcname": "IsPacked", - "location": "imgui:2608", + "location": "imgui:2771", "ov_cimguiname": "ImFontAtlasCustomRect_IsPacked", "ret": "bool", "signature": "()const", @@ -3519,7 +3519,7 @@ "offset": "ImVec2(0,0)" }, "funcname": "AddCustomRectFontGlyph", - "location": "imgui:2691", + "location": "imgui:2855", "ov_cimguiname": "ImFontAtlas_AddCustomRectFontGlyph", "ret": "int", "signature": "(ImFont*,ImWchar,int,int,float,const ImVec2)", @@ -3548,7 +3548,7 @@ "cimguiname": "ImFontAtlas_AddCustomRectRegular", "defaults": {}, "funcname": "AddCustomRectRegular", - "location": "imgui:2690", + "location": "imgui:2854", "ov_cimguiname": "ImFontAtlas_AddCustomRectRegular", "ret": "int", "signature": "(int,int)", @@ -3573,7 +3573,7 @@ "cimguiname": "ImFontAtlas_AddFont", "defaults": {}, "funcname": "AddFont", - "location": "imgui:2641", + "location": "imgui:2804", "ov_cimguiname": "ImFontAtlas_AddFont", "ret": "ImFont*", "signature": "(const ImFontConfig*)", @@ -3600,7 +3600,7 @@ "font_cfg": "NULL" }, "funcname": "AddFontDefault", - "location": "imgui:2642", + "location": "imgui:2805", "ov_cimguiname": "ImFontAtlas_AddFontDefault", "ret": "ImFont*", "signature": "(const ImFontConfig*)", @@ -3640,7 +3640,7 @@ "glyph_ranges": "NULL" }, "funcname": "AddFontFromFileTTF", - "location": "imgui:2643", + "location": "imgui:2806", "ov_cimguiname": "ImFontAtlas_AddFontFromFileTTF", "ret": "ImFont*", "signature": "(const char*,float,const ImFontConfig*,const ImWchar*)", @@ -3680,7 +3680,7 @@ "glyph_ranges": "NULL" }, "funcname": "AddFontFromMemoryCompressedBase85TTF", - "location": "imgui:2646", + "location": "imgui:2809", "ov_cimguiname": "ImFontAtlas_AddFontFromMemoryCompressedBase85TTF", "ret": "ImFont*", "signature": "(const char*,float,const ImFontConfig*,const ImWchar*)", @@ -3724,7 +3724,7 @@ "glyph_ranges": "NULL" }, "funcname": "AddFontFromMemoryCompressedTTF", - "location": "imgui:2645", + "location": "imgui:2808", "ov_cimguiname": "ImFontAtlas_AddFontFromMemoryCompressedTTF", "ret": "ImFont*", "signature": "(const void*,int,float,const ImFontConfig*,const ImWchar*)", @@ -3768,7 +3768,7 @@ "glyph_ranges": "NULL" }, "funcname": "AddFontFromMemoryTTF", - "location": "imgui:2644", + "location": "imgui:2807", "ov_cimguiname": "ImFontAtlas_AddFontFromMemoryTTF", "ret": "ImFont*", "signature": "(void*,int,float,const ImFontConfig*,const ImWchar*)", @@ -3789,7 +3789,7 @@ "cimguiname": "ImFontAtlas_Build", "defaults": {}, "funcname": "Build", - "location": "imgui:2657", + "location": "imgui:2820", "ov_cimguiname": "ImFontAtlas_Build", "ret": "bool", "signature": "()", @@ -3822,7 +3822,7 @@ "cimguiname": "ImFontAtlas_CalcCustomRectUV", "defaults": {}, "funcname": "CalcCustomRectUV", - "location": "imgui:2695", + "location": "imgui:2859", "ov_cimguiname": "ImFontAtlas_CalcCustomRectUV", "ret": "void", "signature": "(const ImFontAtlasCustomRect*,ImVec2*,ImVec2*)const", @@ -3843,7 +3843,7 @@ "cimguiname": "ImFontAtlas_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui:2650", + "location": "imgui:2813", "ov_cimguiname": "ImFontAtlas_Clear", "ret": "void", "signature": "()", @@ -3864,7 +3864,7 @@ "cimguiname": "ImFontAtlas_ClearFonts", "defaults": {}, "funcname": "ClearFonts", - "location": "imgui:2649", + "location": "imgui:2812", "ov_cimguiname": "ImFontAtlas_ClearFonts", "ret": "void", "signature": "()", @@ -3885,7 +3885,7 @@ "cimguiname": "ImFontAtlas_ClearInputData", "defaults": {}, "funcname": "ClearInputData", - "location": "imgui:2647", + "location": "imgui:2810", "ov_cimguiname": "ImFontAtlas_ClearInputData", "ret": "void", "signature": "()", @@ -3906,7 +3906,7 @@ "cimguiname": "ImFontAtlas_ClearTexData", "defaults": {}, "funcname": "ClearTexData", - "location": "imgui:2648", + "location": "imgui:2811", "ov_cimguiname": "ImFontAtlas_ClearTexData", "ret": "void", "signature": "()", @@ -3931,7 +3931,7 @@ "cimguiname": "ImFontAtlas_GetCustomRectByIndex", "defaults": {}, "funcname": "GetCustomRectByIndex", - "location": "imgui:2692", + "location": "imgui:2856", "ov_cimguiname": "ImFontAtlas_GetCustomRectByIndex", "ret": "ImFontAtlasCustomRect*", "signature": "(int)", @@ -3952,7 +3952,7 @@ "cimguiname": "ImFontAtlas_GetGlyphRangesChineseFull", "defaults": {}, "funcname": "GetGlyphRangesChineseFull", - "location": "imgui:2673", + "location": "imgui:2837", "ov_cimguiname": "ImFontAtlas_GetGlyphRangesChineseFull", "ret": "const ImWchar*", "signature": "()", @@ -3973,7 +3973,7 @@ "cimguiname": "ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon", "defaults": {}, "funcname": "GetGlyphRangesChineseSimplifiedCommon", - "location": "imgui:2674", + "location": "imgui:2838", "ov_cimguiname": "ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon", "ret": "const ImWchar*", "signature": "()", @@ -3994,7 +3994,7 @@ "cimguiname": "ImFontAtlas_GetGlyphRangesCyrillic", "defaults": {}, "funcname": "GetGlyphRangesCyrillic", - "location": "imgui:2675", + "location": "imgui:2839", "ov_cimguiname": "ImFontAtlas_GetGlyphRangesCyrillic", "ret": "const ImWchar*", "signature": "()", @@ -4015,13 +4015,34 @@ "cimguiname": "ImFontAtlas_GetGlyphRangesDefault", "defaults": {}, "funcname": "GetGlyphRangesDefault", - "location": "imgui:2670", + "location": "imgui:2833", "ov_cimguiname": "ImFontAtlas_GetGlyphRangesDefault", "ret": "const ImWchar*", "signature": "()", "stname": "ImFontAtlas" } ], + "ImFontAtlas_GetGlyphRangesGreek": [ + { + "args": "(ImFontAtlas* self)", + "argsT": [ + { + "name": "self", + "type": "ImFontAtlas*" + } + ], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImFontAtlas_GetGlyphRangesGreek", + "defaults": {}, + "funcname": "GetGlyphRangesGreek", + "location": "imgui:2834", + "ov_cimguiname": "ImFontAtlas_GetGlyphRangesGreek", + "ret": "const ImWchar*", + "signature": "()", + "stname": "ImFontAtlas" + } + ], "ImFontAtlas_GetGlyphRangesJapanese": [ { "args": "(ImFontAtlas* self)", @@ -4036,7 +4057,7 @@ "cimguiname": "ImFontAtlas_GetGlyphRangesJapanese", "defaults": {}, "funcname": "GetGlyphRangesJapanese", - "location": "imgui:2672", + "location": "imgui:2836", "ov_cimguiname": "ImFontAtlas_GetGlyphRangesJapanese", "ret": "const ImWchar*", "signature": "()", @@ -4057,7 +4078,7 @@ "cimguiname": "ImFontAtlas_GetGlyphRangesKorean", "defaults": {}, "funcname": "GetGlyphRangesKorean", - "location": "imgui:2671", + "location": "imgui:2835", "ov_cimguiname": "ImFontAtlas_GetGlyphRangesKorean", "ret": "const ImWchar*", "signature": "()", @@ -4078,7 +4099,7 @@ "cimguiname": "ImFontAtlas_GetGlyphRangesThai", "defaults": {}, "funcname": "GetGlyphRangesThai", - "location": "imgui:2676", + "location": "imgui:2840", "ov_cimguiname": "ImFontAtlas_GetGlyphRangesThai", "ret": "const ImWchar*", "signature": "()", @@ -4099,7 +4120,7 @@ "cimguiname": "ImFontAtlas_GetGlyphRangesVietnamese", "defaults": {}, "funcname": "GetGlyphRangesVietnamese", - "location": "imgui:2677", + "location": "imgui:2841", "ov_cimguiname": "ImFontAtlas_GetGlyphRangesVietnamese", "ret": "const ImWchar*", "signature": "()", @@ -4140,7 +4161,7 @@ "cimguiname": "ImFontAtlas_GetMouseCursorTexData", "defaults": {}, "funcname": "GetMouseCursorTexData", - "location": "imgui:2696", + "location": "imgui:2860", "ov_cimguiname": "ImFontAtlas_GetMouseCursorTexData", "ret": "bool", "signature": "(ImGuiMouseCursor,ImVec2*,ImVec2*,ImVec2[2],ImVec2[2])", @@ -4179,7 +4200,7 @@ "out_bytes_per_pixel": "NULL" }, "funcname": "GetTexDataAsAlpha8", - "location": "imgui:2658", + "location": "imgui:2821", "ov_cimguiname": "ImFontAtlas_GetTexDataAsAlpha8", "ret": "void", "signature": "(unsigned char**,int*,int*,int*)", @@ -4218,7 +4239,7 @@ "out_bytes_per_pixel": "NULL" }, "funcname": "GetTexDataAsRGBA32", - "location": "imgui:2659", + "location": "imgui:2822", "ov_cimguiname": "ImFontAtlas_GetTexDataAsRGBA32", "ret": "void", "signature": "(unsigned char**,int*,int*,int*)", @@ -4235,7 +4256,7 @@ "constructor": true, "defaults": {}, "funcname": "ImFontAtlas", - "location": "imgui:2639", + "location": "imgui:2802", "ov_cimguiname": "ImFontAtlas_ImFontAtlas", "signature": "()", "stname": "ImFontAtlas" @@ -4255,7 +4276,7 @@ "cimguiname": "ImFontAtlas_IsBuilt", "defaults": {}, "funcname": "IsBuilt", - "location": "imgui:2660", + "location": "imgui:2823", "ov_cimguiname": "ImFontAtlas_IsBuilt", "ret": "bool", "signature": "()const", @@ -4280,7 +4301,7 @@ "cimguiname": "ImFontAtlas_SetTexID", "defaults": {}, "funcname": "SetTexID", - "location": "imgui:2661", + "location": "imgui:2824", "ov_cimguiname": "ImFontAtlas_SetTexID", "ret": "void", "signature": "(ImTextureID)", @@ -4300,7 +4321,7 @@ "cimguiname": "ImFontAtlas_destroy", "defaults": {}, "destructor": true, - "location": "imgui:2640", + "location": "imgui:2803", "ov_cimguiname": "ImFontAtlas_destroy", "realdestructor": true, "ret": "void", @@ -4318,7 +4339,7 @@ "constructor": true, "defaults": {}, "funcname": "ImFontConfig", - "location": "imgui:2567", + "location": "imgui:2730", "ov_cimguiname": "ImFontConfig_ImFontConfig", "signature": "()", "stname": "ImFontConfig" @@ -4361,7 +4382,7 @@ "cimguiname": "ImFontGlyphRangesBuilder_AddChar", "defaults": {}, "funcname": "AddChar", - "location": "imgui:2592", + "location": "imgui:2755", "ov_cimguiname": "ImFontGlyphRangesBuilder_AddChar", "ret": "void", "signature": "(ImWchar)", @@ -4386,7 +4407,7 @@ "cimguiname": "ImFontGlyphRangesBuilder_AddRanges", "defaults": {}, "funcname": "AddRanges", - "location": "imgui:2594", + "location": "imgui:2757", "ov_cimguiname": "ImFontGlyphRangesBuilder_AddRanges", "ret": "void", "signature": "(const ImWchar*)", @@ -4417,7 +4438,7 @@ "text_end": "NULL" }, "funcname": "AddText", - "location": "imgui:2593", + "location": "imgui:2756", "ov_cimguiname": "ImFontGlyphRangesBuilder_AddText", "ret": "void", "signature": "(const char*,const char*)", @@ -4442,7 +4463,7 @@ "cimguiname": "ImFontGlyphRangesBuilder_BuildRanges", "defaults": {}, "funcname": "BuildRanges", - "location": "imgui:2595", + "location": "imgui:2758", "ov_cimguiname": "ImFontGlyphRangesBuilder_BuildRanges", "ret": "void", "signature": "(ImVector_ImWchar*)", @@ -4463,7 +4484,7 @@ "cimguiname": "ImFontGlyphRangesBuilder_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui:2589", + "location": "imgui:2752", "ov_cimguiname": "ImFontGlyphRangesBuilder_Clear", "ret": "void", "signature": "()", @@ -4488,7 +4509,7 @@ "cimguiname": "ImFontGlyphRangesBuilder_GetBit", "defaults": {}, "funcname": "GetBit", - "location": "imgui:2590", + "location": "imgui:2753", "ov_cimguiname": "ImFontGlyphRangesBuilder_GetBit", "ret": "bool", "signature": "(size_t)const", @@ -4505,7 +4526,7 @@ "constructor": true, "defaults": {}, "funcname": "ImFontGlyphRangesBuilder", - "location": "imgui:2588", + "location": "imgui:2751", "ov_cimguiname": "ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder", "signature": "()", "stname": "ImFontGlyphRangesBuilder" @@ -4529,7 +4550,7 @@ "cimguiname": "ImFontGlyphRangesBuilder_SetBit", "defaults": {}, "funcname": "SetBit", - "location": "imgui:2591", + "location": "imgui:2754", "ov_cimguiname": "ImFontGlyphRangesBuilder_SetBit", "ret": "void", "signature": "(size_t)", @@ -4613,7 +4634,7 @@ "cimguiname": "ImFont_AddGlyph", "defaults": {}, "funcname": "AddGlyph", - "location": "imgui:2784", + "location": "imgui:2950", "ov_cimguiname": "ImFont_AddGlyph", "ret": "void", "signature": "(const ImFontConfig*,ImWchar,float,float,float,float,float,float,float,float,float)", @@ -4648,7 +4669,7 @@ "overwrite_dst": "true" }, "funcname": "AddRemapChar", - "location": "imgui:2785", + "location": "imgui:2951", "ov_cimguiname": "ImFont_AddRemapChar", "ret": "void", "signature": "(ImWchar,ImWchar,bool)", @@ -4669,7 +4690,7 @@ "cimguiname": "ImFont_BuildLookupTable", "defaults": {}, "funcname": "BuildLookupTable", - "location": "imgui:2781", + "location": "imgui:2947", "ov_cimguiname": "ImFont_BuildLookupTable", "ret": "void", "signature": "()", @@ -4721,7 +4742,7 @@ "text_end": "NULL" }, "funcname": "CalcTextSizeA", - "location": "imgui:2775", + "location": "imgui:2941", "nonUDT": 1, "ov_cimguiname": "ImFont_CalcTextSizeA", "ret": "void", @@ -4759,7 +4780,7 @@ "cimguiname": "ImFont_CalcWordWrapPositionA", "defaults": {}, "funcname": "CalcWordWrapPositionA", - "location": "imgui:2776", + "location": "imgui:2942", "ov_cimguiname": "ImFont_CalcWordWrapPositionA", "ret": "const char*", "signature": "(float,const char*,const char*,float)const", @@ -4780,7 +4801,7 @@ "cimguiname": "ImFont_ClearOutputData", "defaults": {}, "funcname": "ClearOutputData", - "location": "imgui:2782", + "location": "imgui:2948", "ov_cimguiname": "ImFont_ClearOutputData", "ret": "void", "signature": "()", @@ -4805,7 +4826,7 @@ "cimguiname": "ImFont_FindGlyph", "defaults": {}, "funcname": "FindGlyph", - "location": "imgui:2767", + "location": "imgui:2933", "ov_cimguiname": "ImFont_FindGlyph", "ret": "const ImFontGlyph*", "signature": "(ImWchar)const", @@ -4830,7 +4851,7 @@ "cimguiname": "ImFont_FindGlyphNoFallback", "defaults": {}, "funcname": "FindGlyphNoFallback", - "location": "imgui:2768", + "location": "imgui:2934", "ov_cimguiname": "ImFont_FindGlyphNoFallback", "ret": "const ImFontGlyph*", "signature": "(ImWchar)const", @@ -4855,7 +4876,7 @@ "cimguiname": "ImFont_GetCharAdvance", "defaults": {}, "funcname": "GetCharAdvance", - "location": "imgui:2769", + "location": "imgui:2935", "ov_cimguiname": "ImFont_GetCharAdvance", "ret": "float", "signature": "(ImWchar)const", @@ -4876,7 +4897,7 @@ "cimguiname": "ImFont_GetDebugName", "defaults": {}, "funcname": "GetDebugName", - "location": "imgui:2771", + "location": "imgui:2937", "ov_cimguiname": "ImFont_GetDebugName", "ret": "const char*", "signature": "()const", @@ -4901,7 +4922,7 @@ "cimguiname": "ImFont_GrowIndex", "defaults": {}, "funcname": "GrowIndex", - "location": "imgui:2783", + "location": "imgui:2949", "ov_cimguiname": "ImFont_GrowIndex", "ret": "void", "signature": "(int)", @@ -4918,7 +4939,7 @@ "constructor": true, "defaults": {}, "funcname": "ImFont", - "location": "imgui:2765", + "location": "imgui:2931", "ov_cimguiname": "ImFont_ImFont", "signature": "()", "stname": "ImFont" @@ -4946,7 +4967,7 @@ "cimguiname": "ImFont_IsGlyphRangeUnused", "defaults": {}, "funcname": "IsGlyphRangeUnused", - "location": "imgui:2787", + "location": "imgui:2953", "ov_cimguiname": "ImFont_IsGlyphRangeUnused", "ret": "bool", "signature": "(unsigned int,unsigned int)", @@ -4967,7 +4988,7 @@ "cimguiname": "ImFont_IsLoaded", "defaults": {}, "funcname": "IsLoaded", - "location": "imgui:2770", + "location": "imgui:2936", "ov_cimguiname": "ImFont_IsLoaded", "ret": "bool", "signature": "()const", @@ -4976,7 +4997,7 @@ ], "ImFont_RenderChar": [ { - "args": "(ImFont* self,ImDrawList* draw_list,float size,ImVec2 pos,ImU32 col,ImWchar c)", + "args": "(ImFont* self,ImDrawList* draw_list,float size,const ImVec2 pos,ImU32 col,ImWchar c)", "argsT": [ { "name": "self", @@ -4992,7 +5013,7 @@ }, { "name": "pos", - "type": "ImVec2" + "type": "const ImVec2" }, { "name": "col", @@ -5003,21 +5024,21 @@ "type": "ImWchar" } ], - "argsoriginal": "(ImDrawList* draw_list,float size,ImVec2 pos,ImU32 col,ImWchar c)", + "argsoriginal": "(ImDrawList* draw_list,float size,const ImVec2& pos,ImU32 col,ImWchar c)", "call_args": "(draw_list,size,pos,col,c)", "cimguiname": "ImFont_RenderChar", "defaults": {}, "funcname": "RenderChar", - "location": "imgui:2777", + "location": "imgui:2943", "ov_cimguiname": "ImFont_RenderChar", "ret": "void", - "signature": "(ImDrawList*,float,ImVec2,ImU32,ImWchar)const", + "signature": "(ImDrawList*,float,const ImVec2,ImU32,ImWchar)const", "stname": "ImFont" } ], "ImFont_RenderText": [ { - "args": "(ImFont* self,ImDrawList* draw_list,float size,ImVec2 pos,ImU32 col,const ImVec4 clip_rect,const char* text_begin,const char* text_end,float wrap_width,bool cpu_fine_clip)", + "args": "(ImFont* self,ImDrawList* draw_list,float size,const ImVec2 pos,ImU32 col,const ImVec4 clip_rect,const char* text_begin,const char* text_end,float wrap_width,bool cpu_fine_clip)", "argsT": [ { "name": "self", @@ -5033,7 +5054,7 @@ }, { "name": "pos", - "type": "ImVec2" + "type": "const ImVec2" }, { "name": "col", @@ -5060,7 +5081,7 @@ "type": "bool" } ], - "argsoriginal": "(ImDrawList* draw_list,float size,ImVec2 pos,ImU32 col,const ImVec4& clip_rect,const char* text_begin,const char* text_end,float wrap_width=0.0f,bool cpu_fine_clip=false)", + "argsoriginal": "(ImDrawList* draw_list,float size,const ImVec2& pos,ImU32 col,const ImVec4& clip_rect,const char* text_begin,const char* text_end,float wrap_width=0.0f,bool cpu_fine_clip=false)", "call_args": "(draw_list,size,pos,col,clip_rect,text_begin,text_end,wrap_width,cpu_fine_clip)", "cimguiname": "ImFont_RenderText", "defaults": { @@ -5068,10 +5089,10 @@ "wrap_width": "0.0f" }, "funcname": "RenderText", - "location": "imgui:2778", + "location": "imgui:2944", "ov_cimguiname": "ImFont_RenderText", "ret": "void", - "signature": "(ImDrawList*,float,ImVec2,ImU32,const ImVec4,const char*,const char*,float,bool)const", + "signature": "(ImDrawList*,float,const ImVec2,ImU32,const ImVec4,const char*,const char*,float,bool)const", "stname": "ImFont" } ], @@ -5097,7 +5118,7 @@ "cimguiname": "ImFont_SetGlyphVisible", "defaults": {}, "funcname": "SetGlyphVisible", - "location": "imgui:2786", + "location": "imgui:2952", "ov_cimguiname": "ImFont_SetGlyphVisible", "ret": "void", "signature": "(ImWchar,bool)", @@ -5117,7 +5138,7 @@ "cimguiname": "ImFont_destroy", "defaults": {}, "destructor": true, - "location": "imgui:2766", + "location": "imgui:2932", "ov_cimguiname": "ImFont_destroy", "realdestructor": true, "ret": "void", @@ -5135,7 +5156,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiComboPreviewData", - "location": "imgui_internal:978", + "location": "imgui_internal:1016", "ov_cimguiname": "ImGuiComboPreviewData_ImGuiComboPreviewData", "signature": "()", "stname": "ImGuiComboPreviewData" @@ -5170,7 +5191,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiContextHook", - "location": "imgui_internal:1490", + "location": "imgui_internal:1733", "ov_cimguiname": "ImGuiContextHook_ImGuiContextHook", "signature": "()", "stname": "ImGuiContextHook" @@ -5210,7 +5231,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiContext", - "location": "imgui_internal:1751", + "location": "imgui_internal:2033", "ov_cimguiname": "ImGuiContext_ImGuiContext", "signature": "(ImFontAtlas*)", "stname": "ImGuiContext" @@ -5235,6 +5256,31 @@ "stname": "ImGuiContext" } ], + "ImGuiDataVarInfo_GetVarPtr": [ + { + "args": "(ImGuiDataVarInfo* self,void* parent)", + "argsT": [ + { + "name": "self", + "type": "ImGuiDataVarInfo*" + }, + { + "name": "parent", + "type": "void*" + } + ], + "argsoriginal": "(void* parent)", + "call_args": "(parent)", + "cimguiname": "ImGuiDataVarInfo_GetVarPtr", + "defaults": {}, + "funcname": "GetVarPtr", + "location": "imgui_internal:964", + "ov_cimguiname": "ImGuiDataVarInfo_GetVarPtr", + "ret": "void*", + "signature": "(void*)const", + "stname": "ImGuiDataVarInfo" + } + ], "ImGuiIO_AddFocusEvent": [ { "args": "(ImGuiIO* self,bool focused)", @@ -5253,7 +5299,7 @@ "cimguiname": "ImGuiIO_AddFocusEvent", "defaults": {}, "funcname": "AddFocusEvent", - "location": "imgui:1898", + "location": "imgui:1999", "ov_cimguiname": "ImGuiIO_AddFocusEvent", "ret": "void", "signature": "(bool)", @@ -5278,7 +5324,7 @@ "cimguiname": "ImGuiIO_AddInputCharacter", "defaults": {}, "funcname": "AddInputCharacter", - "location": "imgui:1895", + "location": "imgui:2000", "ov_cimguiname": "ImGuiIO_AddInputCharacter", "ret": "void", "signature": "(unsigned int)", @@ -5303,7 +5349,7 @@ "cimguiname": "ImGuiIO_AddInputCharacterUTF16", "defaults": {}, "funcname": "AddInputCharacterUTF16", - "location": "imgui:1896", + "location": "imgui:2001", "ov_cimguiname": "ImGuiIO_AddInputCharacterUTF16", "ret": "void", "signature": "(ImWchar16)", @@ -5328,79 +5374,317 @@ "cimguiname": "ImGuiIO_AddInputCharactersUTF8", "defaults": {}, "funcname": "AddInputCharactersUTF8", - "location": "imgui:1897", + "location": "imgui:2002", "ov_cimguiname": "ImGuiIO_AddInputCharactersUTF8", "ret": "void", "signature": "(const char*)", "stname": "ImGuiIO" } ], - "ImGuiIO_ClearInputCharacters": [ + "ImGuiIO_AddKeyAnalogEvent": [ { - "args": "(ImGuiIO* self)", + "args": "(ImGuiIO* self,ImGuiKey key,bool down,float v)", "argsT": [ { "name": "self", "type": "ImGuiIO*" + }, + { + "name": "key", + "type": "ImGuiKey" + }, + { + "name": "down", + "type": "bool" + }, + { + "name": "v", + "type": "float" } ], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "ImGuiIO_ClearInputCharacters", + "argsoriginal": "(ImGuiKey key,bool down,float v)", + "call_args": "(key,down,v)", + "cimguiname": "ImGuiIO_AddKeyAnalogEvent", "defaults": {}, - "funcname": "ClearInputCharacters", - "location": "imgui:1899", - "ov_cimguiname": "ImGuiIO_ClearInputCharacters", + "funcname": "AddKeyAnalogEvent", + "location": "imgui:1994", + "ov_cimguiname": "ImGuiIO_AddKeyAnalogEvent", "ret": "void", - "signature": "()", + "signature": "(ImGuiKey,bool,float)", "stname": "ImGuiIO" } ], - "ImGuiIO_ClearInputKeys": [ + "ImGuiIO_AddKeyEvent": [ { - "args": "(ImGuiIO* self)", + "args": "(ImGuiIO* self,ImGuiKey key,bool down)", "argsT": [ { "name": "self", "type": "ImGuiIO*" + }, + { + "name": "key", + "type": "ImGuiKey" + }, + { + "name": "down", + "type": "bool" } ], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "ImGuiIO_ClearInputKeys", + "argsoriginal": "(ImGuiKey key,bool down)", + "call_args": "(key,down)", + "cimguiname": "ImGuiIO_AddKeyEvent", "defaults": {}, - "funcname": "ClearInputKeys", - "location": "imgui:1900", - "ov_cimguiname": "ImGuiIO_ClearInputKeys", + "funcname": "AddKeyEvent", + "location": "imgui:1993", + "ov_cimguiname": "ImGuiIO_AddKeyEvent", "ret": "void", - "signature": "()", + "signature": "(ImGuiKey,bool)", "stname": "ImGuiIO" } ], - "ImGuiIO_ImGuiIO": [ + "ImGuiIO_AddMouseButtonEvent": [ { - "args": "()", - "argsT": [], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "ImGuiIO_ImGuiIO", - "constructor": true, + "args": "(ImGuiIO* self,int button,bool down)", + "argsT": [ + { + "name": "self", + "type": "ImGuiIO*" + }, + { + "name": "button", + "type": "int" + }, + { + "name": "down", + "type": "bool" + } + ], + "argsoriginal": "(int button,bool down)", + "call_args": "(button,down)", + "cimguiname": "ImGuiIO_AddMouseButtonEvent", "defaults": {}, - "funcname": "ImGuiIO", - "location": "imgui:1953", - "ov_cimguiname": "ImGuiIO_ImGuiIO", - "signature": "()", + "funcname": "AddMouseButtonEvent", + "location": "imgui:1996", + "ov_cimguiname": "ImGuiIO_AddMouseButtonEvent", + "ret": "void", + "signature": "(int,bool)", "stname": "ImGuiIO" } ], - "ImGuiIO_destroy": [ + "ImGuiIO_AddMousePosEvent": [ { - "args": "(ImGuiIO* self)", + "args": "(ImGuiIO* self,float x,float y)", "argsT": [ { "name": "self", "type": "ImGuiIO*" - } + }, + { + "name": "x", + "type": "float" + }, + { + "name": "y", + "type": "float" + } + ], + "argsoriginal": "(float x,float y)", + "call_args": "(x,y)", + "cimguiname": "ImGuiIO_AddMousePosEvent", + "defaults": {}, + "funcname": "AddMousePosEvent", + "location": "imgui:1995", + "ov_cimguiname": "ImGuiIO_AddMousePosEvent", + "ret": "void", + "signature": "(float,float)", + "stname": "ImGuiIO" + } + ], + "ImGuiIO_AddMouseSourceEvent": [ + { + "args": "(ImGuiIO* self,ImGuiMouseSource source)", + "argsT": [ + { + "name": "self", + "type": "ImGuiIO*" + }, + { + "name": "source", + "type": "ImGuiMouseSource" + } + ], + "argsoriginal": "(ImGuiMouseSource source)", + "call_args": "(source)", + "cimguiname": "ImGuiIO_AddMouseSourceEvent", + "defaults": {}, + "funcname": "AddMouseSourceEvent", + "location": "imgui:1998", + "ov_cimguiname": "ImGuiIO_AddMouseSourceEvent", + "ret": "void", + "signature": "(ImGuiMouseSource)", + "stname": "ImGuiIO" + } + ], + "ImGuiIO_AddMouseWheelEvent": [ + { + "args": "(ImGuiIO* self,float wheel_x,float wheel_y)", + "argsT": [ + { + "name": "self", + "type": "ImGuiIO*" + }, + { + "name": "wheel_x", + "type": "float" + }, + { + "name": "wheel_y", + "type": "float" + } + ], + "argsoriginal": "(float wheel_x,float wheel_y)", + "call_args": "(wheel_x,wheel_y)", + "cimguiname": "ImGuiIO_AddMouseWheelEvent", + "defaults": {}, + "funcname": "AddMouseWheelEvent", + "location": "imgui:1997", + "ov_cimguiname": "ImGuiIO_AddMouseWheelEvent", + "ret": "void", + "signature": "(float,float)", + "stname": "ImGuiIO" + } + ], + "ImGuiIO_ClearInputCharacters": [ + { + "args": "(ImGuiIO* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiIO*" + } + ], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiIO_ClearInputCharacters", + "defaults": {}, + "funcname": "ClearInputCharacters", + "location": "imgui:2006", + "ov_cimguiname": "ImGuiIO_ClearInputCharacters", + "ret": "void", + "signature": "()", + "stname": "ImGuiIO" + } + ], + "ImGuiIO_ClearInputKeys": [ + { + "args": "(ImGuiIO* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiIO*" + } + ], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiIO_ClearInputKeys", + "defaults": {}, + "funcname": "ClearInputKeys", + "location": "imgui:2007", + "ov_cimguiname": "ImGuiIO_ClearInputKeys", + "ret": "void", + "signature": "()", + "stname": "ImGuiIO" + } + ], + "ImGuiIO_ImGuiIO": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiIO_ImGuiIO", + "constructor": true, + "defaults": {}, + "funcname": "ImGuiIO", + "location": "imgui:2084", + "ov_cimguiname": "ImGuiIO_ImGuiIO", + "signature": "()", + "stname": "ImGuiIO" + } + ], + "ImGuiIO_SetAppAcceptingEvents": [ + { + "args": "(ImGuiIO* self,bool accepting_events)", + "argsT": [ + { + "name": "self", + "type": "ImGuiIO*" + }, + { + "name": "accepting_events", + "type": "bool" + } + ], + "argsoriginal": "(bool accepting_events)", + "call_args": "(accepting_events)", + "cimguiname": "ImGuiIO_SetAppAcceptingEvents", + "defaults": {}, + "funcname": "SetAppAcceptingEvents", + "location": "imgui:2005", + "ov_cimguiname": "ImGuiIO_SetAppAcceptingEvents", + "ret": "void", + "signature": "(bool)", + "stname": "ImGuiIO" + } + ], + "ImGuiIO_SetKeyEventNativeData": [ + { + "args": "(ImGuiIO* self,ImGuiKey key,int native_keycode,int native_scancode,int native_legacy_index)", + "argsT": [ + { + "name": "self", + "type": "ImGuiIO*" + }, + { + "name": "key", + "type": "ImGuiKey" + }, + { + "name": "native_keycode", + "type": "int" + }, + { + "name": "native_scancode", + "type": "int" + }, + { + "name": "native_legacy_index", + "type": "int" + } + ], + "argsoriginal": "(ImGuiKey key,int native_keycode,int native_scancode,int native_legacy_index=-1)", + "call_args": "(key,native_keycode,native_scancode,native_legacy_index)", + "cimguiname": "ImGuiIO_SetKeyEventNativeData", + "defaults": { + "native_legacy_index": "-1" + }, + "funcname": "SetKeyEventNativeData", + "location": "imgui:2004", + "ov_cimguiname": "ImGuiIO_SetKeyEventNativeData", + "ret": "void", + "signature": "(ImGuiKey,int,int,int)", + "stname": "ImGuiIO" + } + ], + "ImGuiIO_destroy": [ + { + "args": "(ImGuiIO* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiIO*" + } ], "call_args": "(self)", "cimguiname": "ImGuiIO_destroy", @@ -5412,6 +5696,41 @@ "stname": "ImGuiIO" } ], + "ImGuiInputEvent_ImGuiInputEvent": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiInputEvent_ImGuiInputEvent", + "constructor": true, + "defaults": {}, + "funcname": "ImGuiInputEvent", + "location": "imgui_internal:1300", + "ov_cimguiname": "ImGuiInputEvent_ImGuiInputEvent", + "signature": "()", + "stname": "ImGuiInputEvent" + } + ], + "ImGuiInputEvent_destroy": [ + { + "args": "(ImGuiInputEvent* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiInputEvent*" + } + ], + "call_args": "(self)", + "cimguiname": "ImGuiInputEvent_destroy", + "defaults": {}, + "destructor": true, + "ov_cimguiname": "ImGuiInputEvent_destroy", + "ret": "void", + "signature": "(ImGuiInputEvent*)", + "stname": "ImGuiInputEvent" + } + ], "ImGuiInputTextCallbackData_ClearSelection": [ { "args": "(ImGuiInputTextCallbackData* self)", @@ -5426,7 +5745,7 @@ "cimguiname": "ImGuiInputTextCallbackData_ClearSelection", "defaults": {}, "funcname": "ClearSelection", - "location": "imgui:1994", + "location": "imgui:2126", "ov_cimguiname": "ImGuiInputTextCallbackData_ClearSelection", "ret": "void", "signature": "()", @@ -5455,7 +5774,7 @@ "cimguiname": "ImGuiInputTextCallbackData_DeleteChars", "defaults": {}, "funcname": "DeleteChars", - "location": "imgui:1991", + "location": "imgui:2123", "ov_cimguiname": "ImGuiInputTextCallbackData_DeleteChars", "ret": "void", "signature": "(int,int)", @@ -5476,7 +5795,7 @@ "cimguiname": "ImGuiInputTextCallbackData_HasSelection", "defaults": {}, "funcname": "HasSelection", - "location": "imgui:1995", + "location": "imgui:2127", "ov_cimguiname": "ImGuiInputTextCallbackData_HasSelection", "ret": "bool", "signature": "()const", @@ -5493,7 +5812,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiInputTextCallbackData", - "location": "imgui:1990", + "location": "imgui:2122", "ov_cimguiname": "ImGuiInputTextCallbackData_ImGuiInputTextCallbackData", "signature": "()", "stname": "ImGuiInputTextCallbackData" @@ -5527,7 +5846,7 @@ "text_end": "NULL" }, "funcname": "InsertChars", - "location": "imgui:1992", + "location": "imgui:2124", "ov_cimguiname": "ImGuiInputTextCallbackData_InsertChars", "ret": "void", "signature": "(int,const char*,const char*)", @@ -5548,7 +5867,7 @@ "cimguiname": "ImGuiInputTextCallbackData_SelectAll", "defaults": {}, "funcname": "SelectAll", - "location": "imgui:1993", + "location": "imgui:2125", "ov_cimguiname": "ImGuiInputTextCallbackData_SelectAll", "ret": "void", "signature": "()", @@ -5574,6 +5893,62 @@ "stname": "ImGuiInputTextCallbackData" } ], + "ImGuiInputTextDeactivatedState_ClearFreeMemory": [ + { + "args": "(ImGuiInputTextDeactivatedState* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiInputTextDeactivatedState*" + } + ], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiInputTextDeactivatedState_ClearFreeMemory", + "defaults": {}, + "funcname": "ClearFreeMemory", + "location": "imgui_internal:1060", + "ov_cimguiname": "ImGuiInputTextDeactivatedState_ClearFreeMemory", + "ret": "void", + "signature": "()", + "stname": "ImGuiInputTextDeactivatedState" + } + ], + "ImGuiInputTextDeactivatedState_ImGuiInputTextDeactivatedState": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiInputTextDeactivatedState_ImGuiInputTextDeactivatedState", + "constructor": true, + "defaults": {}, + "funcname": "ImGuiInputTextDeactivatedState", + "location": "imgui_internal:1059", + "ov_cimguiname": "ImGuiInputTextDeactivatedState_ImGuiInputTextDeactivatedState", + "signature": "()", + "stname": "ImGuiInputTextDeactivatedState" + } + ], + "ImGuiInputTextDeactivatedState_destroy": [ + { + "args": "(ImGuiInputTextDeactivatedState* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiInputTextDeactivatedState*" + } + ], + "call_args": "(self)", + "cimguiname": "ImGuiInputTextDeactivatedState_destroy", + "defaults": {}, + "destructor": true, + "ov_cimguiname": "ImGuiInputTextDeactivatedState_destroy", + "ret": "void", + "signature": "(ImGuiInputTextDeactivatedState*)", + "stname": "ImGuiInputTextDeactivatedState" + } + ], "ImGuiInputTextState_ClearFreeMemory": [ { "args": "(ImGuiInputTextState* self)", @@ -5588,7 +5963,7 @@ "cimguiname": "ImGuiInputTextState_ClearFreeMemory", "defaults": {}, "funcname": "ClearFreeMemory", - "location": "imgui_internal:1036", + "location": "imgui_internal:1084", "ov_cimguiname": "ImGuiInputTextState_ClearFreeMemory", "ret": "void", "signature": "()", @@ -5609,7 +5984,7 @@ "cimguiname": "ImGuiInputTextState_ClearSelection", "defaults": {}, "funcname": "ClearSelection", - "location": "imgui_internal:1045", + "location": "imgui_internal:1093", "ov_cimguiname": "ImGuiInputTextState_ClearSelection", "ret": "void", "signature": "()", @@ -5630,7 +6005,7 @@ "cimguiname": "ImGuiInputTextState_ClearText", "defaults": {}, "funcname": "ClearText", - "location": "imgui_internal:1035", + "location": "imgui_internal:1083", "ov_cimguiname": "ImGuiInputTextState_ClearText", "ret": "void", "signature": "()", @@ -5651,7 +6026,7 @@ "cimguiname": "ImGuiInputTextState_CursorAnimReset", "defaults": {}, "funcname": "CursorAnimReset", - "location": "imgui_internal:1042", + "location": "imgui_internal:1090", "ov_cimguiname": "ImGuiInputTextState_CursorAnimReset", "ret": "void", "signature": "()", @@ -5672,7 +6047,7 @@ "cimguiname": "ImGuiInputTextState_CursorClamp", "defaults": {}, "funcname": "CursorClamp", - "location": "imgui_internal:1043", + "location": "imgui_internal:1091", "ov_cimguiname": "ImGuiInputTextState_CursorClamp", "ret": "void", "signature": "()", @@ -5693,7 +6068,7 @@ "cimguiname": "ImGuiInputTextState_GetCursorPos", "defaults": {}, "funcname": "GetCursorPos", - "location": "imgui_internal:1046", + "location": "imgui_internal:1094", "ov_cimguiname": "ImGuiInputTextState_GetCursorPos", "ret": "int", "signature": "()const", @@ -5714,7 +6089,7 @@ "cimguiname": "ImGuiInputTextState_GetRedoAvailCount", "defaults": {}, "funcname": "GetRedoAvailCount", - "location": "imgui_internal:1038", + "location": "imgui_internal:1086", "ov_cimguiname": "ImGuiInputTextState_GetRedoAvailCount", "ret": "int", "signature": "()const", @@ -5735,7 +6110,7 @@ "cimguiname": "ImGuiInputTextState_GetSelectionEnd", "defaults": {}, "funcname": "GetSelectionEnd", - "location": "imgui_internal:1048", + "location": "imgui_internal:1096", "ov_cimguiname": "ImGuiInputTextState_GetSelectionEnd", "ret": "int", "signature": "()const", @@ -5756,7 +6131,7 @@ "cimguiname": "ImGuiInputTextState_GetSelectionStart", "defaults": {}, "funcname": "GetSelectionStart", - "location": "imgui_internal:1047", + "location": "imgui_internal:1095", "ov_cimguiname": "ImGuiInputTextState_GetSelectionStart", "ret": "int", "signature": "()const", @@ -5777,7 +6152,7 @@ "cimguiname": "ImGuiInputTextState_GetUndoAvailCount", "defaults": {}, "funcname": "GetUndoAvailCount", - "location": "imgui_internal:1037", + "location": "imgui_internal:1085", "ov_cimguiname": "ImGuiInputTextState_GetUndoAvailCount", "ret": "int", "signature": "()const", @@ -5798,7 +6173,7 @@ "cimguiname": "ImGuiInputTextState_HasSelection", "defaults": {}, "funcname": "HasSelection", - "location": "imgui_internal:1044", + "location": "imgui_internal:1092", "ov_cimguiname": "ImGuiInputTextState_HasSelection", "ret": "bool", "signature": "()const", @@ -5815,7 +6190,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiInputTextState", - "location": "imgui_internal:1034", + "location": "imgui_internal:1082", "ov_cimguiname": "ImGuiInputTextState_ImGuiInputTextState", "signature": "()", "stname": "ImGuiInputTextState" @@ -5839,7 +6214,7 @@ "cimguiname": "ImGuiInputTextState_OnKeyPressed", "defaults": {}, "funcname": "OnKeyPressed", - "location": "imgui_internal:1039", + "location": "imgui_internal:1087", "ov_cimguiname": "ImGuiInputTextState_OnKeyPressed", "ret": "void", "signature": "(int)", @@ -5860,7 +6235,7 @@ "cimguiname": "ImGuiInputTextState_SelectAll", "defaults": {}, "funcname": "SelectAll", - "location": "imgui_internal:1049", + "location": "imgui_internal:1097", "ov_cimguiname": "ImGuiInputTextState_SelectAll", "ret": "void", "signature": "()", @@ -5886,6 +6261,132 @@ "stname": "ImGuiInputTextState" } ], + "ImGuiKeyOwnerData_ImGuiKeyOwnerData": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiKeyOwnerData_ImGuiKeyOwnerData", + "constructor": true, + "defaults": {}, + "funcname": "ImGuiKeyOwnerData", + "location": "imgui_internal:1342", + "ov_cimguiname": "ImGuiKeyOwnerData_ImGuiKeyOwnerData", + "signature": "()", + "stname": "ImGuiKeyOwnerData" + } + ], + "ImGuiKeyOwnerData_destroy": [ + { + "args": "(ImGuiKeyOwnerData* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiKeyOwnerData*" + } + ], + "call_args": "(self)", + "cimguiname": "ImGuiKeyOwnerData_destroy", + "defaults": {}, + "destructor": true, + "ov_cimguiname": "ImGuiKeyOwnerData_destroy", + "ret": "void", + "signature": "(ImGuiKeyOwnerData*)", + "stname": "ImGuiKeyOwnerData" + } + ], + "ImGuiKeyRoutingData_ImGuiKeyRoutingData": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiKeyRoutingData_ImGuiKeyRoutingData", + "constructor": true, + "defaults": {}, + "funcname": "ImGuiKeyRoutingData", + "location": "imgui_internal:1318", + "ov_cimguiname": "ImGuiKeyRoutingData_ImGuiKeyRoutingData", + "signature": "()", + "stname": "ImGuiKeyRoutingData" + } + ], + "ImGuiKeyRoutingData_destroy": [ + { + "args": "(ImGuiKeyRoutingData* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiKeyRoutingData*" + } + ], + "call_args": "(self)", + "cimguiname": "ImGuiKeyRoutingData_destroy", + "defaults": {}, + "destructor": true, + "ov_cimguiname": "ImGuiKeyRoutingData_destroy", + "ret": "void", + "signature": "(ImGuiKeyRoutingData*)", + "stname": "ImGuiKeyRoutingData" + } + ], + "ImGuiKeyRoutingTable_Clear": [ + { + "args": "(ImGuiKeyRoutingTable* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiKeyRoutingTable*" + } + ], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiKeyRoutingTable_Clear", + "defaults": {}, + "funcname": "Clear", + "location": "imgui_internal:1330", + "ov_cimguiname": "ImGuiKeyRoutingTable_Clear", + "ret": "void", + "signature": "()", + "stname": "ImGuiKeyRoutingTable" + } + ], + "ImGuiKeyRoutingTable_ImGuiKeyRoutingTable": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiKeyRoutingTable_ImGuiKeyRoutingTable", + "constructor": true, + "defaults": {}, + "funcname": "ImGuiKeyRoutingTable", + "location": "imgui_internal:1329", + "ov_cimguiname": "ImGuiKeyRoutingTable_ImGuiKeyRoutingTable", + "signature": "()", + "stname": "ImGuiKeyRoutingTable" + } + ], + "ImGuiKeyRoutingTable_destroy": [ + { + "args": "(ImGuiKeyRoutingTable* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiKeyRoutingTable*" + } + ], + "call_args": "(self)", + "cimguiname": "ImGuiKeyRoutingTable_destroy", + "defaults": {}, + "destructor": true, + "ov_cimguiname": "ImGuiKeyRoutingTable_destroy", + "ret": "void", + "signature": "(ImGuiKeyRoutingTable*)", + "stname": "ImGuiKeyRoutingTable" + } + ], "ImGuiLastItemData_ImGuiLastItemData": [ { "args": "()", @@ -5896,7 +6397,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiLastItemData", - "location": "imgui_internal:1131", + "location": "imgui_internal:1180", "ov_cimguiname": "ImGuiLastItemData_ImGuiLastItemData", "signature": "()", "stname": "ImGuiLastItemData" @@ -5931,7 +6432,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiListClipperData", - "location": "imgui_internal:1199", + "location": "imgui_internal:1418", "ov_cimguiname": "ImGuiListClipperData_ImGuiListClipperData", "signature": "()", "stname": "ImGuiListClipperData" @@ -5955,7 +6456,7 @@ "cimguiname": "ImGuiListClipperData_Reset", "defaults": {}, "funcname": "Reset", - "location": "imgui_internal:1200", + "location": "imgui_internal:1419", "ov_cimguiname": "ImGuiListClipperData_Reset", "ret": "void", "signature": "(ImGuiListClipper*)", @@ -6000,7 +6501,7 @@ "defaults": {}, "funcname": "FromIndices", "is_static_function": true, - "location": "imgui_internal:1186", + "location": "imgui_internal:1405", "ov_cimguiname": "ImGuiListClipperRange_FromIndices", "ret": "ImGuiListClipperRange", "signature": "(int,int)", @@ -6034,7 +6535,7 @@ "defaults": {}, "funcname": "FromPositions", "is_static_function": true, - "location": "imgui_internal:1187", + "location": "imgui_internal:1406", "ov_cimguiname": "ImGuiListClipperRange_FromPositions", "ret": "ImGuiListClipperRange", "signature": "(float,float,int,int)", @@ -6065,7 +6566,7 @@ "items_height": "-1.0f" }, "funcname": "Begin", - "location": "imgui:2206", + "location": "imgui:2339", "ov_cimguiname": "ImGuiListClipper_Begin", "ret": "void", "signature": "(int,float)", @@ -6086,7 +6587,7 @@ "cimguiname": "ImGuiListClipper_End", "defaults": {}, "funcname": "End", - "location": "imgui:2207", + "location": "imgui:2340", "ov_cimguiname": "ImGuiListClipper_End", "ret": "void", "signature": "()", @@ -6115,7 +6616,7 @@ "cimguiname": "ImGuiListClipper_ForceDisplayRangeByIndices", "defaults": {}, "funcname": "ForceDisplayRangeByIndices", - "location": "imgui:2211", + "location": "imgui:2344", "ov_cimguiname": "ImGuiListClipper_ForceDisplayRangeByIndices", "ret": "void", "signature": "(int,int)", @@ -6132,7 +6633,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiListClipper", - "location": "imgui:2204", + "location": "imgui:2337", "ov_cimguiname": "ImGuiListClipper_ImGuiListClipper", "signature": "()", "stname": "ImGuiListClipper" @@ -6152,7 +6653,7 @@ "cimguiname": "ImGuiListClipper_Step", "defaults": {}, "funcname": "Step", - "location": "imgui:2208", + "location": "imgui:2341", "ov_cimguiname": "ImGuiListClipper_Step", "ret": "bool", "signature": "()", @@ -6172,7 +6673,7 @@ "cimguiname": "ImGuiListClipper_destroy", "defaults": {}, "destructor": true, - "location": "imgui:2205", + "location": "imgui:2338", "ov_cimguiname": "ImGuiListClipper_destroy", "realdestructor": true, "ret": "void", @@ -6198,7 +6699,7 @@ "cimguiname": "ImGuiMenuColumns_CalcNextTotalWidth", "defaults": {}, "funcname": "CalcNextTotalWidth", - "location": "imgui_internal:1012", + "location": "imgui_internal:1050", "ov_cimguiname": "ImGuiMenuColumns_CalcNextTotalWidth", "ret": "void", "signature": "(bool)", @@ -6235,7 +6736,7 @@ "cimguiname": "ImGuiMenuColumns_DeclColumns", "defaults": {}, "funcname": "DeclColumns", - "location": "imgui_internal:1011", + "location": "imgui_internal:1049", "ov_cimguiname": "ImGuiMenuColumns_DeclColumns", "ret": "float", "signature": "(float,float,float,float)", @@ -6252,7 +6753,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiMenuColumns", - "location": "imgui_internal:1009", + "location": "imgui_internal:1047", "ov_cimguiname": "ImGuiMenuColumns_ImGuiMenuColumns", "signature": "()", "stname": "ImGuiMenuColumns" @@ -6280,7 +6781,7 @@ "cimguiname": "ImGuiMenuColumns_Update", "defaults": {}, "funcname": "Update", - "location": "imgui_internal:1010", + "location": "imgui_internal:1048", "ov_cimguiname": "ImGuiMenuColumns_Update", "ret": "void", "signature": "(float,bool)", @@ -6306,41 +6807,6 @@ "stname": "ImGuiMenuColumns" } ], - "ImGuiMetricsConfig_ImGuiMetricsConfig": [ - { - "args": "()", - "argsT": [], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "ImGuiMetricsConfig_ImGuiMetricsConfig", - "constructor": true, - "defaults": {}, - "funcname": "ImGuiMetricsConfig", - "location": "imgui_internal:1441", - "ov_cimguiname": "ImGuiMetricsConfig_ImGuiMetricsConfig", - "signature": "()", - "stname": "ImGuiMetricsConfig" - } - ], - "ImGuiMetricsConfig_destroy": [ - { - "args": "(ImGuiMetricsConfig* self)", - "argsT": [ - { - "name": "self", - "type": "ImGuiMetricsConfig*" - } - ], - "call_args": "(self)", - "cimguiname": "ImGuiMetricsConfig_destroy", - "defaults": {}, - "destructor": true, - "ov_cimguiname": "ImGuiMetricsConfig_destroy", - "ret": "void", - "signature": "(ImGuiMetricsConfig*)", - "stname": "ImGuiMetricsConfig" - } - ], "ImGuiNavItemData_Clear": [ { "args": "(ImGuiNavItemData* self)", @@ -6355,7 +6821,7 @@ "cimguiname": "ImGuiNavItemData_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui_internal:1285", + "location": "imgui_internal:1495", "ov_cimguiname": "ImGuiNavItemData_Clear", "ret": "void", "signature": "()", @@ -6372,7 +6838,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiNavItemData", - "location": "imgui_internal:1284", + "location": "imgui_internal:1494", "ov_cimguiname": "ImGuiNavItemData_ImGuiNavItemData", "signature": "()", "stname": "ImGuiNavItemData" @@ -6411,7 +6877,7 @@ "cimguiname": "ImGuiNextItemData_ClearFlags", "defaults": {}, "funcname": "ClearFlags", - "location": "imgui_internal:1118", + "location": "imgui_internal:1167", "ov_cimguiname": "ImGuiNextItemData_ClearFlags", "ret": "void", "signature": "()", @@ -6428,7 +6894,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiNextItemData", - "location": "imgui_internal:1117", + "location": "imgui_internal:1166", "ov_cimguiname": "ImGuiNextItemData_ImGuiNextItemData", "signature": "()", "stname": "ImGuiNextItemData" @@ -6467,7 +6933,7 @@ "cimguiname": "ImGuiNextWindowData_ClearFlags", "defaults": {}, "funcname": "ClearFlags", - "location": "imgui_internal:1099", + "location": "imgui_internal:1148", "ov_cimguiname": "ImGuiNextWindowData_ClearFlags", "ret": "void", "signature": "()", @@ -6484,7 +6950,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiNextWindowData", - "location": "imgui_internal:1098", + "location": "imgui_internal:1147", "ov_cimguiname": "ImGuiNextWindowData_ImGuiNextWindowData", "signature": "()", "stname": "ImGuiNextWindowData" @@ -6519,7 +6985,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiOldColumnData", - "location": "imgui_internal:1320", + "location": "imgui_internal:1530", "ov_cimguiname": "ImGuiOldColumnData_ImGuiOldColumnData", "signature": "()", "stname": "ImGuiOldColumnData" @@ -6554,7 +7020,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiOldColumns", - "location": "imgui_internal:1341", + "location": "imgui_internal:1551", "ov_cimguiname": "ImGuiOldColumns_ImGuiOldColumns", "signature": "()", "stname": "ImGuiOldColumns" @@ -6589,7 +7055,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiOnceUponAFrame", - "location": "imgui:2070", + "location": "imgui:2202", "ov_cimguiname": "ImGuiOnceUponAFrame_ImGuiOnceUponAFrame", "signature": "()", "stname": "ImGuiOnceUponAFrame" @@ -6628,7 +7094,7 @@ "cimguiname": "ImGuiPayload_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui:2024", + "location": "imgui:2156", "ov_cimguiname": "ImGuiPayload_Clear", "ret": "void", "signature": "()", @@ -6645,7 +7111,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiPayload", - "location": "imgui:2023", + "location": "imgui:2155", "ov_cimguiname": "ImGuiPayload_ImGuiPayload", "signature": "()", "stname": "ImGuiPayload" @@ -6669,7 +7135,7 @@ "cimguiname": "ImGuiPayload_IsDataType", "defaults": {}, "funcname": "IsDataType", - "location": "imgui:2025", + "location": "imgui:2157", "ov_cimguiname": "ImGuiPayload_IsDataType", "ret": "bool", "signature": "(const char*)const", @@ -6690,7 +7156,7 @@ "cimguiname": "ImGuiPayload_IsDelivery", "defaults": {}, "funcname": "IsDelivery", - "location": "imgui:2027", + "location": "imgui:2159", "ov_cimguiname": "ImGuiPayload_IsDelivery", "ret": "bool", "signature": "()const", @@ -6711,7 +7177,7 @@ "cimguiname": "ImGuiPayload_IsPreview", "defaults": {}, "funcname": "IsPreview", - "location": "imgui:2026", + "location": "imgui:2158", "ov_cimguiname": "ImGuiPayload_IsPreview", "ret": "bool", "signature": "()const", @@ -6737,6 +7203,41 @@ "stname": "ImGuiPayload" } ], + "ImGuiPlatformImeData_ImGuiPlatformImeData": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiPlatformImeData_ImGuiPlatformImeData", + "constructor": true, + "defaults": {}, + "funcname": "ImGuiPlatformImeData", + "location": "imgui:3005", + "ov_cimguiname": "ImGuiPlatformImeData_ImGuiPlatformImeData", + "signature": "()", + "stname": "ImGuiPlatformImeData" + } + ], + "ImGuiPlatformImeData_destroy": [ + { + "args": "(ImGuiPlatformImeData* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiPlatformImeData*" + } + ], + "call_args": "(self)", + "cimguiname": "ImGuiPlatformImeData_destroy", + "defaults": {}, + "destructor": true, + "ov_cimguiname": "ImGuiPlatformImeData_destroy", + "ret": "void", + "signature": "(ImGuiPlatformImeData*)", + "stname": "ImGuiPlatformImeData" + } + ], "ImGuiPopupData_ImGuiPopupData": [ { "args": "()", @@ -6747,7 +7248,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiPopupData", - "location": "imgui_internal:1063", + "location": "imgui_internal:1112", "ov_cimguiname": "ImGuiPopupData_ImGuiPopupData", "signature": "()", "stname": "ImGuiPopupData" @@ -6787,7 +7288,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiPtrOrIndex", - "location": "imgui_internal:1170", + "location": "imgui_internal:1220", "ov_cimguiname": "ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr", "signature": "(void*)", "stname": "ImGuiPtrOrIndex" @@ -6806,7 +7307,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiPtrOrIndex", - "location": "imgui_internal:1171", + "location": "imgui_internal:1221", "ov_cimguiname": "ImGuiPtrOrIndex_ImGuiPtrOrIndex_Int", "signature": "(int)", "stname": "ImGuiPtrOrIndex" @@ -6841,7 +7342,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiSettingsHandler", - "location": "imgui_internal:1423", + "location": "imgui_internal:1634", "ov_cimguiname": "ImGuiSettingsHandler_ImGuiSettingsHandler", "signature": "()", "stname": "ImGuiSettingsHandler" @@ -6876,7 +7377,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiStackLevelInfo", - "location": "imgui_internal:1461", + "location": "imgui_internal:1702", "ov_cimguiname": "ImGuiStackLevelInfo_ImGuiStackLevelInfo", "signature": "()", "stname": "ImGuiStackLevelInfo" @@ -6901,24 +7402,28 @@ "stname": "ImGuiStackLevelInfo" } ], - "ImGuiStackSizes_CompareWithCurrentState": [ + "ImGuiStackSizes_CompareWithContextState": [ { - "args": "(ImGuiStackSizes* self)", + "args": "(ImGuiStackSizes* self,ImGuiContext* ctx)", "argsT": [ { "name": "self", "type": "ImGuiStackSizes*" + }, + { + "name": "ctx", + "type": "ImGuiContext*" } ], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "ImGuiStackSizes_CompareWithCurrentState", + "argsoriginal": "(ImGuiContext* ctx)", + "call_args": "(ctx)", + "cimguiname": "ImGuiStackSizes_CompareWithContextState", "defaults": {}, - "funcname": "CompareWithCurrentState", - "location": "imgui_internal:1148", - "ov_cimguiname": "ImGuiStackSizes_CompareWithCurrentState", + "funcname": "CompareWithContextState", + "location": "imgui_internal:1197", + "ov_cimguiname": "ImGuiStackSizes_CompareWithContextState", "ret": "void", - "signature": "()", + "signature": "(ImGuiContext*)", "stname": "ImGuiStackSizes" } ], @@ -6932,30 +7437,34 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiStackSizes", - "location": "imgui_internal:1146", + "location": "imgui_internal:1195", "ov_cimguiname": "ImGuiStackSizes_ImGuiStackSizes", "signature": "()", "stname": "ImGuiStackSizes" } ], - "ImGuiStackSizes_SetToCurrentState": [ + "ImGuiStackSizes_SetToContextState": [ { - "args": "(ImGuiStackSizes* self)", + "args": "(ImGuiStackSizes* self,ImGuiContext* ctx)", "argsT": [ { "name": "self", "type": "ImGuiStackSizes*" + }, + { + "name": "ctx", + "type": "ImGuiContext*" } ], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "ImGuiStackSizes_SetToCurrentState", + "argsoriginal": "(ImGuiContext* ctx)", + "call_args": "(ctx)", + "cimguiname": "ImGuiStackSizes_SetToContextState", "defaults": {}, - "funcname": "SetToCurrentState", - "location": "imgui_internal:1147", - "ov_cimguiname": "ImGuiStackSizes_SetToCurrentState", + "funcname": "SetToContextState", + "location": "imgui_internal:1196", + "ov_cimguiname": "ImGuiStackSizes_SetToContextState", "ret": "void", - "signature": "()", + "signature": "(ImGuiContext*)", "stname": "ImGuiStackSizes" } ], @@ -6988,7 +7497,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiStackTool", - "location": "imgui_internal:1472", + "location": "imgui_internal:1715", "ov_cimguiname": "ImGuiStackTool_ImGuiStackTool", "signature": "()", "stname": "ImGuiStackTool" @@ -7032,7 +7541,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiStoragePair", - "location": "imgui:2137", + "location": "imgui:2269", "ov_cimguiname": "ImGuiStoragePair_ImGuiStoragePair_Int", "signature": "(ImGuiID,int)", "stname": "ImGuiStoragePair" @@ -7055,7 +7564,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiStoragePair", - "location": "imgui:2138", + "location": "imgui:2270", "ov_cimguiname": "ImGuiStoragePair_ImGuiStoragePair_Float", "signature": "(ImGuiID,float)", "stname": "ImGuiStoragePair" @@ -7078,7 +7587,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiStoragePair", - "location": "imgui:2139", + "location": "imgui:2271", "ov_cimguiname": "ImGuiStoragePair_ImGuiStoragePair_Ptr", "signature": "(ImGuiID,void*)", "stname": "ImGuiStoragePair" @@ -7117,7 +7626,7 @@ "cimguiname": "ImGuiStorage_BuildSortByKey", "defaults": {}, "funcname": "BuildSortByKey", - "location": "imgui:2170", + "location": "imgui:2302", "ov_cimguiname": "ImGuiStorage_BuildSortByKey", "ret": "void", "signature": "()", @@ -7138,7 +7647,7 @@ "cimguiname": "ImGuiStorage_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui:2147", + "location": "imgui:2279", "ov_cimguiname": "ImGuiStorage_Clear", "ret": "void", "signature": "()", @@ -7169,7 +7678,7 @@ "default_val": "false" }, "funcname": "GetBool", - "location": "imgui:2150", + "location": "imgui:2282", "ov_cimguiname": "ImGuiStorage_GetBool", "ret": "bool", "signature": "(ImGuiID,bool)const", @@ -7200,7 +7709,7 @@ "default_val": "false" }, "funcname": "GetBoolRef", - "location": "imgui:2162", + "location": "imgui:2294", "ov_cimguiname": "ImGuiStorage_GetBoolRef", "ret": "bool*", "signature": "(ImGuiID,bool)", @@ -7231,7 +7740,7 @@ "default_val": "0.0f" }, "funcname": "GetFloat", - "location": "imgui:2152", + "location": "imgui:2284", "ov_cimguiname": "ImGuiStorage_GetFloat", "ret": "float", "signature": "(ImGuiID,float)const", @@ -7262,7 +7771,7 @@ "default_val": "0.0f" }, "funcname": "GetFloatRef", - "location": "imgui:2163", + "location": "imgui:2295", "ov_cimguiname": "ImGuiStorage_GetFloatRef", "ret": "float*", "signature": "(ImGuiID,float)", @@ -7293,7 +7802,7 @@ "default_val": "0" }, "funcname": "GetInt", - "location": "imgui:2148", + "location": "imgui:2280", "ov_cimguiname": "ImGuiStorage_GetInt", "ret": "int", "signature": "(ImGuiID,int)const", @@ -7324,7 +7833,7 @@ "default_val": "0" }, "funcname": "GetIntRef", - "location": "imgui:2161", + "location": "imgui:2293", "ov_cimguiname": "ImGuiStorage_GetIntRef", "ret": "int*", "signature": "(ImGuiID,int)", @@ -7349,7 +7858,7 @@ "cimguiname": "ImGuiStorage_GetVoidPtr", "defaults": {}, "funcname": "GetVoidPtr", - "location": "imgui:2154", + "location": "imgui:2286", "ov_cimguiname": "ImGuiStorage_GetVoidPtr", "ret": "void*", "signature": "(ImGuiID)const", @@ -7380,7 +7889,7 @@ "default_val": "NULL" }, "funcname": "GetVoidPtrRef", - "location": "imgui:2164", + "location": "imgui:2296", "ov_cimguiname": "ImGuiStorage_GetVoidPtrRef", "ret": "void**", "signature": "(ImGuiID,void*)", @@ -7405,7 +7914,7 @@ "cimguiname": "ImGuiStorage_SetAllInt", "defaults": {}, "funcname": "SetAllInt", - "location": "imgui:2167", + "location": "imgui:2299", "ov_cimguiname": "ImGuiStorage_SetAllInt", "ret": "void", "signature": "(int)", @@ -7434,7 +7943,7 @@ "cimguiname": "ImGuiStorage_SetBool", "defaults": {}, "funcname": "SetBool", - "location": "imgui:2151", + "location": "imgui:2283", "ov_cimguiname": "ImGuiStorage_SetBool", "ret": "void", "signature": "(ImGuiID,bool)", @@ -7463,7 +7972,7 @@ "cimguiname": "ImGuiStorage_SetFloat", "defaults": {}, "funcname": "SetFloat", - "location": "imgui:2153", + "location": "imgui:2285", "ov_cimguiname": "ImGuiStorage_SetFloat", "ret": "void", "signature": "(ImGuiID,float)", @@ -7492,7 +8001,7 @@ "cimguiname": "ImGuiStorage_SetInt", "defaults": {}, "funcname": "SetInt", - "location": "imgui:2149", + "location": "imgui:2281", "ov_cimguiname": "ImGuiStorage_SetInt", "ret": "void", "signature": "(ImGuiID,int)", @@ -7521,7 +8030,7 @@ "cimguiname": "ImGuiStorage_SetVoidPtr", "defaults": {}, "funcname": "SetVoidPtr", - "location": "imgui:2155", + "location": "imgui:2287", "ov_cimguiname": "ImGuiStorage_SetVoidPtr", "ret": "void", "signature": "(ImGuiID,void*)", @@ -7547,7 +8056,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiStyleMod", - "location": "imgui_internal:963", + "location": "imgui_internal:1001", "ov_cimguiname": "ImGuiStyleMod_ImGuiStyleMod_Int", "signature": "(ImGuiStyleVar,int)", "stname": "ImGuiStyleMod" @@ -7570,7 +8079,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiStyleMod", - "location": "imgui_internal:964", + "location": "imgui_internal:1002", "ov_cimguiname": "ImGuiStyleMod_ImGuiStyleMod_Float", "signature": "(ImGuiStyleVar,float)", "stname": "ImGuiStyleMod" @@ -7593,7 +8102,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiStyleMod", - "location": "imgui_internal:965", + "location": "imgui_internal:1003", "ov_cimguiname": "ImGuiStyleMod_ImGuiStyleMod_Vec2", "signature": "(ImGuiStyleVar,ImVec2)", "stname": "ImGuiStyleMod" @@ -7628,7 +8137,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiStyle", - "location": "imgui:1809", + "location": "imgui:1893", "ov_cimguiname": "ImGuiStyle_ImGuiStyle", "signature": "()", "stname": "ImGuiStyle" @@ -7652,7 +8161,7 @@ "cimguiname": "ImGuiStyle_ScaleAllSizes", "defaults": {}, "funcname": "ScaleAllSizes", - "location": "imgui:1810", + "location": "imgui:1894", "ov_cimguiname": "ImGuiStyle_ScaleAllSizes", "ret": "void", "signature": "(float)", @@ -7678,56 +8187,6 @@ "stname": "ImGuiStyle" } ], - "ImGuiTabBar_GetTabName": [ - { - "args": "(ImGuiTabBar* self,const ImGuiTabItem* tab)", - "argsT": [ - { - "name": "self", - "type": "ImGuiTabBar*" - }, - { - "name": "tab", - "type": "const ImGuiTabItem*" - } - ], - "argsoriginal": "(const ImGuiTabItem* tab)", - "call_args": "(tab)", - "cimguiname": "ImGuiTabBar_GetTabName", - "defaults": {}, - "funcname": "GetTabName", - "location": "imgui_internal:2145", - "ov_cimguiname": "ImGuiTabBar_GetTabName", - "ret": "const char*", - "signature": "(const ImGuiTabItem*)const", - "stname": "ImGuiTabBar" - } - ], - "ImGuiTabBar_GetTabOrder": [ - { - "args": "(ImGuiTabBar* self,const ImGuiTabItem* tab)", - "argsT": [ - { - "name": "self", - "type": "ImGuiTabBar*" - }, - { - "name": "tab", - "type": "const ImGuiTabItem*" - } - ], - "argsoriginal": "(const ImGuiTabItem* tab)", - "call_args": "(tab)", - "cimguiname": "ImGuiTabBar_GetTabOrder", - "defaults": {}, - "funcname": "GetTabOrder", - "location": "imgui_internal:2144", - "ov_cimguiname": "ImGuiTabBar_GetTabOrder", - "ret": "int", - "signature": "(const ImGuiTabItem*)const", - "stname": "ImGuiTabBar" - } - ], "ImGuiTabBar_ImGuiTabBar": [ { "args": "()", @@ -7738,7 +8197,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTabBar", - "location": "imgui_internal:2143", + "location": "imgui_internal:2454", "ov_cimguiname": "ImGuiTabBar_ImGuiTabBar", "signature": "()", "stname": "ImGuiTabBar" @@ -7773,7 +8232,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTabItem", - "location": "imgui_internal:2105", + "location": "imgui_internal:2416", "ov_cimguiname": "ImGuiTabItem_ImGuiTabItem", "signature": "()", "stname": "ImGuiTabItem" @@ -7808,7 +8267,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTableColumnSettings", - "location": "imgui_internal:2379", + "location": "imgui_internal:2696", "ov_cimguiname": "ImGuiTableColumnSettings_ImGuiTableColumnSettings", "signature": "()", "stname": "ImGuiTableColumnSettings" @@ -7843,7 +8302,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTableColumnSortSpecs", - "location": "imgui:2038", + "location": "imgui:2170", "ov_cimguiname": "ImGuiTableColumnSortSpecs_ImGuiTableColumnSortSpecs", "signature": "()", "stname": "ImGuiTableColumnSortSpecs" @@ -7878,7 +8337,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTableColumn", - "location": "imgui_internal:2212", + "location": "imgui_internal:2516", "ov_cimguiname": "ImGuiTableColumn_ImGuiTableColumn", "signature": "()", "stname": "ImGuiTableColumn" @@ -7903,6 +8362,41 @@ "stname": "ImGuiTableColumn" } ], + "ImGuiTableInstanceData_ImGuiTableInstanceData": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiTableInstanceData_ImGuiTableInstanceData", + "constructor": true, + "defaults": {}, + "funcname": "ImGuiTableInstanceData", + "location": "imgui_internal:2545", + "ov_cimguiname": "ImGuiTableInstanceData_ImGuiTableInstanceData", + "signature": "()", + "stname": "ImGuiTableInstanceData" + } + ], + "ImGuiTableInstanceData_destroy": [ + { + "args": "(ImGuiTableInstanceData* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiTableInstanceData*" + } + ], + "call_args": "(self)", + "cimguiname": "ImGuiTableInstanceData_destroy", + "defaults": {}, + "destructor": true, + "ov_cimguiname": "ImGuiTableInstanceData_destroy", + "ret": "void", + "signature": "(ImGuiTableInstanceData*)", + "stname": "ImGuiTableInstanceData" + } + ], "ImGuiTableSettings_GetColumnSettings": [ { "args": "(ImGuiTableSettings* self)", @@ -7917,7 +8411,7 @@ "cimguiname": "ImGuiTableSettings_GetColumnSettings", "defaults": {}, "funcname": "GetColumnSettings", - "location": "imgui_internal:2402", + "location": "imgui_internal:2719", "ov_cimguiname": "ImGuiTableSettings_GetColumnSettings", "ret": "ImGuiTableColumnSettings*", "signature": "()", @@ -7934,7 +8428,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTableSettings", - "location": "imgui_internal:2401", + "location": "imgui_internal:2718", "ov_cimguiname": "ImGuiTableSettings_ImGuiTableSettings", "signature": "()", "stname": "ImGuiTableSettings" @@ -7969,7 +8463,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTableSortSpecs", - "location": "imgui:2051", + "location": "imgui:2183", "ov_cimguiname": "ImGuiTableSortSpecs_ImGuiTableSortSpecs", "signature": "()", "stname": "ImGuiTableSortSpecs" @@ -8004,7 +8498,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTableTempData", - "location": "imgui_internal:2364", + "location": "imgui_internal:2681", "ov_cimguiname": "ImGuiTableTempData_ImGuiTableTempData", "signature": "()", "stname": "ImGuiTableTempData" @@ -8039,7 +8533,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTable", - "location": "imgui_internal:2340", + "location": "imgui_internal:2657", "ov_cimguiname": "ImGuiTable_ImGuiTable", "signature": "()", "stname": "ImGuiTable" @@ -8058,7 +8552,7 @@ "cimguiname": "ImGuiTable_destroy", "defaults": {}, "destructor": true, - "location": "imgui_internal:2341", + "location": "imgui_internal:2658", "ov_cimguiname": "ImGuiTable_destroy", "realdestructor": true, "ret": "void", @@ -8076,7 +8570,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTextBuffer", - "location": "imgui:2108", + "location": "imgui:2240", "ov_cimguiname": "ImGuiTextBuffer_ImGuiTextBuffer", "signature": "()", "stname": "ImGuiTextBuffer" @@ -8106,7 +8600,7 @@ "str_end": "NULL" }, "funcname": "append", - "location": "imgui:2117", + "location": "imgui:2249", "ov_cimguiname": "ImGuiTextBuffer_append", "ret": "void", "signature": "(const char*,const char*)", @@ -8136,7 +8630,7 @@ "defaults": {}, "funcname": "appendf", "isvararg": "...)", - "location": "imgui:2118", + "location": "imgui:2250", "manual": true, "ov_cimguiname": "ImGuiTextBuffer_appendf", "ret": "void", @@ -8166,7 +8660,7 @@ "cimguiname": "ImGuiTextBuffer_appendfv", "defaults": {}, "funcname": "appendfv", - "location": "imgui:2119", + "location": "imgui:2251", "ov_cimguiname": "ImGuiTextBuffer_appendfv", "ret": "void", "signature": "(const char*,va_list)", @@ -8187,7 +8681,7 @@ "cimguiname": "ImGuiTextBuffer_begin", "defaults": {}, "funcname": "begin", - "location": "imgui:2110", + "location": "imgui:2242", "ov_cimguiname": "ImGuiTextBuffer_begin", "ret": "const char*", "signature": "()const", @@ -8208,7 +8702,7 @@ "cimguiname": "ImGuiTextBuffer_c_str", "defaults": {}, "funcname": "c_str", - "location": "imgui:2116", + "location": "imgui:2248", "ov_cimguiname": "ImGuiTextBuffer_c_str", "ret": "const char*", "signature": "()const", @@ -8229,7 +8723,7 @@ "cimguiname": "ImGuiTextBuffer_clear", "defaults": {}, "funcname": "clear", - "location": "imgui:2114", + "location": "imgui:2246", "ov_cimguiname": "ImGuiTextBuffer_clear", "ret": "void", "signature": "()", @@ -8269,7 +8763,7 @@ "cimguiname": "ImGuiTextBuffer_empty", "defaults": {}, "funcname": "empty", - "location": "imgui:2113", + "location": "imgui:2245", "ov_cimguiname": "ImGuiTextBuffer_empty", "ret": "bool", "signature": "()const", @@ -8290,7 +8784,7 @@ "cimguiname": "ImGuiTextBuffer_end", "defaults": {}, "funcname": "end", - "location": "imgui:2111", + "location": "imgui:2243", "ov_cimguiname": "ImGuiTextBuffer_end", "ret": "const char*", "signature": "()const", @@ -8315,7 +8809,7 @@ "cimguiname": "ImGuiTextBuffer_reserve", "defaults": {}, "funcname": "reserve", - "location": "imgui:2115", + "location": "imgui:2247", "ov_cimguiname": "ImGuiTextBuffer_reserve", "ret": "void", "signature": "(int)", @@ -8336,7 +8830,7 @@ "cimguiname": "ImGuiTextBuffer_size", "defaults": {}, "funcname": "size", - "location": "imgui:2112", + "location": "imgui:2244", "ov_cimguiname": "ImGuiTextBuffer_size", "ret": "int", "signature": "()const", @@ -8357,7 +8851,7 @@ "cimguiname": "ImGuiTextFilter_Build", "defaults": {}, "funcname": "Build", - "location": "imgui:2081", + "location": "imgui:2213", "ov_cimguiname": "ImGuiTextFilter_Build", "ret": "void", "signature": "()", @@ -8378,7 +8872,7 @@ "cimguiname": "ImGuiTextFilter_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui:2082", + "location": "imgui:2214", "ov_cimguiname": "ImGuiTextFilter_Clear", "ret": "void", "signature": "()", @@ -8410,7 +8904,7 @@ "width": "0.0f" }, "funcname": "Draw", - "location": "imgui:2079", + "location": "imgui:2211", "ov_cimguiname": "ImGuiTextFilter_Draw", "ret": "bool", "signature": "(const char*,float)", @@ -8434,7 +8928,7 @@ "default_filter": "\"\"" }, "funcname": "ImGuiTextFilter", - "location": "imgui:2078", + "location": "imgui:2210", "ov_cimguiname": "ImGuiTextFilter_ImGuiTextFilter", "signature": "(const char*)", "stname": "ImGuiTextFilter" @@ -8454,7 +8948,7 @@ "cimguiname": "ImGuiTextFilter_IsActive", "defaults": {}, "funcname": "IsActive", - "location": "imgui:2083", + "location": "imgui:2215", "ov_cimguiname": "ImGuiTextFilter_IsActive", "ret": "bool", "signature": "()const", @@ -8485,7 +8979,7 @@ "text_end": "NULL" }, "funcname": "PassFilter", - "location": "imgui:2080", + "location": "imgui:2212", "ov_cimguiname": "ImGuiTextFilter_PassFilter", "ret": "bool", "signature": "(const char*,const char*)const", @@ -8511,6 +9005,139 @@ "stname": "ImGuiTextFilter" } ], + "ImGuiTextIndex_append": [ + { + "args": "(ImGuiTextIndex* self,const char* base,int old_size,int new_size)", + "argsT": [ + { + "name": "self", + "type": "ImGuiTextIndex*" + }, + { + "name": "base", + "type": "const char*" + }, + { + "name": "old_size", + "type": "int" + }, + { + "name": "new_size", + "type": "int" + } + ], + "argsoriginal": "(const char* base,int old_size,int new_size)", + "call_args": "(base,old_size,new_size)", + "cimguiname": "ImGuiTextIndex_append", + "defaults": {}, + "funcname": "append", + "location": "imgui_internal:714", + "ov_cimguiname": "ImGuiTextIndex_append", + "ret": "void", + "signature": "(const char*,int,int)", + "stname": "ImGuiTextIndex" + } + ], + "ImGuiTextIndex_clear": [ + { + "args": "(ImGuiTextIndex* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiTextIndex*" + } + ], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiTextIndex_clear", + "defaults": {}, + "funcname": "clear", + "location": "imgui_internal:710", + "ov_cimguiname": "ImGuiTextIndex_clear", + "ret": "void", + "signature": "()", + "stname": "ImGuiTextIndex" + } + ], + "ImGuiTextIndex_get_line_begin": [ + { + "args": "(ImGuiTextIndex* self,const char* base,int n)", + "argsT": [ + { + "name": "self", + "type": "ImGuiTextIndex*" + }, + { + "name": "base", + "type": "const char*" + }, + { + "name": "n", + "type": "int" + } + ], + "argsoriginal": "(const char* base,int n)", + "call_args": "(base,n)", + "cimguiname": "ImGuiTextIndex_get_line_begin", + "defaults": {}, + "funcname": "get_line_begin", + "location": "imgui_internal:712", + "ov_cimguiname": "ImGuiTextIndex_get_line_begin", + "ret": "const char*", + "signature": "(const char*,int)", + "stname": "ImGuiTextIndex" + } + ], + "ImGuiTextIndex_get_line_end": [ + { + "args": "(ImGuiTextIndex* self,const char* base,int n)", + "argsT": [ + { + "name": "self", + "type": "ImGuiTextIndex*" + }, + { + "name": "base", + "type": "const char*" + }, + { + "name": "n", + "type": "int" + } + ], + "argsoriginal": "(const char* base,int n)", + "call_args": "(base,n)", + "cimguiname": "ImGuiTextIndex_get_line_end", + "defaults": {}, + "funcname": "get_line_end", + "location": "imgui_internal:713", + "ov_cimguiname": "ImGuiTextIndex_get_line_end", + "ret": "const char*", + "signature": "(const char*,int)", + "stname": "ImGuiTextIndex" + } + ], + "ImGuiTextIndex_size": [ + { + "args": "(ImGuiTextIndex* self)", + "argsT": [ + { + "name": "self", + "type": "ImGuiTextIndex*" + } + ], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "ImGuiTextIndex_size", + "defaults": {}, + "funcname": "size", + "location": "imgui_internal:711", + "ov_cimguiname": "ImGuiTextIndex_size", + "ret": "int", + "signature": "()", + "stname": "ImGuiTextIndex" + } + ], "ImGuiTextRange_ImGuiTextRange": [ { "args": "()", @@ -8521,7 +9148,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTextRange", - "location": "imgui:2091", + "location": "imgui:2223", "ov_cimguiname": "ImGuiTextRange_ImGuiTextRange_Nil", "signature": "()", "stname": "ImGuiTextRange" @@ -8544,7 +9171,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiTextRange", - "location": "imgui:2092", + "location": "imgui:2224", "ov_cimguiname": "ImGuiTextRange_ImGuiTextRange_Str", "signature": "(const char*,const char*)", "stname": "ImGuiTextRange" @@ -8583,7 +9210,7 @@ "cimguiname": "ImGuiTextRange_empty", "defaults": {}, "funcname": "empty", - "location": "imgui:2093", + "location": "imgui:2225", "ov_cimguiname": "ImGuiTextRange_empty", "ret": "bool", "signature": "()const", @@ -8612,7 +9239,7 @@ "cimguiname": "ImGuiTextRange_split", "defaults": {}, "funcname": "split", - "location": "imgui:2094", + "location": "imgui:2226", "ov_cimguiname": "ImGuiTextRange_split", "ret": "void", "signature": "(char,ImVector_ImGuiTextRange*)const", @@ -8641,7 +9268,7 @@ "cimguiname": "ImGuiViewportP_CalcWorkRectPos", "defaults": {}, "funcname": "CalcWorkRectPos", - "location": "imgui_internal:1382", + "location": "imgui_internal:1592", "nonUDT": 1, "ov_cimguiname": "ImGuiViewportP_CalcWorkRectPos", "ret": "void", @@ -8675,7 +9302,7 @@ "cimguiname": "ImGuiViewportP_CalcWorkRectSize", "defaults": {}, "funcname": "CalcWorkRectSize", - "location": "imgui_internal:1383", + "location": "imgui_internal:1593", "nonUDT": 1, "ov_cimguiname": "ImGuiViewportP_CalcWorkRectSize", "ret": "void", @@ -8701,7 +9328,7 @@ "cimguiname": "ImGuiViewportP_GetBuildWorkRect", "defaults": {}, "funcname": "GetBuildWorkRect", - "location": "imgui_internal:1389", + "location": "imgui_internal:1599", "nonUDT": 1, "ov_cimguiname": "ImGuiViewportP_GetBuildWorkRect", "ret": "void", @@ -8727,7 +9354,7 @@ "cimguiname": "ImGuiViewportP_GetMainRect", "defaults": {}, "funcname": "GetMainRect", - "location": "imgui_internal:1387", + "location": "imgui_internal:1597", "nonUDT": 1, "ov_cimguiname": "ImGuiViewportP_GetMainRect", "ret": "void", @@ -8753,7 +9380,7 @@ "cimguiname": "ImGuiViewportP_GetWorkRect", "defaults": {}, "funcname": "GetWorkRect", - "location": "imgui_internal:1388", + "location": "imgui_internal:1598", "nonUDT": 1, "ov_cimguiname": "ImGuiViewportP_GetWorkRect", "ret": "void", @@ -8771,7 +9398,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiViewportP", - "location": "imgui_internal:1378", + "location": "imgui_internal:1588", "ov_cimguiname": "ImGuiViewportP_ImGuiViewportP", "signature": "()", "stname": "ImGuiViewportP" @@ -8791,7 +9418,7 @@ "cimguiname": "ImGuiViewportP_UpdateWorkRect", "defaults": {}, "funcname": "UpdateWorkRect", - "location": "imgui_internal:1384", + "location": "imgui_internal:1594", "ov_cimguiname": "ImGuiViewportP_UpdateWorkRect", "ret": "void", "signature": "()", @@ -8811,7 +9438,7 @@ "cimguiname": "ImGuiViewportP_destroy", "defaults": {}, "destructor": true, - "location": "imgui_internal:1379", + "location": "imgui_internal:1589", "ov_cimguiname": "ImGuiViewportP_destroy", "realdestructor": true, "ret": "void", @@ -8837,7 +9464,7 @@ "cimguiname": "ImGuiViewport_GetCenter", "defaults": {}, "funcname": "GetCenter", - "location": "imgui:2821", + "location": "imgui:2990", "nonUDT": 1, "ov_cimguiname": "ImGuiViewport_GetCenter", "ret": "void", @@ -8863,7 +9490,7 @@ "cimguiname": "ImGuiViewport_GetWorkCenter", "defaults": {}, "funcname": "GetWorkCenter", - "location": "imgui:2822", + "location": "imgui:2991", "nonUDT": 1, "ov_cimguiname": "ImGuiViewport_GetWorkCenter", "ret": "void", @@ -8881,7 +9508,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiViewport", - "location": "imgui:2818", + "location": "imgui:2987", "ov_cimguiname": "ImGuiViewport_ImGuiViewport", "signature": "()", "stname": "ImGuiViewport" @@ -8920,7 +9547,7 @@ "cimguiname": "ImGuiWindowSettings_GetName", "defaults": {}, "funcname": "GetName", - "location": "imgui_internal:1408", + "location": "imgui_internal:1619", "ov_cimguiname": "ImGuiWindowSettings_GetName", "ret": "char*", "signature": "()", @@ -8937,7 +9564,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiWindowSettings", - "location": "imgui_internal:1407", + "location": "imgui_internal:1618", "ov_cimguiname": "ImGuiWindowSettings_ImGuiWindowSettings", "signature": "()", "stname": "ImGuiWindowSettings" @@ -8976,7 +9603,7 @@ "cimguiname": "ImGuiWindow_CalcFontSize", "defaults": {}, "funcname": "CalcFontSize", - "location": "imgui_internal:2063", + "location": "imgui_internal:2373", "ov_cimguiname": "ImGuiWindow_CalcFontSize", "ret": "float", "signature": "()const", @@ -9007,7 +9634,7 @@ "str_end": "NULL" }, "funcname": "GetID", - "location": "imgui_internal:2053", + "location": "imgui_internal:2366", "ov_cimguiname": "ImGuiWindow_GetID_Str", "ret": "ImGuiID", "signature": "(const char*,const char*)", @@ -9030,7 +9657,7 @@ "cimguiname": "ImGuiWindow_GetID", "defaults": {}, "funcname": "GetID", - "location": "imgui_internal:2054", + "location": "imgui_internal:2367", "ov_cimguiname": "ImGuiWindow_GetID_Ptr", "ret": "ImGuiID", "signature": "(const void*)", @@ -9053,7 +9680,7 @@ "cimguiname": "ImGuiWindow_GetID", "defaults": {}, "funcname": "GetID", - "location": "imgui_internal:2055", + "location": "imgui_internal:2368", "ov_cimguiname": "ImGuiWindow_GetID_Int", "ret": "ImGuiID", "signature": "(int)", @@ -9078,90 +9705,13 @@ "cimguiname": "ImGuiWindow_GetIDFromRectangle", "defaults": {}, "funcname": "GetIDFromRectangle", - "location": "imgui_internal:2059", + "location": "imgui_internal:2369", "ov_cimguiname": "ImGuiWindow_GetIDFromRectangle", "ret": "ImGuiID", "signature": "(const ImRect)", "stname": "ImGuiWindow" } ], - "ImGuiWindow_GetIDNoKeepAlive": [ - { - "args": "(ImGuiWindow* self,const char* str,const char* str_end)", - "argsT": [ - { - "name": "self", - "type": "ImGuiWindow*" - }, - { - "name": "str", - "type": "const char*" - }, - { - "name": "str_end", - "type": "const char*" - } - ], - "argsoriginal": "(const char* str,const char* str_end=((void*)0))", - "call_args": "(str,str_end)", - "cimguiname": "ImGuiWindow_GetIDNoKeepAlive", - "defaults": { - "str_end": "NULL" - }, - "funcname": "GetIDNoKeepAlive", - "location": "imgui_internal:2056", - "ov_cimguiname": "ImGuiWindow_GetIDNoKeepAlive_Str", - "ret": "ImGuiID", - "signature": "(const char*,const char*)", - "stname": "ImGuiWindow" - }, - { - "args": "(ImGuiWindow* self,const void* ptr)", - "argsT": [ - { - "name": "self", - "type": "ImGuiWindow*" - }, - { - "name": "ptr", - "type": "const void*" - } - ], - "argsoriginal": "(const void* ptr)", - "call_args": "(ptr)", - "cimguiname": "ImGuiWindow_GetIDNoKeepAlive", - "defaults": {}, - "funcname": "GetIDNoKeepAlive", - "location": "imgui_internal:2057", - "ov_cimguiname": "ImGuiWindow_GetIDNoKeepAlive_Ptr", - "ret": "ImGuiID", - "signature": "(const void*)", - "stname": "ImGuiWindow" - }, - { - "args": "(ImGuiWindow* self,int n)", - "argsT": [ - { - "name": "self", - "type": "ImGuiWindow*" - }, - { - "name": "n", - "type": "int" - } - ], - "argsoriginal": "(int n)", - "call_args": "(n)", - "cimguiname": "ImGuiWindow_GetIDNoKeepAlive", - "defaults": {}, - "funcname": "GetIDNoKeepAlive", - "location": "imgui_internal:2058", - "ov_cimguiname": "ImGuiWindow_GetIDNoKeepAlive_Int", - "ret": "ImGuiID", - "signature": "(int)", - "stname": "ImGuiWindow" - } - ], "ImGuiWindow_ImGuiWindow": [ { "args": "(ImGuiContext* context,const char* name)", @@ -9181,7 +9731,7 @@ "constructor": true, "defaults": {}, "funcname": "ImGuiWindow", - "location": "imgui_internal:2049", + "location": "imgui_internal:2362", "ov_cimguiname": "ImGuiWindow_ImGuiWindow", "signature": "(ImGuiContext*,const char*)", "stname": "ImGuiWindow" @@ -9201,7 +9751,7 @@ "cimguiname": "ImGuiWindow_MenuBarHeight", "defaults": {}, "funcname": "MenuBarHeight", - "location": "imgui_internal:2066", + "location": "imgui_internal:2376", "ov_cimguiname": "ImGuiWindow_MenuBarHeight", "ret": "float", "signature": "()const", @@ -9226,7 +9776,7 @@ "cimguiname": "ImGuiWindow_MenuBarRect", "defaults": {}, "funcname": "MenuBarRect", - "location": "imgui_internal:2067", + "location": "imgui_internal:2377", "nonUDT": 1, "ov_cimguiname": "ImGuiWindow_MenuBarRect", "ret": "void", @@ -9252,7 +9802,7 @@ "cimguiname": "ImGuiWindow_Rect", "defaults": {}, "funcname": "Rect", - "location": "imgui_internal:2062", + "location": "imgui_internal:2372", "nonUDT": 1, "ov_cimguiname": "ImGuiWindow_Rect", "ret": "void", @@ -9274,7 +9824,7 @@ "cimguiname": "ImGuiWindow_TitleBarHeight", "defaults": {}, "funcname": "TitleBarHeight", - "location": "imgui_internal:2064", + "location": "imgui_internal:2374", "ov_cimguiname": "ImGuiWindow_TitleBarHeight", "ret": "float", "signature": "()const", @@ -9299,7 +9849,7 @@ "cimguiname": "ImGuiWindow_TitleBarRect", "defaults": {}, "funcname": "TitleBarRect", - "location": "imgui_internal:2065", + "location": "imgui_internal:2375", "nonUDT": 1, "ov_cimguiname": "ImGuiWindow_TitleBarRect", "ret": "void", @@ -9320,7 +9870,7 @@ "cimguiname": "ImGuiWindow_destroy", "defaults": {}, "destructor": true, - "location": "imgui_internal:2051", + "location": "imgui_internal:2364", "ov_cimguiname": "ImGuiWindow_destroy", "realdestructor": true, "ret": "void", @@ -9342,7 +9892,7 @@ "cimguiname": "ImPool_Add", "defaults": {}, "funcname": "Add", - "location": "imgui_internal:639", + "location": "imgui_internal:663", "ov_cimguiname": "ImPool_Add", "ret": "T*", "signature": "()", @@ -9364,7 +9914,7 @@ "cimguiname": "ImPool_Clear", "defaults": {}, "funcname": "Clear", - "location": "imgui_internal:638", + "location": "imgui_internal:662", "ov_cimguiname": "ImPool_Clear", "ret": "void", "signature": "()", @@ -9390,7 +9940,7 @@ "cimguiname": "ImPool_Contains", "defaults": {}, "funcname": "Contains", - "location": "imgui_internal:637", + "location": "imgui_internal:661", "ov_cimguiname": "ImPool_Contains", "ret": "bool", "signature": "(const T*)const", @@ -9412,7 +9962,7 @@ "cimguiname": "ImPool_GetAliveCount", "defaults": {}, "funcname": "GetAliveCount", - "location": "imgui_internal:646", + "location": "imgui_internal:670", "ov_cimguiname": "ImPool_GetAliveCount", "ret": "int", "signature": "()const", @@ -9434,7 +9984,7 @@ "cimguiname": "ImPool_GetBufSize", "defaults": {}, "funcname": "GetBufSize", - "location": "imgui_internal:647", + "location": "imgui_internal:671", "ov_cimguiname": "ImPool_GetBufSize", "ret": "int", "signature": "()const", @@ -9460,7 +10010,7 @@ "cimguiname": "ImPool_GetByIndex", "defaults": {}, "funcname": "GetByIndex", - "location": "imgui_internal:634", + "location": "imgui_internal:658", "ov_cimguiname": "ImPool_GetByIndex", "ret": "T*", "signature": "(ImPoolIdx)", @@ -9486,7 +10036,7 @@ "cimguiname": "ImPool_GetByKey", "defaults": {}, "funcname": "GetByKey", - "location": "imgui_internal:633", + "location": "imgui_internal:657", "ov_cimguiname": "ImPool_GetByKey", "ret": "T*", "signature": "(ImGuiID)", @@ -9512,7 +10062,7 @@ "cimguiname": "ImPool_GetIndex", "defaults": {}, "funcname": "GetIndex", - "location": "imgui_internal:635", + "location": "imgui_internal:659", "ov_cimguiname": "ImPool_GetIndex", "ret": "ImPoolIdx", "signature": "(const T*)const", @@ -9534,7 +10084,7 @@ "cimguiname": "ImPool_GetMapSize", "defaults": {}, "funcname": "GetMapSize", - "location": "imgui_internal:648", + "location": "imgui_internal:672", "ov_cimguiname": "ImPool_GetMapSize", "ret": "int", "signature": "()const", @@ -9560,7 +10110,7 @@ "cimguiname": "ImPool_GetOrAddByKey", "defaults": {}, "funcname": "GetOrAddByKey", - "location": "imgui_internal:636", + "location": "imgui_internal:660", "ov_cimguiname": "ImPool_GetOrAddByKey", "ret": "T*", "signature": "(ImGuiID)", @@ -9578,7 +10128,7 @@ "constructor": true, "defaults": {}, "funcname": "ImPool", - "location": "imgui_internal:631", + "location": "imgui_internal:655", "ov_cimguiname": "ImPool_ImPool", "signature": "()", "stname": "ImPool", @@ -9607,7 +10157,7 @@ "cimguiname": "ImPool_Remove", "defaults": {}, "funcname": "Remove", - "location": "imgui_internal:640", + "location": "imgui_internal:664", "ov_cimguiname": "ImPool_Remove_TPtr", "ret": "void", "signature": "(ImGuiID,const T*)", @@ -9635,7 +10185,7 @@ "cimguiname": "ImPool_Remove", "defaults": {}, "funcname": "Remove", - "location": "imgui_internal:641", + "location": "imgui_internal:665", "ov_cimguiname": "ImPool_Remove_PoolIdx", "ret": "void", "signature": "(ImGuiID,ImPoolIdx)", @@ -9661,7 +10211,7 @@ "cimguiname": "ImPool_Reserve", "defaults": {}, "funcname": "Reserve", - "location": "imgui_internal:642", + "location": "imgui_internal:666", "ov_cimguiname": "ImPool_Reserve", "ret": "void", "signature": "(int)", @@ -9687,7 +10237,7 @@ "cimguiname": "ImPool_TryGetMapData", "defaults": {}, "funcname": "TryGetMapData", - "location": "imgui_internal:649", + "location": "imgui_internal:673", "ov_cimguiname": "ImPool_TryGetMapData", "ret": "T*", "signature": "(ImPoolIdx)", @@ -9708,7 +10258,7 @@ "cimguiname": "ImPool_destroy", "defaults": {}, "destructor": true, - "location": "imgui_internal:632", + "location": "imgui_internal:656", "ov_cimguiname": "ImPool_destroy", "realdestructor": true, "ret": "void", @@ -9735,7 +10285,7 @@ "cimguiname": "ImRect_Add", "defaults": {}, "funcname": "Add", - "location": "imgui_internal:509", + "location": "imgui_internal:526", "ov_cimguiname": "ImRect_Add_Vec2", "ret": "void", "signature": "(const ImVec2)", @@ -9758,7 +10308,7 @@ "cimguiname": "ImRect_Add", "defaults": {}, "funcname": "Add", - "location": "imgui_internal:510", + "location": "imgui_internal:527", "ov_cimguiname": "ImRect_Add_Rect", "ret": "void", "signature": "(const ImRect)", @@ -9783,7 +10333,7 @@ "cimguiname": "ImRect_ClipWith", "defaults": {}, "funcname": "ClipWith", - "location": "imgui_internal:516", + "location": "imgui_internal:533", "ov_cimguiname": "ImRect_ClipWith", "ret": "void", "signature": "(const ImRect)", @@ -9808,7 +10358,7 @@ "cimguiname": "ImRect_ClipWithFull", "defaults": {}, "funcname": "ClipWithFull", - "location": "imgui_internal:517", + "location": "imgui_internal:534", "ov_cimguiname": "ImRect_ClipWithFull", "ret": "void", "signature": "(const ImRect)", @@ -9833,7 +10383,7 @@ "cimguiname": "ImRect_Contains", "defaults": {}, "funcname": "Contains", - "location": "imgui_internal:506", + "location": "imgui_internal:523", "ov_cimguiname": "ImRect_Contains_Vec2", "ret": "bool", "signature": "(const ImVec2)const", @@ -9856,7 +10406,7 @@ "cimguiname": "ImRect_Contains", "defaults": {}, "funcname": "Contains", - "location": "imgui_internal:507", + "location": "imgui_internal:524", "ov_cimguiname": "ImRect_Contains_Rect", "ret": "bool", "signature": "(const ImRect)const", @@ -9881,7 +10431,7 @@ "cimguiname": "ImRect_Expand", "defaults": {}, "funcname": "Expand", - "location": "imgui_internal:511", + "location": "imgui_internal:528", "ov_cimguiname": "ImRect_Expand_Float", "ret": "void", "signature": "(const float)", @@ -9904,7 +10454,7 @@ "cimguiname": "ImRect_Expand", "defaults": {}, "funcname": "Expand", - "location": "imgui_internal:512", + "location": "imgui_internal:529", "ov_cimguiname": "ImRect_Expand_Vec2", "ret": "void", "signature": "(const ImVec2)", @@ -9925,7 +10475,7 @@ "cimguiname": "ImRect_Floor", "defaults": {}, "funcname": "Floor", - "location": "imgui_internal:518", + "location": "imgui_internal:535", "ov_cimguiname": "ImRect_Floor", "ret": "void", "signature": "()", @@ -9946,7 +10496,7 @@ "cimguiname": "ImRect_GetArea", "defaults": {}, "funcname": "GetArea", - "location": "imgui_internal:501", + "location": "imgui_internal:518", "ov_cimguiname": "ImRect_GetArea", "ret": "float", "signature": "()const", @@ -9971,7 +10521,7 @@ "cimguiname": "ImRect_GetBL", "defaults": {}, "funcname": "GetBL", - "location": "imgui_internal:504", + "location": "imgui_internal:521", "nonUDT": 1, "ov_cimguiname": "ImRect_GetBL", "ret": "void", @@ -9997,7 +10547,7 @@ "cimguiname": "ImRect_GetBR", "defaults": {}, "funcname": "GetBR", - "location": "imgui_internal:505", + "location": "imgui_internal:522", "nonUDT": 1, "ov_cimguiname": "ImRect_GetBR", "ret": "void", @@ -10023,7 +10573,7 @@ "cimguiname": "ImRect_GetCenter", "defaults": {}, "funcname": "GetCenter", - "location": "imgui_internal:497", + "location": "imgui_internal:514", "nonUDT": 1, "ov_cimguiname": "ImRect_GetCenter", "ret": "void", @@ -10045,7 +10595,7 @@ "cimguiname": "ImRect_GetHeight", "defaults": {}, "funcname": "GetHeight", - "location": "imgui_internal:500", + "location": "imgui_internal:517", "ov_cimguiname": "ImRect_GetHeight", "ret": "float", "signature": "()const", @@ -10070,7 +10620,7 @@ "cimguiname": "ImRect_GetSize", "defaults": {}, "funcname": "GetSize", - "location": "imgui_internal:498", + "location": "imgui_internal:515", "nonUDT": 1, "ov_cimguiname": "ImRect_GetSize", "ret": "void", @@ -10096,7 +10646,7 @@ "cimguiname": "ImRect_GetTL", "defaults": {}, "funcname": "GetTL", - "location": "imgui_internal:502", + "location": "imgui_internal:519", "nonUDT": 1, "ov_cimguiname": "ImRect_GetTL", "ret": "void", @@ -10122,7 +10672,7 @@ "cimguiname": "ImRect_GetTR", "defaults": {}, "funcname": "GetTR", - "location": "imgui_internal:503", + "location": "imgui_internal:520", "nonUDT": 1, "ov_cimguiname": "ImRect_GetTR", "ret": "void", @@ -10144,7 +10694,7 @@ "cimguiname": "ImRect_GetWidth", "defaults": {}, "funcname": "GetWidth", - "location": "imgui_internal:499", + "location": "imgui_internal:516", "ov_cimguiname": "ImRect_GetWidth", "ret": "float", "signature": "()const", @@ -10161,7 +10711,7 @@ "constructor": true, "defaults": {}, "funcname": "ImRect", - "location": "imgui_internal:492", + "location": "imgui_internal:509", "ov_cimguiname": "ImRect_ImRect_Nil", "signature": "()", "stname": "ImRect" @@ -10184,7 +10734,7 @@ "constructor": true, "defaults": {}, "funcname": "ImRect", - "location": "imgui_internal:493", + "location": "imgui_internal:510", "ov_cimguiname": "ImRect_ImRect_Vec2", "signature": "(const ImVec2,const ImVec2)", "stname": "ImRect" @@ -10203,7 +10753,7 @@ "constructor": true, "defaults": {}, "funcname": "ImRect", - "location": "imgui_internal:494", + "location": "imgui_internal:511", "ov_cimguiname": "ImRect_ImRect_Vec4", "signature": "(const ImVec4)", "stname": "ImRect" @@ -10234,7 +10784,7 @@ "constructor": true, "defaults": {}, "funcname": "ImRect", - "location": "imgui_internal:495", + "location": "imgui_internal:512", "ov_cimguiname": "ImRect_ImRect_Float", "signature": "(float,float,float,float)", "stname": "ImRect" @@ -10254,7 +10804,7 @@ "cimguiname": "ImRect_IsInverted", "defaults": {}, "funcname": "IsInverted", - "location": "imgui_internal:519", + "location": "imgui_internal:536", "ov_cimguiname": "ImRect_IsInverted", "ret": "bool", "signature": "()const", @@ -10279,7 +10829,7 @@ "cimguiname": "ImRect_Overlaps", "defaults": {}, "funcname": "Overlaps", - "location": "imgui_internal:508", + "location": "imgui_internal:525", "ov_cimguiname": "ImRect_Overlaps", "ret": "bool", "signature": "(const ImRect)const", @@ -10304,7 +10854,7 @@ "cimguiname": "ImRect_ToVec4", "defaults": {}, "funcname": "ToVec4", - "location": "imgui_internal:520", + "location": "imgui_internal:537", "nonUDT": 1, "ov_cimguiname": "ImRect_ToVec4", "ret": "void", @@ -10330,7 +10880,7 @@ "cimguiname": "ImRect_Translate", "defaults": {}, "funcname": "Translate", - "location": "imgui_internal:513", + "location": "imgui_internal:530", "ov_cimguiname": "ImRect_Translate", "ret": "void", "signature": "(const ImVec2)", @@ -10355,7 +10905,7 @@ "cimguiname": "ImRect_TranslateX", "defaults": {}, "funcname": "TranslateX", - "location": "imgui_internal:514", + "location": "imgui_internal:531", "ov_cimguiname": "ImRect_TranslateX", "ret": "void", "signature": "(float)", @@ -10380,7 +10930,7 @@ "cimguiname": "ImRect_TranslateY", "defaults": {}, "funcname": "TranslateY", - "location": "imgui_internal:515", + "location": "imgui_internal:532", "ov_cimguiname": "ImRect_TranslateY", "ret": "void", "signature": "(float)", @@ -10420,7 +10970,7 @@ "cimguiname": "ImSpanAllocator_GetArenaSizeInBytes", "defaults": {}, "funcname": "GetArenaSizeInBytes", - "location": "imgui_internal:611", + "location": "imgui_internal:635", "ov_cimguiname": "ImSpanAllocator_GetArenaSizeInBytes", "ret": "int", "signature": "()", @@ -10446,7 +10996,7 @@ "cimguiname": "ImSpanAllocator_GetSpanPtrBegin", "defaults": {}, "funcname": "GetSpanPtrBegin", - "location": "imgui_internal:613", + "location": "imgui_internal:637", "ov_cimguiname": "ImSpanAllocator_GetSpanPtrBegin", "ret": "void*", "signature": "(int)", @@ -10472,7 +11022,7 @@ "cimguiname": "ImSpanAllocator_GetSpanPtrEnd", "defaults": {}, "funcname": "GetSpanPtrEnd", - "location": "imgui_internal:614", + "location": "imgui_internal:638", "ov_cimguiname": "ImSpanAllocator_GetSpanPtrEnd", "ret": "void*", "signature": "(int)", @@ -10490,7 +11040,7 @@ "constructor": true, "defaults": {}, "funcname": "ImSpanAllocator", - "location": "imgui_internal:609", + "location": "imgui_internal:633", "ov_cimguiname": "ImSpanAllocator_ImSpanAllocator", "signature": "()", "stname": "ImSpanAllocator", @@ -10525,7 +11075,7 @@ "a": "4" }, "funcname": "Reserve", - "location": "imgui_internal:610", + "location": "imgui_internal:634", "ov_cimguiname": "ImSpanAllocator_Reserve", "ret": "void", "signature": "(int,size_t,int)", @@ -10551,7 +11101,7 @@ "cimguiname": "ImSpanAllocator_SetArenaBasePtr", "defaults": {}, "funcname": "SetArenaBasePtr", - "location": "imgui_internal:612", + "location": "imgui_internal:636", "ov_cimguiname": "ImSpanAllocator_SetArenaBasePtr", "ret": "void", "signature": "(void*)", @@ -10589,7 +11139,7 @@ "constructor": true, "defaults": {}, "funcname": "ImSpan", - "location": "imgui_internal:577", + "location": "imgui_internal:601", "ov_cimguiname": "ImSpan_ImSpan_Nil", "signature": "()", "stname": "ImSpan", @@ -10613,7 +11163,7 @@ "constructor": true, "defaults": {}, "funcname": "ImSpan", - "location": "imgui_internal:578", + "location": "imgui_internal:602", "ov_cimguiname": "ImSpan_ImSpan_TPtrInt", "signature": "(T*,int)", "stname": "ImSpan", @@ -10637,7 +11187,7 @@ "constructor": true, "defaults": {}, "funcname": "ImSpan", - "location": "imgui_internal:579", + "location": "imgui_internal:603", "ov_cimguiname": "ImSpan_ImSpan_TPtrTPtr", "signature": "(T*,T*)", "stname": "ImSpan", @@ -10658,7 +11208,7 @@ "cimguiname": "ImSpan_begin", "defaults": {}, "funcname": "begin", - "location": "imgui_internal:588", + "location": "imgui_internal:612", "ov_cimguiname": "ImSpan_begin_Nil", "ret": "T*", "signature": "()", @@ -10678,7 +11228,7 @@ "cimguiname": "ImSpan_begin", "defaults": {}, "funcname": "begin", - "location": "imgui_internal:589", + "location": "imgui_internal:613", "ov_cimguiname": "ImSpan_begin__const", "ret": "const T*", "signature": "()const", @@ -10720,7 +11270,7 @@ "cimguiname": "ImSpan_end", "defaults": {}, "funcname": "end", - "location": "imgui_internal:590", + "location": "imgui_internal:614", "ov_cimguiname": "ImSpan_end_Nil", "ret": "T*", "signature": "()", @@ -10740,7 +11290,7 @@ "cimguiname": "ImSpan_end", "defaults": {}, "funcname": "end", - "location": "imgui_internal:591", + "location": "imgui_internal:615", "ov_cimguiname": "ImSpan_end__const", "ret": "const T*", "signature": "()const", @@ -10766,7 +11316,7 @@ "cimguiname": "ImSpan_index_from_ptr", "defaults": {}, "funcname": "index_from_ptr", - "location": "imgui_internal:594", + "location": "imgui_internal:618", "ov_cimguiname": "ImSpan_index_from_ptr", "ret": "int", "signature": "(const T*)const", @@ -10796,7 +11346,7 @@ "cimguiname": "ImSpan_set", "defaults": {}, "funcname": "set", - "location": "imgui_internal:581", + "location": "imgui_internal:605", "ov_cimguiname": "ImSpan_set_Int", "ret": "void", "signature": "(T*,int)", @@ -10824,7 +11374,7 @@ "cimguiname": "ImSpan_set", "defaults": {}, "funcname": "set", - "location": "imgui_internal:582", + "location": "imgui_internal:606", "ov_cimguiname": "ImSpan_set_TPtr", "ret": "void", "signature": "(T*,T*)", @@ -10846,7 +11396,7 @@ "cimguiname": "ImSpan_size", "defaults": {}, "funcname": "size", - "location": "imgui_internal:583", + "location": "imgui_internal:607", "ov_cimguiname": "ImSpan_size", "ret": "int", "signature": "()const", @@ -10868,7 +11418,7 @@ "cimguiname": "ImSpan_size_in_bytes", "defaults": {}, "funcname": "size_in_bytes", - "location": "imgui_internal:584", + "location": "imgui_internal:608", "ov_cimguiname": "ImSpan_size_in_bytes", "ret": "int", "signature": "()const", @@ -10886,7 +11436,7 @@ "constructor": true, "defaults": {}, "funcname": "ImVec1", - "location": "imgui_internal:472", + "location": "imgui_internal:489", "ov_cimguiname": "ImVec1_ImVec1_Nil", "signature": "()", "stname": "ImVec1" @@ -10905,7 +11455,7 @@ "constructor": true, "defaults": {}, "funcname": "ImVec1", - "location": "imgui_internal:473", + "location": "imgui_internal:490", "ov_cimguiname": "ImVec1_ImVec1_Float", "signature": "(float)", "stname": "ImVec1" @@ -10940,7 +11490,7 @@ "constructor": true, "defaults": {}, "funcname": "ImVec2", - "location": "imgui:262", + "location": "imgui:257", "ov_cimguiname": "ImVec2_ImVec2_Nil", "signature": "()", "stname": "ImVec2" @@ -10963,7 +11513,7 @@ "constructor": true, "defaults": {}, "funcname": "ImVec2", - "location": "imgui:263", + "location": "imgui:258", "ov_cimguiname": "ImVec2_ImVec2_Float", "signature": "(float,float)", "stname": "ImVec2" @@ -10998,7 +11548,7 @@ "constructor": true, "defaults": {}, "funcname": "ImVec2ih", - "location": "imgui_internal:480", + "location": "imgui_internal:497", "ov_cimguiname": "ImVec2ih_ImVec2ih_Nil", "signature": "()", "stname": "ImVec2ih" @@ -11021,7 +11571,7 @@ "constructor": true, "defaults": {}, "funcname": "ImVec2ih", - "location": "imgui_internal:481", + "location": "imgui_internal:498", "ov_cimguiname": "ImVec2ih_ImVec2ih_short", "signature": "(short,short)", "stname": "ImVec2ih" @@ -11040,7 +11590,7 @@ "constructor": true, "defaults": {}, "funcname": "ImVec2ih", - "location": "imgui_internal:482", + "location": "imgui_internal:499", "ov_cimguiname": "ImVec2ih_ImVec2ih_Vec2", "signature": "(const ImVec2)", "stname": "ImVec2ih" @@ -11075,7 +11625,7 @@ "constructor": true, "defaults": {}, "funcname": "ImVec4", - "location": "imgui:275", + "location": "imgui:270", "ov_cimguiname": "ImVec4_ImVec4_Nil", "signature": "()", "stname": "ImVec4" @@ -11106,7 +11656,7 @@ "constructor": true, "defaults": {}, "funcname": "ImVec4", - "location": "imgui:276", + "location": "imgui:271", "ov_cimguiname": "ImVec4_ImVec4_Float", "signature": "(float,float,float,float)", "stname": "ImVec4" @@ -11141,18 +11691,18 @@ "constructor": true, "defaults": {}, "funcname": "ImVector", - "location": "imgui:1707", + "location": "imgui:1787", "ov_cimguiname": "ImVector_ImVector_Nil", "signature": "()", "stname": "ImVector", "templated": true }, { - "args": "(const ImVector src)", + "args": "(const ImVector_T src)", "argsT": [ { "name": "src", - "type": "const ImVector" + "type": "const ImVector_T " } ], "argsoriginal": "(const ImVector& src)", @@ -11161,9 +11711,9 @@ "constructor": true, "defaults": {}, "funcname": "ImVector", - "location": "imgui:1708", - "ov_cimguiname": "ImVector_ImVector_Vector", - "signature": "(const ImVector)", + "location": "imgui:1788", + "ov_cimguiname": "ImVector_ImVector_Vector_T_", + "signature": "(const ImVector_T )", "stname": "ImVector", "templated": true } @@ -11186,7 +11736,7 @@ "cimguiname": "ImVector__grow_capacity", "defaults": {}, "funcname": "_grow_capacity", - "location": "imgui:1734", + "location": "imgui:1814", "ov_cimguiname": "ImVector__grow_capacity", "ret": "int", "signature": "(int)const", @@ -11208,7 +11758,7 @@ "cimguiname": "ImVector_back", "defaults": {}, "funcname": "back", - "location": "imgui:1730", + "location": "imgui:1810", "ov_cimguiname": "ImVector_back_Nil", "ret": "T*", "retref": "&", @@ -11229,7 +11779,7 @@ "cimguiname": "ImVector_back", "defaults": {}, "funcname": "back", - "location": "imgui:1731", + "location": "imgui:1811", "ov_cimguiname": "ImVector_back__const", "ret": "const T*", "retref": "&", @@ -11252,7 +11802,7 @@ "cimguiname": "ImVector_begin", "defaults": {}, "funcname": "begin", - "location": "imgui:1724", + "location": "imgui:1804", "ov_cimguiname": "ImVector_begin_Nil", "ret": "T*", "signature": "()", @@ -11272,7 +11822,7 @@ "cimguiname": "ImVector_begin", "defaults": {}, "funcname": "begin", - "location": "imgui:1725", + "location": "imgui:1805", "ov_cimguiname": "ImVector_begin__const", "ret": "const T*", "signature": "()const", @@ -11294,7 +11844,7 @@ "cimguiname": "ImVector_capacity", "defaults": {}, "funcname": "capacity", - "location": "imgui:1720", + "location": "imgui:1800", "ov_cimguiname": "ImVector_capacity", "ret": "int", "signature": "()const", @@ -11316,7 +11866,7 @@ "cimguiname": "ImVector_clear", "defaults": {}, "funcname": "clear", - "location": "imgui:1712", + "location": "imgui:1792", "ov_cimguiname": "ImVector_clear", "ret": "void", "signature": "()", @@ -11338,7 +11888,7 @@ "cimguiname": "ImVector_clear_delete", "defaults": {}, "funcname": "clear_delete", - "location": "imgui:1713", + "location": "imgui:1793", "ov_cimguiname": "ImVector_clear_delete", "ret": "void", "signature": "()", @@ -11360,7 +11910,7 @@ "cimguiname": "ImVector_clear_destruct", "defaults": {}, "funcname": "clear_destruct", - "location": "imgui:1714", + "location": "imgui:1794", "ov_cimguiname": "ImVector_clear_destruct", "ret": "void", "signature": "()", @@ -11386,7 +11936,7 @@ "cimguiname": "ImVector_contains", "defaults": {}, "funcname": "contains", - "location": "imgui:1748", + "location": "imgui:1829", "ov_cimguiname": "ImVector_contains", "ret": "bool", "signature": "(const T)const", @@ -11407,7 +11957,7 @@ "cimguiname": "ImVector_destroy", "defaults": {}, "destructor": true, - "location": "imgui:1710", + "location": "imgui:1790", "ov_cimguiname": "ImVector_destroy", "realdestructor": true, "ret": "void", @@ -11430,7 +11980,7 @@ "cimguiname": "ImVector_empty", "defaults": {}, "funcname": "empty", - "location": "imgui:1716", + "location": "imgui:1796", "ov_cimguiname": "ImVector_empty", "ret": "bool", "signature": "()const", @@ -11452,7 +12002,7 @@ "cimguiname": "ImVector_end", "defaults": {}, "funcname": "end", - "location": "imgui:1726", + "location": "imgui:1806", "ov_cimguiname": "ImVector_end_Nil", "ret": "T*", "signature": "()", @@ -11472,7 +12022,7 @@ "cimguiname": "ImVector_end", "defaults": {}, "funcname": "end", - "location": "imgui:1727", + "location": "imgui:1807", "ov_cimguiname": "ImVector_end__const", "ret": "const T*", "signature": "()const", @@ -11498,7 +12048,7 @@ "cimguiname": "ImVector_erase", "defaults": {}, "funcname": "erase", - "location": "imgui:1744", + "location": "imgui:1825", "ov_cimguiname": "ImVector_erase_Nil", "ret": "T*", "signature": "(const T*)", @@ -11526,7 +12076,7 @@ "cimguiname": "ImVector_erase", "defaults": {}, "funcname": "erase", - "location": "imgui:1745", + "location": "imgui:1826", "ov_cimguiname": "ImVector_erase_TPtr", "ret": "T*", "signature": "(const T*,const T*)", @@ -11552,7 +12102,7 @@ "cimguiname": "ImVector_erase_unsorted", "defaults": {}, "funcname": "erase_unsorted", - "location": "imgui:1746", + "location": "imgui:1827", "ov_cimguiname": "ImVector_erase_unsorted", "ret": "T*", "signature": "(const T*)", @@ -11578,7 +12128,7 @@ "cimguiname": "ImVector_find", "defaults": {}, "funcname": "find", - "location": "imgui:1749", + "location": "imgui:1830", "ov_cimguiname": "ImVector_find_Nil", "ret": "T*", "signature": "(const T)", @@ -11602,7 +12152,7 @@ "cimguiname": "ImVector_find", "defaults": {}, "funcname": "find", - "location": "imgui:1750", + "location": "imgui:1831", "ov_cimguiname": "ImVector_find__const", "ret": "const T*", "signature": "(const T)const", @@ -11628,7 +12178,7 @@ "cimguiname": "ImVector_find_erase", "defaults": {}, "funcname": "find_erase", - "location": "imgui:1751", + "location": "imgui:1832", "ov_cimguiname": "ImVector_find_erase", "ret": "bool", "signature": "(const T)", @@ -11654,7 +12204,7 @@ "cimguiname": "ImVector_find_erase_unsorted", "defaults": {}, "funcname": "find_erase_unsorted", - "location": "imgui:1752", + "location": "imgui:1833", "ov_cimguiname": "ImVector_find_erase_unsorted", "ret": "bool", "signature": "(const T)", @@ -11676,7 +12226,7 @@ "cimguiname": "ImVector_front", "defaults": {}, "funcname": "front", - "location": "imgui:1728", + "location": "imgui:1808", "ov_cimguiname": "ImVector_front_Nil", "ret": "T*", "retref": "&", @@ -11697,7 +12247,7 @@ "cimguiname": "ImVector_front", "defaults": {}, "funcname": "front", - "location": "imgui:1729", + "location": "imgui:1809", "ov_cimguiname": "ImVector_front__const", "ret": "const T*", "retref": "&", @@ -11724,7 +12274,7 @@ "cimguiname": "ImVector_index_from_ptr", "defaults": {}, "funcname": "index_from_ptr", - "location": "imgui:1753", + "location": "imgui:1834", "ov_cimguiname": "ImVector_index_from_ptr", "ret": "int", "signature": "(const T*)const", @@ -11754,7 +12304,7 @@ "cimguiname": "ImVector_insert", "defaults": {}, "funcname": "insert", - "location": "imgui:1747", + "location": "imgui:1828", "ov_cimguiname": "ImVector_insert", "ret": "T*", "signature": "(const T*,const T)", @@ -11776,7 +12326,7 @@ "cimguiname": "ImVector_max_size", "defaults": {}, "funcname": "max_size", - "location": "imgui:1719", + "location": "imgui:1799", "ov_cimguiname": "ImVector_max_size", "ret": "int", "signature": "()const", @@ -11798,7 +12348,7 @@ "cimguiname": "ImVector_pop_back", "defaults": {}, "funcname": "pop_back", - "location": "imgui:1742", + "location": "imgui:1823", "ov_cimguiname": "ImVector_pop_back", "ret": "void", "signature": "()", @@ -11824,7 +12374,7 @@ "cimguiname": "ImVector_push_back", "defaults": {}, "funcname": "push_back", - "location": "imgui:1741", + "location": "imgui:1822", "ov_cimguiname": "ImVector_push_back", "ret": "void", "signature": "(const T)", @@ -11850,7 +12400,7 @@ "cimguiname": "ImVector_push_front", "defaults": {}, "funcname": "push_front", - "location": "imgui:1743", + "location": "imgui:1824", "ov_cimguiname": "ImVector_push_front", "ret": "void", "signature": "(const T)", @@ -11876,7 +12426,7 @@ "cimguiname": "ImVector_reserve", "defaults": {}, "funcname": "reserve", - "location": "imgui:1738", + "location": "imgui:1818", "ov_cimguiname": "ImVector_reserve", "ret": "void", "signature": "(int)", @@ -11884,6 +12434,32 @@ "templated": true } ], + "ImVector_reserve_discard": [ + { + "args": "(ImVector* self,int new_capacity)", + "argsT": [ + { + "name": "self", + "type": "ImVector*" + }, + { + "name": "new_capacity", + "type": "int" + } + ], + "argsoriginal": "(int new_capacity)", + "call_args": "(new_capacity)", + "cimguiname": "ImVector_reserve_discard", + "defaults": {}, + "funcname": "reserve_discard", + "location": "imgui:1819", + "ov_cimguiname": "ImVector_reserve_discard", + "ret": "void", + "signature": "(int)", + "stname": "ImVector", + "templated": true + } + ], "ImVector_resize": [ { "args": "(ImVector* self,int new_size)", @@ -11902,7 +12478,7 @@ "cimguiname": "ImVector_resize", "defaults": {}, "funcname": "resize", - "location": "imgui:1735", + "location": "imgui:1815", "ov_cimguiname": "ImVector_resize_Nil", "ret": "void", "signature": "(int)", @@ -11930,7 +12506,7 @@ "cimguiname": "ImVector_resize", "defaults": {}, "funcname": "resize", - "location": "imgui:1736", + "location": "imgui:1816", "ov_cimguiname": "ImVector_resize_T", "ret": "void", "signature": "(int,const T)", @@ -11956,7 +12532,7 @@ "cimguiname": "ImVector_shrink", "defaults": {}, "funcname": "shrink", - "location": "imgui:1737", + "location": "imgui:1817", "ov_cimguiname": "ImVector_shrink", "ret": "void", "signature": "(int)", @@ -11978,7 +12554,7 @@ "cimguiname": "ImVector_size", "defaults": {}, "funcname": "size", - "location": "imgui:1717", + "location": "imgui:1797", "ov_cimguiname": "ImVector_size", "ret": "int", "signature": "()const", @@ -12000,7 +12576,7 @@ "cimguiname": "ImVector_size_in_bytes", "defaults": {}, "funcname": "size_in_bytes", - "location": "imgui:1718", + "location": "imgui:1798", "ov_cimguiname": "ImVector_size_in_bytes", "ret": "int", "signature": "()const", @@ -12010,7 +12586,7 @@ ], "ImVector_swap": [ { - "args": "(ImVector* self,ImVector* rhs)", + "args": "(ImVector* self,ImVector_T * rhs)", "argsT": [ { "name": "self", @@ -12019,7 +12595,7 @@ { "name": "rhs", "reftoptr": true, - "type": "ImVector*" + "type": "ImVector_T *" } ], "argsoriginal": "(ImVector& rhs)", @@ -12027,10 +12603,10 @@ "cimguiname": "ImVector_swap", "defaults": {}, "funcname": "swap", - "location": "imgui:1732", + "location": "imgui:1812", "ov_cimguiname": "ImVector_swap", "ret": "void", - "signature": "(ImVector*)", + "signature": "(ImVector_T *)", "stname": "ImVector", "templated": true } @@ -12055,7 +12631,7 @@ "flags": "0" }, "funcname": "AcceptDragDropPayload", - "location": "imgui:813", + "location": "imgui:814", "namespace": "ImGui", "ov_cimguiname": "igAcceptDragDropPayload", "ret": "const ImGuiPayload*", @@ -12077,7 +12653,7 @@ "cimguiname": "igActivateItem", "defaults": {}, "funcname": "ActivateItem", - "location": "imgui_internal:2579", + "location": "imgui_internal:2897", "namespace": "ImGui", "ov_cimguiname": "igActivateItem", "ret": "void", @@ -12103,7 +12679,7 @@ "cimguiname": "igAddContextHook", "defaults": {}, "funcname": "AddContextHook", - "location": "imgui_internal:2462", + "location": "imgui_internal:2781", "namespace": "ImGui", "ov_cimguiname": "igAddContextHook", "ret": "ImGuiID", @@ -12111,6 +12687,28 @@ "stname": "" } ], + "igAddSettingsHandler": [ + { + "args": "(const ImGuiSettingsHandler* handler)", + "argsT": [ + { + "name": "handler", + "type": "const ImGuiSettingsHandler*" + } + ], + "argsoriginal": "(const ImGuiSettingsHandler* handler)", + "call_args": "(handler)", + "cimguiname": "igAddSettingsHandler", + "defaults": {}, + "funcname": "AddSettingsHandler", + "location": "imgui_internal:2792", + "namespace": "ImGui", + "ov_cimguiname": "igAddSettingsHandler", + "ret": "void", + "signature": "(const ImGuiSettingsHandler*)", + "stname": "" + } + ], "igAlignTextToFramePadding": [ { "args": "()", @@ -12120,7 +12718,7 @@ "cimguiname": "igAlignTextToFramePadding", "defaults": {}, "funcname": "AlignTextToFramePadding", - "location": "imgui:458", + "location": "imgui:457", "namespace": "ImGui", "ov_cimguiname": "igAlignTextToFramePadding", "ret": "void", @@ -12182,7 +12780,7 @@ "flags": "0" }, "funcname": "ArrowButtonEx", - "location": "imgui_internal:2718", + "location": "imgui_internal:3111", "namespace": "ImGui", "ov_cimguiname": "igArrowButtonEx", "ret": "bool", @@ -12215,7 +12813,7 @@ "p_open": "NULL" }, "funcname": "Begin", - "location": "imgui:335", + "location": "imgui:331", "namespace": "ImGui", "ov_cimguiname": "igBegin", "ret": "bool", @@ -12253,7 +12851,7 @@ "size": "ImVec2(0,0)" }, "funcname": "BeginChild", - "location": "imgui:346", + "location": "imgui:342", "namespace": "ImGui", "ov_cimguiname": "igBeginChild_Str", "ret": "bool", @@ -12289,7 +12887,7 @@ "size": "ImVec2(0,0)" }, "funcname": "BeginChild", - "location": "imgui:347", + "location": "imgui:343", "namespace": "ImGui", "ov_cimguiname": "igBeginChild_ID", "ret": "bool", @@ -12327,7 +12925,7 @@ "cimguiname": "igBeginChildEx", "defaults": {}, "funcname": "BeginChildEx", - "location": "imgui_internal:2542", + "location": "imgui_internal:2863", "namespace": "ImGui", "ov_cimguiname": "igBeginChildEx", "ret": "bool", @@ -12359,7 +12957,7 @@ "flags": "0" }, "funcname": "BeginChildFrame", - "location": "imgui:872", + "location": "imgui:876", "namespace": "ImGui", "ov_cimguiname": "igBeginChildFrame", "ret": "bool", @@ -12391,7 +12989,7 @@ "flags": "0" }, "funcname": "BeginColumns", - "location": "imgui_internal:2610", + "location": "imgui_internal:3001", "namespace": "ImGui", "ov_cimguiname": "igBeginColumns", "ret": "void", @@ -12423,7 +13021,7 @@ "flags": "0" }, "funcname": "BeginCombo", - "location": "imgui:519", + "location": "imgui:522", "namespace": "ImGui", "ov_cimguiname": "igBeginCombo", "ret": "bool", @@ -12453,7 +13051,7 @@ "cimguiname": "igBeginComboPopup", "defaults": {}, "funcname": "BeginComboPopup", - "location": "imgui_internal:2562", + "location": "imgui_internal:2883", "namespace": "ImGui", "ov_cimguiname": "igBeginComboPopup", "ret": "bool", @@ -12470,7 +13068,7 @@ "cimguiname": "igBeginComboPreview", "defaults": {}, "funcname": "BeginComboPreview", - "location": "imgui_internal:2563", + "location": "imgui_internal:2884", "namespace": "ImGui", "ov_cimguiname": "igBeginComboPreview", "ret": "bool", @@ -12494,7 +13092,7 @@ "disabled": "true" }, "funcname": "BeginDisabled", - "location": "imgui:821", + "location": "imgui:822", "namespace": "ImGui", "ov_cimguiname": "igBeginDisabled", "ret": "void", @@ -12518,7 +13116,7 @@ "flags": "0" }, "funcname": "BeginDragDropSource", - "location": "imgui:809", + "location": "imgui:810", "namespace": "ImGui", "ov_cimguiname": "igBeginDragDropSource", "ret": "bool", @@ -12535,7 +13133,7 @@ "cimguiname": "igBeginDragDropTarget", "defaults": {}, "funcname": "BeginDragDropTarget", - "location": "imgui:812", + "location": "imgui:813", "namespace": "ImGui", "ov_cimguiname": "igBeginDragDropTarget", "ret": "bool", @@ -12561,7 +13159,7 @@ "cimguiname": "igBeginDragDropTargetCustom", "defaults": {}, "funcname": "BeginDragDropTargetCustom", - "location": "imgui_internal:2604", + "location": "imgui_internal:2994", "namespace": "ImGui", "ov_cimguiname": "igBeginDragDropTargetCustom", "ret": "bool", @@ -12578,7 +13176,7 @@ "cimguiname": "igBeginGroup", "defaults": {}, "funcname": "BeginGroup", - "location": "imgui:447", + "location": "imgui:446", "namespace": "ImGui", "ov_cimguiname": "igBeginGroup", "ret": "void", @@ -12606,7 +13204,7 @@ "size": "ImVec2(0,0)" }, "funcname": "BeginListBox", - "location": "imgui:630", + "location": "imgui:634", "namespace": "ImGui", "ov_cimguiname": "igBeginListBox", "ret": "bool", @@ -12623,7 +13221,7 @@ "cimguiname": "igBeginMainMenuBar", "defaults": {}, "funcname": "BeginMainMenuBar", - "location": "imgui:656", + "location": "imgui:660", "namespace": "ImGui", "ov_cimguiname": "igBeginMainMenuBar", "ret": "bool", @@ -12651,7 +13249,7 @@ "enabled": "true" }, "funcname": "BeginMenu", - "location": "imgui:658", + "location": "imgui:662", "namespace": "ImGui", "ov_cimguiname": "igBeginMenu", "ret": "bool", @@ -12668,7 +13266,7 @@ "cimguiname": "igBeginMenuBar", "defaults": {}, "funcname": "BeginMenuBar", - "location": "imgui:654", + "location": "imgui:658", "namespace": "ImGui", "ov_cimguiname": "igBeginMenuBar", "ret": "bool", @@ -12700,7 +13298,7 @@ "enabled": "true" }, "funcname": "BeginMenuEx", - "location": "imgui_internal:2558", + "location": "imgui_internal:2879", "namespace": "ImGui", "ov_cimguiname": "igBeginMenuEx", "ret": "bool", @@ -12728,7 +13326,7 @@ "flags": "0" }, "funcname": "BeginPopup", - "location": "imgui:682", + "location": "imgui:686", "namespace": "ImGui", "ov_cimguiname": "igBeginPopup", "ret": "bool", @@ -12757,7 +13355,7 @@ "str_id": "NULL" }, "funcname": "BeginPopupContextItem", - "location": "imgui:703", + "location": "imgui:708", "namespace": "ImGui", "ov_cimguiname": "igBeginPopupContextItem", "ret": "bool", @@ -12786,7 +13384,7 @@ "str_id": "NULL" }, "funcname": "BeginPopupContextVoid", - "location": "imgui:705", + "location": "imgui:710", "namespace": "ImGui", "ov_cimguiname": "igBeginPopupContextVoid", "ret": "bool", @@ -12815,7 +13413,7 @@ "str_id": "NULL" }, "funcname": "BeginPopupContextWindow", - "location": "imgui:704", + "location": "imgui:709", "namespace": "ImGui", "ov_cimguiname": "igBeginPopupContextWindow", "ret": "bool", @@ -12841,7 +13439,7 @@ "cimguiname": "igBeginPopupEx", "defaults": {}, "funcname": "BeginPopupEx", - "location": "imgui_internal:2548", + "location": "imgui_internal:2869", "namespace": "ImGui", "ov_cimguiname": "igBeginPopupEx", "ret": "bool", @@ -12874,7 +13472,7 @@ "p_open": "NULL" }, "funcname": "BeginPopupModal", - "location": "imgui:683", + "location": "imgui:687", "namespace": "ImGui", "ov_cimguiname": "igBeginPopupModal", "ret": "bool", @@ -12902,7 +13500,7 @@ "flags": "0" }, "funcname": "BeginTabBar", - "location": "imgui:787", + "location": "imgui:788", "namespace": "ImGui", "ov_cimguiname": "igBeginTabBar", "ret": "bool", @@ -12932,7 +13530,7 @@ "cimguiname": "igBeginTabBarEx", "defaults": {}, "funcname": "BeginTabBarEx", - "location": "imgui_internal:2672", + "location": "imgui_internal:3067", "namespace": "ImGui", "ov_cimguiname": "igBeginTabBarEx", "ret": "bool", @@ -12965,7 +13563,7 @@ "p_open": "NULL" }, "funcname": "BeginTabItem", - "location": "imgui:789", + "location": "imgui:790", "namespace": "ImGui", "ov_cimguiname": "igBeginTabItem", "ret": "bool", @@ -13007,7 +13605,7 @@ "outer_size": "ImVec2(0.0f,0.0f)" }, "funcname": "BeginTable", - "location": "imgui:738", + "location": "imgui:741", "namespace": "ImGui", "ov_cimguiname": "igBeginTable", "ret": "bool", @@ -13053,7 +13651,7 @@ "outer_size": "ImVec2(0,0)" }, "funcname": "BeginTableEx", - "location": "imgui_internal:2632", + "location": "imgui_internal:3023", "namespace": "ImGui", "ov_cimguiname": "igBeginTableEx", "ret": "bool", @@ -13070,10 +13668,10 @@ "cimguiname": "igBeginTooltip", "defaults": {}, "funcname": "BeginTooltip", - "location": "imgui:665", + "location": "imgui:669", "namespace": "ImGui", "ov_cimguiname": "igBeginTooltip", - "ret": "void", + "ret": "bool", "signature": "()", "stname": "" } @@ -13096,10 +13694,10 @@ "cimguiname": "igBeginTooltipEx", "defaults": {}, "funcname": "BeginTooltipEx", - "location": "imgui_internal:2549", + "location": "imgui_internal:2870", "namespace": "ImGui", "ov_cimguiname": "igBeginTooltipEx", - "ret": "void", + "ret": "bool", "signature": "(ImGuiTooltipFlags,ImGuiWindowFlags)", "stname": "" } @@ -13134,7 +13732,7 @@ "cimguiname": "igBeginViewportSideBar", "defaults": {}, "funcname": "BeginViewportSideBar", - "location": "imgui_internal:2557", + "location": "imgui_internal:2878", "namespace": "ImGui", "ov_cimguiname": "igBeginViewportSideBar", "ret": "bool", @@ -13156,7 +13754,7 @@ "cimguiname": "igBringWindowToDisplayBack", "defaults": {}, "funcname": "BringWindowToDisplayBack", - "location": "imgui_internal:2439", + "location": "imgui_internal:2757", "namespace": "ImGui", "ov_cimguiname": "igBringWindowToDisplayBack", "ret": "void", @@ -13182,7 +13780,7 @@ "cimguiname": "igBringWindowToDisplayBehind", "defaults": {}, "funcname": "BringWindowToDisplayBehind", - "location": "imgui_internal:2440", + "location": "imgui_internal:2758", "namespace": "ImGui", "ov_cimguiname": "igBringWindowToDisplayBehind", "ret": "void", @@ -13204,7 +13802,7 @@ "cimguiname": "igBringWindowToDisplayFront", "defaults": {}, "funcname": "BringWindowToDisplayFront", - "location": "imgui_internal:2438", + "location": "imgui_internal:2756", "namespace": "ImGui", "ov_cimguiname": "igBringWindowToDisplayFront", "ret": "void", @@ -13226,7 +13824,7 @@ "cimguiname": "igBringWindowToFocusFront", "defaults": {}, "funcname": "BringWindowToFocusFront", - "location": "imgui_internal:2437", + "location": "imgui_internal:2755", "namespace": "ImGui", "ov_cimguiname": "igBringWindowToFocusFront", "ret": "void", @@ -13243,7 +13841,7 @@ "cimguiname": "igBullet", "defaults": {}, "funcname": "Bullet", - "location": "imgui:514", + "location": "imgui:512", "namespace": "ImGui", "ov_cimguiname": "igBullet", "ret": "void", @@ -13270,7 +13868,7 @@ "defaults": {}, "funcname": "BulletText", "isvararg": "...)", - "location": "imgui:496", + "location": "imgui:495", "namespace": "ImGui", "ov_cimguiname": "igBulletText", "ret": "void", @@ -13296,7 +13894,7 @@ "cimguiname": "igBulletTextV", "defaults": {}, "funcname": "BulletTextV", - "location": "imgui:497", + "location": "imgui:496", "namespace": "ImGui", "ov_cimguiname": "igBulletTextV", "ret": "void", @@ -13364,7 +13962,7 @@ "flags": "0" }, "funcname": "ButtonBehavior", - "location": "imgui_internal:2731", + "location": "imgui_internal:3129", "namespace": "ImGui", "ov_cimguiname": "igButtonBehavior", "ret": "bool", @@ -13397,7 +13995,7 @@ "size_arg": "ImVec2(0,0)" }, "funcname": "ButtonEx", - "location": "imgui_internal:2715", + "location": "imgui_internal:3110", "namespace": "ImGui", "ov_cimguiname": "igButtonEx", "ret": "bool", @@ -13431,7 +14029,7 @@ "cimguiname": "igCalcItemSize", "defaults": {}, "funcname": "CalcItemSize", - "location": "imgui_internal:2513", + "location": "imgui_internal:2844", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igCalcItemSize", @@ -13449,7 +14047,7 @@ "cimguiname": "igCalcItemWidth", "defaults": {}, "funcname": "CalcItemWidth", - "location": "imgui:419", + "location": "imgui:418", "namespace": "ImGui", "ov_cimguiname": "igCalcItemWidth", "ret": "float", @@ -13491,7 +14089,7 @@ "wrap_width": "-1.0f" }, "funcname": "CalcTextSize", - "location": "imgui:876", + "location": "imgui:880", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igCalcTextSize", @@ -13526,7 +14124,7 @@ "cimguiname": "igCalcTypematicRepeatAmount", "defaults": {}, "funcname": "CalcTypematicRepeatAmount", - "location": "imgui_internal:2578", + "location": "imgui_internal:2929", "namespace": "ImGui", "ov_cimguiname": "igCalcTypematicRepeatAmount", "ret": "int", @@ -13552,7 +14150,7 @@ "cimguiname": "igCalcWindowNextAutoFitSize", "defaults": {}, "funcname": "CalcWindowNextAutoFitSize", - "location": "imgui_internal:2422", + "location": "imgui_internal:2739", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igCalcWindowNextAutoFitSize", @@ -13579,7 +14177,7 @@ "cimguiname": "igCalcWrapWidthForPos", "defaults": {}, "funcname": "CalcWrapWidthForPos", - "location": "imgui_internal:2514", + "location": "imgui_internal:2845", "namespace": "ImGui", "ov_cimguiname": "igCalcWrapWidthForPos", "ret": "float", @@ -13605,7 +14203,7 @@ "cimguiname": "igCallContextHooks", "defaults": {}, "funcname": "CallContextHooks", - "location": "imgui_internal:2464", + "location": "imgui_internal:2783", "namespace": "ImGui", "ov_cimguiname": "igCallContextHooks", "ret": "void", @@ -13613,54 +14211,6 @@ "stname": "" } ], - "igCaptureKeyboardFromApp": [ - { - "args": "(bool want_capture_keyboard_value)", - "argsT": [ - { - "name": "want_capture_keyboard_value", - "type": "bool" - } - ], - "argsoriginal": "(bool want_capture_keyboard_value=true)", - "call_args": "(want_capture_keyboard_value)", - "cimguiname": "igCaptureKeyboardFromApp", - "defaults": { - "want_capture_keyboard_value": "true" - }, - "funcname": "CaptureKeyboardFromApp", - "location": "imgui:892", - "namespace": "ImGui", - "ov_cimguiname": "igCaptureKeyboardFromApp", - "ret": "void", - "signature": "(bool)", - "stname": "" - } - ], - "igCaptureMouseFromApp": [ - { - "args": "(bool want_capture_mouse_value)", - "argsT": [ - { - "name": "want_capture_mouse_value", - "type": "bool" - } - ], - "argsoriginal": "(bool want_capture_mouse_value=true)", - "call_args": "(want_capture_mouse_value)", - "cimguiname": "igCaptureMouseFromApp", - "defaults": { - "want_capture_mouse_value": "true" - }, - "funcname": "CaptureMouseFromApp", - "location": "imgui:913", - "namespace": "ImGui", - "ov_cimguiname": "igCaptureMouseFromApp", - "ret": "void", - "signature": "(bool)", - "stname": "" - } - ], "igCheckbox": [ { "args": "(const char* label,bool* v)", @@ -13679,7 +14229,7 @@ "cimguiname": "igCheckbox", "defaults": {}, "funcname": "Checkbox", - "location": "imgui:508", + "location": "imgui:506", "namespace": "ImGui", "ov_cimguiname": "igCheckbox", "ret": "bool", @@ -13709,7 +14259,7 @@ "cimguiname": "igCheckboxFlags", "defaults": {}, "funcname": "CheckboxFlags", - "location": "imgui:509", + "location": "imgui:507", "namespace": "ImGui", "ov_cimguiname": "igCheckboxFlags_IntPtr", "ret": "bool", @@ -13737,7 +14287,7 @@ "cimguiname": "igCheckboxFlags", "defaults": {}, "funcname": "CheckboxFlags", - "location": "imgui:510", + "location": "imgui:508", "namespace": "ImGui", "ov_cimguiname": "igCheckboxFlags_UintPtr", "ret": "bool", @@ -13765,7 +14315,7 @@ "cimguiname": "igCheckboxFlags", "defaults": {}, "funcname": "CheckboxFlags", - "location": "imgui_internal:2727", + "location": "imgui_internal:3115", "namespace": "ImGui", "ov_cimguiname": "igCheckboxFlags_S64Ptr", "ret": "bool", @@ -13793,7 +14343,7 @@ "cimguiname": "igCheckboxFlags", "defaults": {}, "funcname": "CheckboxFlags", - "location": "imgui_internal:2728", + "location": "imgui_internal:3116", "namespace": "ImGui", "ov_cimguiname": "igCheckboxFlags_U64Ptr", "ret": "bool", @@ -13810,7 +14360,7 @@ "cimguiname": "igClearActiveID", "defaults": {}, "funcname": "ClearActiveID", - "location": "imgui_internal:2498", + "location": "imgui_internal:2827", "namespace": "ImGui", "ov_cimguiname": "igClearActiveID", "ret": "void", @@ -13827,7 +14377,7 @@ "cimguiname": "igClearDragDrop", "defaults": {}, "funcname": "ClearDragDrop", - "location": "imgui_internal:2605", + "location": "imgui_internal:2995", "namespace": "ImGui", "ov_cimguiname": "igClearDragDrop", "ret": "void", @@ -13844,7 +14394,7 @@ "cimguiname": "igClearIniSettings", "defaults": {}, "funcname": "ClearIniSettings", - "location": "imgui_internal:2469", + "location": "imgui_internal:2791", "namespace": "ImGui", "ov_cimguiname": "igClearIniSettings", "ret": "void", @@ -13852,6 +14402,28 @@ "stname": "" } ], + "igClearWindowSettings": [ + { + "args": "(const char* name)", + "argsT": [ + { + "name": "name", + "type": "const char*" + } + ], + "argsoriginal": "(const char* name)", + "call_args": "(name)", + "cimguiname": "igClearWindowSettings", + "defaults": {}, + "funcname": "ClearWindowSettings", + "location": "imgui_internal:2800", + "namespace": "ImGui", + "ov_cimguiname": "igClearWindowSettings", + "ret": "void", + "signature": "(const char*)", + "stname": "" + } + ], "igCloseButton": [ { "args": "(ImGuiID id,const ImVec2 pos)", @@ -13870,7 +14442,7 @@ "cimguiname": "igCloseButton", "defaults": {}, "funcname": "CloseButton", - "location": "imgui_internal:2716", + "location": "imgui_internal:3119", "namespace": "ImGui", "ov_cimguiname": "igCloseButton", "ret": "bool", @@ -13887,7 +14459,7 @@ "cimguiname": "igCloseCurrentPopup", "defaults": {}, "funcname": "CloseCurrentPopup", - "location": "imgui:696", + "location": "imgui:701", "namespace": "ImGui", "ov_cimguiname": "igCloseCurrentPopup", "ret": "void", @@ -13913,7 +14485,7 @@ "cimguiname": "igClosePopupToLevel", "defaults": {}, "funcname": "ClosePopupToLevel", - "location": "imgui_internal:2544", + "location": "imgui_internal:2865", "namespace": "ImGui", "ov_cimguiname": "igClosePopupToLevel", "ret": "void", @@ -13930,7 +14502,7 @@ "cimguiname": "igClosePopupsExceptModals", "defaults": {}, "funcname": "ClosePopupsExceptModals", - "location": "imgui_internal:2546", + "location": "imgui_internal:2867", "namespace": "ImGui", "ov_cimguiname": "igClosePopupsExceptModals", "ret": "void", @@ -13956,7 +14528,7 @@ "cimguiname": "igClosePopupsOverWindow", "defaults": {}, "funcname": "ClosePopupsOverWindow", - "location": "imgui_internal:2545", + "location": "imgui_internal:2866", "namespace": "ImGui", "ov_cimguiname": "igClosePopupsOverWindow", "ret": "void", @@ -13982,7 +14554,7 @@ "cimguiname": "igCollapseButton", "defaults": {}, "funcname": "CollapseButton", - "location": "imgui_internal:2717", + "location": "imgui_internal:3120", "namespace": "ImGui", "ov_cimguiname": "igCollapseButton", "ret": "bool", @@ -14010,7 +14582,7 @@ "flags": "0" }, "funcname": "CollapsingHeader", - "location": "imgui:614", + "location": "imgui:618", "namespace": "ImGui", "ov_cimguiname": "igCollapsingHeader_TreeNodeFlags", "ret": "bool", @@ -14040,7 +14612,7 @@ "flags": "0" }, "funcname": "CollapsingHeader", - "location": "imgui:615", + "location": "imgui:619", "namespace": "ImGui", "ov_cimguiname": "igCollapsingHeader_BoolPtr", "ret": "bool", @@ -14050,7 +14622,7 @@ ], "igColorButton": [ { - "args": "(const char* desc_id,const ImVec4 col,ImGuiColorEditFlags flags,ImVec2 size)", + "args": "(const char* desc_id,const ImVec4 col,ImGuiColorEditFlags flags,const ImVec2 size)", "argsT": [ { "name": "desc_id", @@ -14066,10 +14638,10 @@ }, { "name": "size", - "type": "ImVec2" + "type": "const ImVec2" } ], - "argsoriginal": "(const char* desc_id,const ImVec4& col,ImGuiColorEditFlags flags=0,ImVec2 size=ImVec2(0,0))", + "argsoriginal": "(const char* desc_id,const ImVec4& col,ImGuiColorEditFlags flags=0,const ImVec2& size=ImVec2(0,0))", "call_args": "(desc_id,col,flags,size)", "cimguiname": "igColorButton", "defaults": { @@ -14077,11 +14649,11 @@ "size": "ImVec2(0,0)" }, "funcname": "ColorButton", - "location": "imgui:595", + "location": "imgui:599", "namespace": "ImGui", "ov_cimguiname": "igColorButton", "ret": "bool", - "signature": "(const char*,const ImVec4,ImGuiColorEditFlags,ImVec2)", + "signature": "(const char*,const ImVec4,ImGuiColorEditFlags,const ImVec2)", "stname": "" } ], @@ -14099,7 +14671,7 @@ "cimguiname": "igColorConvertFloat4ToU32", "defaults": {}, "funcname": "ColorConvertFloat4ToU32", - "location": "imgui:880", + "location": "imgui:884", "namespace": "ImGui", "ov_cimguiname": "igColorConvertFloat4ToU32", "ret": "ImU32", @@ -14144,7 +14716,7 @@ "cimguiname": "igColorConvertHSVtoRGB", "defaults": {}, "funcname": "ColorConvertHSVtoRGB", - "location": "imgui:882", + "location": "imgui:886", "namespace": "ImGui", "ov_cimguiname": "igColorConvertHSVtoRGB", "ret": "void", @@ -14189,7 +14761,7 @@ "cimguiname": "igColorConvertRGBtoHSV", "defaults": {}, "funcname": "ColorConvertRGBtoHSV", - "location": "imgui:881", + "location": "imgui:885", "namespace": "ImGui", "ov_cimguiname": "igColorConvertRGBtoHSV", "ret": "void", @@ -14215,7 +14787,7 @@ "cimguiname": "igColorConvertU32ToFloat4", "defaults": {}, "funcname": "ColorConvertU32ToFloat4", - "location": "imgui:879", + "location": "imgui:883", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igColorConvertU32ToFloat4", @@ -14248,7 +14820,7 @@ "flags": "0" }, "funcname": "ColorEdit3", - "location": "imgui:591", + "location": "imgui:595", "namespace": "ImGui", "ov_cimguiname": "igColorEdit3", "ret": "bool", @@ -14280,7 +14852,7 @@ "flags": "0" }, "funcname": "ColorEdit4", - "location": "imgui:592", + "location": "imgui:596", "namespace": "ImGui", "ov_cimguiname": "igColorEdit4", "ret": "bool", @@ -14306,7 +14878,7 @@ "cimguiname": "igColorEditOptionsPopup", "defaults": {}, "funcname": "ColorEditOptionsPopup", - "location": "imgui_internal:2766", + "location": "imgui_internal:3166", "namespace": "ImGui", "ov_cimguiname": "igColorEditOptionsPopup", "ret": "void", @@ -14338,7 +14910,7 @@ "flags": "0" }, "funcname": "ColorPicker3", - "location": "imgui:593", + "location": "imgui:597", "namespace": "ImGui", "ov_cimguiname": "igColorPicker3", "ret": "bool", @@ -14375,7 +14947,7 @@ "ref_col": "NULL" }, "funcname": "ColorPicker4", - "location": "imgui:594", + "location": "imgui:598", "namespace": "ImGui", "ov_cimguiname": "igColorPicker4", "ret": "bool", @@ -14401,7 +14973,7 @@ "cimguiname": "igColorPickerOptionsPopup", "defaults": {}, "funcname": "ColorPickerOptionsPopup", - "location": "imgui_internal:2767", + "location": "imgui_internal:3167", "namespace": "ImGui", "ov_cimguiname": "igColorPickerOptionsPopup", "ret": "void", @@ -14431,7 +15003,7 @@ "cimguiname": "igColorTooltip", "defaults": {}, "funcname": "ColorTooltip", - "location": "imgui_internal:2765", + "location": "imgui_internal:3165", "namespace": "ImGui", "ov_cimguiname": "igColorTooltip", "ret": "void", @@ -14505,7 +15077,7 @@ "popup_max_height_in_items": "-1" }, "funcname": "Combo", - "location": "imgui:521", + "location": "imgui:524", "namespace": "ImGui", "ov_cimguiname": "igCombo_Str_arr", "ret": "bool", @@ -14539,7 +15111,7 @@ "popup_max_height_in_items": "-1" }, "funcname": "Combo", - "location": "imgui:522", + "location": "imgui:525", "namespace": "ImGui", "ov_cimguiname": "igCombo_Str", "ret": "bool", @@ -14583,7 +15155,7 @@ "popup_max_height_in_items": "-1" }, "funcname": "Combo", - "location": "imgui:523", + "location": "imgui:526", "namespace": "ImGui", "ov_cimguiname": "igCombo_FnBoolPtr", "ret": "bool", @@ -14591,6 +15163,54 @@ "stname": "" } ], + "igConvertShortcutMod": [ + { + "args": "(ImGuiKeyChord key_chord)", + "argsT": [ + { + "name": "key_chord", + "type": "ImGuiKeyChord" + } + ], + "argsoriginal": "(ImGuiKeyChord key_chord)", + "call_args": "(key_chord)", + "cimguiname": "igConvertShortcutMod", + "defaults": {}, + "funcname": "ConvertShortcutMod", + "location": "imgui_internal:2910", + "namespace": "ImGui", + "ov_cimguiname": "igConvertShortcutMod", + "ret": "ImGuiKeyChord", + "signature": "(ImGuiKeyChord)", + "stname": "" + } + ], + "igConvertSingleModFlagToKey": [ + { + "args": "(ImGuiContext* ctx,ImGuiKey key)", + "argsT": [ + { + "name": "ctx", + "type": "ImGuiContext*" + }, + { + "name": "key", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiContext* ctx,ImGuiKey key)", + "call_args": "(ctx,key)", + "cimguiname": "igConvertSingleModFlagToKey", + "defaults": {}, + "funcname": "ConvertSingleModFlagToKey", + "location": "imgui_internal:2911", + "namespace": "ImGui", + "ov_cimguiname": "igConvertSingleModFlagToKey", + "ret": "ImGuiKey", + "signature": "(ImGuiContext*,ImGuiKey)", + "stname": "" + } + ], "igCreateContext": [ { "args": "(ImFontAtlas* shared_font_atlas)", @@ -14607,7 +15227,7 @@ "shared_font_atlas": "NULL" }, "funcname": "CreateContext", - "location": "imgui:294", + "location": "imgui:289", "namespace": "ImGui", "ov_cimguiname": "igCreateContext", "ret": "ImGuiContext*", @@ -14629,7 +15249,7 @@ "cimguiname": "igCreateNewWindowSettings", "defaults": {}, "funcname": "CreateNewWindowSettings", - "location": "imgui_internal:2470", + "location": "imgui_internal:2797", "namespace": "ImGui", "ov_cimguiname": "igCreateNewWindowSettings", "ret": "ImGuiWindowSettings*", @@ -14637,79 +15257,75 @@ "stname": "" } ], - "igDataTypeApplyOp": [ + "igDataTypeApplyFromText": [ { - "args": "(ImGuiDataType data_type,int op,void* output,const void* arg_1,const void* arg_2)", + "args": "(const char* buf,ImGuiDataType data_type,void* p_data,const char* format)", "argsT": [ { - "name": "data_type", - "type": "ImGuiDataType" + "name": "buf", + "type": "const char*" }, { - "name": "op", - "type": "int" + "name": "data_type", + "type": "ImGuiDataType" }, { - "name": "output", + "name": "p_data", "type": "void*" }, { - "name": "arg_1", - "type": "const void*" - }, - { - "name": "arg_2", - "type": "const void*" + "name": "format", + "type": "const char*" } ], - "argsoriginal": "(ImGuiDataType data_type,int op,void* output,const void* arg_1,const void* arg_2)", - "call_args": "(data_type,op,output,arg_1,arg_2)", - "cimguiname": "igDataTypeApplyOp", + "argsoriginal": "(const char* buf,ImGuiDataType data_type,void* p_data,const char* format)", + "call_args": "(buf,data_type,p_data,format)", + "cimguiname": "igDataTypeApplyFromText", "defaults": {}, - "funcname": "DataTypeApplyOp", - "location": "imgui_internal:2752", + "funcname": "DataTypeApplyFromText", + "location": "imgui_internal:3152", "namespace": "ImGui", - "ov_cimguiname": "igDataTypeApplyOp", - "ret": "void", - "signature": "(ImGuiDataType,int,void*,const void*,const void*)", + "ov_cimguiname": "igDataTypeApplyFromText", + "ret": "bool", + "signature": "(const char*,ImGuiDataType,void*,const char*)", "stname": "" } ], - "igDataTypeApplyOpFromText": [ + "igDataTypeApplyOp": [ { - "args": "(const char* buf,const char* initial_value_buf,ImGuiDataType data_type,void* p_data,const char* format)", + "args": "(ImGuiDataType data_type,int op,void* output,const void* arg_1,const void* arg_2)", "argsT": [ { - "name": "buf", - "type": "const char*" + "name": "data_type", + "type": "ImGuiDataType" }, { - "name": "initial_value_buf", - "type": "const char*" + "name": "op", + "type": "int" }, { - "name": "data_type", - "type": "ImGuiDataType" + "name": "output", + "type": "void*" }, { - "name": "p_data", - "type": "void*" + "name": "arg_1", + "type": "const void*" }, { - "name": "format", - "type": "const char*" + "name": "arg_2", + "type": "const void*" } ], - "argsoriginal": "(const char* buf,const char* initial_value_buf,ImGuiDataType data_type,void* p_data,const char* format)", - "call_args": "(buf,initial_value_buf,data_type,p_data,format)", - "cimguiname": "igDataTypeApplyOpFromText", + "argsoriginal": "(ImGuiDataType data_type,int op,void* output,const void* arg_1,const void* arg_2)", + "call_args": "(data_type,op,output,arg_1,arg_2)", + "cimguiname": "igDataTypeApplyOp", "defaults": {}, - "funcname": "DataTypeApplyOpFromText", - "location": "imgui_internal:2753", + "funcname": "DataTypeApplyOp", + "location": "imgui_internal:3151", "namespace": "ImGui", - "ov_cimguiname": "igDataTypeApplyOpFromText", - "ret": "bool", - "signature": "(const char*,const char*,ImGuiDataType,void*,const char*)", + "ov_cimguiname": "igDataTypeApplyOp", + "ret": "void", + "signature": "(ImGuiDataType,int,void*,const void*,const void*)", "stname": "" } ], @@ -14739,7 +15355,7 @@ "cimguiname": "igDataTypeClamp", "defaults": {}, "funcname": "DataTypeClamp", - "location": "imgui_internal:2755", + "location": "imgui_internal:3154", "namespace": "ImGui", "ov_cimguiname": "igDataTypeClamp", "ret": "bool", @@ -14769,7 +15385,7 @@ "cimguiname": "igDataTypeCompare", "defaults": {}, "funcname": "DataTypeCompare", - "location": "imgui_internal:2754", + "location": "imgui_internal:3153", "namespace": "ImGui", "ov_cimguiname": "igDataTypeCompare", "ret": "int", @@ -14807,7 +15423,7 @@ "cimguiname": "igDataTypeFormatString", "defaults": {}, "funcname": "DataTypeFormatString", - "location": "imgui_internal:2751", + "location": "imgui_internal:3150", "namespace": "ImGui", "ov_cimguiname": "igDataTypeFormatString", "ret": "int", @@ -14829,7 +15445,7 @@ "cimguiname": "igDataTypeGetInfo", "defaults": {}, "funcname": "DataTypeGetInfo", - "location": "imgui_internal:2750", + "location": "imgui_internal:3149", "namespace": "ImGui", "ov_cimguiname": "igDataTypeGetInfo", "ret": "const ImGuiDataTypeInfo*", @@ -14875,7 +15491,7 @@ "cimguiname": "igDebugCheckVersionAndDataLayout", "defaults": {}, "funcname": "DebugCheckVersionAndDataLayout", - "location": "imgui:931", + "location": "imgui:937", "namespace": "ImGui", "ov_cimguiname": "igDebugCheckVersionAndDataLayout", "ret": "bool", @@ -14899,7 +15515,7 @@ "col": "4278190335" }, "funcname": "DebugDrawItemRect", - "location": "imgui_internal:2784", + "location": "imgui_internal:3192", "namespace": "ImGui", "ov_cimguiname": "igDebugDrawItemRect", "ret": "void", @@ -14933,7 +15549,7 @@ "cimguiname": "igDebugHookIdInfo", "defaults": {}, "funcname": "DebugHookIdInfo", - "location": "imgui_internal:2788", + "location": "imgui_internal:3195", "namespace": "ImGui", "ov_cimguiname": "igDebugHookIdInfo", "ret": "void", @@ -14941,6 +15557,120 @@ "stname": "" } ], + "igDebugLocateItem": [ + { + "args": "(ImGuiID target_id)", + "argsT": [ + { + "name": "target_id", + "type": "ImGuiID" + } + ], + "argsoriginal": "(ImGuiID target_id)", + "call_args": "(target_id)", + "cimguiname": "igDebugLocateItem", + "defaults": {}, + "funcname": "DebugLocateItem", + "location": "imgui_internal:3189", + "namespace": "ImGui", + "ov_cimguiname": "igDebugLocateItem", + "ret": "void", + "signature": "(ImGuiID)", + "stname": "" + } + ], + "igDebugLocateItemOnHover": [ + { + "args": "(ImGuiID target_id)", + "argsT": [ + { + "name": "target_id", + "type": "ImGuiID" + } + ], + "argsoriginal": "(ImGuiID target_id)", + "call_args": "(target_id)", + "cimguiname": "igDebugLocateItemOnHover", + "defaults": {}, + "funcname": "DebugLocateItemOnHover", + "location": "imgui_internal:3190", + "namespace": "ImGui", + "ov_cimguiname": "igDebugLocateItemOnHover", + "ret": "void", + "signature": "(ImGuiID)", + "stname": "" + } + ], + "igDebugLocateItemResolveWithLastItem": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "igDebugLocateItemResolveWithLastItem", + "defaults": {}, + "funcname": "DebugLocateItemResolveWithLastItem", + "location": "imgui_internal:3191", + "namespace": "ImGui", + "ov_cimguiname": "igDebugLocateItemResolveWithLastItem", + "ret": "void", + "signature": "()", + "stname": "" + } + ], + "igDebugLog": [ + { + "args": "(const char* fmt,...)", + "argsT": [ + { + "name": "fmt", + "type": "const char*" + }, + { + "name": "...", + "type": "..." + } + ], + "argsoriginal": "(const char* fmt,...)", + "call_args": "(fmt,...)", + "cimguiname": "igDebugLog", + "defaults": {}, + "funcname": "DebugLog", + "isvararg": "...)", + "location": "imgui_internal:3182", + "namespace": "ImGui", + "ov_cimguiname": "igDebugLog", + "ret": "void", + "signature": "(const char*,...)", + "stname": "" + } + ], + "igDebugLogV": [ + { + "args": "(const char* fmt,va_list args)", + "argsT": [ + { + "name": "fmt", + "type": "const char*" + }, + { + "name": "args", + "type": "va_list" + } + ], + "argsoriginal": "(const char* fmt,va_list args)", + "call_args": "(fmt,args)", + "cimguiname": "igDebugLogV", + "defaults": {}, + "funcname": "DebugLogV", + "location": "imgui_internal:3183", + "namespace": "ImGui", + "ov_cimguiname": "igDebugLogV", + "ret": "void", + "signature": "(const char*,va_list)", + "stname": "" + } + ], "igDebugNodeColumns": [ { "args": "(ImGuiOldColumns* columns)", @@ -14955,7 +15685,7 @@ "cimguiname": "igDebugNodeColumns", "defaults": {}, "funcname": "DebugNodeColumns", - "location": "imgui_internal:2789", + "location": "imgui_internal:3196", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeColumns", "ret": "void", @@ -14993,7 +15723,7 @@ "cimguiname": "igDebugNodeDrawCmdShowMeshAndBoundingBox", "defaults": {}, "funcname": "DebugNodeDrawCmdShowMeshAndBoundingBox", - "location": "imgui_internal:2791", + "location": "imgui_internal:3198", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeDrawCmdShowMeshAndBoundingBox", "ret": "void", @@ -15023,7 +15753,7 @@ "cimguiname": "igDebugNodeDrawList", "defaults": {}, "funcname": "DebugNodeDrawList", - "location": "imgui_internal:2790", + "location": "imgui_internal:3197", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeDrawList", "ret": "void", @@ -15045,7 +15775,7 @@ "cimguiname": "igDebugNodeFont", "defaults": {}, "funcname": "DebugNodeFont", - "location": "imgui_internal:2792", + "location": "imgui_internal:3199", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeFont", "ret": "void", @@ -15053,6 +15783,54 @@ "stname": "" } ], + "igDebugNodeFontGlyph": [ + { + "args": "(ImFont* font,const ImFontGlyph* glyph)", + "argsT": [ + { + "name": "font", + "type": "ImFont*" + }, + { + "name": "glyph", + "type": "const ImFontGlyph*" + } + ], + "argsoriginal": "(ImFont* font,const ImFontGlyph* glyph)", + "call_args": "(font,glyph)", + "cimguiname": "igDebugNodeFontGlyph", + "defaults": {}, + "funcname": "DebugNodeFontGlyph", + "location": "imgui_internal:3200", + "namespace": "ImGui", + "ov_cimguiname": "igDebugNodeFontGlyph", + "ret": "void", + "signature": "(ImFont*,const ImFontGlyph*)", + "stname": "" + } + ], + "igDebugNodeInputTextState": [ + { + "args": "(ImGuiInputTextState* state)", + "argsT": [ + { + "name": "state", + "type": "ImGuiInputTextState*" + } + ], + "argsoriginal": "(ImGuiInputTextState* state)", + "call_args": "(state)", + "cimguiname": "igDebugNodeInputTextState", + "defaults": {}, + "funcname": "DebugNodeInputTextState", + "location": "imgui_internal:3205", + "namespace": "ImGui", + "ov_cimguiname": "igDebugNodeInputTextState", + "ret": "void", + "signature": "(ImGuiInputTextState*)", + "stname": "" + } + ], "igDebugNodeStorage": [ { "args": "(ImGuiStorage* storage,const char* label)", @@ -15071,7 +15849,7 @@ "cimguiname": "igDebugNodeStorage", "defaults": {}, "funcname": "DebugNodeStorage", - "location": "imgui_internal:2793", + "location": "imgui_internal:3201", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeStorage", "ret": "void", @@ -15097,7 +15875,7 @@ "cimguiname": "igDebugNodeTabBar", "defaults": {}, "funcname": "DebugNodeTabBar", - "location": "imgui_internal:2794", + "location": "imgui_internal:3202", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeTabBar", "ret": "void", @@ -15119,7 +15897,7 @@ "cimguiname": "igDebugNodeTable", "defaults": {}, "funcname": "DebugNodeTable", - "location": "imgui_internal:2795", + "location": "imgui_internal:3203", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeTable", "ret": "void", @@ -15141,7 +15919,7 @@ "cimguiname": "igDebugNodeTableSettings", "defaults": {}, "funcname": "DebugNodeTableSettings", - "location": "imgui_internal:2796", + "location": "imgui_internal:3204", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeTableSettings", "ret": "void", @@ -15163,7 +15941,7 @@ "cimguiname": "igDebugNodeViewport", "defaults": {}, "funcname": "DebugNodeViewport", - "location": "imgui_internal:2801", + "location": "imgui_internal:3210", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeViewport", "ret": "void", @@ -15189,7 +15967,7 @@ "cimguiname": "igDebugNodeWindow", "defaults": {}, "funcname": "DebugNodeWindow", - "location": "imgui_internal:2797", + "location": "imgui_internal:3206", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeWindow", "ret": "void", @@ -15211,7 +15989,7 @@ "cimguiname": "igDebugNodeWindowSettings", "defaults": {}, "funcname": "DebugNodeWindowSettings", - "location": "imgui_internal:2798", + "location": "imgui_internal:3207", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeWindowSettings", "ret": "void", @@ -15237,7 +16015,7 @@ "cimguiname": "igDebugNodeWindowsList", "defaults": {}, "funcname": "DebugNodeWindowsList", - "location": "imgui_internal:2799", + "location": "imgui_internal:3208", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeWindowsList", "ret": "void", @@ -15267,7 +16045,7 @@ "cimguiname": "igDebugNodeWindowsListByBeginStackParent", "defaults": {}, "funcname": "DebugNodeWindowsListByBeginStackParent", - "location": "imgui_internal:2800", + "location": "imgui_internal:3209", "namespace": "ImGui", "ov_cimguiname": "igDebugNodeWindowsListByBeginStackParent", "ret": "void", @@ -15275,6 +16053,28 @@ "stname": "" } ], + "igDebugRenderKeyboardPreview": [ + { + "args": "(ImDrawList* draw_list)", + "argsT": [ + { + "name": "draw_list", + "type": "ImDrawList*" + } + ], + "argsoriginal": "(ImDrawList* draw_list)", + "call_args": "(draw_list)", + "cimguiname": "igDebugRenderKeyboardPreview", + "defaults": {}, + "funcname": "DebugRenderKeyboardPreview", + "location": "imgui_internal:3211", + "namespace": "ImGui", + "ov_cimguiname": "igDebugRenderKeyboardPreview", + "ret": "void", + "signature": "(ImDrawList*)", + "stname": "" + } + ], "igDebugRenderViewportThumbnail": [ { "args": "(ImDrawList* draw_list,ImGuiViewportP* viewport,const ImRect bb)", @@ -15297,7 +16097,7 @@ "cimguiname": "igDebugRenderViewportThumbnail", "defaults": {}, "funcname": "DebugRenderViewportThumbnail", - "location": "imgui_internal:2802", + "location": "imgui_internal:3212", "namespace": "ImGui", "ov_cimguiname": "igDebugRenderViewportThumbnail", "ret": "void", @@ -15314,7 +16114,7 @@ "cimguiname": "igDebugStartItemPicker", "defaults": {}, "funcname": "DebugStartItemPicker", - "location": "imgui_internal:2785", + "location": "imgui_internal:3193", "namespace": "ImGui", "ov_cimguiname": "igDebugStartItemPicker", "ret": "void", @@ -15322,6 +16122,28 @@ "stname": "" } ], + "igDebugTextEncoding": [ + { + "args": "(const char* text)", + "argsT": [ + { + "name": "text", + "type": "const char*" + } + ], + "argsoriginal": "(const char* text)", + "call_args": "(text)", + "cimguiname": "igDebugTextEncoding", + "defaults": {}, + "funcname": "DebugTextEncoding", + "location": "imgui:936", + "namespace": "ImGui", + "ov_cimguiname": "igDebugTextEncoding", + "ret": "void", + "signature": "(const char*)", + "stname": "" + } + ], "igDestroyContext": [ { "args": "(ImGuiContext* ctx)", @@ -15338,7 +16160,7 @@ "ctx": "NULL" }, "funcname": "DestroyContext", - "location": "imgui:295", + "location": "imgui:290", "namespace": "ImGui", "ov_cimguiname": "igDestroyContext", "ret": "void", @@ -15388,7 +16210,7 @@ "cimguiname": "igDragBehavior", "defaults": {}, "funcname": "DragBehavior", - "location": "imgui_internal:2732", + "location": "imgui_internal:3130", "namespace": "ImGui", "ov_cimguiname": "igDragBehavior", "ret": "bool", @@ -15440,7 +16262,7 @@ "v_speed": "1.0f" }, "funcname": "DragFloat", - "location": "imgui:536", + "location": "imgui:540", "namespace": "ImGui", "ov_cimguiname": "igDragFloat", "ret": "bool", @@ -15492,7 +16314,7 @@ "v_speed": "1.0f" }, "funcname": "DragFloat2", - "location": "imgui:537", + "location": "imgui:541", "namespace": "ImGui", "ov_cimguiname": "igDragFloat2", "ret": "bool", @@ -15544,7 +16366,7 @@ "v_speed": "1.0f" }, "funcname": "DragFloat3", - "location": "imgui:538", + "location": "imgui:542", "namespace": "ImGui", "ov_cimguiname": "igDragFloat3", "ret": "bool", @@ -15596,7 +16418,7 @@ "v_speed": "1.0f" }, "funcname": "DragFloat4", - "location": "imgui:539", + "location": "imgui:543", "namespace": "ImGui", "ov_cimguiname": "igDragFloat4", "ret": "bool", @@ -15657,7 +16479,7 @@ "v_speed": "1.0f" }, "funcname": "DragFloatRange2", - "location": "imgui:540", + "location": "imgui:544", "namespace": "ImGui", "ov_cimguiname": "igDragFloatRange2", "ret": "bool", @@ -15709,7 +16531,7 @@ "v_speed": "1.0f" }, "funcname": "DragInt", - "location": "imgui:541", + "location": "imgui:545", "namespace": "ImGui", "ov_cimguiname": "igDragInt", "ret": "bool", @@ -15761,7 +16583,7 @@ "v_speed": "1.0f" }, "funcname": "DragInt2", - "location": "imgui:542", + "location": "imgui:546", "namespace": "ImGui", "ov_cimguiname": "igDragInt2", "ret": "bool", @@ -15813,7 +16635,7 @@ "v_speed": "1.0f" }, "funcname": "DragInt3", - "location": "imgui:543", + "location": "imgui:547", "namespace": "ImGui", "ov_cimguiname": "igDragInt3", "ret": "bool", @@ -15865,7 +16687,7 @@ "v_speed": "1.0f" }, "funcname": "DragInt4", - "location": "imgui:544", + "location": "imgui:548", "namespace": "ImGui", "ov_cimguiname": "igDragInt4", "ret": "bool", @@ -15926,7 +16748,7 @@ "v_speed": "1.0f" }, "funcname": "DragIntRange2", - "location": "imgui:545", + "location": "imgui:549", "namespace": "ImGui", "ov_cimguiname": "igDragIntRange2", "ret": "bool", @@ -15982,7 +16804,7 @@ "v_speed": "1.0f" }, "funcname": "DragScalar", - "location": "imgui:546", + "location": "imgui:550", "namespace": "ImGui", "ov_cimguiname": "igDragScalar", "ret": "bool", @@ -16042,7 +16864,7 @@ "v_speed": "1.0f" }, "funcname": "DragScalarN", - "location": "imgui:547", + "location": "imgui:551", "namespace": "ImGui", "ov_cimguiname": "igDragScalarN", "ret": "bool", @@ -16064,7 +16886,7 @@ "cimguiname": "igDummy", "defaults": {}, "funcname": "Dummy", - "location": "imgui:444", + "location": "imgui:443", "namespace": "ImGui", "ov_cimguiname": "igDummy", "ret": "void", @@ -16081,7 +16903,7 @@ "cimguiname": "igEnd", "defaults": {}, "funcname": "End", - "location": "imgui:336", + "location": "imgui:332", "namespace": "ImGui", "ov_cimguiname": "igEnd", "ret": "void", @@ -16098,7 +16920,7 @@ "cimguiname": "igEndChild", "defaults": {}, "funcname": "EndChild", - "location": "imgui:348", + "location": "imgui:344", "namespace": "ImGui", "ov_cimguiname": "igEndChild", "ret": "void", @@ -16115,7 +16937,7 @@ "cimguiname": "igEndChildFrame", "defaults": {}, "funcname": "EndChildFrame", - "location": "imgui:873", + "location": "imgui:877", "namespace": "ImGui", "ov_cimguiname": "igEndChildFrame", "ret": "void", @@ -16132,7 +16954,7 @@ "cimguiname": "igEndColumns", "defaults": {}, "funcname": "EndColumns", - "location": "imgui_internal:2611", + "location": "imgui_internal:3002", "namespace": "ImGui", "ov_cimguiname": "igEndColumns", "ret": "void", @@ -16149,7 +16971,7 @@ "cimguiname": "igEndCombo", "defaults": {}, "funcname": "EndCombo", - "location": "imgui:520", + "location": "imgui:523", "namespace": "ImGui", "ov_cimguiname": "igEndCombo", "ret": "void", @@ -16166,7 +16988,7 @@ "cimguiname": "igEndComboPreview", "defaults": {}, "funcname": "EndComboPreview", - "location": "imgui_internal:2564", + "location": "imgui_internal:2885", "namespace": "ImGui", "ov_cimguiname": "igEndComboPreview", "ret": "void", @@ -16183,7 +17005,7 @@ "cimguiname": "igEndDisabled", "defaults": {}, "funcname": "EndDisabled", - "location": "imgui:822", + "location": "imgui:823", "namespace": "ImGui", "ov_cimguiname": "igEndDisabled", "ret": "void", @@ -16200,7 +17022,7 @@ "cimguiname": "igEndDragDropSource", "defaults": {}, "funcname": "EndDragDropSource", - "location": "imgui:811", + "location": "imgui:812", "namespace": "ImGui", "ov_cimguiname": "igEndDragDropSource", "ret": "void", @@ -16217,7 +17039,7 @@ "cimguiname": "igEndDragDropTarget", "defaults": {}, "funcname": "EndDragDropTarget", - "location": "imgui:814", + "location": "imgui:815", "namespace": "ImGui", "ov_cimguiname": "igEndDragDropTarget", "ret": "void", @@ -16234,7 +17056,7 @@ "cimguiname": "igEndFrame", "defaults": {}, "funcname": "EndFrame", - "location": "imgui:303", + "location": "imgui:298", "namespace": "ImGui", "ov_cimguiname": "igEndFrame", "ret": "void", @@ -16251,7 +17073,7 @@ "cimguiname": "igEndGroup", "defaults": {}, "funcname": "EndGroup", - "location": "imgui:448", + "location": "imgui:447", "namespace": "ImGui", "ov_cimguiname": "igEndGroup", "ret": "void", @@ -16268,7 +17090,7 @@ "cimguiname": "igEndListBox", "defaults": {}, "funcname": "EndListBox", - "location": "imgui:631", + "location": "imgui:635", "namespace": "ImGui", "ov_cimguiname": "igEndListBox", "ret": "void", @@ -16285,7 +17107,7 @@ "cimguiname": "igEndMainMenuBar", "defaults": {}, "funcname": "EndMainMenuBar", - "location": "imgui:657", + "location": "imgui:661", "namespace": "ImGui", "ov_cimguiname": "igEndMainMenuBar", "ret": "void", @@ -16302,7 +17124,7 @@ "cimguiname": "igEndMenu", "defaults": {}, "funcname": "EndMenu", - "location": "imgui:659", + "location": "imgui:663", "namespace": "ImGui", "ov_cimguiname": "igEndMenu", "ret": "void", @@ -16319,7 +17141,7 @@ "cimguiname": "igEndMenuBar", "defaults": {}, "funcname": "EndMenuBar", - "location": "imgui:655", + "location": "imgui:659", "namespace": "ImGui", "ov_cimguiname": "igEndMenuBar", "ret": "void", @@ -16336,7 +17158,7 @@ "cimguiname": "igEndPopup", "defaults": {}, "funcname": "EndPopup", - "location": "imgui:684", + "location": "imgui:688", "namespace": "ImGui", "ov_cimguiname": "igEndPopup", "ret": "void", @@ -16353,7 +17175,7 @@ "cimguiname": "igEndTabBar", "defaults": {}, "funcname": "EndTabBar", - "location": "imgui:788", + "location": "imgui:789", "namespace": "ImGui", "ov_cimguiname": "igEndTabBar", "ret": "void", @@ -16370,7 +17192,7 @@ "cimguiname": "igEndTabItem", "defaults": {}, "funcname": "EndTabItem", - "location": "imgui:790", + "location": "imgui:791", "namespace": "ImGui", "ov_cimguiname": "igEndTabItem", "ret": "void", @@ -16387,7 +17209,7 @@ "cimguiname": "igEndTable", "defaults": {}, "funcname": "EndTable", - "location": "imgui:739", + "location": "imgui:742", "namespace": "ImGui", "ov_cimguiname": "igEndTable", "ret": "void", @@ -16404,7 +17226,7 @@ "cimguiname": "igEndTooltip", "defaults": {}, "funcname": "EndTooltip", - "location": "imgui:666", + "location": "imgui:670", "namespace": "ImGui", "ov_cimguiname": "igEndTooltip", "ret": "void", @@ -16432,7 +17254,7 @@ "user_data": "NULL" }, "funcname": "ErrorCheckEndFrameRecover", - "location": "imgui_internal:2782", + "location": "imgui_internal:3186", "namespace": "ImGui", "ov_cimguiname": "igErrorCheckEndFrameRecover", "ret": "void", @@ -16460,7 +17282,7 @@ "user_data": "NULL" }, "funcname": "ErrorCheckEndWindowRecover", - "location": "imgui_internal:2783", + "location": "imgui_internal:3187", "namespace": "ImGui", "ov_cimguiname": "igErrorCheckEndWindowRecover", "ret": "void", @@ -16468,6 +17290,23 @@ "stname": "" } ], + "igErrorCheckUsingSetCursorPosToExtendParentBoundaries": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "igErrorCheckUsingSetCursorPosToExtendParentBoundaries", + "defaults": {}, + "funcname": "ErrorCheckUsingSetCursorPosToExtendParentBoundaries", + "location": "imgui_internal:3188", + "namespace": "ImGui", + "ov_cimguiname": "igErrorCheckUsingSetCursorPosToExtendParentBoundaries", + "ret": "void", + "signature": "()", + "stname": "" + } + ], "igFindBestWindowPosForPopup": [ { "args": "(ImVec2 *pOut,ImGuiWindow* window)", @@ -16486,7 +17325,7 @@ "cimguiname": "igFindBestWindowPosForPopup", "defaults": {}, "funcname": "FindBestWindowPosForPopup", - "location": "imgui_internal:2553", + "location": "imgui_internal:2874", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igFindBestWindowPosForPopup", @@ -16533,7 +17372,7 @@ "cimguiname": "igFindBestWindowPosForPopupEx", "defaults": {}, "funcname": "FindBestWindowPosForPopupEx", - "location": "imgui_internal:2554", + "location": "imgui_internal:2875", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igFindBestWindowPosForPopupEx", @@ -16556,7 +17395,7 @@ "cimguiname": "igFindBottomMostVisibleWindowWithinBeginStack", "defaults": {}, "funcname": "FindBottomMostVisibleWindowWithinBeginStack", - "location": "imgui_internal:2442", + "location": "imgui_internal:2760", "namespace": "ImGui", "ov_cimguiname": "igFindBottomMostVisibleWindowWithinBeginStack", "ret": "ImGuiWindow*", @@ -16582,7 +17421,7 @@ "cimguiname": "igFindOrCreateColumns", "defaults": {}, "funcname": "FindOrCreateColumns", - "location": "imgui_internal:2616", + "location": "imgui_internal:3007", "namespace": "ImGui", "ov_cimguiname": "igFindOrCreateColumns", "ret": "ImGuiOldColumns*", @@ -16590,28 +17429,6 @@ "stname": "" } ], - "igFindOrCreateWindowSettings": [ - { - "args": "(const char* name)", - "argsT": [ - { - "name": "name", - "type": "const char*" - } - ], - "argsoriginal": "(const char* name)", - "call_args": "(name)", - "cimguiname": "igFindOrCreateWindowSettings", - "defaults": {}, - "funcname": "FindOrCreateWindowSettings", - "location": "imgui_internal:2472", - "namespace": "ImGui", - "ov_cimguiname": "igFindOrCreateWindowSettings", - "ret": "ImGuiWindowSettings*", - "signature": "(const char*)", - "stname": "" - } - ], "igFindRenderedTextEnd": [ { "args": "(const char* text,const char* text_end)", @@ -16632,7 +17449,7 @@ "text_end": "NULL" }, "funcname": "FindRenderedTextEnd", - "location": "imgui_internal:2696", + "location": "imgui_internal:3097", "namespace": "ImGui", "ov_cimguiname": "igFindRenderedTextEnd", "ret": "const char*", @@ -16654,7 +17471,7 @@ "cimguiname": "igFindSettingsHandler", "defaults": {}, "funcname": "FindSettingsHandler", - "location": "imgui_internal:2473", + "location": "imgui_internal:2794", "namespace": "ImGui", "ov_cimguiname": "igFindSettingsHandler", "ret": "ImGuiSettingsHandler*", @@ -16676,7 +17493,7 @@ "cimguiname": "igFindWindowByID", "defaults": {}, "funcname": "FindWindowByID", - "location": "imgui_internal:2419", + "location": "imgui_internal:2736", "namespace": "ImGui", "ov_cimguiname": "igFindWindowByID", "ret": "ImGuiWindow*", @@ -16698,7 +17515,7 @@ "cimguiname": "igFindWindowByName", "defaults": {}, "funcname": "FindWindowByName", - "location": "imgui_internal:2420", + "location": "imgui_internal:2737", "namespace": "ImGui", "ov_cimguiname": "igFindWindowByName", "ret": "ImGuiWindow*", @@ -16720,7 +17537,7 @@ "cimguiname": "igFindWindowDisplayIndex", "defaults": {}, "funcname": "FindWindowDisplayIndex", - "location": "imgui_internal:2441", + "location": "imgui_internal:2759", "namespace": "ImGui", "ov_cimguiname": "igFindWindowDisplayIndex", "ret": "int", @@ -16728,7 +17545,7 @@ "stname": "" } ], - "igFindWindowSettings": [ + "igFindWindowSettingsByID": [ { "args": "(ImGuiID id)", "argsT": [ @@ -16739,17 +17556,39 @@ ], "argsoriginal": "(ImGuiID id)", "call_args": "(id)", - "cimguiname": "igFindWindowSettings", + "cimguiname": "igFindWindowSettingsByID", "defaults": {}, - "funcname": "FindWindowSettings", - "location": "imgui_internal:2471", + "funcname": "FindWindowSettingsByID", + "location": "imgui_internal:2798", "namespace": "ImGui", - "ov_cimguiname": "igFindWindowSettings", + "ov_cimguiname": "igFindWindowSettingsByID", "ret": "ImGuiWindowSettings*", "signature": "(ImGuiID)", "stname": "" } ], + "igFindWindowSettingsByWindow": [ + { + "args": "(ImGuiWindow* window)", + "argsT": [ + { + "name": "window", + "type": "ImGuiWindow*" + } + ], + "argsoriginal": "(ImGuiWindow* window)", + "call_args": "(window)", + "cimguiname": "igFindWindowSettingsByWindow", + "defaults": {}, + "funcname": "FindWindowSettingsByWindow", + "location": "imgui_internal:2799", + "namespace": "ImGui", + "ov_cimguiname": "igFindWindowSettingsByWindow", + "ret": "ImGuiWindowSettings*", + "signature": "(ImGuiWindow*)", + "stname": "" + } + ], "igFocusTopMostWindowUnderOne": [ { "args": "(ImGuiWindow* under_this_window,ImGuiWindow* ignore_window)", @@ -16768,7 +17607,7 @@ "cimguiname": "igFocusTopMostWindowUnderOne", "defaults": {}, "funcname": "FocusTopMostWindowUnderOne", - "location": "imgui_internal:2436", + "location": "imgui_internal:2754", "namespace": "ImGui", "ov_cimguiname": "igFocusTopMostWindowUnderOne", "ret": "void", @@ -16790,7 +17629,7 @@ "cimguiname": "igFocusWindow", "defaults": {}, "funcname": "FocusWindow", - "location": "imgui_internal:2435", + "location": "imgui_internal:2753", "namespace": "ImGui", "ov_cimguiname": "igFocusWindow", "ret": "void", @@ -16812,7 +17651,7 @@ "cimguiname": "igGcAwakeTransientWindowBuffers", "defaults": {}, "funcname": "GcAwakeTransientWindowBuffers", - "location": "imgui_internal:2779", + "location": "imgui_internal:3179", "namespace": "ImGui", "ov_cimguiname": "igGcAwakeTransientWindowBuffers", "ret": "void", @@ -16829,7 +17668,7 @@ "cimguiname": "igGcCompactTransientMiscBuffers", "defaults": {}, "funcname": "GcCompactTransientMiscBuffers", - "location": "imgui_internal:2777", + "location": "imgui_internal:3177", "namespace": "ImGui", "ov_cimguiname": "igGcCompactTransientMiscBuffers", "ret": "void", @@ -16851,7 +17690,7 @@ "cimguiname": "igGcCompactTransientWindowBuffers", "defaults": {}, "funcname": "GcCompactTransientWindowBuffers", - "location": "imgui_internal:2778", + "location": "imgui_internal:3178", "namespace": "ImGui", "ov_cimguiname": "igGcCompactTransientWindowBuffers", "ret": "void", @@ -16868,7 +17707,7 @@ "cimguiname": "igGetActiveID", "defaults": {}, "funcname": "GetActiveID", - "location": "imgui_internal:2494", + "location": "imgui_internal:2823", "namespace": "ImGui", "ov_cimguiname": "igGetActiveID", "ret": "ImGuiID", @@ -16898,7 +17737,7 @@ "cimguiname": "igGetAllocatorFunctions", "defaults": {}, "funcname": "GetAllocatorFunctions", - "location": "imgui:938", + "location": "imgui:944", "namespace": "ImGui", "ov_cimguiname": "igGetAllocatorFunctions", "ret": "void", @@ -16915,7 +17754,7 @@ "cimguiname": "igGetBackgroundDrawList", "defaults": {}, "funcname": "GetBackgroundDrawList", - "location": "imgui:866", + "location": "imgui:864", "namespace": "ImGui", "ov_cimguiname": "igGetBackgroundDrawList_Nil", "ret": "ImDrawList*", @@ -16935,7 +17774,7 @@ "cimguiname": "igGetBackgroundDrawList", "defaults": {}, "funcname": "GetBackgroundDrawList", - "location": "imgui_internal:2448", + "location": "imgui_internal:2766", "namespace": "ImGui", "ov_cimguiname": "igGetBackgroundDrawList_ViewportPtr", "ret": "ImDrawList*", @@ -16952,7 +17791,7 @@ "cimguiname": "igGetClipboardText", "defaults": {}, "funcname": "GetClipboardText", - "location": "imgui:917", + "location": "imgui:923", "namespace": "ImGui", "ov_cimguiname": "igGetClipboardText", "ret": "const char*", @@ -16980,7 +17819,7 @@ "alpha_mul": "1.0f" }, "funcname": "GetColorU32", - "location": "imgui:428", + "location": "imgui:427", "namespace": "ImGui", "ov_cimguiname": "igGetColorU32_Col", "ret": "ImU32", @@ -17000,7 +17839,7 @@ "cimguiname": "igGetColorU32", "defaults": {}, "funcname": "GetColorU32", - "location": "imgui:429", + "location": "imgui:428", "namespace": "ImGui", "ov_cimguiname": "igGetColorU32_Vec4", "ret": "ImU32", @@ -17020,7 +17859,7 @@ "cimguiname": "igGetColorU32", "defaults": {}, "funcname": "GetColorU32", - "location": "imgui:430", + "location": "imgui:429", "namespace": "ImGui", "ov_cimguiname": "igGetColorU32_U32", "ret": "ImU32", @@ -17063,7 +17902,7 @@ "cimguiname": "igGetColumnNormFromOffset", "defaults": {}, "funcname": "GetColumnNormFromOffset", - "location": "imgui_internal:2618", + "location": "imgui_internal:3009", "namespace": "ImGui", "ov_cimguiname": "igGetColumnNormFromOffset", "ret": "float", @@ -17113,7 +17952,7 @@ "cimguiname": "igGetColumnOffsetFromNorm", "defaults": {}, "funcname": "GetColumnOffsetFromNorm", - "location": "imgui_internal:2617", + "location": "imgui_internal:3008", "namespace": "ImGui", "ov_cimguiname": "igGetColumnOffsetFromNorm", "ret": "float", @@ -17180,7 +18019,7 @@ "cimguiname": "igGetColumnsID", "defaults": {}, "funcname": "GetColumnsID", - "location": "imgui_internal:2615", + "location": "imgui_internal:3006", "namespace": "ImGui", "ov_cimguiname": "igGetColumnsID", "ret": "ImGuiID", @@ -17202,7 +18041,7 @@ "cimguiname": "igGetContentRegionAvail", "defaults": {}, "funcname": "GetContentRegionAvail", - "location": "imgui:384", + "location": "imgui:381", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetContentRegionAvail", @@ -17225,7 +18064,7 @@ "cimguiname": "igGetContentRegionMax", "defaults": {}, "funcname": "GetContentRegionMax", - "location": "imgui:385", + "location": "imgui:382", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetContentRegionMax", @@ -17248,7 +18087,7 @@ "cimguiname": "igGetContentRegionMaxAbs", "defaults": {}, "funcname": "GetContentRegionMaxAbs", - "location": "imgui_internal:2517", + "location": "imgui_internal:2848", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetContentRegionMaxAbs", @@ -17266,7 +18105,7 @@ "cimguiname": "igGetCurrentContext", "defaults": {}, "funcname": "GetCurrentContext", - "location": "imgui:296", + "location": "imgui:291", "namespace": "ImGui", "ov_cimguiname": "igGetCurrentContext", "ret": "ImGuiContext*", @@ -17274,6 +18113,40 @@ "stname": "" } ], + "igGetCurrentFocusScope": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "igGetCurrentFocusScope", + "defaults": {}, + "funcname": "GetCurrentFocusScope", + "location": "imgui_internal:2990", + "namespace": "ImGui", + "ov_cimguiname": "igGetCurrentFocusScope", + "ret": "ImGuiID", + "signature": "()", + "stname": "" + } + ], + "igGetCurrentTabBar": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "igGetCurrentTabBar", + "defaults": {}, + "funcname": "GetCurrentTabBar", + "location": "imgui_internal:3066", + "namespace": "ImGui", + "ov_cimguiname": "igGetCurrentTabBar", + "ret": "ImGuiTabBar*", + "signature": "()", + "stname": "" + } + ], "igGetCurrentTable": [ { "args": "()", @@ -17283,7 +18156,7 @@ "cimguiname": "igGetCurrentTable", "defaults": {}, "funcname": "GetCurrentTable", - "location": "imgui_internal:2630", + "location": "imgui_internal:3021", "namespace": "ImGui", "ov_cimguiname": "igGetCurrentTable", "ret": "ImGuiTable*", @@ -17300,7 +18173,7 @@ "cimguiname": "igGetCurrentWindow", "defaults": {}, "funcname": "GetCurrentWindow", - "location": "imgui_internal:2418", + "location": "imgui_internal:2735", "namespace": "ImGui", "ov_cimguiname": "igGetCurrentWindow", "ret": "ImGuiWindow*", @@ -17317,7 +18190,7 @@ "cimguiname": "igGetCurrentWindowRead", "defaults": {}, "funcname": "GetCurrentWindowRead", - "location": "imgui_internal:2417", + "location": "imgui_internal:2734", "namespace": "ImGui", "ov_cimguiname": "igGetCurrentWindowRead", "ret": "ImGuiWindow*", @@ -17339,7 +18212,7 @@ "cimguiname": "igGetCursorPos", "defaults": {}, "funcname": "GetCursorPos", - "location": "imgui:449", + "location": "imgui:448", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetCursorPos", @@ -17357,7 +18230,7 @@ "cimguiname": "igGetCursorPosX", "defaults": {}, "funcname": "GetCursorPosX", - "location": "imgui:450", + "location": "imgui:449", "namespace": "ImGui", "ov_cimguiname": "igGetCursorPosX", "ret": "float", @@ -17374,7 +18247,7 @@ "cimguiname": "igGetCursorPosY", "defaults": {}, "funcname": "GetCursorPosY", - "location": "imgui:451", + "location": "imgui:450", "namespace": "ImGui", "ov_cimguiname": "igGetCursorPosY", "ret": "float", @@ -17396,7 +18269,7 @@ "cimguiname": "igGetCursorScreenPos", "defaults": {}, "funcname": "GetCursorScreenPos", - "location": "imgui:456", + "location": "imgui:455", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetCursorScreenPos", @@ -17419,7 +18292,7 @@ "cimguiname": "igGetCursorStartPos", "defaults": {}, "funcname": "GetCursorStartPos", - "location": "imgui:455", + "location": "imgui:454", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetCursorStartPos", @@ -17437,7 +18310,7 @@ "cimguiname": "igGetDefaultFont", "defaults": {}, "funcname": "GetDefaultFont", - "location": "imgui_internal:2446", + "location": "imgui_internal:2764", "namespace": "ImGui", "ov_cimguiname": "igGetDefaultFont", "ret": "ImFont*", @@ -17454,7 +18327,7 @@ "cimguiname": "igGetDragDropPayload", "defaults": {}, "funcname": "GetDragDropPayload", - "location": "imgui:815", + "location": "imgui:816", "namespace": "ImGui", "ov_cimguiname": "igGetDragDropPayload", "ret": "const ImGuiPayload*", @@ -17471,7 +18344,7 @@ "cimguiname": "igGetDrawData", "defaults": {}, "funcname": "GetDrawData", - "location": "imgui:305", + "location": "imgui:300", "namespace": "ImGui", "ov_cimguiname": "igGetDrawData", "ret": "ImDrawData*", @@ -17488,7 +18361,7 @@ "cimguiname": "igGetDrawListSharedData", "defaults": {}, "funcname": "GetDrawListSharedData", - "location": "imgui:868", + "location": "imgui:872", "namespace": "ImGui", "ov_cimguiname": "igGetDrawListSharedData", "ret": "ImDrawListSharedData*", @@ -17505,7 +18378,7 @@ "cimguiname": "igGetFocusID", "defaults": {}, "funcname": "GetFocusID", - "location": "imgui_internal:2495", + "location": "imgui_internal:2824", "namespace": "ImGui", "ov_cimguiname": "igGetFocusID", "ret": "ImGuiID", @@ -17513,40 +18386,6 @@ "stname": "" } ], - "igGetFocusScope": [ - { - "args": "()", - "argsT": [], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "igGetFocusScope", - "defaults": {}, - "funcname": "GetFocusScope", - "location": "imgui_internal:2588", - "namespace": "ImGui", - "ov_cimguiname": "igGetFocusScope", - "ret": "ImGuiID", - "signature": "()", - "stname": "" - } - ], - "igGetFocusedFocusScope": [ - { - "args": "()", - "argsT": [], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "igGetFocusedFocusScope", - "defaults": {}, - "funcname": "GetFocusedFocusScope", - "location": "imgui_internal:2587", - "namespace": "ImGui", - "ov_cimguiname": "igGetFocusedFocusScope", - "ret": "ImGuiID", - "signature": "()", - "stname": "" - } - ], "igGetFont": [ { "args": "()", @@ -17556,7 +18395,7 @@ "cimguiname": "igGetFont", "defaults": {}, "funcname": "GetFont", - "location": "imgui:425", + "location": "imgui:424", "namespace": "ImGui", "ov_cimguiname": "igGetFont", "ret": "ImFont*", @@ -17573,7 +18412,7 @@ "cimguiname": "igGetFontSize", "defaults": {}, "funcname": "GetFontSize", - "location": "imgui:426", + "location": "imgui:425", "namespace": "ImGui", "ov_cimguiname": "igGetFontSize", "ret": "float", @@ -17595,7 +18434,7 @@ "cimguiname": "igGetFontTexUvWhitePixel", "defaults": {}, "funcname": "GetFontTexUvWhitePixel", - "location": "imgui:427", + "location": "imgui:426", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetFontTexUvWhitePixel", @@ -17613,7 +18452,7 @@ "cimguiname": "igGetForegroundDrawList", "defaults": {}, "funcname": "GetForegroundDrawList", - "location": "imgui:867", + "location": "imgui:865", "namespace": "ImGui", "ov_cimguiname": "igGetForegroundDrawList_Nil", "ret": "ImDrawList*", @@ -17633,7 +18472,7 @@ "cimguiname": "igGetForegroundDrawList", "defaults": {}, "funcname": "GetForegroundDrawList", - "location": "imgui_internal:2447", + "location": "imgui_internal:2765", "namespace": "ImGui", "ov_cimguiname": "igGetForegroundDrawList_WindowPtr", "ret": "ImDrawList*", @@ -17653,7 +18492,7 @@ "cimguiname": "igGetForegroundDrawList", "defaults": {}, "funcname": "GetForegroundDrawList", - "location": "imgui_internal:2449", + "location": "imgui_internal:2767", "namespace": "ImGui", "ov_cimguiname": "igGetForegroundDrawList_ViewportPtr", "ret": "ImDrawList*", @@ -17670,7 +18509,7 @@ "cimguiname": "igGetFrameCount", "defaults": {}, "funcname": "GetFrameCount", - "location": "imgui:865", + "location": "imgui:871", "namespace": "ImGui", "ov_cimguiname": "igGetFrameCount", "ret": "int", @@ -17687,7 +18526,7 @@ "cimguiname": "igGetFrameHeight", "defaults": {}, "funcname": "GetFrameHeight", - "location": "imgui:461", + "location": "imgui:460", "namespace": "ImGui", "ov_cimguiname": "igGetFrameHeight", "ret": "float", @@ -17704,7 +18543,7 @@ "cimguiname": "igGetFrameHeightWithSpacing", "defaults": {}, "funcname": "GetFrameHeightWithSpacing", - "location": "imgui:462", + "location": "imgui:461", "namespace": "ImGui", "ov_cimguiname": "igGetFrameHeightWithSpacing", "ret": "float", @@ -17721,7 +18560,7 @@ "cimguiname": "igGetHoveredID", "defaults": {}, "funcname": "GetHoveredID", - "location": "imgui_internal:2499", + "location": "imgui_internal:2828", "namespace": "ImGui", "ov_cimguiname": "igGetHoveredID", "ret": "ImGuiID", @@ -17743,7 +18582,7 @@ "cimguiname": "igGetID", "defaults": {}, "funcname": "GetID", - "location": "imgui:480", + "location": "imgui:479", "namespace": "ImGui", "ov_cimguiname": "igGetID_Str", "ret": "ImGuiID", @@ -17767,7 +18606,7 @@ "cimguiname": "igGetID", "defaults": {}, "funcname": "GetID", - "location": "imgui:481", + "location": "imgui:480", "namespace": "ImGui", "ov_cimguiname": "igGetID_StrStr", "ret": "ImGuiID", @@ -17787,7 +18626,7 @@ "cimguiname": "igGetID", "defaults": {}, "funcname": "GetID", - "location": "imgui:482", + "location": "imgui:481", "namespace": "ImGui", "ov_cimguiname": "igGetID_Ptr", "ret": "ImGuiID", @@ -17817,12 +18656,36 @@ "cimguiname": "igGetIDWithSeed", "defaults": {}, "funcname": "GetIDWithSeed", - "location": "imgui_internal:2504", + "location": "imgui_internal:2833", "namespace": "ImGui", - "ov_cimguiname": "igGetIDWithSeed", + "ov_cimguiname": "igGetIDWithSeed_Str", "ret": "ImGuiID", "signature": "(const char*,const char*,ImGuiID)", "stname": "" + }, + { + "args": "(int n,ImGuiID seed)", + "argsT": [ + { + "name": "n", + "type": "int" + }, + { + "name": "seed", + "type": "ImGuiID" + } + ], + "argsoriginal": "(int n,ImGuiID seed)", + "call_args": "(n,seed)", + "cimguiname": "igGetIDWithSeed", + "defaults": {}, + "funcname": "GetIDWithSeed", + "location": "imgui_internal:2834", + "namespace": "ImGui", + "ov_cimguiname": "igGetIDWithSeed_Int", + "ret": "ImGuiID", + "signature": "(int,ImGuiID)", + "stname": "" } ], "igGetIO": [ @@ -17834,7 +18697,7 @@ "cimguiname": "igGetIO", "defaults": {}, "funcname": "GetIO", - "location": "imgui:300", + "location": "imgui:295", "namespace": "ImGui", "ov_cimguiname": "igGetIO", "ret": "ImGuiIO*", @@ -17857,7 +18720,7 @@ "cimguiname": "igGetInputTextState", "defaults": {}, "funcname": "GetInputTextState", - "location": "imgui_internal:2762", + "location": "imgui_internal:3162", "namespace": "ImGui", "ov_cimguiname": "igGetInputTextState", "ret": "ImGuiInputTextState*", @@ -17874,7 +18737,7 @@ "cimguiname": "igGetItemFlags", "defaults": {}, "funcname": "GetItemFlags", - "location": "imgui_internal:2493", + "location": "imgui_internal:2822", "namespace": "ImGui", "ov_cimguiname": "igGetItemFlags", "ret": "ImGuiItemFlags", @@ -17891,7 +18754,7 @@ "cimguiname": "igGetItemID", "defaults": {}, "funcname": "GetItemID", - "location": "imgui_internal:2491", + "location": "imgui:851", "namespace": "ImGui", "ov_cimguiname": "igGetItemID", "ret": "ImGuiID", @@ -17913,7 +18776,7 @@ "cimguiname": "igGetItemRectMax", "defaults": {}, "funcname": "GetItemRectMax", - "location": "imgui:851", + "location": "imgui:853", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetItemRectMax", @@ -17936,7 +18799,7 @@ "cimguiname": "igGetItemRectMin", "defaults": {}, "funcname": "GetItemRectMin", - "location": "imgui:850", + "location": "imgui:852", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetItemRectMin", @@ -17958,62 +18821,247 @@ "call_args": "()", "cimguiname": "igGetItemRectSize", "defaults": {}, - "funcname": "GetItemRectSize", - "location": "imgui:852", + "funcname": "GetItemRectSize", + "location": "imgui:854", + "namespace": "ImGui", + "nonUDT": 1, + "ov_cimguiname": "igGetItemRectSize", + "ret": "void", + "signature": "()", + "stname": "" + } + ], + "igGetItemStatusFlags": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "igGetItemStatusFlags", + "defaults": {}, + "funcname": "GetItemStatusFlags", + "location": "imgui_internal:2821", + "namespace": "ImGui", + "ov_cimguiname": "igGetItemStatusFlags", + "ret": "ImGuiItemStatusFlags", + "signature": "()", + "stname": "" + } + ], + "igGetKeyChordName": [ + { + "args": "(ImGuiKeyChord key_chord,char* out_buf,int out_buf_size)", + "argsT": [ + { + "name": "key_chord", + "type": "ImGuiKeyChord" + }, + { + "name": "out_buf", + "type": "char*" + }, + { + "name": "out_buf_size", + "type": "int" + } + ], + "argsoriginal": "(ImGuiKeyChord key_chord,char* out_buf,int out_buf_size)", + "call_args": "(key_chord,out_buf,out_buf_size)", + "cimguiname": "igGetKeyChordName", + "defaults": {}, + "funcname": "GetKeyChordName", + "location": "imgui_internal:2924", + "namespace": "ImGui", + "ov_cimguiname": "igGetKeyChordName", + "ret": "void", + "signature": "(ImGuiKeyChord,char*,int)", + "stname": "" + } + ], + "igGetKeyData": [ + { + "args": "(ImGuiContext* ctx,ImGuiKey key)", + "argsT": [ + { + "name": "ctx", + "type": "ImGuiContext*" + }, + { + "name": "key", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiContext* ctx,ImGuiKey key)", + "call_args": "(ctx,key)", + "cimguiname": "igGetKeyData", + "defaults": {}, + "funcname": "GetKeyData", + "location": "imgui_internal:2922", + "namespace": "ImGui", + "ov_cimguiname": "igGetKeyData_ContextPtr", + "ret": "ImGuiKeyData*", + "signature": "(ImGuiContext*,ImGuiKey)", + "stname": "" + }, + { + "args": "(ImGuiKey key)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igGetKeyData", + "defaults": {}, + "funcname": "GetKeyData", + "location": "imgui_internal:2923", + "namespace": "ImGui", + "ov_cimguiname": "igGetKeyData_Key", + "ret": "ImGuiKeyData*", + "signature": "(ImGuiKey)", + "stname": "" + } + ], + "igGetKeyIndex": [ + { + "args": "(ImGuiKey key)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igGetKeyIndex", + "defaults": {}, + "funcname": "GetKeyIndex", + "location": "imgui:3017", + "namespace": "ImGui", + "ov_cimguiname": "igGetKeyIndex", + "ret": "ImGuiKey", + "signature": "(ImGuiKey)", + "stname": "" + } + ], + "igGetKeyMagnitude2d": [ + { + "args": "(ImVec2 *pOut,ImGuiKey key_left,ImGuiKey key_right,ImGuiKey key_up,ImGuiKey key_down)", + "argsT": [ + { + "name": "pOut", + "type": "ImVec2*" + }, + { + "name": "key_left", + "type": "ImGuiKey" + }, + { + "name": "key_right", + "type": "ImGuiKey" + }, + { + "name": "key_up", + "type": "ImGuiKey" + }, + { + "name": "key_down", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiKey key_left,ImGuiKey key_right,ImGuiKey key_up,ImGuiKey key_down)", + "call_args": "(key_left,key_right,key_up,key_down)", + "cimguiname": "igGetKeyMagnitude2d", + "defaults": {}, + "funcname": "GetKeyMagnitude2d", + "location": "imgui_internal:2927", + "namespace": "ImGui", + "nonUDT": 1, + "ov_cimguiname": "igGetKeyMagnitude2d", + "ret": "void", + "signature": "(ImGuiKey,ImGuiKey,ImGuiKey,ImGuiKey)", + "stname": "" + } + ], + "igGetKeyName": [ + { + "args": "(ImGuiKey key)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igGetKeyName", + "defaults": {}, + "funcname": "GetKeyName", + "location": "imgui:897", "namespace": "ImGui", - "nonUDT": 1, - "ov_cimguiname": "igGetItemRectSize", - "ret": "void", - "signature": "()", + "ov_cimguiname": "igGetKeyName", + "ret": "const char*", + "signature": "(ImGuiKey)", "stname": "" } ], - "igGetItemStatusFlags": [ + "igGetKeyOwner": [ { - "args": "()", - "argsT": [], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "igGetItemStatusFlags", + "args": "(ImGuiKey key)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igGetKeyOwner", "defaults": {}, - "funcname": "GetItemStatusFlags", - "location": "imgui_internal:2492", + "funcname": "GetKeyOwner", + "location": "imgui_internal:2945", "namespace": "ImGui", - "ov_cimguiname": "igGetItemStatusFlags", - "ret": "ImGuiItemStatusFlags", - "signature": "()", + "ov_cimguiname": "igGetKeyOwner", + "ret": "ImGuiID", + "signature": "(ImGuiKey)", "stname": "" } ], - "igGetKeyIndex": [ + "igGetKeyOwnerData": [ { - "args": "(ImGuiKey imgui_key)", + "args": "(ImGuiContext* ctx,ImGuiKey key)", "argsT": [ { - "name": "imgui_key", + "name": "ctx", + "type": "ImGuiContext*" + }, + { + "name": "key", "type": "ImGuiKey" } ], - "argsoriginal": "(ImGuiKey imgui_key)", - "call_args": "(imgui_key)", - "cimguiname": "igGetKeyIndex", + "argsoriginal": "(ImGuiContext* ctx,ImGuiKey key)", + "call_args": "(ctx,key)", + "cimguiname": "igGetKeyOwnerData", "defaults": {}, - "funcname": "GetKeyIndex", - "location": "imgui:887", + "funcname": "GetKeyOwnerData", + "location": "imgui_internal:2950", "namespace": "ImGui", - "ov_cimguiname": "igGetKeyIndex", - "ret": "int", - "signature": "(ImGuiKey)", + "ov_cimguiname": "igGetKeyOwnerData", + "ret": "ImGuiKeyOwnerData*", + "signature": "(ImGuiContext*,ImGuiKey)", "stname": "" } ], "igGetKeyPressedAmount": [ { - "args": "(int key_index,float repeat_delay,float rate)", + "args": "(ImGuiKey key,float repeat_delay,float rate)", "argsT": [ { - "name": "key_index", - "type": "int" + "name": "key", + "type": "ImGuiKey" }, { "name": "repeat_delay", @@ -18024,16 +19072,16 @@ "type": "float" } ], - "argsoriginal": "(int key_index,float repeat_delay,float rate)", - "call_args": "(key_index,repeat_delay,rate)", + "argsoriginal": "(ImGuiKey key,float repeat_delay,float rate)", + "call_args": "(key,repeat_delay,rate)", "cimguiname": "igGetKeyPressedAmount", "defaults": {}, "funcname": "GetKeyPressedAmount", - "location": "imgui:891", + "location": "imgui:896", "namespace": "ImGui", "ov_cimguiname": "igGetKeyPressedAmount", "ret": "int", - "signature": "(int,float,float)", + "signature": "(ImGuiKey,float,float)", "stname": "" } ], @@ -18046,7 +19094,7 @@ "cimguiname": "igGetMainViewport", "defaults": {}, "funcname": "GetMainViewport", - "location": "imgui:859", + "location": "imgui:861", "namespace": "ImGui", "ov_cimguiname": "igGetMainViewport", "ret": "ImGuiViewport*", @@ -18054,23 +19102,6 @@ "stname": "" } ], - "igGetMergedKeyModFlags": [ - { - "args": "()", - "argsT": [], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "igGetMergedKeyModFlags", - "defaults": {}, - "funcname": "GetMergedKeyModFlags", - "location": "imgui_internal:2601", - "namespace": "ImGui", - "ov_cimguiname": "igGetMergedKeyModFlags", - "ret": "ImGuiKeyModFlags", - "signature": "()", - "stname": "" - } - ], "igGetMouseClickedCount": [ { "args": "(ImGuiMouseButton button)", @@ -18085,7 +19116,7 @@ "cimguiname": "igGetMouseClickedCount", "defaults": {}, "funcname": "GetMouseClickedCount", - "location": "imgui:902", + "location": "imgui:908", "namespace": "ImGui", "ov_cimguiname": "igGetMouseClickedCount", "ret": "int", @@ -18102,7 +19133,7 @@ "cimguiname": "igGetMouseCursor", "defaults": {}, "funcname": "GetMouseCursor", - "location": "imgui:911", + "location": "imgui:917", "namespace": "ImGui", "ov_cimguiname": "igGetMouseCursor", "ret": "ImGuiMouseCursor", @@ -18135,7 +19166,7 @@ "lock_threshold": "-1.0f" }, "funcname": "GetMouseDragDelta", - "location": "imgui:909", + "location": "imgui:915", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetMouseDragDelta", @@ -18158,7 +19189,7 @@ "cimguiname": "igGetMousePos", "defaults": {}, "funcname": "GetMousePos", - "location": "imgui:906", + "location": "imgui:912", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetMousePos", @@ -18181,7 +19212,7 @@ "cimguiname": "igGetMousePosOnOpeningCurrentPopup", "defaults": {}, "funcname": "GetMousePosOnOpeningCurrentPopup", - "location": "imgui:907", + "location": "imgui:913", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetMousePosOnOpeningCurrentPopup", @@ -18190,71 +19221,25 @@ "stname": "" } ], - "igGetNavInputAmount": [ + "igGetNavTweakPressedAmount": [ { - "args": "(ImGuiNavInput n,ImGuiInputReadMode mode)", + "args": "(ImGuiAxis axis)", "argsT": [ { - "name": "n", - "type": "ImGuiNavInput" - }, - { - "name": "mode", - "type": "ImGuiInputReadMode" + "name": "axis", + "type": "ImGuiAxis" } ], - "argsoriginal": "(ImGuiNavInput n,ImGuiInputReadMode mode)", - "call_args": "(n,mode)", - "cimguiname": "igGetNavInputAmount", + "argsoriginal": "(ImGuiAxis axis)", + "call_args": "(axis)", + "cimguiname": "igGetNavTweakPressedAmount", "defaults": {}, - "funcname": "GetNavInputAmount", - "location": "imgui_internal:2576", + "funcname": "GetNavTweakPressedAmount", + "location": "imgui_internal:2928", "namespace": "ImGui", - "ov_cimguiname": "igGetNavInputAmount", + "ov_cimguiname": "igGetNavTweakPressedAmount", "ret": "float", - "signature": "(ImGuiNavInput,ImGuiInputReadMode)", - "stname": "" - } - ], - "igGetNavInputAmount2d": [ - { - "args": "(ImVec2 *pOut,ImGuiNavDirSourceFlags dir_sources,ImGuiInputReadMode mode,float slow_factor,float fast_factor)", - "argsT": [ - { - "name": "pOut", - "type": "ImVec2*" - }, - { - "name": "dir_sources", - "type": "ImGuiNavDirSourceFlags" - }, - { - "name": "mode", - "type": "ImGuiInputReadMode" - }, - { - "name": "slow_factor", - "type": "float" - }, - { - "name": "fast_factor", - "type": "float" - } - ], - "argsoriginal": "(ImGuiNavDirSourceFlags dir_sources,ImGuiInputReadMode mode,float slow_factor=0.0f,float fast_factor=0.0f)", - "call_args": "(dir_sources,mode,slow_factor,fast_factor)", - "cimguiname": "igGetNavInputAmount2d", - "defaults": { - "fast_factor": "0.0f", - "slow_factor": "0.0f" - }, - "funcname": "GetNavInputAmount2d", - "location": "imgui_internal:2577", - "namespace": "ImGui", - "nonUDT": 1, - "ov_cimguiname": "igGetNavInputAmount2d", - "ret": "void", - "signature": "(ImGuiNavDirSourceFlags,ImGuiInputReadMode,float,float)", + "signature": "(ImGuiAxis)", "stname": "" } ], @@ -18276,7 +19261,7 @@ "cimguiname": "igGetPopupAllowedExtentRect", "defaults": {}, "funcname": "GetPopupAllowedExtentRect", - "location": "imgui_internal:2550", + "location": "imgui_internal:2871", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetPopupAllowedExtentRect", @@ -18294,7 +19279,7 @@ "cimguiname": "igGetScrollMaxX", "defaults": {}, "funcname": "GetScrollMaxX", - "location": "imgui:394", + "location": "imgui:393", "namespace": "ImGui", "ov_cimguiname": "igGetScrollMaxX", "ret": "float", @@ -18311,7 +19296,7 @@ "cimguiname": "igGetScrollMaxY", "defaults": {}, "funcname": "GetScrollMaxY", - "location": "imgui:395", + "location": "imgui:394", "namespace": "ImGui", "ov_cimguiname": "igGetScrollMaxY", "ret": "float", @@ -18328,7 +19313,7 @@ "cimguiname": "igGetScrollX", "defaults": {}, "funcname": "GetScrollX", - "location": "imgui:390", + "location": "imgui:389", "namespace": "ImGui", "ov_cimguiname": "igGetScrollX", "ret": "float", @@ -18345,7 +19330,7 @@ "cimguiname": "igGetScrollY", "defaults": {}, "funcname": "GetScrollY", - "location": "imgui:391", + "location": "imgui:390", "namespace": "ImGui", "ov_cimguiname": "igGetScrollY", "ret": "float", @@ -18353,6 +19338,28 @@ "stname": "" } ], + "igGetShortcutRoutingData": [ + { + "args": "(ImGuiKeyChord key_chord)", + "argsT": [ + { + "name": "key_chord", + "type": "ImGuiKeyChord" + } + ], + "argsoriginal": "(ImGuiKeyChord key_chord)", + "call_args": "(key_chord)", + "cimguiname": "igGetShortcutRoutingData", + "defaults": {}, + "funcname": "GetShortcutRoutingData", + "location": "imgui_internal:2978", + "namespace": "ImGui", + "ov_cimguiname": "igGetShortcutRoutingData", + "ret": "ImGuiKeyRoutingData*", + "signature": "(ImGuiKeyChord)", + "stname": "" + } + ], "igGetStateStorage": [ { "args": "()", @@ -18362,7 +19369,7 @@ "cimguiname": "igGetStateStorage", "defaults": {}, "funcname": "GetStateStorage", - "location": "imgui:871", + "location": "imgui:875", "namespace": "ImGui", "ov_cimguiname": "igGetStateStorage", "ret": "ImGuiStorage*", @@ -18379,7 +19386,7 @@ "cimguiname": "igGetStyle", "defaults": {}, "funcname": "GetStyle", - "location": "imgui:301", + "location": "imgui:296", "namespace": "ImGui", "ov_cimguiname": "igGetStyle", "ret": "ImGuiStyle*", @@ -18402,7 +19409,7 @@ "cimguiname": "igGetStyleColorName", "defaults": {}, "funcname": "GetStyleColorName", - "location": "imgui:869", + "location": "imgui:873", "namespace": "ImGui", "ov_cimguiname": "igGetStyleColorName", "ret": "const char*", @@ -18424,7 +19431,7 @@ "cimguiname": "igGetStyleColorVec4", "defaults": {}, "funcname": "GetStyleColorVec4", - "location": "imgui:431", + "location": "imgui:430", "namespace": "ImGui", "ov_cimguiname": "igGetStyleColorVec4", "ret": "const ImVec4*", @@ -18433,6 +19440,28 @@ "stname": "" } ], + "igGetStyleVarInfo": [ + { + "args": "(ImGuiStyleVar idx)", + "argsT": [ + { + "name": "idx", + "type": "ImGuiStyleVar" + } + ], + "argsoriginal": "(ImGuiStyleVar idx)", + "call_args": "(idx)", + "cimguiname": "igGetStyleVarInfo", + "defaults": {}, + "funcname": "GetStyleVarInfo", + "location": "imgui_internal:2854", + "namespace": "ImGui", + "ov_cimguiname": "igGetStyleVarInfo", + "ret": "const ImGuiDataVarInfo*", + "signature": "(ImGuiStyleVar)", + "stname": "" + } + ], "igGetTextLineHeight": [ { "args": "()", @@ -18442,7 +19471,7 @@ "cimguiname": "igGetTextLineHeight", "defaults": {}, "funcname": "GetTextLineHeight", - "location": "imgui:459", + "location": "imgui:458", "namespace": "ImGui", "ov_cimguiname": "igGetTextLineHeight", "ret": "float", @@ -18459,7 +19488,7 @@ "cimguiname": "igGetTextLineHeightWithSpacing", "defaults": {}, "funcname": "GetTextLineHeightWithSpacing", - "location": "imgui:460", + "location": "imgui:459", "namespace": "ImGui", "ov_cimguiname": "igGetTextLineHeightWithSpacing", "ret": "float", @@ -18476,7 +19505,7 @@ "cimguiname": "igGetTime", "defaults": {}, "funcname": "GetTime", - "location": "imgui:864", + "location": "imgui:870", "namespace": "ImGui", "ov_cimguiname": "igGetTime", "ret": "double", @@ -18493,7 +19522,7 @@ "cimguiname": "igGetTopMostAndVisiblePopupModal", "defaults": {}, "funcname": "GetTopMostAndVisiblePopupModal", - "location": "imgui_internal:2552", + "location": "imgui_internal:2873", "namespace": "ImGui", "ov_cimguiname": "igGetTopMostAndVisiblePopupModal", "ret": "ImGuiWindow*", @@ -18510,7 +19539,7 @@ "cimguiname": "igGetTopMostPopupModal", "defaults": {}, "funcname": "GetTopMostPopupModal", - "location": "imgui_internal:2551", + "location": "imgui_internal:2872", "namespace": "ImGui", "ov_cimguiname": "igGetTopMostPopupModal", "ret": "ImGuiWindow*", @@ -18527,7 +19556,7 @@ "cimguiname": "igGetTreeNodeToLabelSpacing", "defaults": {}, "funcname": "GetTreeNodeToLabelSpacing", - "location": "imgui:613", + "location": "imgui:617", "namespace": "ImGui", "ov_cimguiname": "igGetTreeNodeToLabelSpacing", "ret": "float", @@ -18535,6 +19564,36 @@ "stname": "" } ], + "igGetTypematicRepeatRate": [ + { + "args": "(ImGuiInputFlags flags,float* repeat_delay,float* repeat_rate)", + "argsT": [ + { + "name": "flags", + "type": "ImGuiInputFlags" + }, + { + "name": "repeat_delay", + "type": "float*" + }, + { + "name": "repeat_rate", + "type": "float*" + } + ], + "argsoriginal": "(ImGuiInputFlags flags,float* repeat_delay,float* repeat_rate)", + "call_args": "(flags,repeat_delay,repeat_rate)", + "cimguiname": "igGetTypematicRepeatRate", + "defaults": {}, + "funcname": "GetTypematicRepeatRate", + "location": "imgui_internal:2930", + "namespace": "ImGui", + "ov_cimguiname": "igGetTypematicRepeatRate", + "ret": "void", + "signature": "(ImGuiInputFlags,float*,float*)", + "stname": "" + } + ], "igGetVersion": [ { "args": "()", @@ -18544,7 +19603,7 @@ "cimguiname": "igGetVersion", "defaults": {}, "funcname": "GetVersion", - "location": "imgui:316", + "location": "imgui:312", "namespace": "ImGui", "ov_cimguiname": "igGetVersion", "ret": "const char*", @@ -18566,7 +19625,7 @@ "cimguiname": "igGetWindowContentRegionMax", "defaults": {}, "funcname": "GetWindowContentRegionMax", - "location": "imgui:387", + "location": "imgui:384", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetWindowContentRegionMax", @@ -18589,7 +19648,7 @@ "cimguiname": "igGetWindowContentRegionMin", "defaults": {}, "funcname": "GetWindowContentRegionMin", - "location": "imgui:386", + "location": "imgui:383", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetWindowContentRegionMin", @@ -18607,7 +19666,7 @@ "cimguiname": "igGetWindowDrawList", "defaults": {}, "funcname": "GetWindowDrawList", - "location": "imgui:356", + "location": "imgui:352", "namespace": "ImGui", "ov_cimguiname": "igGetWindowDrawList", "ret": "ImDrawList*", @@ -18624,7 +19683,7 @@ "cimguiname": "igGetWindowHeight", "defaults": {}, "funcname": "GetWindowHeight", - "location": "imgui:360", + "location": "imgui:356", "namespace": "ImGui", "ov_cimguiname": "igGetWindowHeight", "ret": "float", @@ -18646,7 +19705,7 @@ "cimguiname": "igGetWindowPos", "defaults": {}, "funcname": "GetWindowPos", - "location": "imgui:357", + "location": "imgui:353", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetWindowPos", @@ -18673,7 +19732,7 @@ "cimguiname": "igGetWindowResizeBorderID", "defaults": {}, "funcname": "GetWindowResizeBorderID", - "location": "imgui_internal:2725", + "location": "imgui_internal:3126", "namespace": "ImGui", "ov_cimguiname": "igGetWindowResizeBorderID", "ret": "ImGuiID", @@ -18699,7 +19758,7 @@ "cimguiname": "igGetWindowResizeCornerID", "defaults": {}, "funcname": "GetWindowResizeCornerID", - "location": "imgui_internal:2724", + "location": "imgui_internal:3125", "namespace": "ImGui", "ov_cimguiname": "igGetWindowResizeCornerID", "ret": "ImGuiID", @@ -18725,7 +19784,7 @@ "cimguiname": "igGetWindowScrollbarID", "defaults": {}, "funcname": "GetWindowScrollbarID", - "location": "imgui_internal:2723", + "location": "imgui_internal:3124", "namespace": "ImGui", "ov_cimguiname": "igGetWindowScrollbarID", "ret": "ImGuiID", @@ -18755,7 +19814,7 @@ "cimguiname": "igGetWindowScrollbarRect", "defaults": {}, "funcname": "GetWindowScrollbarRect", - "location": "imgui_internal:2722", + "location": "imgui_internal:3123", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetWindowScrollbarRect", @@ -18778,7 +19837,7 @@ "cimguiname": "igGetWindowSize", "defaults": {}, "funcname": "GetWindowSize", - "location": "imgui:358", + "location": "imgui:354", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igGetWindowSize", @@ -18796,7 +19855,7 @@ "cimguiname": "igGetWindowWidth", "defaults": {}, "funcname": "GetWindowWidth", - "location": "imgui:359", + "location": "imgui:355", "namespace": "ImGui", "ov_cimguiname": "igGetWindowWidth", "ret": "float", @@ -18818,7 +19877,7 @@ "cimguiname": "igImAbs", "defaults": {}, "funcname": "ImAbs", - "location": "imgui_internal:411", + "location": "imgui_internal:426", "ov_cimguiname": "igImAbs_Int", "ret": "int", "signature": "(int)", @@ -18837,7 +19896,7 @@ "cimguiname": "igImAbs", "defaults": {}, "funcname": "ImAbs", - "location": "imgui_internal:412", + "location": "imgui_internal:427", "ov_cimguiname": "igImAbs_Float", "ret": "float", "signature": "(float)", @@ -18856,7 +19915,7 @@ "cimguiname": "igImAbs", "defaults": {}, "funcname": "ImAbs", - "location": "imgui_internal:413", + "location": "imgui_internal:428", "ov_cimguiname": "igImAbs_double", "ret": "double", "signature": "(double)", @@ -18881,7 +19940,7 @@ "cimguiname": "igImAlphaBlendColors", "defaults": {}, "funcname": "ImAlphaBlendColors", - "location": "imgui_internal:310", + "location": "imgui_internal:339", "ov_cimguiname": "igImAlphaBlendColors", "ret": "ImU32", "signature": "(ImU32,ImU32)", @@ -18922,7 +19981,7 @@ "cimguiname": "igImBezierCubicCalc", "defaults": {}, "funcname": "ImBezierCubicCalc", - "location": "imgui_internal:455", + "location": "imgui_internal:472", "nonUDT": 1, "ov_cimguiname": "igImBezierCubicCalc", "ret": "void", @@ -18968,7 +20027,7 @@ "cimguiname": "igImBezierCubicClosestPoint", "defaults": {}, "funcname": "ImBezierCubicClosestPoint", - "location": "imgui_internal:456", + "location": "imgui_internal:473", "nonUDT": 1, "ov_cimguiname": "igImBezierCubicClosestPoint", "ret": "void", @@ -19014,7 +20073,7 @@ "cimguiname": "igImBezierCubicClosestPointCasteljau", "defaults": {}, "funcname": "ImBezierCubicClosestPointCasteljau", - "location": "imgui_internal:457", + "location": "imgui_internal:474", "nonUDT": 1, "ov_cimguiname": "igImBezierCubicClosestPointCasteljau", "ret": "void", @@ -19052,7 +20111,7 @@ "cimguiname": "igImBezierQuadraticCalc", "defaults": {}, "funcname": "ImBezierQuadraticCalc", - "location": "imgui_internal:458", + "location": "imgui_internal:475", "nonUDT": 1, "ov_cimguiname": "igImBezierQuadraticCalc", "ret": "void", @@ -19060,6 +20119,31 @@ "stname": "" } ], + "igImBitArrayClearAllBits": [ + { + "args": "(ImU32* arr,int bitcount)", + "argsT": [ + { + "name": "arr", + "type": "ImU32*" + }, + { + "name": "bitcount", + "type": "int" + } + ], + "argsoriginal": "(ImU32* arr,int bitcount)", + "call_args": "(arr,bitcount)", + "cimguiname": "igImBitArrayClearAllBits", + "defaults": {}, + "funcname": "ImBitArrayClearAllBits", + "location": "imgui_internal:544", + "ov_cimguiname": "igImBitArrayClearAllBits", + "ret": "void", + "signature": "(ImU32*,int)", + "stname": "" + } + ], "igImBitArrayClearBit": [ { "args": "(ImU32* arr,int n)", @@ -19078,13 +20162,34 @@ "cimguiname": "igImBitArrayClearBit", "defaults": {}, "funcname": "ImBitArrayClearBit", - "location": "imgui_internal:526", + "location": "imgui_internal:546", "ov_cimguiname": "igImBitArrayClearBit", "ret": "void", "signature": "(ImU32*,int)", "stname": "" } ], + "igImBitArrayGetStorageSizeInBytes": [ + { + "args": "(int bitcount)", + "argsT": [ + { + "name": "bitcount", + "type": "int" + } + ], + "argsoriginal": "(int bitcount)", + "call_args": "(bitcount)", + "cimguiname": "igImBitArrayGetStorageSizeInBytes", + "defaults": {}, + "funcname": "ImBitArrayGetStorageSizeInBytes", + "location": "imgui_internal:543", + "ov_cimguiname": "igImBitArrayGetStorageSizeInBytes", + "ret": "size_t", + "signature": "(int)", + "stname": "" + } + ], "igImBitArraySetBit": [ { "args": "(ImU32* arr,int n)", @@ -19103,7 +20208,7 @@ "cimguiname": "igImBitArraySetBit", "defaults": {}, "funcname": "ImBitArraySetBit", - "location": "imgui_internal:527", + "location": "imgui_internal:547", "ov_cimguiname": "igImBitArraySetBit", "ret": "void", "signature": "(ImU32*,int)", @@ -19132,7 +20237,7 @@ "cimguiname": "igImBitArraySetBitRange", "defaults": {}, "funcname": "ImBitArraySetBitRange", - "location": "imgui_internal:528", + "location": "imgui_internal:548", "ov_cimguiname": "igImBitArraySetBitRange", "ret": "void", "signature": "(ImU32*,int,int)", @@ -19157,7 +20262,7 @@ "cimguiname": "igImBitArrayTestBit", "defaults": {}, "funcname": "ImBitArrayTestBit", - "location": "imgui_internal:525", + "location": "imgui_internal:545", "ov_cimguiname": "igImBitArrayTestBit", "ret": "bool", "signature": "(const ImU32*,int)", @@ -19178,7 +20283,7 @@ "cimguiname": "igImCharIsBlankA", "defaults": {}, "funcname": "ImCharIsBlankA", - "location": "imgui_internal:336", + "location": "imgui_internal:361", "ov_cimguiname": "igImCharIsBlankA", "ret": "bool", "signature": "(char)", @@ -19199,7 +20304,7 @@ "cimguiname": "igImCharIsBlankW", "defaults": {}, "funcname": "ImCharIsBlankW", - "location": "imgui_internal:337", + "location": "imgui_internal:362", "ov_cimguiname": "igImCharIsBlankW", "ret": "bool", "signature": "(unsigned int)", @@ -19232,7 +20337,7 @@ "cimguiname": "igImClamp", "defaults": {}, "funcname": "ImClamp", - "location": "imgui_internal:435", + "location": "imgui_internal:450", "nonUDT": 1, "ov_cimguiname": "igImClamp", "ret": "void", @@ -19258,13 +20363,42 @@ "cimguiname": "igImDot", "defaults": {}, "funcname": "ImDot", - "location": "imgui_internal:447", + "location": "imgui_internal:463", "ov_cimguiname": "igImDot", "ret": "float", "signature": "(const ImVec2,const ImVec2)", "stname": "" } ], + "igImExponentialMovingAverage": [ + { + "args": "(float avg,float sample,int n)", + "argsT": [ + { + "name": "avg", + "type": "float" + }, + { + "name": "sample", + "type": "float" + }, + { + "name": "n", + "type": "int" + } + ], + "argsoriginal": "(float avg,float sample,int n)", + "call_args": "(avg,sample,n)", + "cimguiname": "igImExponentialMovingAverage", + "defaults": {}, + "funcname": "ImExponentialMovingAverage", + "location": "imgui_internal:468", + "ov_cimguiname": "igImExponentialMovingAverage", + "ret": "float", + "signature": "(float,float,int)", + "stname": "" + } + ], "igImFileClose": [ { "args": "(ImFileHandle file)", @@ -19279,7 +20413,7 @@ "cimguiname": "igImFileClose", "defaults": {}, "funcname": "ImFileClose", - "location": "imgui_internal:384", + "location": "imgui_internal:399", "ov_cimguiname": "igImFileClose", "ret": "bool", "signature": "(ImFileHandle)", @@ -19300,7 +20434,7 @@ "cimguiname": "igImFileGetSize", "defaults": {}, "funcname": "ImFileGetSize", - "location": "imgui_internal:385", + "location": "imgui_internal:400", "ov_cimguiname": "igImFileGetSize", "ret": "ImU64", "signature": "(ImFileHandle)", @@ -19336,7 +20470,7 @@ "padding_bytes": "0" }, "funcname": "ImFileLoadToMemory", - "location": "imgui_internal:391", + "location": "imgui_internal:406", "ov_cimguiname": "igImFileLoadToMemory", "ret": "void*", "signature": "(const char*,const char*,size_t*,int)", @@ -19361,7 +20495,7 @@ "cimguiname": "igImFileOpen", "defaults": {}, "funcname": "ImFileOpen", - "location": "imgui_internal:383", + "location": "imgui_internal:398", "ov_cimguiname": "igImFileOpen", "ret": "ImFileHandle", "signature": "(const char*,const char*)", @@ -19394,7 +20528,7 @@ "cimguiname": "igImFileRead", "defaults": {}, "funcname": "ImFileRead", - "location": "imgui_internal:386", + "location": "imgui_internal:401", "ov_cimguiname": "igImFileRead", "ret": "ImU64", "signature": "(void*,ImU64,ImU64,ImFileHandle)", @@ -19427,7 +20561,7 @@ "cimguiname": "igImFileWrite", "defaults": {}, "funcname": "ImFileWrite", - "location": "imgui_internal:387", + "location": "imgui_internal:402", "ov_cimguiname": "igImFileWrite", "ret": "ImU64", "signature": "(const void*,ImU64,ImU64,ImFileHandle)", @@ -19448,7 +20582,7 @@ "cimguiname": "igImFloor", "defaults": {}, "funcname": "ImFloor", - "location": "imgui_internal:443", + "location": "imgui_internal:458", "ov_cimguiname": "igImFloor_Float", "ret": "float", "signature": "(float)", @@ -19471,7 +20605,7 @@ "cimguiname": "igImFloor", "defaults": {}, "funcname": "ImFloor", - "location": "imgui_internal:445", + "location": "imgui_internal:460", "nonUDT": 1, "ov_cimguiname": "igImFloor_Vec2", "ret": "void", @@ -19488,15 +20622,39 @@ "type": "float" } ], - "argsoriginal": "(float f)", - "call_args": "(f)", + "argsoriginal": "(float f)", + "call_args": "(f)", + "cimguiname": "igImFloorSigned", + "defaults": {}, + "funcname": "ImFloorSigned", + "location": "imgui_internal:459", + "ov_cimguiname": "igImFloorSigned_Float", + "ret": "float", + "signature": "(float)", + "stname": "" + }, + { + "args": "(ImVec2 *pOut,const ImVec2 v)", + "argsT": [ + { + "name": "pOut", + "type": "ImVec2*" + }, + { + "name": "v", + "type": "const ImVec2" + } + ], + "argsoriginal": "(const ImVec2& v)", + "call_args": "(v)", "cimguiname": "igImFloorSigned", "defaults": {}, "funcname": "ImFloorSigned", - "location": "imgui_internal:444", - "ov_cimguiname": "igImFloorSigned", - "ret": "float", - "signature": "(float)", + "location": "imgui_internal:461", + "nonUDT": 1, + "ov_cimguiname": "igImFloorSigned_Vec2", + "ret": "void", + "signature": "(const ImVec2)", "stname": "" } ], @@ -19514,7 +20672,7 @@ "cimguiname": "igImFontAtlasBuildFinish", "defaults": {}, "funcname": "ImFontAtlasBuildFinish", - "location": "imgui_internal:2822", + "location": "imgui_internal:3251", "ov_cimguiname": "igImFontAtlasBuildFinish", "ret": "void", "signature": "(ImFontAtlas*)", @@ -19535,7 +20693,7 @@ "cimguiname": "igImFontAtlasBuildInit", "defaults": {}, "funcname": "ImFontAtlasBuildInit", - "location": "imgui_internal:2819", + "location": "imgui_internal:3248", "ov_cimguiname": "igImFontAtlasBuildInit", "ret": "void", "signature": "(ImFontAtlas*)", @@ -19560,7 +20718,7 @@ "cimguiname": "igImFontAtlasBuildMultiplyCalcLookupTable", "defaults": {}, "funcname": "ImFontAtlasBuildMultiplyCalcLookupTable", - "location": "imgui_internal:2825", + "location": "imgui_internal:3254", "ov_cimguiname": "igImFontAtlasBuildMultiplyCalcLookupTable", "ret": "void", "signature": "(unsigned char[256],float)", @@ -19605,7 +20763,7 @@ "cimguiname": "igImFontAtlasBuildMultiplyRectAlpha8", "defaults": {}, "funcname": "ImFontAtlasBuildMultiplyRectAlpha8", - "location": "imgui_internal:2826", + "location": "imgui_internal:3255", "ov_cimguiname": "igImFontAtlasBuildMultiplyRectAlpha8", "ret": "void", "signature": "(const unsigned char[256],unsigned char*,int,int,int,int,int)", @@ -19630,7 +20788,7 @@ "cimguiname": "igImFontAtlasBuildPackCustomRects", "defaults": {}, "funcname": "ImFontAtlasBuildPackCustomRects", - "location": "imgui_internal:2821", + "location": "imgui_internal:3250", "ov_cimguiname": "igImFontAtlasBuildPackCustomRects", "ret": "void", "signature": "(ImFontAtlas*,void*)", @@ -19679,7 +20837,7 @@ "cimguiname": "igImFontAtlasBuildRender32bppRectFromString", "defaults": {}, "funcname": "ImFontAtlasBuildRender32bppRectFromString", - "location": "imgui_internal:2824", + "location": "imgui_internal:3253", "ov_cimguiname": "igImFontAtlasBuildRender32bppRectFromString", "ret": "void", "signature": "(ImFontAtlas*,int,int,int,int,const char*,char,unsigned int)", @@ -19728,7 +20886,7 @@ "cimguiname": "igImFontAtlasBuildRender8bppRectFromString", "defaults": {}, "funcname": "ImFontAtlasBuildRender8bppRectFromString", - "location": "imgui_internal:2823", + "location": "imgui_internal:3252", "ov_cimguiname": "igImFontAtlasBuildRender8bppRectFromString", "ret": "void", "signature": "(ImFontAtlas*,int,int,int,int,const char*,char,unsigned char)", @@ -19765,7 +20923,7 @@ "cimguiname": "igImFontAtlasBuildSetupFont", "defaults": {}, "funcname": "ImFontAtlasBuildSetupFont", - "location": "imgui_internal:2820", + "location": "imgui_internal:3249", "ov_cimguiname": "igImFontAtlasBuildSetupFont", "ret": "void", "signature": "(ImFontAtlas*,ImFont*,ImFontConfig*,float,float)", @@ -19781,7 +20939,7 @@ "cimguiname": "igImFontAtlasGetBuilderForStbTruetype", "defaults": {}, "funcname": "ImFontAtlasGetBuilderForStbTruetype", - "location": "imgui_internal:2818", + "location": "imgui_internal:3246", "ov_cimguiname": "igImFontAtlasGetBuilderForStbTruetype", "ret": "const ImFontBuilderIO*", "signature": "()", @@ -19815,13 +20973,80 @@ "defaults": {}, "funcname": "ImFormatString", "isvararg": "...)", - "location": "imgui_internal:330", + "location": "imgui_internal:366", "ov_cimguiname": "igImFormatString", "ret": "int", "signature": "(char*,size_t,const char*,...)", "stname": "" } ], + "igImFormatStringToTempBuffer": [ + { + "args": "(const char** out_buf,const char** out_buf_end,const char* fmt,...)", + "argsT": [ + { + "name": "out_buf", + "type": "const char**" + }, + { + "name": "out_buf_end", + "type": "const char**" + }, + { + "name": "fmt", + "type": "const char*" + }, + { + "name": "...", + "type": "..." + } + ], + "argsoriginal": "(const char** out_buf,const char** out_buf_end,const char* fmt,...)", + "call_args": "(out_buf,out_buf_end,fmt,...)", + "cimguiname": "igImFormatStringToTempBuffer", + "defaults": {}, + "funcname": "ImFormatStringToTempBuffer", + "isvararg": "...)", + "location": "imgui_internal:368", + "ov_cimguiname": "igImFormatStringToTempBuffer", + "ret": "void", + "signature": "(const char**,const char**,const char*,...)", + "stname": "" + } + ], + "igImFormatStringToTempBufferV": [ + { + "args": "(const char** out_buf,const char** out_buf_end,const char* fmt,va_list args)", + "argsT": [ + { + "name": "out_buf", + "type": "const char**" + }, + { + "name": "out_buf_end", + "type": "const char**" + }, + { + "name": "fmt", + "type": "const char*" + }, + { + "name": "args", + "type": "va_list" + } + ], + "argsoriginal": "(const char** out_buf,const char** out_buf_end,const char* fmt,va_list args)", + "call_args": "(out_buf,out_buf_end,fmt,args)", + "cimguiname": "igImFormatStringToTempBufferV", + "defaults": {}, + "funcname": "ImFormatStringToTempBufferV", + "location": "imgui_internal:369", + "ov_cimguiname": "igImFormatStringToTempBufferV", + "ret": "void", + "signature": "(const char**,const char**,const char*,va_list)", + "stname": "" + } + ], "igImFormatStringV": [ { "args": "(char* buf,size_t buf_size,const char* fmt,va_list args)", @@ -19848,7 +21073,7 @@ "cimguiname": "igImFormatStringV", "defaults": {}, "funcname": "ImFormatStringV", - "location": "imgui_internal:331", + "location": "imgui_internal:367", "ov_cimguiname": "igImFormatStringV", "ret": "int", "signature": "(char*,size_t,const char*,va_list)", @@ -19873,7 +21098,7 @@ "cimguiname": "igImGetDirQuadrantFromDelta", "defaults": {}, "funcname": "ImGetDirQuadrantFromDelta", - "location": "imgui_internal:464", + "location": "imgui_internal:481", "ov_cimguiname": "igImGetDirQuadrantFromDelta", "ret": "ImGuiDir", "signature": "(float,float)", @@ -19882,7 +21107,7 @@ ], "igImHashData": [ { - "args": "(const void* data,size_t data_size,ImU32 seed)", + "args": "(const void* data,size_t data_size,ImGuiID seed)", "argsT": [ { "name": "data", @@ -19894,26 +21119,26 @@ }, { "name": "seed", - "type": "ImU32" + "type": "ImGuiID" } ], - "argsoriginal": "(const void* data,size_t data_size,ImU32 seed=0)", + "argsoriginal": "(const void* data,size_t data_size,ImGuiID seed=0)", "call_args": "(data,data_size,seed)", "cimguiname": "igImHashData", "defaults": { "seed": "0" }, "funcname": "ImHashData", - "location": "imgui_internal:298", + "location": "imgui_internal:330", "ov_cimguiname": "igImHashData", "ret": "ImGuiID", - "signature": "(const void*,size_t,ImU32)", + "signature": "(const void*,size_t,ImGuiID)", "stname": "" } ], "igImHashStr": [ { - "args": "(const char* data,size_t data_size,ImU32 seed)", + "args": "(const char* data,size_t data_size,ImGuiID seed)", "argsT": [ { "name": "data", @@ -19925,10 +21150,10 @@ }, { "name": "seed", - "type": "ImU32" + "type": "ImGuiID" } ], - "argsoriginal": "(const char* data,size_t data_size=0,ImU32 seed=0)", + "argsoriginal": "(const char* data,size_t data_size=0,ImGuiID seed=0)", "call_args": "(data,data_size,seed)", "cimguiname": "igImHashStr", "defaults": { @@ -19936,10 +21161,10 @@ "seed": "0" }, "funcname": "ImHashStr", - "location": "imgui_internal:299", + "location": "imgui_internal:331", "ov_cimguiname": "igImHashStr", "ret": "ImGuiID", - "signature": "(const char*,size_t,ImU32)", + "signature": "(const char*,size_t,ImGuiID)", "stname": "" } ], @@ -19961,7 +21186,7 @@ "cimguiname": "igImInvLength", "defaults": {}, "funcname": "ImInvLength", - "location": "imgui_internal:442", + "location": "imgui_internal:457", "ov_cimguiname": "igImInvLength", "ret": "float", "signature": "(const ImVec2,float)", @@ -19982,7 +21207,7 @@ "cimguiname": "igImIsFloatAboveGuaranteedIntegerPrecision", "defaults": {}, "funcname": "ImIsFloatAboveGuaranteedIntegerPrecision", - "location": "imgui_internal:451", + "location": "imgui_internal:467", "ov_cimguiname": "igImIsFloatAboveGuaranteedIntegerPrecision", "ret": "bool", "signature": "(float)", @@ -20003,7 +21228,7 @@ "cimguiname": "igImIsPowerOfTwo", "defaults": {}, "funcname": "ImIsPowerOfTwo", - "location": "imgui_internal:313", + "location": "imgui_internal:342", "ov_cimguiname": "igImIsPowerOfTwo_Int", "ret": "bool", "signature": "(int)", @@ -20022,7 +21247,7 @@ "cimguiname": "igImIsPowerOfTwo", "defaults": {}, "funcname": "ImIsPowerOfTwo", - "location": "imgui_internal:314", + "location": "imgui_internal:343", "ov_cimguiname": "igImIsPowerOfTwo_U64", "ret": "bool", "signature": "(ImU64)", @@ -20043,7 +21268,7 @@ "cimguiname": "igImLengthSqr", "defaults": {}, "funcname": "ImLengthSqr", - "location": "imgui_internal:440", + "location": "imgui_internal:455", "ov_cimguiname": "igImLengthSqr_Vec2", "ret": "float", "signature": "(const ImVec2)", @@ -20062,7 +21287,7 @@ "cimguiname": "igImLengthSqr", "defaults": {}, "funcname": "ImLengthSqr", - "location": "imgui_internal:441", + "location": "imgui_internal:456", "ov_cimguiname": "igImLengthSqr_Vec4", "ret": "float", "signature": "(const ImVec4)", @@ -20095,7 +21320,7 @@ "cimguiname": "igImLerp", "defaults": {}, "funcname": "ImLerp", - "location": "imgui_internal:436", + "location": "imgui_internal:451", "nonUDT": 1, "ov_cimguiname": "igImLerp_Vec2Float", "ret": "void", @@ -20127,7 +21352,7 @@ "cimguiname": "igImLerp", "defaults": {}, "funcname": "ImLerp", - "location": "imgui_internal:437", + "location": "imgui_internal:452", "nonUDT": 1, "ov_cimguiname": "igImLerp_Vec2Vec2", "ret": "void", @@ -20159,7 +21384,7 @@ "cimguiname": "igImLerp", "defaults": {}, "funcname": "ImLerp", - "location": "imgui_internal:438", + "location": "imgui_internal:453", "nonUDT": 1, "ov_cimguiname": "igImLerp_Vec4", "ret": "void", @@ -20193,7 +21418,7 @@ "cimguiname": "igImLineClosestPoint", "defaults": {}, "funcname": "ImLineClosestPoint", - "location": "imgui_internal:459", + "location": "imgui_internal:476", "nonUDT": 1, "ov_cimguiname": "igImLineClosestPoint", "ret": "void", @@ -20223,7 +21448,7 @@ "cimguiname": "igImLinearSweep", "defaults": {}, "funcname": "ImLinearSweep", - "location": "imgui_internal:449", + "location": "imgui_internal:465", "ov_cimguiname": "igImLinearSweep", "ret": "float", "signature": "(float,float,float)", @@ -20244,7 +21469,7 @@ "cimguiname": "igImLog", "defaults": {}, "funcname": "ImLog", - "location": "imgui_internal:409", + "location": "imgui_internal:424", "ov_cimguiname": "igImLog_Float", "ret": "float", "signature": "(float)", @@ -20263,7 +21488,7 @@ "cimguiname": "igImLog", "defaults": {}, "funcname": "ImLog", - "location": "imgui_internal:410", + "location": "imgui_internal:425", "ov_cimguiname": "igImLog_double", "ret": "double", "signature": "(double)", @@ -20292,7 +21517,7 @@ "cimguiname": "igImMax", "defaults": {}, "funcname": "ImMax", - "location": "imgui_internal:434", + "location": "imgui_internal:449", "nonUDT": 1, "ov_cimguiname": "igImMax", "ret": "void", @@ -20322,7 +21547,7 @@ "cimguiname": "igImMin", "defaults": {}, "funcname": "ImMin", - "location": "imgui_internal:433", + "location": "imgui_internal:448", "nonUDT": 1, "ov_cimguiname": "igImMin", "ret": "void", @@ -20348,7 +21573,7 @@ "cimguiname": "igImModPositive", "defaults": {}, "funcname": "ImModPositive", - "location": "imgui_internal:446", + "location": "imgui_internal:462", "ov_cimguiname": "igImModPositive", "ret": "int", "signature": "(int,int)", @@ -20377,7 +21602,7 @@ "cimguiname": "igImMul", "defaults": {}, "funcname": "ImMul", - "location": "imgui_internal:450", + "location": "imgui_internal:466", "nonUDT": 1, "ov_cimguiname": "igImMul", "ret": "void", @@ -20399,7 +21624,7 @@ "cimguiname": "igImParseFormatFindEnd", "defaults": {}, "funcname": "ImParseFormatFindEnd", - "location": "imgui_internal:333", + "location": "imgui_internal:371", "ov_cimguiname": "igImParseFormatFindEnd", "ret": "const char*", "signature": "(const char*)", @@ -20420,7 +21645,7 @@ "cimguiname": "igImParseFormatFindStart", "defaults": {}, "funcname": "ImParseFormatFindStart", - "location": "imgui_internal:332", + "location": "imgui_internal:370", "ov_cimguiname": "igImParseFormatFindStart", "ret": "const char*", "signature": "(const char*)", @@ -20445,13 +21670,71 @@ "cimguiname": "igImParseFormatPrecision", "defaults": {}, "funcname": "ImParseFormatPrecision", - "location": "imgui_internal:335", + "location": "imgui_internal:375", "ov_cimguiname": "igImParseFormatPrecision", "ret": "int", "signature": "(const char*,int)", "stname": "" } ], + "igImParseFormatSanitizeForPrinting": [ + { + "args": "(const char* fmt_in,char* fmt_out,size_t fmt_out_size)", + "argsT": [ + { + "name": "fmt_in", + "type": "const char*" + }, + { + "name": "fmt_out", + "type": "char*" + }, + { + "name": "fmt_out_size", + "type": "size_t" + } + ], + "argsoriginal": "(const char* fmt_in,char* fmt_out,size_t fmt_out_size)", + "call_args": "(fmt_in,fmt_out,fmt_out_size)", + "cimguiname": "igImParseFormatSanitizeForPrinting", + "defaults": {}, + "funcname": "ImParseFormatSanitizeForPrinting", + "location": "imgui_internal:373", + "ov_cimguiname": "igImParseFormatSanitizeForPrinting", + "ret": "void", + "signature": "(const char*,char*,size_t)", + "stname": "" + } + ], + "igImParseFormatSanitizeForScanning": [ + { + "args": "(const char* fmt_in,char* fmt_out,size_t fmt_out_size)", + "argsT": [ + { + "name": "fmt_in", + "type": "const char*" + }, + { + "name": "fmt_out", + "type": "char*" + }, + { + "name": "fmt_out_size", + "type": "size_t" + } + ], + "argsoriginal": "(const char* fmt_in,char* fmt_out,size_t fmt_out_size)", + "call_args": "(fmt_in,fmt_out,fmt_out_size)", + "cimguiname": "igImParseFormatSanitizeForScanning", + "defaults": {}, + "funcname": "ImParseFormatSanitizeForScanning", + "location": "imgui_internal:374", + "ov_cimguiname": "igImParseFormatSanitizeForScanning", + "ret": "const char*", + "signature": "(const char*,char*,size_t)", + "stname": "" + } + ], "igImParseFormatTrimDecorations": [ { "args": "(const char* format,char* buf,size_t buf_size)", @@ -20474,7 +21757,7 @@ "cimguiname": "igImParseFormatTrimDecorations", "defaults": {}, "funcname": "ImParseFormatTrimDecorations", - "location": "imgui_internal:334", + "location": "imgui_internal:372", "ov_cimguiname": "igImParseFormatTrimDecorations", "ret": "const char*", "signature": "(const char*,char*,size_t)", @@ -20499,7 +21782,7 @@ "cimguiname": "igImPow", "defaults": {}, "funcname": "ImPow", - "location": "imgui_internal:407", + "location": "imgui_internal:422", "ov_cimguiname": "igImPow_Float", "ret": "float", "signature": "(float,float)", @@ -20522,7 +21805,7 @@ "cimguiname": "igImPow", "defaults": {}, "funcname": "ImPow", - "location": "imgui_internal:408", + "location": "imgui_internal:423", "ov_cimguiname": "igImPow_double", "ret": "double", "signature": "(double,double)", @@ -20557,7 +21840,7 @@ "cimguiname": "igImQsort", "defaults": {}, "funcname": "ImQsort", - "location": "imgui_internal:306", + "location": "imgui_internal:335", "ov_cimguiname": "igImQsort", "ret": "void", "signature": "(void*,size_t,size_t,int(*)(void const*,void const*))", @@ -20590,7 +21873,7 @@ "cimguiname": "igImRotate", "defaults": {}, "funcname": "ImRotate", - "location": "imgui_internal:448", + "location": "imgui_internal:464", "nonUDT": 1, "ov_cimguiname": "igImRotate", "ret": "void", @@ -20612,7 +21895,7 @@ "cimguiname": "igImRsqrt", "defaults": {}, "funcname": "ImRsqrt", - "location": "imgui_internal:419", + "location": "imgui_internal:434", "ov_cimguiname": "igImRsqrt_Float", "ret": "float", "signature": "(float)", @@ -20631,7 +21914,7 @@ "cimguiname": "igImRsqrt", "defaults": {}, "funcname": "ImRsqrt", - "location": "imgui_internal:421", + "location": "imgui_internal:436", "ov_cimguiname": "igImRsqrt_double", "ret": "double", "signature": "(double)", @@ -20652,7 +21935,7 @@ "cimguiname": "igImSaturate", "defaults": {}, "funcname": "ImSaturate", - "location": "imgui_internal:439", + "location": "imgui_internal:454", "ov_cimguiname": "igImSaturate", "ret": "float", "signature": "(float)", @@ -20673,7 +21956,7 @@ "cimguiname": "igImSign", "defaults": {}, "funcname": "ImSign", - "location": "imgui_internal:414", + "location": "imgui_internal:429", "ov_cimguiname": "igImSign_Float", "ret": "float", "signature": "(float)", @@ -20692,7 +21975,7 @@ "cimguiname": "igImSign", "defaults": {}, "funcname": "ImSign", - "location": "imgui_internal:415", + "location": "imgui_internal:430", "ov_cimguiname": "igImSign_double", "ret": "double", "signature": "(double)", @@ -20713,7 +21996,7 @@ "cimguiname": "igImStrSkipBlank", "defaults": {}, "funcname": "ImStrSkipBlank", - "location": "imgui_internal:329", + "location": "imgui_internal:358", "ov_cimguiname": "igImStrSkipBlank", "ret": "const char*", "signature": "(const char*)", @@ -20734,7 +22017,7 @@ "cimguiname": "igImStrTrimBlanks", "defaults": {}, "funcname": "ImStrTrimBlanks", - "location": "imgui_internal:328", + "location": "imgui_internal:357", "ov_cimguiname": "igImStrTrimBlanks", "ret": "void", "signature": "(char*)", @@ -20759,7 +22042,7 @@ "cimguiname": "igImStrbolW", "defaults": {}, "funcname": "ImStrbolW", - "location": "imgui_internal:326", + "location": "imgui_internal:355", "ov_cimguiname": "igImStrbolW", "ret": "const ImWchar*", "signature": "(const ImWchar*,const ImWchar*)", @@ -20788,7 +22071,7 @@ "cimguiname": "igImStrchrRange", "defaults": {}, "funcname": "ImStrchrRange", - "location": "imgui_internal:323", + "location": "imgui_internal:352", "ov_cimguiname": "igImStrchrRange", "ret": "const char*", "signature": "(const char*,const char*,char)", @@ -20809,7 +22092,7 @@ "cimguiname": "igImStrdup", "defaults": {}, "funcname": "ImStrdup", - "location": "imgui_internal:321", + "location": "imgui_internal:350", "ov_cimguiname": "igImStrdup", "ret": "char*", "signature": "(const char*)", @@ -20838,7 +22121,7 @@ "cimguiname": "igImStrdupcpy", "defaults": {}, "funcname": "ImStrdupcpy", - "location": "imgui_internal:322", + "location": "imgui_internal:351", "ov_cimguiname": "igImStrdupcpy", "ret": "char*", "signature": "(char*,size_t*,const char*)", @@ -20863,7 +22146,7 @@ "cimguiname": "igImStreolRange", "defaults": {}, "funcname": "ImStreolRange", - "location": "imgui_internal:325", + "location": "imgui_internal:354", "ov_cimguiname": "igImStreolRange", "ret": "const char*", "signature": "(const char*,const char*)", @@ -20888,7 +22171,7 @@ "cimguiname": "igImStricmp", "defaults": {}, "funcname": "ImStricmp", - "location": "imgui_internal:318", + "location": "imgui_internal:347", "ov_cimguiname": "igImStricmp", "ret": "int", "signature": "(const char*,const char*)", @@ -20921,7 +22204,7 @@ "cimguiname": "igImStristr", "defaults": {}, "funcname": "ImStristr", - "location": "imgui_internal:327", + "location": "imgui_internal:356", "ov_cimguiname": "igImStristr", "ret": "const char*", "signature": "(const char*,const char*,const char*,const char*)", @@ -20942,7 +22225,7 @@ "cimguiname": "igImStrlenW", "defaults": {}, "funcname": "ImStrlenW", - "location": "imgui_internal:324", + "location": "imgui_internal:353", "ov_cimguiname": "igImStrlenW", "ret": "int", "signature": "(const ImWchar*)", @@ -20971,7 +22254,7 @@ "cimguiname": "igImStrncpy", "defaults": {}, "funcname": "ImStrncpy", - "location": "imgui_internal:320", + "location": "imgui_internal:349", "ov_cimguiname": "igImStrncpy", "ret": "void", "signature": "(char*,const char*,size_t)", @@ -21000,7 +22283,7 @@ "cimguiname": "igImStrnicmp", "defaults": {}, "funcname": "ImStrnicmp", - "location": "imgui_internal:319", + "location": "imgui_internal:348", "ov_cimguiname": "igImStrnicmp", "ret": "int", "signature": "(const char*,const char*,size_t)", @@ -21029,7 +22312,7 @@ "cimguiname": "igImTextCharFromUtf8", "defaults": {}, "funcname": "ImTextCharFromUtf8", - "location": "imgui_internal:342", + "location": "imgui_internal:380", "ov_cimguiname": "igImTextCharFromUtf8", "ret": "int", "signature": "(unsigned int*,const char*,const char*)", @@ -21054,7 +22337,7 @@ "cimguiname": "igImTextCharToUtf8", "defaults": {}, "funcname": "ImTextCharToUtf8", - "location": "imgui_internal:340", + "location": "imgui_internal:378", "ov_cimguiname": "igImTextCharToUtf8", "ret": "const char*", "signature": "(char[5],unsigned int)", @@ -21079,7 +22362,7 @@ "cimguiname": "igImTextCountCharsFromUtf8", "defaults": {}, "funcname": "ImTextCountCharsFromUtf8", - "location": "imgui_internal:344", + "location": "imgui_internal:382", "ov_cimguiname": "igImTextCountCharsFromUtf8", "ret": "int", "signature": "(const char*,const char*)", @@ -21104,7 +22387,7 @@ "cimguiname": "igImTextCountUtf8BytesFromChar", "defaults": {}, "funcname": "ImTextCountUtf8BytesFromChar", - "location": "imgui_internal:345", + "location": "imgui_internal:383", "ov_cimguiname": "igImTextCountUtf8BytesFromChar", "ret": "int", "signature": "(const char*,const char*)", @@ -21129,7 +22412,7 @@ "cimguiname": "igImTextCountUtf8BytesFromStr", "defaults": {}, "funcname": "ImTextCountUtf8BytesFromStr", - "location": "imgui_internal:346", + "location": "imgui_internal:384", "ov_cimguiname": "igImTextCountUtf8BytesFromStr", "ret": "int", "signature": "(const ImWchar*,const ImWchar*)", @@ -21168,7 +22451,7 @@ "in_remaining": "NULL" }, "funcname": "ImTextStrFromUtf8", - "location": "imgui_internal:343", + "location": "imgui_internal:381", "ov_cimguiname": "igImTextStrFromUtf8", "ret": "int", "signature": "(ImWchar*,int,const char*,const char*,const char**)", @@ -21201,13 +22484,34 @@ "cimguiname": "igImTextStrToUtf8", "defaults": {}, "funcname": "ImTextStrToUtf8", - "location": "imgui_internal:341", + "location": "imgui_internal:379", "ov_cimguiname": "igImTextStrToUtf8", "ret": "int", "signature": "(char*,int,const ImWchar*,const ImWchar*)", "stname": "" } ], + "igImToUpper": [ + { + "args": "(char c)", + "argsT": [ + { + "name": "c", + "type": "char" + } + ], + "argsoriginal": "(char c)", + "call_args": "(c)", + "cimguiname": "igImToUpper", + "defaults": {}, + "funcname": "ImToUpper", + "location": "imgui_internal:360", + "ov_cimguiname": "igImToUpper", + "ret": "char", + "signature": "(char)", + "stname": "" + } + ], "igImTriangleArea": [ { "args": "(const ImVec2 a,const ImVec2 b,const ImVec2 c)", @@ -21230,7 +22534,7 @@ "cimguiname": "igImTriangleArea", "defaults": {}, "funcname": "ImTriangleArea", - "location": "imgui_internal:463", + "location": "imgui_internal:480", "ov_cimguiname": "igImTriangleArea", "ret": "float", "signature": "(const ImVec2,const ImVec2,const ImVec2)", @@ -21278,7 +22582,7 @@ "cimguiname": "igImTriangleBarycentricCoords", "defaults": {}, "funcname": "ImTriangleBarycentricCoords", - "location": "imgui_internal:462", + "location": "imgui_internal:479", "ov_cimguiname": "igImTriangleBarycentricCoords", "ret": "void", "signature": "(const ImVec2,const ImVec2,const ImVec2,const ImVec2,float*,float*,float*)", @@ -21315,7 +22619,7 @@ "cimguiname": "igImTriangleClosestPoint", "defaults": {}, "funcname": "ImTriangleClosestPoint", - "location": "imgui_internal:461", + "location": "imgui_internal:478", "nonUDT": 1, "ov_cimguiname": "igImTriangleClosestPoint", "ret": "void", @@ -21349,7 +22653,7 @@ "cimguiname": "igImTriangleContainsPoint", "defaults": {}, "funcname": "ImTriangleContainsPoint", - "location": "imgui_internal:460", + "location": "imgui_internal:477", "ov_cimguiname": "igImTriangleContainsPoint", "ret": "bool", "signature": "(const ImVec2,const ImVec2,const ImVec2,const ImVec2)", @@ -21370,7 +22674,7 @@ "cimguiname": "igImUpperPowerOfTwo", "defaults": {}, "funcname": "ImUpperPowerOfTwo", - "location": "imgui_internal:315", + "location": "imgui_internal:344", "ov_cimguiname": "igImUpperPowerOfTwo", "ret": "int", "signature": "(int)", @@ -21416,7 +22720,7 @@ "uv1": "ImVec2(1,1)" }, "funcname": "Image", - "location": "imgui:506", + "location": "imgui:516", "namespace": "ImGui", "ov_cimguiname": "igImage", "ret": "void", @@ -21426,8 +22730,12 @@ ], "igImageButton": [ { - "args": "(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,int frame_padding,const ImVec4 bg_col,const ImVec4 tint_col)", + "args": "(const char* str_id,ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 bg_col,const ImVec4 tint_col)", "argsT": [ + { + "name": "str_id", + "type": "const char*" + }, { "name": "user_texture_id", "type": "ImTextureID" @@ -21444,10 +22752,6 @@ "name": "uv1", "type": "const ImVec2" }, - { - "name": "frame_padding", - "type": "int" - }, { "name": "bg_col", "type": "const ImVec4" @@ -21457,28 +22761,27 @@ "type": "const ImVec4" } ], - "argsoriginal": "(ImTextureID user_texture_id,const ImVec2& size,const ImVec2& uv0=ImVec2(0,0),const ImVec2& uv1=ImVec2(1,1),int frame_padding=-1,const ImVec4& bg_col=ImVec4(0,0,0,0),const ImVec4& tint_col=ImVec4(1,1,1,1))", - "call_args": "(user_texture_id,size,uv0,uv1,frame_padding,bg_col,tint_col)", + "argsoriginal": "(const char* str_id,ImTextureID user_texture_id,const ImVec2& size,const ImVec2& uv0=ImVec2(0,0),const ImVec2& uv1=ImVec2(1,1),const ImVec4& bg_col=ImVec4(0,0,0,0),const ImVec4& tint_col=ImVec4(1,1,1,1))", + "call_args": "(str_id,user_texture_id,size,uv0,uv1,bg_col,tint_col)", "cimguiname": "igImageButton", "defaults": { "bg_col": "ImVec4(0,0,0,0)", - "frame_padding": "-1", "tint_col": "ImVec4(1,1,1,1)", "uv0": "ImVec2(0,0)", "uv1": "ImVec2(1,1)" }, "funcname": "ImageButton", - "location": "imgui:507", + "location": "imgui:517", "namespace": "ImGui", "ov_cimguiname": "igImageButton", "ret": "bool", - "signature": "(ImTextureID,const ImVec2,const ImVec2,const ImVec2,int,const ImVec4,const ImVec4)", + "signature": "(const char*,ImTextureID,const ImVec2,const ImVec2,const ImVec2,const ImVec4,const ImVec4)", "stname": "" } ], "igImageButtonEx": [ { - "args": "(ImGuiID id,ImTextureID texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec2 padding,const ImVec4 bg_col,const ImVec4 tint_col)", + "args": "(ImGuiID id,ImTextureID texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 bg_col,const ImVec4 tint_col,ImGuiButtonFlags flags)", "argsT": [ { "name": "id", @@ -21500,10 +22803,6 @@ "name": "uv1", "type": "const ImVec2" }, - { - "name": "padding", - "type": "const ImVec2" - }, { "name": "bg_col", "type": "const ImVec4" @@ -21511,18 +22810,24 @@ { "name": "tint_col", "type": "const ImVec4" + }, + { + "name": "flags", + "type": "ImGuiButtonFlags" } ], - "argsoriginal": "(ImGuiID id,ImTextureID texture_id,const ImVec2& size,const ImVec2& uv0,const ImVec2& uv1,const ImVec2& padding,const ImVec4& bg_col,const ImVec4& tint_col)", - "call_args": "(id,texture_id,size,uv0,uv1,padding,bg_col,tint_col)", + "argsoriginal": "(ImGuiID id,ImTextureID texture_id,const ImVec2& size,const ImVec2& uv0,const ImVec2& uv1,const ImVec4& bg_col,const ImVec4& tint_col,ImGuiButtonFlags flags=0)", + "call_args": "(id,texture_id,size,uv0,uv1,bg_col,tint_col,flags)", "cimguiname": "igImageButtonEx", - "defaults": {}, + "defaults": { + "flags": "0" + }, "funcname": "ImageButtonEx", - "location": "imgui_internal:2721", + "location": "imgui_internal:3112", "namespace": "ImGui", "ov_cimguiname": "igImageButtonEx", "ret": "bool", - "signature": "(ImGuiID,ImTextureID,const ImVec2,const ImVec2,const ImVec2,const ImVec2,const ImVec4,const ImVec4)", + "signature": "(ImGuiID,ImTextureID,const ImVec2,const ImVec2,const ImVec2,const ImVec4,const ImVec4,ImGuiButtonFlags)", "stname": "" } ], @@ -21542,7 +22847,7 @@ "indent_w": "0.0f" }, "funcname": "Indent", - "location": "imgui:445", + "location": "imgui:444", "namespace": "ImGui", "ov_cimguiname": "igIndent", "ret": "void", @@ -21552,23 +22857,18 @@ ], "igInitialize": [ { - "args": "(ImGuiContext* context)", - "argsT": [ - { - "name": "context", - "type": "ImGuiContext*" - } - ], - "argsoriginal": "(ImGuiContext* context)", - "call_args": "(context)", + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", "cimguiname": "igInitialize", "defaults": {}, "funcname": "Initialize", - "location": "imgui_internal:2452", + "location": "imgui_internal:2770", "namespace": "ImGui", "ov_cimguiname": "igInitialize", "ret": "void", - "signature": "(ImGuiContext*)", + "signature": "()", "stname": "" } ], @@ -21611,7 +22911,7 @@ "step_fast": "0.0" }, "funcname": "InputDouble", - "location": "imgui:584", + "location": "imgui:588", "namespace": "ImGui", "ov_cimguiname": "igInputDouble", "ret": "bool", @@ -21658,7 +22958,7 @@ "step_fast": "0.0f" }, "funcname": "InputFloat", - "location": "imgui:576", + "location": "imgui:580", "namespace": "ImGui", "ov_cimguiname": "igInputFloat", "ret": "bool", @@ -21695,7 +22995,7 @@ "format": "\"%.3f\"" }, "funcname": "InputFloat2", - "location": "imgui:577", + "location": "imgui:581", "namespace": "ImGui", "ov_cimguiname": "igInputFloat2", "ret": "bool", @@ -21732,7 +23032,7 @@ "format": "\"%.3f\"" }, "funcname": "InputFloat3", - "location": "imgui:578", + "location": "imgui:582", "namespace": "ImGui", "ov_cimguiname": "igInputFloat3", "ret": "bool", @@ -21769,7 +23069,7 @@ "format": "\"%.3f\"" }, "funcname": "InputFloat4", - "location": "imgui:579", + "location": "imgui:583", "namespace": "ImGui", "ov_cimguiname": "igInputFloat4", "ret": "bool", @@ -21811,7 +23111,7 @@ "step_fast": "100" }, "funcname": "InputInt", - "location": "imgui:580", + "location": "imgui:584", "namespace": "ImGui", "ov_cimguiname": "igInputInt", "ret": "bool", @@ -21843,7 +23143,7 @@ "flags": "0" }, "funcname": "InputInt2", - "location": "imgui:581", + "location": "imgui:585", "namespace": "ImGui", "ov_cimguiname": "igInputInt2", "ret": "bool", @@ -21875,7 +23175,7 @@ "flags": "0" }, "funcname": "InputInt3", - "location": "imgui:582", + "location": "imgui:586", "namespace": "ImGui", "ov_cimguiname": "igInputInt3", "ret": "bool", @@ -21907,7 +23207,7 @@ "flags": "0" }, "funcname": "InputInt4", - "location": "imgui:583", + "location": "imgui:587", "namespace": "ImGui", "ov_cimguiname": "igInputInt4", "ret": "bool", @@ -21958,7 +23258,7 @@ "p_step_fast": "NULL" }, "funcname": "InputScalar", - "location": "imgui:585", + "location": "imgui:589", "namespace": "ImGui", "ov_cimguiname": "igInputScalar", "ret": "bool", @@ -22013,7 +23313,7 @@ "p_step_fast": "NULL" }, "funcname": "InputScalarN", - "location": "imgui:586", + "location": "imgui:590", "namespace": "ImGui", "ov_cimguiname": "igInputScalarN", "ret": "bool", @@ -22059,7 +23359,7 @@ "user_data": "NULL" }, "funcname": "InputText", - "location": "imgui:573", + "location": "imgui:577", "namespace": "ImGui", "ov_cimguiname": "igInputText", "ret": "bool", @@ -22067,6 +23367,28 @@ "stname": "" } ], + "igInputTextDeactivateHook": [ + { + "args": "(ImGuiID id)", + "argsT": [ + { + "name": "id", + "type": "ImGuiID" + } + ], + "argsoriginal": "(ImGuiID id)", + "call_args": "(id)", + "cimguiname": "igInputTextDeactivateHook", + "defaults": {}, + "funcname": "InputTextDeactivateHook", + "location": "imgui_internal:3158", + "namespace": "ImGui", + "ov_cimguiname": "igInputTextDeactivateHook", + "ret": "void", + "signature": "(ImGuiID)", + "stname": "" + } + ], "igInputTextEx": [ { "args": "(const char* label,const char* hint,char* buf,int buf_size,const ImVec2 size_arg,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,void* user_data)", @@ -22112,7 +23434,7 @@ "user_data": "NULL" }, "funcname": "InputTextEx", - "location": "imgui_internal:2758", + "location": "imgui_internal:3157", "namespace": "ImGui", "ov_cimguiname": "igInputTextEx", "ret": "bool", @@ -22163,7 +23485,7 @@ "user_data": "NULL" }, "funcname": "InputTextMultiline", - "location": "imgui:574", + "location": "imgui:578", "namespace": "ImGui", "ov_cimguiname": "igInputTextMultiline", "ret": "bool", @@ -22213,7 +23535,7 @@ "user_data": "NULL" }, "funcname": "InputTextWithHint", - "location": "imgui:575", + "location": "imgui:579", "namespace": "ImGui", "ov_cimguiname": "igInputTextWithHint", "ret": "bool", @@ -22234,44 +23556,22 @@ "type": "const ImVec2" }, { - "name": "flags", - "type": "ImGuiButtonFlags" - } - ], - "argsoriginal": "(const char* str_id,const ImVec2& size,ImGuiButtonFlags flags=0)", - "call_args": "(str_id,size,flags)", - "cimguiname": "igInvisibleButton", - "defaults": { - "flags": "0" - }, - "funcname": "InvisibleButton", - "location": "imgui:504", - "namespace": "ImGui", - "ov_cimguiname": "igInvisibleButton", - "ret": "bool", - "signature": "(const char*,const ImVec2,ImGuiButtonFlags)", - "stname": "" - } - ], - "igIsActiveIdUsingKey": [ - { - "args": "(ImGuiKey key)", - "argsT": [ - { - "name": "key", - "type": "ImGuiKey" + "name": "flags", + "type": "ImGuiButtonFlags" } ], - "argsoriginal": "(ImGuiKey key)", - "call_args": "(key)", - "cimguiname": "igIsActiveIdUsingKey", - "defaults": {}, - "funcname": "IsActiveIdUsingKey", - "location": "imgui_internal:2596", + "argsoriginal": "(const char* str_id,const ImVec2& size,ImGuiButtonFlags flags=0)", + "call_args": "(str_id,size,flags)", + "cimguiname": "igInvisibleButton", + "defaults": { + "flags": "0" + }, + "funcname": "InvisibleButton", + "location": "imgui:504", "namespace": "ImGui", - "ov_cimguiname": "igIsActiveIdUsingKey", + "ov_cimguiname": "igInvisibleButton", "ret": "bool", - "signature": "(ImGuiKey)", + "signature": "(const char*,const ImVec2,ImGuiButtonFlags)", "stname": "" } ], @@ -22289,7 +23589,7 @@ "cimguiname": "igIsActiveIdUsingNavDir", "defaults": {}, "funcname": "IsActiveIdUsingNavDir", - "location": "imgui_internal:2594", + "location": "imgui_internal:2932", "namespace": "ImGui", "ov_cimguiname": "igIsActiveIdUsingNavDir", "ret": "bool", @@ -22297,25 +23597,25 @@ "stname": "" } ], - "igIsActiveIdUsingNavInput": [ + "igIsAliasKey": [ { - "args": "(ImGuiNavInput input)", + "args": "(ImGuiKey key)", "argsT": [ { - "name": "input", - "type": "ImGuiNavInput" + "name": "key", + "type": "ImGuiKey" } ], - "argsoriginal": "(ImGuiNavInput input)", - "call_args": "(input)", - "cimguiname": "igIsActiveIdUsingNavInput", + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igIsAliasKey", "defaults": {}, - "funcname": "IsActiveIdUsingNavInput", - "location": "imgui_internal:2595", + "funcname": "IsAliasKey", + "location": "imgui_internal:2909", "namespace": "ImGui", - "ov_cimguiname": "igIsActiveIdUsingNavInput", + "ov_cimguiname": "igIsAliasKey", "ret": "bool", - "signature": "(ImGuiNavInput)", + "signature": "(ImGuiKey)", "stname": "" } ], @@ -22328,7 +23628,7 @@ "cimguiname": "igIsAnyItemActive", "defaults": {}, "funcname": "IsAnyItemActive", - "location": "imgui:848", + "location": "imgui:849", "namespace": "ImGui", "ov_cimguiname": "igIsAnyItemActive", "ret": "bool", @@ -22345,7 +23645,7 @@ "cimguiname": "igIsAnyItemFocused", "defaults": {}, "funcname": "IsAnyItemFocused", - "location": "imgui:849", + "location": "imgui:850", "namespace": "ImGui", "ov_cimguiname": "igIsAnyItemFocused", "ret": "bool", @@ -22362,7 +23662,7 @@ "cimguiname": "igIsAnyItemHovered", "defaults": {}, "funcname": "IsAnyItemHovered", - "location": "imgui:847", + "location": "imgui:848", "namespace": "ImGui", "ov_cimguiname": "igIsAnyItemHovered", "ret": "bool", @@ -22379,7 +23679,7 @@ "cimguiname": "igIsAnyMouseDown", "defaults": {}, "funcname": "IsAnyMouseDown", - "location": "imgui:905", + "location": "imgui:911", "namespace": "ImGui", "ov_cimguiname": "igIsAnyMouseDown", "ret": "bool", @@ -22405,7 +23705,7 @@ "cimguiname": "igIsClippedEx", "defaults": {}, "funcname": "IsClippedEx", - "location": "imgui_internal:2511", + "location": "imgui_internal:2842", "namespace": "ImGui", "ov_cimguiname": "igIsClippedEx", "ret": "bool", @@ -22413,6 +23713,23 @@ "stname": "" } ], + "igIsDragDropActive": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "igIsDragDropActive", + "defaults": {}, + "funcname": "IsDragDropActive", + "location": "imgui_internal:2993", + "namespace": "ImGui", + "ov_cimguiname": "igIsDragDropActive", + "ret": "bool", + "signature": "()", + "stname": "" + } + ], "igIsDragDropPayloadBeingAccepted": [ { "args": "()", @@ -22422,7 +23739,7 @@ "cimguiname": "igIsDragDropPayloadBeingAccepted", "defaults": {}, "funcname": "IsDragDropPayloadBeingAccepted", - "location": "imgui_internal:2606", + "location": "imgui_internal:2996", "namespace": "ImGui", "ov_cimguiname": "igIsDragDropPayloadBeingAccepted", "ret": "bool", @@ -22430,6 +23747,28 @@ "stname": "" } ], + "igIsGamepadKey": [ + { + "args": "(ImGuiKey key)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igIsGamepadKey", + "defaults": {}, + "funcname": "IsGamepadKey", + "location": "imgui_internal:2907", + "namespace": "ImGui", + "ov_cimguiname": "igIsGamepadKey", + "ret": "bool", + "signature": "(ImGuiKey)", + "stname": "" + } + ], "igIsItemActivated": [ { "args": "()", @@ -22439,7 +23778,7 @@ "cimguiname": "igIsItemActivated", "defaults": {}, "funcname": "IsItemActivated", - "location": "imgui:843", + "location": "imgui:844", "namespace": "ImGui", "ov_cimguiname": "igIsItemActivated", "ret": "bool", @@ -22456,7 +23795,7 @@ "cimguiname": "igIsItemActive", "defaults": {}, "funcname": "IsItemActive", - "location": "imgui:838", + "location": "imgui:839", "namespace": "ImGui", "ov_cimguiname": "igIsItemActive", "ret": "bool", @@ -22480,7 +23819,7 @@ "mouse_button": "0" }, "funcname": "IsItemClicked", - "location": "imgui:840", + "location": "imgui:841", "namespace": "ImGui", "ov_cimguiname": "igIsItemClicked", "ret": "bool", @@ -22497,7 +23836,7 @@ "cimguiname": "igIsItemDeactivated", "defaults": {}, "funcname": "IsItemDeactivated", - "location": "imgui:844", + "location": "imgui:845", "namespace": "ImGui", "ov_cimguiname": "igIsItemDeactivated", "ret": "bool", @@ -22514,7 +23853,7 @@ "cimguiname": "igIsItemDeactivatedAfterEdit", "defaults": {}, "funcname": "IsItemDeactivatedAfterEdit", - "location": "imgui:845", + "location": "imgui:846", "namespace": "ImGui", "ov_cimguiname": "igIsItemDeactivatedAfterEdit", "ret": "bool", @@ -22531,7 +23870,7 @@ "cimguiname": "igIsItemEdited", "defaults": {}, "funcname": "IsItemEdited", - "location": "imgui:842", + "location": "imgui:843", "namespace": "ImGui", "ov_cimguiname": "igIsItemEdited", "ret": "bool", @@ -22548,7 +23887,7 @@ "cimguiname": "igIsItemFocused", "defaults": {}, "funcname": "IsItemFocused", - "location": "imgui:839", + "location": "imgui:840", "namespace": "ImGui", "ov_cimguiname": "igIsItemFocused", "ret": "bool", @@ -22572,7 +23911,7 @@ "flags": "0" }, "funcname": "IsItemHovered", - "location": "imgui:837", + "location": "imgui:838", "namespace": "ImGui", "ov_cimguiname": "igIsItemHovered", "ret": "bool", @@ -22589,7 +23928,7 @@ "cimguiname": "igIsItemToggledOpen", "defaults": {}, "funcname": "IsItemToggledOpen", - "location": "imgui:846", + "location": "imgui:847", "namespace": "ImGui", "ov_cimguiname": "igIsItemToggledOpen", "ret": "bool", @@ -22606,7 +23945,7 @@ "cimguiname": "igIsItemToggledSelection", "defaults": {}, "funcname": "IsItemToggledSelection", - "location": "imgui_internal:2516", + "location": "imgui_internal:2847", "namespace": "ImGui", "ov_cimguiname": "igIsItemToggledSelection", "ret": "bool", @@ -22623,7 +23962,7 @@ "cimguiname": "igIsItemVisible", "defaults": {}, "funcname": "IsItemVisible", - "location": "imgui:841", + "location": "imgui:842", "namespace": "ImGui", "ov_cimguiname": "igIsItemVisible", "ret": "bool", @@ -22633,51 +23972,105 @@ ], "igIsKeyDown": [ { - "args": "(int user_key_index)", + "args": "(ImGuiKey key)", "argsT": [ { - "name": "user_key_index", - "type": "int" + "name": "key", + "type": "ImGuiKey" } ], - "argsoriginal": "(int user_key_index)", - "call_args": "(user_key_index)", + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", "cimguiname": "igIsKeyDown", "defaults": {}, "funcname": "IsKeyDown", - "location": "imgui:888", + "location": "imgui:893", "namespace": "ImGui", - "ov_cimguiname": "igIsKeyDown", + "ov_cimguiname": "igIsKeyDown_Nil", "ret": "bool", - "signature": "(int)", + "signature": "(ImGuiKey)", + "stname": "" + }, + { + "args": "(ImGuiKey key,ImGuiID owner_id)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + }, + { + "name": "owner_id", + "type": "ImGuiID" + } + ], + "argsoriginal": "(ImGuiKey key,ImGuiID owner_id)", + "call_args": "(key,owner_id)", + "cimguiname": "igIsKeyDown", + "defaults": {}, + "funcname": "IsKeyDown", + "location": "imgui_internal:2958", + "namespace": "ImGui", + "ov_cimguiname": "igIsKeyDown_ID", + "ret": "bool", + "signature": "(ImGuiKey,ImGuiID)", "stname": "" } ], "igIsKeyPressed": [ { - "args": "(int user_key_index,bool repeat)", + "args": "(ImGuiKey key,bool repeat)", "argsT": [ { - "name": "user_key_index", - "type": "int" + "name": "key", + "type": "ImGuiKey" }, { "name": "repeat", "type": "bool" } ], - "argsoriginal": "(int user_key_index,bool repeat=true)", - "call_args": "(user_key_index,repeat)", + "argsoriginal": "(ImGuiKey key,bool repeat=true)", + "call_args": "(key,repeat)", "cimguiname": "igIsKeyPressed", "defaults": { "repeat": "true" }, "funcname": "IsKeyPressed", - "location": "imgui:889", + "location": "imgui:894", "namespace": "ImGui", - "ov_cimguiname": "igIsKeyPressed", + "ov_cimguiname": "igIsKeyPressed_Bool", "ret": "bool", - "signature": "(int,bool)", + "signature": "(ImGuiKey,bool)", + "stname": "" + }, + { + "args": "(ImGuiKey key,ImGuiID owner_id,ImGuiInputFlags flags)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + }, + { + "name": "owner_id", + "type": "ImGuiID" + }, + { + "name": "flags", + "type": "ImGuiInputFlags" + } + ], + "argsoriginal": "(ImGuiKey key,ImGuiID owner_id,ImGuiInputFlags flags=0)", + "call_args": "(key,owner_id,flags)", + "cimguiname": "igIsKeyPressed", + "defaults": { + "flags": "0" + }, + "funcname": "IsKeyPressed", + "location": "imgui_internal:2959", + "namespace": "ImGui", + "ov_cimguiname": "igIsKeyPressed_ID", + "ret": "bool", + "signature": "(ImGuiKey,ImGuiID,ImGuiInputFlags)", "stname": "" } ], @@ -22701,7 +24094,7 @@ "repeat": "true" }, "funcname": "IsKeyPressedMap", - "location": "imgui_internal:2598", + "location": "imgui_internal:3228", "namespace": "ImGui", "ov_cimguiname": "igIsKeyPressedMap", "ret": "bool", @@ -22711,23 +24104,91 @@ ], "igIsKeyReleased": [ { - "args": "(int user_key_index)", + "args": "(ImGuiKey key)", "argsT": [ { - "name": "user_key_index", - "type": "int" + "name": "key", + "type": "ImGuiKey" } ], - "argsoriginal": "(int user_key_index)", - "call_args": "(user_key_index)", + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", "cimguiname": "igIsKeyReleased", "defaults": {}, "funcname": "IsKeyReleased", - "location": "imgui:890", + "location": "imgui:895", "namespace": "ImGui", - "ov_cimguiname": "igIsKeyReleased", + "ov_cimguiname": "igIsKeyReleased_Nil", "ret": "bool", - "signature": "(int)", + "signature": "(ImGuiKey)", + "stname": "" + }, + { + "args": "(ImGuiKey key,ImGuiID owner_id)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + }, + { + "name": "owner_id", + "type": "ImGuiID" + } + ], + "argsoriginal": "(ImGuiKey key,ImGuiID owner_id)", + "call_args": "(key,owner_id)", + "cimguiname": "igIsKeyReleased", + "defaults": {}, + "funcname": "IsKeyReleased", + "location": "imgui_internal:2960", + "namespace": "ImGui", + "ov_cimguiname": "igIsKeyReleased_ID", + "ret": "bool", + "signature": "(ImGuiKey,ImGuiID)", + "stname": "" + } + ], + "igIsKeyboardKey": [ + { + "args": "(ImGuiKey key)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igIsKeyboardKey", + "defaults": {}, + "funcname": "IsKeyboardKey", + "location": "imgui_internal:2906", + "namespace": "ImGui", + "ov_cimguiname": "igIsKeyboardKey", + "ret": "bool", + "signature": "(ImGuiKey)", + "stname": "" + } + ], + "igIsLegacyKey": [ + { + "args": "(ImGuiKey key)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igIsLegacyKey", + "defaults": {}, + "funcname": "IsLegacyKey", + "location": "imgui_internal:2905", + "namespace": "ImGui", + "ov_cimguiname": "igIsLegacyKey", + "ret": "bool", + "signature": "(ImGuiKey)", "stname": "" } ], @@ -22751,12 +24212,42 @@ "repeat": "false" }, "funcname": "IsMouseClicked", - "location": "imgui:899", + "location": "imgui:905", "namespace": "ImGui", - "ov_cimguiname": "igIsMouseClicked", + "ov_cimguiname": "igIsMouseClicked_Bool", "ret": "bool", "signature": "(ImGuiMouseButton,bool)", "stname": "" + }, + { + "args": "(ImGuiMouseButton button,ImGuiID owner_id,ImGuiInputFlags flags)", + "argsT": [ + { + "name": "button", + "type": "ImGuiMouseButton" + }, + { + "name": "owner_id", + "type": "ImGuiID" + }, + { + "name": "flags", + "type": "ImGuiInputFlags" + } + ], + "argsoriginal": "(ImGuiMouseButton button,ImGuiID owner_id,ImGuiInputFlags flags=0)", + "call_args": "(button,owner_id,flags)", + "cimguiname": "igIsMouseClicked", + "defaults": { + "flags": "0" + }, + "funcname": "IsMouseClicked", + "location": "imgui_internal:2962", + "namespace": "ImGui", + "ov_cimguiname": "igIsMouseClicked_ID", + "ret": "bool", + "signature": "(ImGuiMouseButton,ImGuiID,ImGuiInputFlags)", + "stname": "" } ], "igIsMouseDoubleClicked": [ @@ -22773,7 +24264,7 @@ "cimguiname": "igIsMouseDoubleClicked", "defaults": {}, "funcname": "IsMouseDoubleClicked", - "location": "imgui:901", + "location": "imgui:907", "namespace": "ImGui", "ov_cimguiname": "igIsMouseDoubleClicked", "ret": "bool", @@ -22795,12 +24286,36 @@ "cimguiname": "igIsMouseDown", "defaults": {}, "funcname": "IsMouseDown", - "location": "imgui:898", + "location": "imgui:904", "namespace": "ImGui", - "ov_cimguiname": "igIsMouseDown", + "ov_cimguiname": "igIsMouseDown_Nil", "ret": "bool", "signature": "(ImGuiMouseButton)", "stname": "" + }, + { + "args": "(ImGuiMouseButton button,ImGuiID owner_id)", + "argsT": [ + { + "name": "button", + "type": "ImGuiMouseButton" + }, + { + "name": "owner_id", + "type": "ImGuiID" + } + ], + "argsoriginal": "(ImGuiMouseButton button,ImGuiID owner_id)", + "call_args": "(button,owner_id)", + "cimguiname": "igIsMouseDown", + "defaults": {}, + "funcname": "IsMouseDown", + "location": "imgui_internal:2961", + "namespace": "ImGui", + "ov_cimguiname": "igIsMouseDown_ID", + "ret": "bool", + "signature": "(ImGuiMouseButton,ImGuiID)", + "stname": "" } ], "igIsMouseDragPastThreshold": [ @@ -22823,7 +24338,7 @@ "lock_threshold": "-1.0f" }, "funcname": "IsMouseDragPastThreshold", - "location": "imgui_internal:2597", + "location": "imgui_internal:2926", "namespace": "ImGui", "ov_cimguiname": "igIsMouseDragPastThreshold", "ret": "bool", @@ -22851,7 +24366,7 @@ "lock_threshold": "-1.0f" }, "funcname": "IsMouseDragging", - "location": "imgui:908", + "location": "imgui:914", "namespace": "ImGui", "ov_cimguiname": "igIsMouseDragging", "ret": "bool", @@ -22883,11 +24398,33 @@ "clip": "true" }, "funcname": "IsMouseHoveringRect", - "location": "imgui:903", + "location": "imgui:909", + "namespace": "ImGui", + "ov_cimguiname": "igIsMouseHoveringRect", + "ret": "bool", + "signature": "(const ImVec2,const ImVec2,bool)", + "stname": "" + } + ], + "igIsMouseKey": [ + { + "args": "(ImGuiKey key)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + } + ], + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igIsMouseKey", + "defaults": {}, + "funcname": "IsMouseKey", + "location": "imgui_internal:2908", "namespace": "ImGui", - "ov_cimguiname": "igIsMouseHoveringRect", + "ov_cimguiname": "igIsMouseKey", "ret": "bool", - "signature": "(const ImVec2,const ImVec2,bool)", + "signature": "(ImGuiKey)", "stname": "" } ], @@ -22907,7 +24444,7 @@ "mouse_pos": "NULL" }, "funcname": "IsMousePosValid", - "location": "imgui:904", + "location": "imgui:910", "namespace": "ImGui", "ov_cimguiname": "igIsMousePosValid", "ret": "bool", @@ -22929,59 +24466,79 @@ "cimguiname": "igIsMouseReleased", "defaults": {}, "funcname": "IsMouseReleased", - "location": "imgui:900", + "location": "imgui:906", "namespace": "ImGui", - "ov_cimguiname": "igIsMouseReleased", + "ov_cimguiname": "igIsMouseReleased_Nil", "ret": "bool", "signature": "(ImGuiMouseButton)", "stname": "" + }, + { + "args": "(ImGuiMouseButton button,ImGuiID owner_id)", + "argsT": [ + { + "name": "button", + "type": "ImGuiMouseButton" + }, + { + "name": "owner_id", + "type": "ImGuiID" + } + ], + "argsoriginal": "(ImGuiMouseButton button,ImGuiID owner_id)", + "call_args": "(button,owner_id)", + "cimguiname": "igIsMouseReleased", + "defaults": {}, + "funcname": "IsMouseReleased", + "location": "imgui_internal:2963", + "namespace": "ImGui", + "ov_cimguiname": "igIsMouseReleased_ID", + "ret": "bool", + "signature": "(ImGuiMouseButton,ImGuiID)", + "stname": "" } ], - "igIsNavInputDown": [ + "igIsNamedKey": [ { - "args": "(ImGuiNavInput n)", + "args": "(ImGuiKey key)", "argsT": [ { - "name": "n", - "type": "ImGuiNavInput" + "name": "key", + "type": "ImGuiKey" } ], - "argsoriginal": "(ImGuiNavInput n)", - "call_args": "(n)", - "cimguiname": "igIsNavInputDown", + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igIsNamedKey", "defaults": {}, - "funcname": "IsNavInputDown", - "location": "imgui_internal:2599", + "funcname": "IsNamedKey", + "location": "imgui_internal:2903", "namespace": "ImGui", - "ov_cimguiname": "igIsNavInputDown", + "ov_cimguiname": "igIsNamedKey", "ret": "bool", - "signature": "(ImGuiNavInput)", + "signature": "(ImGuiKey)", "stname": "" } ], - "igIsNavInputTest": [ + "igIsNamedKeyOrModKey": [ { - "args": "(ImGuiNavInput n,ImGuiInputReadMode rm)", + "args": "(ImGuiKey key)", "argsT": [ { - "name": "n", - "type": "ImGuiNavInput" - }, - { - "name": "rm", - "type": "ImGuiInputReadMode" + "name": "key", + "type": "ImGuiKey" } ], - "argsoriginal": "(ImGuiNavInput n,ImGuiInputReadMode rm)", - "call_args": "(n,rm)", - "cimguiname": "igIsNavInputTest", + "argsoriginal": "(ImGuiKey key)", + "call_args": "(key)", + "cimguiname": "igIsNamedKeyOrModKey", "defaults": {}, - "funcname": "IsNavInputTest", - "location": "imgui_internal:2600", + "funcname": "IsNamedKeyOrModKey", + "location": "imgui_internal:2904", "namespace": "ImGui", - "ov_cimguiname": "igIsNavInputTest", + "ov_cimguiname": "igIsNamedKeyOrModKey", "ret": "bool", - "signature": "(ImGuiNavInput,ImGuiInputReadMode)", + "signature": "(ImGuiKey)", "stname": "" } ], @@ -23005,7 +24562,7 @@ "flags": "0" }, "funcname": "IsPopupOpen", - "location": "imgui:711", + "location": "imgui:716", "namespace": "ImGui", "ov_cimguiname": "igIsPopupOpen_Str", "ret": "bool", @@ -23029,7 +24586,7 @@ "cimguiname": "igIsPopupOpen", "defaults": {}, "funcname": "IsPopupOpen", - "location": "imgui_internal:2547", + "location": "imgui_internal:2868", "namespace": "ImGui", "ov_cimguiname": "igIsPopupOpen_ID", "ret": "bool", @@ -23051,7 +24608,7 @@ "cimguiname": "igIsRectVisible", "defaults": {}, "funcname": "IsRectVisible", - "location": "imgui:862", + "location": "imgui:868", "namespace": "ImGui", "ov_cimguiname": "igIsRectVisible_Nil", "ret": "bool", @@ -23075,7 +24632,7 @@ "cimguiname": "igIsRectVisible", "defaults": {}, "funcname": "IsRectVisible", - "location": "imgui:863", + "location": "imgui:869", "namespace": "ImGui", "ov_cimguiname": "igIsRectVisible_Vec2", "ret": "bool", @@ -23101,7 +24658,7 @@ "cimguiname": "igIsWindowAbove", "defaults": {}, "funcname": "IsWindowAbove", - "location": "imgui_internal:2425", + "location": "imgui_internal:2742", "namespace": "ImGui", "ov_cimguiname": "igIsWindowAbove", "ret": "bool", @@ -23118,7 +24675,7 @@ "cimguiname": "igIsWindowAppearing", "defaults": {}, "funcname": "IsWindowAppearing", - "location": "imgui:352", + "location": "imgui:348", "namespace": "ImGui", "ov_cimguiname": "igIsWindowAppearing", "ret": "bool", @@ -23148,7 +24705,7 @@ "cimguiname": "igIsWindowChildOf", "defaults": {}, "funcname": "IsWindowChildOf", - "location": "imgui_internal:2423", + "location": "imgui_internal:2740", "namespace": "ImGui", "ov_cimguiname": "igIsWindowChildOf", "ret": "bool", @@ -23165,7 +24722,7 @@ "cimguiname": "igIsWindowCollapsed", "defaults": {}, "funcname": "IsWindowCollapsed", - "location": "imgui:353", + "location": "imgui:349", "namespace": "ImGui", "ov_cimguiname": "igIsWindowCollapsed", "ret": "bool", @@ -23173,6 +24730,34 @@ "stname": "" } ], + "igIsWindowContentHoverable": [ + { + "args": "(ImGuiWindow* window,ImGuiHoveredFlags flags)", + "argsT": [ + { + "name": "window", + "type": "ImGuiWindow*" + }, + { + "name": "flags", + "type": "ImGuiHoveredFlags" + } + ], + "argsoriginal": "(ImGuiWindow* window,ImGuiHoveredFlags flags=0)", + "call_args": "(window,flags)", + "cimguiname": "igIsWindowContentHoverable", + "defaults": { + "flags": "0" + }, + "funcname": "IsWindowContentHoverable", + "location": "imgui_internal:2841", + "namespace": "ImGui", + "ov_cimguiname": "igIsWindowContentHoverable", + "ret": "bool", + "signature": "(ImGuiWindow*,ImGuiHoveredFlags)", + "stname": "" + } + ], "igIsWindowFocused": [ { "args": "(ImGuiFocusedFlags flags)", @@ -23189,7 +24774,7 @@ "flags": "0" }, "funcname": "IsWindowFocused", - "location": "imgui:354", + "location": "imgui:350", "namespace": "ImGui", "ov_cimguiname": "igIsWindowFocused", "ret": "bool", @@ -23213,7 +24798,7 @@ "flags": "0" }, "funcname": "IsWindowHovered", - "location": "imgui:355", + "location": "imgui:351", "namespace": "ImGui", "ov_cimguiname": "igIsWindowHovered", "ret": "bool", @@ -23235,7 +24820,7 @@ "cimguiname": "igIsWindowNavFocusable", "defaults": {}, "funcname": "IsWindowNavFocusable", - "location": "imgui_internal:2426", + "location": "imgui_internal:2743", "namespace": "ImGui", "ov_cimguiname": "igIsWindowNavFocusable", "ret": "bool", @@ -23261,7 +24846,7 @@ "cimguiname": "igIsWindowWithinBeginStackOf", "defaults": {}, "funcname": "IsWindowWithinBeginStackOf", - "location": "imgui_internal:2424", + "location": "imgui_internal:2741", "namespace": "ImGui", "ov_cimguiname": "igIsWindowWithinBeginStackOf", "ret": "bool", @@ -23298,7 +24883,7 @@ "nav_bb": "NULL" }, "funcname": "ItemAdd", - "location": "imgui_internal:2509", + "location": "imgui_internal:2839", "namespace": "ImGui", "ov_cimguiname": "igItemAdd", "ret": "bool", @@ -23324,7 +24909,7 @@ "cimguiname": "igItemHoverable", "defaults": {}, "funcname": "ItemHoverable", - "location": "imgui_internal:2510", + "location": "imgui_internal:2840", "namespace": "ImGui", "ov_cimguiname": "igItemHoverable", "ret": "bool", @@ -23352,7 +24937,7 @@ "text_baseline_y": "-1.0f" }, "funcname": "ItemSize", - "location": "imgui_internal:2507", + "location": "imgui_internal:2837", "namespace": "ImGui", "ov_cimguiname": "igItemSize_Vec2", "ret": "void", @@ -23378,7 +24963,7 @@ "text_baseline_y": "-1.0f" }, "funcname": "ItemSize", - "location": "imgui_internal:2508", + "location": "imgui_internal:2838", "namespace": "ImGui", "ov_cimguiname": "igItemSize_Rect", "ret": "void", @@ -23400,7 +24985,7 @@ "cimguiname": "igKeepAliveID", "defaults": {}, "funcname": "KeepAliveID", - "location": "imgui_internal:2501", + "location": "imgui_internal:2830", "namespace": "ImGui", "ov_cimguiname": "igKeepAliveID", "ret": "void", @@ -23431,7 +25016,7 @@ "defaults": {}, "funcname": "LabelText", "isvararg": "...)", - "location": "imgui:494", + "location": "imgui:493", "namespace": "ImGui", "ov_cimguiname": "igLabelText", "ret": "void", @@ -23461,7 +25046,7 @@ "cimguiname": "igLabelTextV", "defaults": {}, "funcname": "LabelTextV", - "location": "imgui:495", + "location": "imgui:494", "namespace": "ImGui", "ov_cimguiname": "igLabelTextV", "ret": "void", @@ -23501,7 +25086,7 @@ "height_in_items": "-1" }, "funcname": "ListBox", - "location": "imgui:632", + "location": "imgui:636", "namespace": "ImGui", "ov_cimguiname": "igListBox_Str_arr", "ret": "bool", @@ -23545,7 +25130,7 @@ "height_in_items": "-1" }, "funcname": "ListBox", - "location": "imgui:633", + "location": "imgui:637", "namespace": "ImGui", "ov_cimguiname": "igListBox_FnBoolPtr", "ret": "bool", @@ -23567,7 +25152,7 @@ "cimguiname": "igLoadIniSettingsFromDisk", "defaults": {}, "funcname": "LoadIniSettingsFromDisk", - "location": "imgui:924", + "location": "imgui:930", "namespace": "ImGui", "ov_cimguiname": "igLoadIniSettingsFromDisk", "ret": "void", @@ -23595,7 +25180,7 @@ "ini_size": "0" }, "funcname": "LoadIniSettingsFromMemory", - "location": "imgui:925", + "location": "imgui:931", "namespace": "ImGui", "ov_cimguiname": "igLoadIniSettingsFromMemory", "ret": "void", @@ -23603,6 +25188,54 @@ "stname": "" } ], + "igLocalizeGetMsg": [ + { + "args": "(ImGuiLocKey key)", + "argsT": [ + { + "name": "key", + "type": "ImGuiLocKey" + } + ], + "argsoriginal": "(ImGuiLocKey key)", + "call_args": "(key)", + "cimguiname": "igLocalizeGetMsg", + "defaults": {}, + "funcname": "LocalizeGetMsg", + "location": "imgui_internal:2804", + "namespace": "ImGui", + "ov_cimguiname": "igLocalizeGetMsg", + "ret": "const char*", + "signature": "(ImGuiLocKey)", + "stname": "" + } + ], + "igLocalizeRegisterEntries": [ + { + "args": "(const ImGuiLocEntry* entries,int count)", + "argsT": [ + { + "name": "entries", + "type": "const ImGuiLocEntry*" + }, + { + "name": "count", + "type": "int" + } + ], + "argsoriginal": "(const ImGuiLocEntry* entries,int count)", + "call_args": "(entries,count)", + "cimguiname": "igLocalizeRegisterEntries", + "defaults": {}, + "funcname": "LocalizeRegisterEntries", + "location": "imgui_internal:2803", + "namespace": "ImGui", + "ov_cimguiname": "igLocalizeRegisterEntries", + "ret": "void", + "signature": "(const ImGuiLocEntry*,int)", + "stname": "" + } + ], "igLogBegin": [ { "args": "(ImGuiLogType type,int auto_open_depth)", @@ -23621,7 +25254,7 @@ "cimguiname": "igLogBegin", "defaults": {}, "funcname": "LogBegin", - "location": "imgui_internal:2536", + "location": "imgui_internal:2857", "namespace": "ImGui", "ov_cimguiname": "igLogBegin", "ret": "void", @@ -23638,7 +25271,7 @@ "cimguiname": "igLogButtons", "defaults": {}, "funcname": "LogButtons", - "location": "imgui:800", + "location": "imgui:801", "namespace": "ImGui", "ov_cimguiname": "igLogButtons", "ret": "void", @@ -23655,7 +25288,7 @@ "cimguiname": "igLogFinish", "defaults": {}, "funcname": "LogFinish", - "location": "imgui:799", + "location": "imgui:800", "namespace": "ImGui", "ov_cimguiname": "igLogFinish", "ret": "void", @@ -23687,7 +25320,7 @@ "text_end": "NULL" }, "funcname": "LogRenderedText", - "location": "imgui_internal:2538", + "location": "imgui_internal:2859", "namespace": "ImGui", "ov_cimguiname": "igLogRenderedText", "ret": "void", @@ -23713,7 +25346,7 @@ "cimguiname": "igLogSetNextTextDecoration", "defaults": {}, "funcname": "LogSetNextTextDecoration", - "location": "imgui_internal:2539", + "location": "imgui_internal:2860", "namespace": "ImGui", "ov_cimguiname": "igLogSetNextTextDecoration", "ret": "void", @@ -23740,7 +25373,7 @@ "defaults": {}, "funcname": "LogText", "isvararg": "...)", - "location": "imgui:801", + "location": "imgui:802", "manual": true, "namespace": "ImGui", "ov_cimguiname": "igLogText", @@ -23767,7 +25400,7 @@ "cimguiname": "igLogTextV", "defaults": {}, "funcname": "LogTextV", - "location": "imgui:802", + "location": "imgui:803", "namespace": "ImGui", "ov_cimguiname": "igLogTextV", "ret": "void", @@ -23791,7 +25424,7 @@ "auto_open_depth": "-1" }, "funcname": "LogToBuffer", - "location": "imgui_internal:2537", + "location": "imgui_internal:2858", "namespace": "ImGui", "ov_cimguiname": "igLogToBuffer", "ret": "void", @@ -23815,7 +25448,7 @@ "auto_open_depth": "-1" }, "funcname": "LogToClipboard", - "location": "imgui:798", + "location": "imgui:799", "namespace": "ImGui", "ov_cimguiname": "igLogToClipboard", "ret": "void", @@ -23844,7 +25477,7 @@ "filename": "NULL" }, "funcname": "LogToFile", - "location": "imgui:797", + "location": "imgui:798", "namespace": "ImGui", "ov_cimguiname": "igLogToFile", "ret": "void", @@ -23868,7 +25501,7 @@ "auto_open_depth": "-1" }, "funcname": "LogToTTY", - "location": "imgui:796", + "location": "imgui:797", "namespace": "ImGui", "ov_cimguiname": "igLogToTTY", "ret": "void", @@ -23885,7 +25518,7 @@ "cimguiname": "igMarkIniSettingsDirty", "defaults": {}, "funcname": "MarkIniSettingsDirty", - "location": "imgui_internal:2467", + "location": "imgui_internal:2789", "namespace": "ImGui", "ov_cimguiname": "igMarkIniSettingsDirty_Nil", "ret": "void", @@ -23905,7 +25538,7 @@ "cimguiname": "igMarkIniSettingsDirty", "defaults": {}, "funcname": "MarkIniSettingsDirty", - "location": "imgui_internal:2468", + "location": "imgui_internal:2790", "namespace": "ImGui", "ov_cimguiname": "igMarkIniSettingsDirty_WindowPtr", "ret": "void", @@ -23927,7 +25560,7 @@ "cimguiname": "igMarkItemEdited", "defaults": {}, "funcname": "MarkItemEdited", - "location": "imgui_internal:2502", + "location": "imgui_internal:2831", "namespace": "ImGui", "ov_cimguiname": "igMarkItemEdited", "ret": "void", @@ -23949,7 +25582,7 @@ "cimguiname": "igMemAlloc", "defaults": {}, "funcname": "MemAlloc", - "location": "imgui:939", + "location": "imgui:945", "namespace": "ImGui", "ov_cimguiname": "igMemAlloc", "ret": "void*", @@ -23971,7 +25604,7 @@ "cimguiname": "igMemFree", "defaults": {}, "funcname": "MemFree", - "location": "imgui:940", + "location": "imgui:946", "namespace": "ImGui", "ov_cimguiname": "igMemFree", "ret": "void", @@ -24009,7 +25642,7 @@ "shortcut": "NULL" }, "funcname": "MenuItem", - "location": "imgui:660", + "location": "imgui:664", "namespace": "ImGui", "ov_cimguiname": "igMenuItem_Bool", "ret": "bool", @@ -24043,7 +25676,7 @@ "enabled": "true" }, "funcname": "MenuItem", - "location": "imgui:661", + "location": "imgui:665", "namespace": "ImGui", "ov_cimguiname": "igMenuItem_BoolPtr", "ret": "bool", @@ -24085,7 +25718,7 @@ "shortcut": "NULL" }, "funcname": "MenuItemEx", - "location": "imgui_internal:2559", + "location": "imgui_internal:2880", "namespace": "ImGui", "ov_cimguiname": "igMenuItemEx", "ret": "bool", @@ -24093,6 +25726,28 @@ "stname": "" } ], + "igMouseButtonToKey": [ + { + "args": "(ImGuiMouseButton button)", + "argsT": [ + { + "name": "button", + "type": "ImGuiMouseButton" + } + ], + "argsoriginal": "(ImGuiMouseButton button)", + "call_args": "(button)", + "cimguiname": "igMouseButtonToKey", + "defaults": {}, + "funcname": "MouseButtonToKey", + "location": "imgui_internal:2925", + "namespace": "ImGui", + "ov_cimguiname": "igMouseButtonToKey", + "ret": "ImGuiKey", + "signature": "(ImGuiMouseButton)", + "stname": "" + } + ], "igNavInitRequestApplyResult": [ { "args": "()", @@ -24102,7 +25757,7 @@ "cimguiname": "igNavInitRequestApplyResult", "defaults": {}, "funcname": "NavInitRequestApplyResult", - "location": "imgui_internal:2568", + "location": "imgui_internal:2889", "namespace": "ImGui", "ov_cimguiname": "igNavInitRequestApplyResult", "ret": "void", @@ -24128,7 +25783,7 @@ "cimguiname": "igNavInitWindow", "defaults": {}, "funcname": "NavInitWindow", - "location": "imgui_internal:2567", + "location": "imgui_internal:2888", "namespace": "ImGui", "ov_cimguiname": "igNavInitWindow", "ret": "void", @@ -24145,7 +25800,7 @@ "cimguiname": "igNavMoveRequestApplyResult", "defaults": {}, "funcname": "NavMoveRequestApplyResult", - "location": "imgui_internal:2574", + "location": "imgui_internal:2895", "namespace": "ImGui", "ov_cimguiname": "igNavMoveRequestApplyResult", "ret": "void", @@ -24162,7 +25817,7 @@ "cimguiname": "igNavMoveRequestButNoResultYet", "defaults": {}, "funcname": "NavMoveRequestButNoResultYet", - "location": "imgui_internal:2569", + "location": "imgui_internal:2890", "namespace": "ImGui", "ov_cimguiname": "igNavMoveRequestButNoResultYet", "ret": "bool", @@ -24179,7 +25834,7 @@ "cimguiname": "igNavMoveRequestCancel", "defaults": {}, "funcname": "NavMoveRequestCancel", - "location": "imgui_internal:2573", + "location": "imgui_internal:2894", "namespace": "ImGui", "ov_cimguiname": "igNavMoveRequestCancel", "ret": "void", @@ -24213,7 +25868,7 @@ "cimguiname": "igNavMoveRequestForward", "defaults": {}, "funcname": "NavMoveRequestForward", - "location": "imgui_internal:2571", + "location": "imgui_internal:2892", "namespace": "ImGui", "ov_cimguiname": "igNavMoveRequestForward", "ret": "void", @@ -24235,7 +25890,7 @@ "cimguiname": "igNavMoveRequestResolveWithLastItem", "defaults": {}, "funcname": "NavMoveRequestResolveWithLastItem", - "location": "imgui_internal:2572", + "location": "imgui_internal:2893", "namespace": "ImGui", "ov_cimguiname": "igNavMoveRequestResolveWithLastItem", "ret": "void", @@ -24269,7 +25924,7 @@ "cimguiname": "igNavMoveRequestSubmit", "defaults": {}, "funcname": "NavMoveRequestSubmit", - "location": "imgui_internal:2570", + "location": "imgui_internal:2891", "namespace": "ImGui", "ov_cimguiname": "igNavMoveRequestSubmit", "ret": "void", @@ -24295,7 +25950,7 @@ "cimguiname": "igNavMoveRequestTryWrapping", "defaults": {}, "funcname": "NavMoveRequestTryWrapping", - "location": "imgui_internal:2575", + "location": "imgui_internal:2896", "namespace": "ImGui", "ov_cimguiname": "igNavMoveRequestTryWrapping", "ret": "void", @@ -24312,7 +25967,7 @@ "cimguiname": "igNewFrame", "defaults": {}, "funcname": "NewFrame", - "location": "imgui:302", + "location": "imgui:297", "namespace": "ImGui", "ov_cimguiname": "igNewFrame", "ret": "void", @@ -24329,7 +25984,7 @@ "cimguiname": "igNewLine", "defaults": {}, "funcname": "NewLine", - "location": "imgui:442", + "location": "imgui:441", "namespace": "ImGui", "ov_cimguiname": "igNewLine", "ret": "void", @@ -24374,7 +26029,7 @@ "popup_flags": "0" }, "funcname": "OpenPopup", - "location": "imgui:693", + "location": "imgui:698", "namespace": "ImGui", "ov_cimguiname": "igOpenPopup_Str", "ret": "void", @@ -24400,7 +26055,7 @@ "popup_flags": "0" }, "funcname": "OpenPopup", - "location": "imgui:694", + "location": "imgui:699", "namespace": "ImGui", "ov_cimguiname": "igOpenPopup_ID", "ret": "void", @@ -24428,7 +26083,7 @@ "popup_flags": "ImGuiPopupFlags_None" }, "funcname": "OpenPopupEx", - "location": "imgui_internal:2543", + "location": "imgui_internal:2864", "namespace": "ImGui", "ov_cimguiname": "igOpenPopupEx", "ret": "void", @@ -24457,7 +26112,7 @@ "str_id": "NULL" }, "funcname": "OpenPopupOnItemClick", - "location": "imgui:695", + "location": "imgui:700", "namespace": "ImGui", "ov_cimguiname": "igOpenPopupOnItemClick", "ret": "void", @@ -24467,7 +26122,7 @@ ], "igPlotEx": [ { - "args": "(ImGuiPlotType plot_type,const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 frame_size)", + "args": "(ImGuiPlotType plot_type,const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,const ImVec2 size_arg)", "argsT": [ { "name": "plot_type", @@ -24508,20 +26163,20 @@ "type": "float" }, { - "name": "frame_size", - "type": "ImVec2" + "name": "size_arg", + "type": "const ImVec2" } ], - "argsoriginal": "(ImGuiPlotType plot_type,const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 frame_size)", - "call_args": "(plot_type,label,values_getter,data,values_count,values_offset,overlay_text,scale_min,scale_max,frame_size)", + "argsoriginal": "(ImGuiPlotType plot_type,const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,const ImVec2& size_arg)", + "call_args": "(plot_type,label,values_getter,data,values_count,values_offset,overlay_text,scale_min,scale_max,size_arg)", "cimguiname": "igPlotEx", "defaults": {}, "funcname": "PlotEx", - "location": "imgui_internal:2770", + "location": "imgui_internal:3170", "namespace": "ImGui", "ov_cimguiname": "igPlotEx", "ret": "int", - "signature": "(ImGuiPlotType,const char*,float(*)(void*,int),void*,int,int,const char*,float,float,ImVec2)", + "signature": "(ImGuiPlotType,const char*,float(*)(void*,int),void*,int,int,const char*,float,float,const ImVec2)", "stname": "" } ], @@ -24578,7 +26233,7 @@ "values_offset": "0" }, "funcname": "PlotHistogram", - "location": "imgui:639", + "location": "imgui:643", "namespace": "ImGui", "ov_cimguiname": "igPlotHistogram_FloatPtr", "ret": "void", @@ -24638,7 +26293,7 @@ "values_offset": "0" }, "funcname": "PlotHistogram", - "location": "imgui:640", + "location": "imgui:644", "namespace": "ImGui", "ov_cimguiname": "igPlotHistogram_FnFloatPtr", "ret": "void", @@ -24699,7 +26354,7 @@ "values_offset": "0" }, "funcname": "PlotLines", - "location": "imgui:637", + "location": "imgui:641", "namespace": "ImGui", "ov_cimguiname": "igPlotLines_FloatPtr", "ret": "void", @@ -24759,7 +26414,7 @@ "values_offset": "0" }, "funcname": "PlotLines", - "location": "imgui:638", + "location": "imgui:642", "namespace": "ImGui", "ov_cimguiname": "igPlotLines_FnFloatPtr", "ret": "void", @@ -24767,23 +26422,6 @@ "stname": "" } ], - "igPopAllowKeyboardFocus": [ - { - "args": "()", - "argsT": [], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "igPopAllowKeyboardFocus", - "defaults": {}, - "funcname": "PopAllowKeyboardFocus", - "location": "imgui:411", - "namespace": "ImGui", - "ov_cimguiname": "igPopAllowKeyboardFocus", - "ret": "void", - "signature": "()", - "stname": "" - } - ], "igPopButtonRepeat": [ { "args": "()", @@ -24793,7 +26431,7 @@ "cimguiname": "igPopButtonRepeat", "defaults": {}, "funcname": "PopButtonRepeat", - "location": "imgui:413", + "location": "imgui:412", "namespace": "ImGui", "ov_cimguiname": "igPopButtonRepeat", "ret": "void", @@ -24810,7 +26448,7 @@ "cimguiname": "igPopClipRect", "defaults": {}, "funcname": "PopClipRect", - "location": "imgui:827", + "location": "imgui:828", "namespace": "ImGui", "ov_cimguiname": "igPopClipRect", "ret": "void", @@ -24827,7 +26465,7 @@ "cimguiname": "igPopColumnsBackground", "defaults": {}, "funcname": "PopColumnsBackground", - "location": "imgui_internal:2614", + "location": "imgui_internal:3005", "namespace": "ImGui", "ov_cimguiname": "igPopColumnsBackground", "ret": "void", @@ -24844,7 +26482,7 @@ "cimguiname": "igPopFocusScope", "defaults": {}, "funcname": "PopFocusScope", - "location": "imgui_internal:2586", + "location": "imgui_internal:2989", "namespace": "ImGui", "ov_cimguiname": "igPopFocusScope", "ret": "void", @@ -24861,7 +26499,7 @@ "cimguiname": "igPopFont", "defaults": {}, "funcname": "PopFont", - "location": "imgui:403", + "location": "imgui:402", "namespace": "ImGui", "ov_cimguiname": "igPopFont", "ret": "void", @@ -24878,7 +26516,7 @@ "cimguiname": "igPopID", "defaults": {}, "funcname": "PopID", - "location": "imgui:479", + "location": "imgui:478", "namespace": "ImGui", "ov_cimguiname": "igPopID", "ret": "void", @@ -24895,7 +26533,7 @@ "cimguiname": "igPopItemFlag", "defaults": {}, "funcname": "PopItemFlag", - "location": "imgui_internal:2522", + "location": "imgui_internal:2853", "namespace": "ImGui", "ov_cimguiname": "igPopItemFlag", "ret": "void", @@ -24912,7 +26550,7 @@ "cimguiname": "igPopItemWidth", "defaults": {}, "funcname": "PopItemWidth", - "location": "imgui:417", + "location": "imgui:416", "namespace": "ImGui", "ov_cimguiname": "igPopItemWidth", "ret": "void", @@ -24936,7 +26574,7 @@ "count": "1" }, "funcname": "PopStyleColor", - "location": "imgui:406", + "location": "imgui:405", "namespace": "ImGui", "ov_cimguiname": "igPopStyleColor", "ret": "void", @@ -24960,7 +26598,7 @@ "count": "1" }, "funcname": "PopStyleVar", - "location": "imgui:409", + "location": "imgui:408", "namespace": "ImGui", "ov_cimguiname": "igPopStyleVar", "ret": "void", @@ -24968,6 +26606,23 @@ "stname": "" } ], + "igPopTabStop": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "igPopTabStop", + "defaults": {}, + "funcname": "PopTabStop", + "location": "imgui:410", + "namespace": "ImGui", + "ov_cimguiname": "igPopTabStop", + "ret": "void", + "signature": "()", + "stname": "" + } + ], "igPopTextWrapPos": [ { "args": "()", @@ -24977,7 +26632,7 @@ "cimguiname": "igPopTextWrapPos", "defaults": {}, "funcname": "PopTextWrapPos", - "location": "imgui:421", + "location": "imgui:420", "namespace": "ImGui", "ov_cimguiname": "igPopTextWrapPos", "ret": "void", @@ -25010,7 +26665,7 @@ "size_arg": "ImVec2(-FLT_MIN,0)" }, "funcname": "ProgressBar", - "location": "imgui:513", + "location": "imgui:511", "namespace": "ImGui", "ov_cimguiname": "igProgressBar", "ret": "void", @@ -25018,28 +26673,6 @@ "stname": "" } ], - "igPushAllowKeyboardFocus": [ - { - "args": "(bool allow_keyboard_focus)", - "argsT": [ - { - "name": "allow_keyboard_focus", - "type": "bool" - } - ], - "argsoriginal": "(bool allow_keyboard_focus)", - "call_args": "(allow_keyboard_focus)", - "cimguiname": "igPushAllowKeyboardFocus", - "defaults": {}, - "funcname": "PushAllowKeyboardFocus", - "location": "imgui:410", - "namespace": "ImGui", - "ov_cimguiname": "igPushAllowKeyboardFocus", - "ret": "void", - "signature": "(bool)", - "stname": "" - } - ], "igPushButtonRepeat": [ { "args": "(bool repeat)", @@ -25054,7 +26687,7 @@ "cimguiname": "igPushButtonRepeat", "defaults": {}, "funcname": "PushButtonRepeat", - "location": "imgui:412", + "location": "imgui:411", "namespace": "ImGui", "ov_cimguiname": "igPushButtonRepeat", "ret": "void", @@ -25084,7 +26717,7 @@ "cimguiname": "igPushClipRect", "defaults": {}, "funcname": "PushClipRect", - "location": "imgui:826", + "location": "imgui:827", "namespace": "ImGui", "ov_cimguiname": "igPushClipRect", "ret": "void", @@ -25106,7 +26739,7 @@ "cimguiname": "igPushColumnClipRect", "defaults": {}, "funcname": "PushColumnClipRect", - "location": "imgui_internal:2612", + "location": "imgui_internal:3003", "namespace": "ImGui", "ov_cimguiname": "igPushColumnClipRect", "ret": "void", @@ -25123,7 +26756,7 @@ "cimguiname": "igPushColumnsBackground", "defaults": {}, "funcname": "PushColumnsBackground", - "location": "imgui_internal:2613", + "location": "imgui_internal:3004", "namespace": "ImGui", "ov_cimguiname": "igPushColumnsBackground", "ret": "void", @@ -25145,7 +26778,7 @@ "cimguiname": "igPushFocusScope", "defaults": {}, "funcname": "PushFocusScope", - "location": "imgui_internal:2585", + "location": "imgui_internal:2988", "namespace": "ImGui", "ov_cimguiname": "igPushFocusScope", "ret": "void", @@ -25167,7 +26800,7 @@ "cimguiname": "igPushFont", "defaults": {}, "funcname": "PushFont", - "location": "imgui:402", + "location": "imgui:401", "namespace": "ImGui", "ov_cimguiname": "igPushFont", "ret": "void", @@ -25189,7 +26822,7 @@ "cimguiname": "igPushID", "defaults": {}, "funcname": "PushID", - "location": "imgui:475", + "location": "imgui:474", "namespace": "ImGui", "ov_cimguiname": "igPushID_Str", "ret": "void", @@ -25213,7 +26846,7 @@ "cimguiname": "igPushID", "defaults": {}, "funcname": "PushID", - "location": "imgui:476", + "location": "imgui:475", "namespace": "ImGui", "ov_cimguiname": "igPushID_StrStr", "ret": "void", @@ -25233,7 +26866,7 @@ "cimguiname": "igPushID", "defaults": {}, "funcname": "PushID", - "location": "imgui:477", + "location": "imgui:476", "namespace": "ImGui", "ov_cimguiname": "igPushID_Ptr", "ret": "void", @@ -25253,7 +26886,7 @@ "cimguiname": "igPushID", "defaults": {}, "funcname": "PushID", - "location": "imgui:478", + "location": "imgui:477", "namespace": "ImGui", "ov_cimguiname": "igPushID_Int", "ret": "void", @@ -25279,7 +26912,7 @@ "cimguiname": "igPushItemFlag", "defaults": {}, "funcname": "PushItemFlag", - "location": "imgui_internal:2521", + "location": "imgui_internal:2852", "namespace": "ImGui", "ov_cimguiname": "igPushItemFlag", "ret": "void", @@ -25301,7 +26934,7 @@ "cimguiname": "igPushItemWidth", "defaults": {}, "funcname": "PushItemWidth", - "location": "imgui:416", + "location": "imgui:415", "namespace": "ImGui", "ov_cimguiname": "igPushItemWidth", "ret": "void", @@ -25327,7 +26960,7 @@ "cimguiname": "igPushMultiItemsWidths", "defaults": {}, "funcname": "PushMultiItemsWidths", - "location": "imgui_internal:2515", + "location": "imgui_internal:2846", "namespace": "ImGui", "ov_cimguiname": "igPushMultiItemsWidths", "ret": "void", @@ -25349,7 +26982,7 @@ "cimguiname": "igPushOverrideID", "defaults": {}, "funcname": "PushOverrideID", - "location": "imgui_internal:2503", + "location": "imgui_internal:2832", "namespace": "ImGui", "ov_cimguiname": "igPushOverrideID", "ret": "void", @@ -25375,7 +27008,7 @@ "cimguiname": "igPushStyleColor", "defaults": {}, "funcname": "PushStyleColor", - "location": "imgui:404", + "location": "imgui:403", "namespace": "ImGui", "ov_cimguiname": "igPushStyleColor_U32", "ret": "void", @@ -25399,7 +27032,7 @@ "cimguiname": "igPushStyleColor", "defaults": {}, "funcname": "PushStyleColor", - "location": "imgui:405", + "location": "imgui:404", "namespace": "ImGui", "ov_cimguiname": "igPushStyleColor_Vec4", "ret": "void", @@ -25425,7 +27058,7 @@ "cimguiname": "igPushStyleVar", "defaults": {}, "funcname": "PushStyleVar", - "location": "imgui:407", + "location": "imgui:406", "namespace": "ImGui", "ov_cimguiname": "igPushStyleVar_Float", "ret": "void", @@ -25449,7 +27082,7 @@ "cimguiname": "igPushStyleVar", "defaults": {}, "funcname": "PushStyleVar", - "location": "imgui:408", + "location": "imgui:407", "namespace": "ImGui", "ov_cimguiname": "igPushStyleVar_Vec2", "ret": "void", @@ -25457,6 +27090,28 @@ "stname": "" } ], + "igPushTabStop": [ + { + "args": "(bool tab_stop)", + "argsT": [ + { + "name": "tab_stop", + "type": "bool" + } + ], + "argsoriginal": "(bool tab_stop)", + "call_args": "(tab_stop)", + "cimguiname": "igPushTabStop", + "defaults": {}, + "funcname": "PushTabStop", + "location": "imgui:409", + "namespace": "ImGui", + "ov_cimguiname": "igPushTabStop", + "ret": "void", + "signature": "(bool)", + "stname": "" + } + ], "igPushTextWrapPos": [ { "args": "(float wrap_local_pos_x)", @@ -25473,7 +27128,7 @@ "wrap_local_pos_x": "0.0f" }, "funcname": "PushTextWrapPos", - "location": "imgui:420", + "location": "imgui:419", "namespace": "ImGui", "ov_cimguiname": "igPushTextWrapPos", "ret": "void", @@ -25499,7 +27154,7 @@ "cimguiname": "igRadioButton", "defaults": {}, "funcname": "RadioButton", - "location": "imgui:511", + "location": "imgui:509", "namespace": "ImGui", "ov_cimguiname": "igRadioButton_Bool", "ret": "bool", @@ -25527,7 +27182,7 @@ "cimguiname": "igRadioButton", "defaults": {}, "funcname": "RadioButton", - "location": "imgui:512", + "location": "imgui:510", "namespace": "ImGui", "ov_cimguiname": "igRadioButton_IntPtr", "ret": "bool", @@ -25548,16 +27203,38 @@ "type": "ImGuiID" } ], - "argsoriginal": "(ImGuiContext* context,ImGuiID hook_to_remove)", - "call_args": "(context,hook_to_remove)", - "cimguiname": "igRemoveContextHook", + "argsoriginal": "(ImGuiContext* context,ImGuiID hook_to_remove)", + "call_args": "(context,hook_to_remove)", + "cimguiname": "igRemoveContextHook", + "defaults": {}, + "funcname": "RemoveContextHook", + "location": "imgui_internal:2782", + "namespace": "ImGui", + "ov_cimguiname": "igRemoveContextHook", + "ret": "void", + "signature": "(ImGuiContext*,ImGuiID)", + "stname": "" + } + ], + "igRemoveSettingsHandler": [ + { + "args": "(const char* type_name)", + "argsT": [ + { + "name": "type_name", + "type": "const char*" + } + ], + "argsoriginal": "(const char* type_name)", + "call_args": "(type_name)", + "cimguiname": "igRemoveSettingsHandler", "defaults": {}, - "funcname": "RemoveContextHook", - "location": "imgui_internal:2463", + "funcname": "RemoveSettingsHandler", + "location": "imgui_internal:2793", "namespace": "ImGui", - "ov_cimguiname": "igRemoveContextHook", + "ov_cimguiname": "igRemoveSettingsHandler", "ret": "void", - "signature": "(ImGuiContext*,ImGuiID)", + "signature": "(const char*)", "stname": "" } ], @@ -25570,7 +27247,7 @@ "cimguiname": "igRender", "defaults": {}, "funcname": "Render", - "location": "imgui:304", + "location": "imgui:299", "namespace": "ImGui", "ov_cimguiname": "igRender", "ret": "void", @@ -25610,7 +27287,7 @@ "scale": "1.0f" }, "funcname": "RenderArrow", - "location": "imgui_internal:2699", + "location": "imgui_internal:3101", "namespace": "ImGui", "ov_cimguiname": "igRenderArrow", "ret": "void", @@ -25648,7 +27325,7 @@ "cimguiname": "igRenderArrowPointingAt", "defaults": {}, "funcname": "RenderArrowPointingAt", - "location": "imgui_internal:2703", + "location": "imgui_internal:3104", "namespace": "ImGui", "ov_cimguiname": "igRenderArrowPointingAt", "ret": "void", @@ -25678,7 +27355,7 @@ "cimguiname": "igRenderBullet", "defaults": {}, "funcname": "RenderBullet", - "location": "imgui_internal:2700", + "location": "imgui_internal:3102", "namespace": "ImGui", "ov_cimguiname": "igRenderBullet", "ret": "void", @@ -25712,7 +27389,7 @@ "cimguiname": "igRenderCheckMark", "defaults": {}, "funcname": "RenderCheckMark", - "location": "imgui_internal:2701", + "location": "imgui_internal:3103", "namespace": "ImGui", "ov_cimguiname": "igRenderCheckMark", "ret": "void", @@ -25765,7 +27442,7 @@ "rounding": "0.0f" }, "funcname": "RenderColorRectWithAlphaCheckerboard", - "location": "imgui_internal:2694", + "location": "imgui_internal:3095", "namespace": "ImGui", "ov_cimguiname": "igRenderColorRectWithAlphaCheckerboard", "ret": "void", @@ -25773,6 +27450,28 @@ "stname": "" } ], + "igRenderDragDropTargetRect": [ + { + "args": "(const ImRect bb)", + "argsT": [ + { + "name": "bb", + "type": "const ImRect" + } + ], + "argsoriginal": "(const ImRect& bb)", + "call_args": "(bb)", + "cimguiname": "igRenderDragDropTargetRect", + "defaults": {}, + "funcname": "RenderDragDropTargetRect", + "location": "imgui_internal:2997", + "namespace": "ImGui", + "ov_cimguiname": "igRenderDragDropTargetRect", + "ret": "void", + "signature": "(const ImRect)", + "stname": "" + } + ], "igRenderFrame": [ { "args": "(ImVec2 p_min,ImVec2 p_max,ImU32 fill_col,bool border,float rounding)", @@ -25806,7 +27505,7 @@ "rounding": "0.0f" }, "funcname": "RenderFrame", - "location": "imgui_internal:2692", + "location": "imgui_internal:3093", "namespace": "ImGui", "ov_cimguiname": "igRenderFrame", "ret": "void", @@ -25838,7 +27537,7 @@ "rounding": "0.0f" }, "funcname": "RenderFrameBorder", - "location": "imgui_internal:2693", + "location": "imgui_internal:3094", "namespace": "ImGui", "ov_cimguiname": "igRenderFrameBorder", "ret": "void", @@ -25848,12 +27547,8 @@ ], "igRenderMouseCursor": [ { - "args": "(ImDrawList* draw_list,ImVec2 pos,float scale,ImGuiMouseCursor mouse_cursor,ImU32 col_fill,ImU32 col_border,ImU32 col_shadow)", + "args": "(ImVec2 pos,float scale,ImGuiMouseCursor mouse_cursor,ImU32 col_fill,ImU32 col_border,ImU32 col_shadow)", "argsT": [ - { - "name": "draw_list", - "type": "ImDrawList*" - }, { "name": "pos", "type": "ImVec2" @@ -25879,16 +27574,16 @@ "type": "ImU32" } ], - "argsoriginal": "(ImDrawList* draw_list,ImVec2 pos,float scale,ImGuiMouseCursor mouse_cursor,ImU32 col_fill,ImU32 col_border,ImU32 col_shadow)", - "call_args": "(draw_list,pos,scale,mouse_cursor,col_fill,col_border,col_shadow)", + "argsoriginal": "(ImVec2 pos,float scale,ImGuiMouseCursor mouse_cursor,ImU32 col_fill,ImU32 col_border,ImU32 col_shadow)", + "call_args": "(pos,scale,mouse_cursor,col_fill,col_border,col_shadow)", "cimguiname": "igRenderMouseCursor", "defaults": {}, "funcname": "RenderMouseCursor", - "location": "imgui_internal:2702", + "location": "imgui_internal:3098", "namespace": "ImGui", "ov_cimguiname": "igRenderMouseCursor", "ret": "void", - "signature": "(ImDrawList*,ImVec2,float,ImGuiMouseCursor,ImU32,ImU32,ImU32)", + "signature": "(ImVec2,float,ImGuiMouseCursor,ImU32,ImU32,ImU32)", "stname": "" } ], @@ -25916,7 +27611,7 @@ "flags": "ImGuiNavHighlightFlags_TypeDefault" }, "funcname": "RenderNavHighlight", - "location": "imgui_internal:2695", + "location": "imgui_internal:3096", "namespace": "ImGui", "ov_cimguiname": "igRenderNavHighlight", "ret": "void", @@ -25958,7 +27653,7 @@ "cimguiname": "igRenderRectFilledRangeH", "defaults": {}, "funcname": "RenderRectFilledRangeH", - "location": "imgui_internal:2704", + "location": "imgui_internal:3105", "namespace": "ImGui", "ov_cimguiname": "igRenderRectFilledRangeH", "ret": "void", @@ -25968,7 +27663,7 @@ ], "igRenderRectFilledWithHole": [ { - "args": "(ImDrawList* draw_list,ImRect outer,ImRect inner,ImU32 col,float rounding)", + "args": "(ImDrawList* draw_list,const ImRect outer,const ImRect inner,ImU32 col,float rounding)", "argsT": [ { "name": "draw_list", @@ -25976,11 +27671,11 @@ }, { "name": "outer", - "type": "ImRect" + "type": "const ImRect" }, { "name": "inner", - "type": "ImRect" + "type": "const ImRect" }, { "name": "col", @@ -25991,16 +27686,16 @@ "type": "float" } ], - "argsoriginal": "(ImDrawList* draw_list,ImRect outer,ImRect inner,ImU32 col,float rounding)", + "argsoriginal": "(ImDrawList* draw_list,const ImRect& outer,const ImRect& inner,ImU32 col,float rounding)", "call_args": "(draw_list,outer,inner,col,rounding)", "cimguiname": "igRenderRectFilledWithHole", "defaults": {}, "funcname": "RenderRectFilledWithHole", - "location": "imgui_internal:2705", + "location": "imgui_internal:3106", "namespace": "ImGui", "ov_cimguiname": "igRenderRectFilledWithHole", "ret": "void", - "signature": "(ImDrawList*,ImRect,ImRect,ImU32,float)", + "signature": "(ImDrawList*,const ImRect,const ImRect,ImU32,float)", "stname": "" } ], @@ -26033,7 +27728,7 @@ "text_end": "NULL" }, "funcname": "RenderText", - "location": "imgui_internal:2687", + "location": "imgui_internal:3088", "namespace": "ImGui", "ov_cimguiname": "igRenderText", "ret": "void", @@ -26082,7 +27777,7 @@ "clip_rect": "NULL" }, "funcname": "RenderTextClipped", - "location": "imgui_internal:2689", + "location": "imgui_internal:3090", "namespace": "ImGui", "ov_cimguiname": "igRenderTextClipped", "ret": "void", @@ -26135,7 +27830,7 @@ "clip_rect": "NULL" }, "funcname": "RenderTextClippedEx", - "location": "imgui_internal:2690", + "location": "imgui_internal:3091", "namespace": "ImGui", "ov_cimguiname": "igRenderTextClippedEx", "ret": "void", @@ -26185,7 +27880,7 @@ "cimguiname": "igRenderTextEllipsis", "defaults": {}, "funcname": "RenderTextEllipsis", - "location": "imgui_internal:2691", + "location": "imgui_internal:3092", "namespace": "ImGui", "ov_cimguiname": "igRenderTextEllipsis", "ret": "void", @@ -26219,7 +27914,7 @@ "cimguiname": "igRenderTextWrapped", "defaults": {}, "funcname": "RenderTextWrapped", - "location": "imgui_internal:2688", + "location": "imgui_internal:3089", "namespace": "ImGui", "ov_cimguiname": "igRenderTextWrapped", "ret": "void", @@ -26243,7 +27938,7 @@ "button": "0" }, "funcname": "ResetMouseDragDelta", - "location": "imgui:910", + "location": "imgui:916", "namespace": "ImGui", "ov_cimguiname": "igResetMouseDragDelta", "ret": "void", @@ -26272,7 +27967,7 @@ "spacing": "-1.0f" }, "funcname": "SameLine", - "location": "imgui:441", + "location": "imgui:440", "namespace": "ImGui", "ov_cimguiname": "igSameLine", "ret": "void", @@ -26294,7 +27989,7 @@ "cimguiname": "igSaveIniSettingsToDisk", "defaults": {}, "funcname": "SaveIniSettingsToDisk", - "location": "imgui:926", + "location": "imgui:932", "namespace": "ImGui", "ov_cimguiname": "igSaveIniSettingsToDisk", "ret": "void", @@ -26318,7 +28013,7 @@ "out_ini_size": "NULL" }, "funcname": "SaveIniSettingsToMemory", - "location": "imgui:927", + "location": "imgui:933", "namespace": "ImGui", "ov_cimguiname": "igSaveIniSettingsToMemory", "ret": "const char*", @@ -26344,7 +28039,7 @@ "cimguiname": "igScrollToBringRectIntoView", "defaults": {}, "funcname": "ScrollToBringRectIntoView", - "location": "imgui_internal:2487", + "location": "imgui_internal:2817", "namespace": "ImGui", "ov_cimguiname": "igScrollToBringRectIntoView", "ret": "void", @@ -26368,7 +28063,7 @@ "flags": "0" }, "funcname": "ScrollToItem", - "location": "imgui_internal:2483", + "location": "imgui_internal:2813", "namespace": "ImGui", "ov_cimguiname": "igScrollToItem", "ret": "void", @@ -26400,7 +28095,7 @@ "flags": "0" }, "funcname": "ScrollToRect", - "location": "imgui_internal:2484", + "location": "imgui_internal:2814", "namespace": "ImGui", "ov_cimguiname": "igScrollToRect", "ret": "void", @@ -26436,7 +28131,7 @@ "flags": "0" }, "funcname": "ScrollToRectEx", - "location": "imgui_internal:2485", + "location": "imgui_internal:2815", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igScrollToRectEx", @@ -26459,7 +28154,7 @@ "cimguiname": "igScrollbar", "defaults": {}, "funcname": "Scrollbar", - "location": "imgui_internal:2719", + "location": "imgui_internal:3121", "namespace": "ImGui", "ov_cimguiname": "igScrollbar", "ret": "void", @@ -26505,7 +28200,7 @@ "cimguiname": "igScrollbarEx", "defaults": {}, "funcname": "ScrollbarEx", - "location": "imgui_internal:2720", + "location": "imgui_internal:3122", "namespace": "ImGui", "ov_cimguiname": "igScrollbarEx", "ret": "bool", @@ -26543,7 +28238,7 @@ "size": "ImVec2(0,0)" }, "funcname": "Selectable", - "location": "imgui:621", + "location": "imgui:625", "namespace": "ImGui", "ov_cimguiname": "igSelectable_Bool", "ret": "bool", @@ -26578,7 +28273,7 @@ "size": "ImVec2(0,0)" }, "funcname": "Selectable", - "location": "imgui:622", + "location": "imgui:626", "namespace": "ImGui", "ov_cimguiname": "igSelectable_BoolPtr", "ret": "bool", @@ -26595,7 +28290,7 @@ "cimguiname": "igSeparator", "defaults": {}, "funcname": "Separator", - "location": "imgui:440", + "location": "imgui:439", "namespace": "ImGui", "ov_cimguiname": "igSeparator", "ret": "void", @@ -26617,7 +28312,7 @@ "cimguiname": "igSeparatorEx", "defaults": {}, "funcname": "SeparatorEx", - "location": "imgui_internal:2726", + "location": "imgui_internal:3113", "namespace": "ImGui", "ov_cimguiname": "igSeparatorEx", "ret": "void", @@ -26625,6 +28320,62 @@ "stname": "" } ], + "igSeparatorText": [ + { + "args": "(const char* label)", + "argsT": [ + { + "name": "label", + "type": "const char*" + } + ], + "argsoriginal": "(const char* label)", + "call_args": "(label)", + "cimguiname": "igSeparatorText", + "defaults": {}, + "funcname": "SeparatorText", + "location": "imgui:497", + "namespace": "ImGui", + "ov_cimguiname": "igSeparatorText", + "ret": "void", + "signature": "(const char*)", + "stname": "" + } + ], + "igSeparatorTextEx": [ + { + "args": "(ImGuiID id,const char* label,const char* label_end,float extra_width)", + "argsT": [ + { + "name": "id", + "type": "ImGuiID" + }, + { + "name": "label", + "type": "const char*" + }, + { + "name": "label_end", + "type": "const char*" + }, + { + "name": "extra_width", + "type": "float" + } + ], + "argsoriginal": "(ImGuiID id,const char* label,const char* label_end,float extra_width)", + "call_args": "(id,label,label_end,extra_width)", + "cimguiname": "igSeparatorTextEx", + "defaults": {}, + "funcname": "SeparatorTextEx", + "location": "imgui_internal:3114", + "namespace": "ImGui", + "ov_cimguiname": "igSeparatorTextEx", + "ret": "void", + "signature": "(ImGuiID,const char*,const char*,float)", + "stname": "" + } + ], "igSetActiveID": [ { "args": "(ImGuiID id,ImGuiWindow* window)", @@ -26643,7 +28394,7 @@ "cimguiname": "igSetActiveID", "defaults": {}, "funcname": "SetActiveID", - "location": "imgui_internal:2496", + "location": "imgui_internal:2825", "namespace": "ImGui", "ov_cimguiname": "igSetActiveID", "ret": "void", @@ -26651,18 +28402,18 @@ "stname": "" } ], - "igSetActiveIdUsingNavAndKeys": [ + "igSetActiveIdUsingAllKeyboardKeys": [ { "args": "()", "argsT": [], "argsoriginal": "()", "call_args": "()", - "cimguiname": "igSetActiveIdUsingNavAndKeys", + "cimguiname": "igSetActiveIdUsingAllKeyboardKeys", "defaults": {}, - "funcname": "SetActiveIdUsingNavAndKeys", - "location": "imgui_internal:2593", + "funcname": "SetActiveIdUsingAllKeyboardKeys", + "location": "imgui_internal:2931", "namespace": "ImGui", - "ov_cimguiname": "igSetActiveIdUsingNavAndKeys", + "ov_cimguiname": "igSetActiveIdUsingAllKeyboardKeys", "ret": "void", "signature": "()", "stname": "" @@ -26692,7 +28443,7 @@ "user_data": "NULL" }, "funcname": "SetAllocatorFunctions", - "location": "imgui:937", + "location": "imgui:943", "namespace": "ImGui", "ov_cimguiname": "igSetAllocatorFunctions", "ret": "void", @@ -26714,7 +28465,7 @@ "cimguiname": "igSetClipboardText", "defaults": {}, "funcname": "SetClipboardText", - "location": "imgui:918", + "location": "imgui:924", "namespace": "ImGui", "ov_cimguiname": "igSetClipboardText", "ret": "void", @@ -26736,7 +28487,7 @@ "cimguiname": "igSetColorEditOptions", "defaults": {}, "funcname": "SetColorEditOptions", - "location": "imgui:596", + "location": "imgui:600", "namespace": "ImGui", "ov_cimguiname": "igSetColorEditOptions", "ret": "void", @@ -26810,7 +28561,7 @@ "cimguiname": "igSetCurrentContext", "defaults": {}, "funcname": "SetCurrentContext", - "location": "imgui:297", + "location": "imgui:292", "namespace": "ImGui", "ov_cimguiname": "igSetCurrentContext", "ret": "void", @@ -26832,7 +28583,7 @@ "cimguiname": "igSetCurrentFont", "defaults": {}, "funcname": "SetCurrentFont", - "location": "imgui_internal:2445", + "location": "imgui_internal:2763", "namespace": "ImGui", "ov_cimguiname": "igSetCurrentFont", "ret": "void", @@ -26854,7 +28605,7 @@ "cimguiname": "igSetCursorPos", "defaults": {}, "funcname": "SetCursorPos", - "location": "imgui:452", + "location": "imgui:451", "namespace": "ImGui", "ov_cimguiname": "igSetCursorPos", "ret": "void", @@ -26876,7 +28627,7 @@ "cimguiname": "igSetCursorPosX", "defaults": {}, "funcname": "SetCursorPosX", - "location": "imgui:453", + "location": "imgui:452", "namespace": "ImGui", "ov_cimguiname": "igSetCursorPosX", "ret": "void", @@ -26898,7 +28649,7 @@ "cimguiname": "igSetCursorPosY", "defaults": {}, "funcname": "SetCursorPosY", - "location": "imgui:454", + "location": "imgui:453", "namespace": "ImGui", "ov_cimguiname": "igSetCursorPosY", "ret": "void", @@ -26920,7 +28671,7 @@ "cimguiname": "igSetCursorScreenPos", "defaults": {}, "funcname": "SetCursorScreenPos", - "location": "imgui:457", + "location": "imgui:456", "namespace": "ImGui", "ov_cimguiname": "igSetCursorScreenPos", "ret": "void", @@ -26956,7 +28707,7 @@ "cond": "0" }, "funcname": "SetDragDropPayload", - "location": "imgui:810", + "location": "imgui:811", "namespace": "ImGui", "ov_cimguiname": "igSetDragDropPayload", "ret": "bool", @@ -26982,7 +28733,7 @@ "cimguiname": "igSetFocusID", "defaults": {}, "funcname": "SetFocusID", - "location": "imgui_internal:2497", + "location": "imgui_internal:2826", "namespace": "ImGui", "ov_cimguiname": "igSetFocusID", "ret": "void", @@ -27004,7 +28755,7 @@ "cimguiname": "igSetHoveredID", "defaults": {}, "funcname": "SetHoveredID", - "location": "imgui_internal:2500", + "location": "imgui_internal:2829", "namespace": "ImGui", "ov_cimguiname": "igSetHoveredID", "ret": "void", @@ -27021,7 +28772,7 @@ "cimguiname": "igSetItemAllowOverlap", "defaults": {}, "funcname": "SetItemAllowOverlap", - "location": "imgui:853", + "location": "imgui:855", "namespace": "ImGui", "ov_cimguiname": "igSetItemAllowOverlap", "ret": "void", @@ -27038,7 +28789,7 @@ "cimguiname": "igSetItemDefaultFocus", "defaults": {}, "funcname": "SetItemDefaultFocus", - "location": "imgui:831", + "location": "imgui:832", "namespace": "ImGui", "ov_cimguiname": "igSetItemDefaultFocus", "ret": "void", @@ -27046,20 +28797,95 @@ "stname": "" } ], - "igSetItemUsingMouseWheel": [ + "igSetItemKeyOwner": [ { - "args": "()", - "argsT": [], - "argsoriginal": "()", - "call_args": "()", - "cimguiname": "igSetItemUsingMouseWheel", - "defaults": {}, - "funcname": "SetItemUsingMouseWheel", - "location": "imgui_internal:2592", + "args": "(ImGuiKey key,ImGuiInputFlags flags)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + }, + { + "name": "flags", + "type": "ImGuiInputFlags" + } + ], + "argsoriginal": "(ImGuiKey key,ImGuiInputFlags flags=0)", + "call_args": "(key,flags)", + "cimguiname": "igSetItemKeyOwner", + "defaults": { + "flags": "0" + }, + "funcname": "SetItemKeyOwner", + "location": "imgui_internal:2948", "namespace": "ImGui", - "ov_cimguiname": "igSetItemUsingMouseWheel", + "ov_cimguiname": "igSetItemKeyOwner", "ret": "void", - "signature": "()", + "signature": "(ImGuiKey,ImGuiInputFlags)", + "stname": "" + } + ], + "igSetKeyOwner": [ + { + "args": "(ImGuiKey key,ImGuiID owner_id,ImGuiInputFlags flags)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + }, + { + "name": "owner_id", + "type": "ImGuiID" + }, + { + "name": "flags", + "type": "ImGuiInputFlags" + } + ], + "argsoriginal": "(ImGuiKey key,ImGuiID owner_id,ImGuiInputFlags flags=0)", + "call_args": "(key,owner_id,flags)", + "cimguiname": "igSetKeyOwner", + "defaults": { + "flags": "0" + }, + "funcname": "SetKeyOwner", + "location": "imgui_internal:2946", + "namespace": "ImGui", + "ov_cimguiname": "igSetKeyOwner", + "ret": "void", + "signature": "(ImGuiKey,ImGuiID,ImGuiInputFlags)", + "stname": "" + } + ], + "igSetKeyOwnersForKeyChord": [ + { + "args": "(ImGuiKeyChord key,ImGuiID owner_id,ImGuiInputFlags flags)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKeyChord" + }, + { + "name": "owner_id", + "type": "ImGuiID" + }, + { + "name": "flags", + "type": "ImGuiInputFlags" + } + ], + "argsoriginal": "(ImGuiKeyChord key,ImGuiID owner_id,ImGuiInputFlags flags=0)", + "call_args": "(key,owner_id,flags)", + "cimguiname": "igSetKeyOwnersForKeyChord", + "defaults": { + "flags": "0" + }, + "funcname": "SetKeyOwnersForKeyChord", + "location": "imgui_internal:2947", + "namespace": "ImGui", + "ov_cimguiname": "igSetKeyOwnersForKeyChord", + "ret": "void", + "signature": "(ImGuiKeyChord,ImGuiID,ImGuiInputFlags)", "stname": "" } ], @@ -27079,7 +28905,7 @@ "offset": "0" }, "funcname": "SetKeyboardFocusHere", - "location": "imgui:832", + "location": "imgui:833", "namespace": "ImGui", "ov_cimguiname": "igSetKeyboardFocusHere", "ret": "void", @@ -27113,7 +28939,7 @@ "cimguiname": "igSetLastItemData", "defaults": {}, "funcname": "SetLastItemData", - "location": "imgui_internal:2512", + "location": "imgui_internal:2843", "namespace": "ImGui", "ov_cimguiname": "igSetLastItemData", "ret": "void", @@ -27135,7 +28961,7 @@ "cimguiname": "igSetMouseCursor", "defaults": {}, "funcname": "SetMouseCursor", - "location": "imgui:912", + "location": "imgui:918", "namespace": "ImGui", "ov_cimguiname": "igSetMouseCursor", "ret": "void", @@ -27169,7 +28995,7 @@ "cimguiname": "igSetNavID", "defaults": {}, "funcname": "SetNavID", - "location": "imgui_internal:2580", + "location": "imgui_internal:2899", "namespace": "ImGui", "ov_cimguiname": "igSetNavID", "ret": "void", @@ -27177,6 +29003,72 @@ "stname": "" } ], + "igSetNavWindow": [ + { + "args": "(ImGuiWindow* window)", + "argsT": [ + { + "name": "window", + "type": "ImGuiWindow*" + } + ], + "argsoriginal": "(ImGuiWindow* window)", + "call_args": "(window)", + "cimguiname": "igSetNavWindow", + "defaults": {}, + "funcname": "SetNavWindow", + "location": "imgui_internal:2898", + "namespace": "ImGui", + "ov_cimguiname": "igSetNavWindow", + "ret": "void", + "signature": "(ImGuiWindow*)", + "stname": "" + } + ], + "igSetNextFrameWantCaptureKeyboard": [ + { + "args": "(bool want_capture_keyboard)", + "argsT": [ + { + "name": "want_capture_keyboard", + "type": "bool" + } + ], + "argsoriginal": "(bool want_capture_keyboard)", + "call_args": "(want_capture_keyboard)", + "cimguiname": "igSetNextFrameWantCaptureKeyboard", + "defaults": {}, + "funcname": "SetNextFrameWantCaptureKeyboard", + "location": "imgui:898", + "namespace": "ImGui", + "ov_cimguiname": "igSetNextFrameWantCaptureKeyboard", + "ret": "void", + "signature": "(bool)", + "stname": "" + } + ], + "igSetNextFrameWantCaptureMouse": [ + { + "args": "(bool want_capture_mouse)", + "argsT": [ + { + "name": "want_capture_mouse", + "type": "bool" + } + ], + "argsoriginal": "(bool want_capture_mouse)", + "call_args": "(want_capture_mouse)", + "cimguiname": "igSetNextFrameWantCaptureMouse", + "defaults": {}, + "funcname": "SetNextFrameWantCaptureMouse", + "location": "imgui:919", + "namespace": "ImGui", + "ov_cimguiname": "igSetNextFrameWantCaptureMouse", + "ret": "void", + "signature": "(bool)", + "stname": "" + } + ], "igSetNextItemOpen": [ { "args": "(bool is_open,ImGuiCond cond)", @@ -27197,7 +29089,7 @@ "cond": "0" }, "funcname": "SetNextItemOpen", - "location": "imgui:616", + "location": "imgui:620", "namespace": "ImGui", "ov_cimguiname": "igSetNextItemOpen", "ret": "void", @@ -27219,7 +29111,7 @@ "cimguiname": "igSetNextItemWidth", "defaults": {}, "funcname": "SetNextItemWidth", - "location": "imgui:418", + "location": "imgui:417", "namespace": "ImGui", "ov_cimguiname": "igSetNextItemWidth", "ret": "void", @@ -27241,7 +29133,7 @@ "cimguiname": "igSetNextWindowBgAlpha", "defaults": {}, "funcname": "SetNextWindowBgAlpha", - "location": "imgui:370", + "location": "imgui:367", "namespace": "ImGui", "ov_cimguiname": "igSetNextWindowBgAlpha", "ret": "void", @@ -27269,7 +29161,7 @@ "cond": "0" }, "funcname": "SetNextWindowCollapsed", - "location": "imgui:368", + "location": "imgui:364", "namespace": "ImGui", "ov_cimguiname": "igSetNextWindowCollapsed", "ret": "void", @@ -27291,7 +29183,7 @@ "cimguiname": "igSetNextWindowContentSize", "defaults": {}, "funcname": "SetNextWindowContentSize", - "location": "imgui:367", + "location": "imgui:363", "namespace": "ImGui", "ov_cimguiname": "igSetNextWindowContentSize", "ret": "void", @@ -27308,7 +29200,7 @@ "cimguiname": "igSetNextWindowFocus", "defaults": {}, "funcname": "SetNextWindowFocus", - "location": "imgui:369", + "location": "imgui:365", "namespace": "ImGui", "ov_cimguiname": "igSetNextWindowFocus", "ret": "void", @@ -27341,7 +29233,7 @@ "pivot": "ImVec2(0,0)" }, "funcname": "SetNextWindowPos", - "location": "imgui:364", + "location": "imgui:360", "namespace": "ImGui", "ov_cimguiname": "igSetNextWindowPos", "ret": "void", @@ -27363,7 +29255,7 @@ "cimguiname": "igSetNextWindowScroll", "defaults": {}, "funcname": "SetNextWindowScroll", - "location": "imgui_internal:2476", + "location": "imgui:366", "namespace": "ImGui", "ov_cimguiname": "igSetNextWindowScroll", "ret": "void", @@ -27391,7 +29283,7 @@ "cond": "0" }, "funcname": "SetNextWindowSize", - "location": "imgui:365", + "location": "imgui:361", "namespace": "ImGui", "ov_cimguiname": "igSetNextWindowSize", "ret": "void", @@ -27428,7 +29320,7 @@ "custom_callback_data": "NULL" }, "funcname": "SetNextWindowSizeConstraints", - "location": "imgui:366", + "location": "imgui:362", "namespace": "ImGui", "ov_cimguiname": "igSetNextWindowSizeConstraints", "ret": "void", @@ -27456,7 +29348,7 @@ "center_x_ratio": "0.5f" }, "funcname": "SetScrollFromPosX", - "location": "imgui:398", + "location": "imgui:397", "namespace": "ImGui", "ov_cimguiname": "igSetScrollFromPosX_Float", "ret": "void", @@ -27484,7 +29376,7 @@ "cimguiname": "igSetScrollFromPosX", "defaults": {}, "funcname": "SetScrollFromPosX", - "location": "imgui_internal:2479", + "location": "imgui_internal:2809", "namespace": "ImGui", "ov_cimguiname": "igSetScrollFromPosX_WindowPtr", "ret": "void", @@ -27512,7 +29404,7 @@ "center_y_ratio": "0.5f" }, "funcname": "SetScrollFromPosY", - "location": "imgui:399", + "location": "imgui:398", "namespace": "ImGui", "ov_cimguiname": "igSetScrollFromPosY_Float", "ret": "void", @@ -27540,7 +29432,7 @@ "cimguiname": "igSetScrollFromPosY", "defaults": {}, "funcname": "SetScrollFromPosY", - "location": "imgui_internal:2480", + "location": "imgui_internal:2810", "namespace": "ImGui", "ov_cimguiname": "igSetScrollFromPosY_WindowPtr", "ret": "void", @@ -27564,7 +29456,7 @@ "center_x_ratio": "0.5f" }, "funcname": "SetScrollHereX", - "location": "imgui:396", + "location": "imgui:395", "namespace": "ImGui", "ov_cimguiname": "igSetScrollHereX", "ret": "void", @@ -27588,7 +29480,7 @@ "center_y_ratio": "0.5f" }, "funcname": "SetScrollHereY", - "location": "imgui:397", + "location": "imgui:396", "namespace": "ImGui", "ov_cimguiname": "igSetScrollHereY", "ret": "void", @@ -27610,7 +29502,7 @@ "cimguiname": "igSetScrollX", "defaults": {}, "funcname": "SetScrollX", - "location": "imgui:392", + "location": "imgui:391", "namespace": "ImGui", "ov_cimguiname": "igSetScrollX_Float", "ret": "void", @@ -27634,7 +29526,7 @@ "cimguiname": "igSetScrollX", "defaults": {}, "funcname": "SetScrollX", - "location": "imgui_internal:2477", + "location": "imgui_internal:2807", "namespace": "ImGui", "ov_cimguiname": "igSetScrollX_WindowPtr", "ret": "void", @@ -27656,7 +29548,7 @@ "cimguiname": "igSetScrollY", "defaults": {}, "funcname": "SetScrollY", - "location": "imgui:393", + "location": "imgui:392", "namespace": "ImGui", "ov_cimguiname": "igSetScrollY_Float", "ret": "void", @@ -27680,7 +29572,7 @@ "cimguiname": "igSetScrollY", "defaults": {}, "funcname": "SetScrollY", - "location": "imgui_internal:2478", + "location": "imgui_internal:2808", "namespace": "ImGui", "ov_cimguiname": "igSetScrollY_WindowPtr", "ret": "void", @@ -27688,6 +29580,39 @@ "stname": "" } ], + "igSetShortcutRouting": [ + { + "args": "(ImGuiKeyChord key_chord,ImGuiID owner_id,ImGuiInputFlags flags)", + "argsT": [ + { + "name": "key_chord", + "type": "ImGuiKeyChord" + }, + { + "name": "owner_id", + "type": "ImGuiID" + }, + { + "name": "flags", + "type": "ImGuiInputFlags" + } + ], + "argsoriginal": "(ImGuiKeyChord key_chord,ImGuiID owner_id=0,ImGuiInputFlags flags=0)", + "call_args": "(key_chord,owner_id,flags)", + "cimguiname": "igSetShortcutRouting", + "defaults": { + "flags": "0", + "owner_id": "0" + }, + "funcname": "SetShortcutRouting", + "location": "imgui_internal:2976", + "namespace": "ImGui", + "ov_cimguiname": "igSetShortcutRouting", + "ret": "bool", + "signature": "(ImGuiKeyChord,ImGuiID,ImGuiInputFlags)", + "stname": "" + } + ], "igSetStateStorage": [ { "args": "(ImGuiStorage* storage)", @@ -27702,7 +29627,7 @@ "cimguiname": "igSetStateStorage", "defaults": {}, "funcname": "SetStateStorage", - "location": "imgui:870", + "location": "imgui:874", "namespace": "ImGui", "ov_cimguiname": "igSetStateStorage", "ret": "void", @@ -27724,7 +29649,7 @@ "cimguiname": "igSetTabItemClosed", "defaults": {}, "funcname": "SetTabItemClosed", - "location": "imgui:792", + "location": "imgui:793", "namespace": "ImGui", "ov_cimguiname": "igSetTabItemClosed", "ret": "void", @@ -27751,7 +29676,7 @@ "defaults": {}, "funcname": "SetTooltip", "isvararg": "...)", - "location": "imgui:667", + "location": "imgui:671", "namespace": "ImGui", "ov_cimguiname": "igSetTooltip", "ret": "void", @@ -27777,7 +29702,7 @@ "cimguiname": "igSetTooltipV", "defaults": {}, "funcname": "SetTooltipV", - "location": "imgui:668", + "location": "imgui:672", "namespace": "ImGui", "ov_cimguiname": "igSetTooltipV", "ret": "void", @@ -27803,7 +29728,7 @@ "cimguiname": "igSetWindowClipRectBeforeSetChannel", "defaults": {}, "funcname": "SetWindowClipRectBeforeSetChannel", - "location": "imgui_internal:2609", + "location": "imgui_internal:3000", "namespace": "ImGui", "ov_cimguiname": "igSetWindowClipRectBeforeSetChannel", "ret": "void", @@ -27831,7 +29756,7 @@ "cond": "0" }, "funcname": "SetWindowCollapsed", - "location": "imgui:373", + "location": "imgui:370", "namespace": "ImGui", "ov_cimguiname": "igSetWindowCollapsed_Bool", "ret": "void", @@ -27861,7 +29786,7 @@ "cond": "0" }, "funcname": "SetWindowCollapsed", - "location": "imgui:378", + "location": "imgui:375", "namespace": "ImGui", "ov_cimguiname": "igSetWindowCollapsed_Str", "ret": "void", @@ -27891,7 +29816,7 @@ "cond": "0" }, "funcname": "SetWindowCollapsed", - "location": "imgui_internal:2429", + "location": "imgui_internal:2746", "namespace": "ImGui", "ov_cimguiname": "igSetWindowCollapsed_WindowPtr", "ret": "void", @@ -27908,7 +29833,7 @@ "cimguiname": "igSetWindowFocus", "defaults": {}, "funcname": "SetWindowFocus", - "location": "imgui:374", + "location": "imgui:371", "namespace": "ImGui", "ov_cimguiname": "igSetWindowFocus_Nil", "ret": "void", @@ -27928,7 +29853,7 @@ "cimguiname": "igSetWindowFocus", "defaults": {}, "funcname": "SetWindowFocus", - "location": "imgui:379", + "location": "imgui:376", "namespace": "ImGui", "ov_cimguiname": "igSetWindowFocus_Str", "ret": "void", @@ -27950,7 +29875,7 @@ "cimguiname": "igSetWindowFontScale", "defaults": {}, "funcname": "SetWindowFontScale", - "location": "imgui:375", + "location": "imgui:372", "namespace": "ImGui", "ov_cimguiname": "igSetWindowFontScale", "ret": "void", @@ -27958,6 +29883,28 @@ "stname": "" } ], + "igSetWindowHiddendAndSkipItemsForCurrentFrame": [ + { + "args": "(ImGuiWindow* window)", + "argsT": [ + { + "name": "window", + "type": "ImGuiWindow*" + } + ], + "argsoriginal": "(ImGuiWindow* window)", + "call_args": "(window)", + "cimguiname": "igSetWindowHiddendAndSkipItemsForCurrentFrame", + "defaults": {}, + "funcname": "SetWindowHiddendAndSkipItemsForCurrentFrame", + "location": "imgui_internal:2748", + "namespace": "ImGui", + "ov_cimguiname": "igSetWindowHiddendAndSkipItemsForCurrentFrame", + "ret": "void", + "signature": "(ImGuiWindow*)", + "stname": "" + } + ], "igSetWindowHitTestHole": [ { "args": "(ImGuiWindow* window,const ImVec2 pos,const ImVec2 size)", @@ -27980,7 +29927,7 @@ "cimguiname": "igSetWindowHitTestHole", "defaults": {}, "funcname": "SetWindowHitTestHole", - "location": "imgui_internal:2430", + "location": "imgui_internal:2747", "namespace": "ImGui", "ov_cimguiname": "igSetWindowHitTestHole", "ret": "void", @@ -28008,7 +29955,7 @@ "cond": "0" }, "funcname": "SetWindowPos", - "location": "imgui:371", + "location": "imgui:368", "namespace": "ImGui", "ov_cimguiname": "igSetWindowPos_Vec2", "ret": "void", @@ -28038,7 +29985,7 @@ "cond": "0" }, "funcname": "SetWindowPos", - "location": "imgui:376", + "location": "imgui:373", "namespace": "ImGui", "ov_cimguiname": "igSetWindowPos_Str", "ret": "void", @@ -28068,7 +30015,7 @@ "cond": "0" }, "funcname": "SetWindowPos", - "location": "imgui_internal:2427", + "location": "imgui_internal:2744", "namespace": "ImGui", "ov_cimguiname": "igSetWindowPos_WindowPtr", "ret": "void", @@ -28096,7 +30043,7 @@ "cond": "0" }, "funcname": "SetWindowSize", - "location": "imgui:372", + "location": "imgui:369", "namespace": "ImGui", "ov_cimguiname": "igSetWindowSize_Vec2", "ret": "void", @@ -28126,7 +30073,7 @@ "cond": "0" }, "funcname": "SetWindowSize", - "location": "imgui:377", + "location": "imgui:374", "namespace": "ImGui", "ov_cimguiname": "igSetWindowSize_Str", "ret": "void", @@ -28156,7 +30103,7 @@ "cond": "0" }, "funcname": "SetWindowSize", - "location": "imgui_internal:2428", + "location": "imgui_internal:2745", "namespace": "ImGui", "ov_cimguiname": "igSetWindowSize_WindowPtr", "ret": "void", @@ -28164,6 +30111,32 @@ "stname": "" } ], + "igSetWindowViewport": [ + { + "args": "(ImGuiWindow* window,ImGuiViewportP* viewport)", + "argsT": [ + { + "name": "window", + "type": "ImGuiWindow*" + }, + { + "name": "viewport", + "type": "ImGuiViewportP*" + } + ], + "argsoriginal": "(ImGuiWindow* window,ImGuiViewportP* viewport)", + "call_args": "(window,viewport)", + "cimguiname": "igSetWindowViewport", + "defaults": {}, + "funcname": "SetWindowViewport", + "location": "imgui_internal:2786", + "namespace": "ImGui", + "ov_cimguiname": "igSetWindowViewport", + "ret": "void", + "signature": "(ImGuiWindow*,ImGuiViewportP*)", + "stname": "" + } + ], "igShadeVertsLinearColorGradientKeepAlpha": [ { "args": "(ImDrawList* draw_list,int vert_start_idx,int vert_end_idx,ImVec2 gradient_p0,ImVec2 gradient_p1,ImU32 col0,ImU32 col1)", @@ -28202,7 +30175,7 @@ "cimguiname": "igShadeVertsLinearColorGradientKeepAlpha", "defaults": {}, "funcname": "ShadeVertsLinearColorGradientKeepAlpha", - "location": "imgui_internal:2773", + "location": "imgui_internal:3173", "namespace": "ImGui", "ov_cimguiname": "igShadeVertsLinearColorGradientKeepAlpha", "ret": "void", @@ -28252,7 +30225,7 @@ "cimguiname": "igShadeVertsLinearUV", "defaults": {}, "funcname": "ShadeVertsLinearUV", - "location": "imgui_internal:2774", + "location": "imgui_internal:3174", "namespace": "ImGui", "ov_cimguiname": "igShadeVertsLinearUV", "ret": "void", @@ -28260,6 +30233,39 @@ "stname": "" } ], + "igShortcut": [ + { + "args": "(ImGuiKeyChord key_chord,ImGuiID owner_id,ImGuiInputFlags flags)", + "argsT": [ + { + "name": "key_chord", + "type": "ImGuiKeyChord" + }, + { + "name": "owner_id", + "type": "ImGuiID" + }, + { + "name": "flags", + "type": "ImGuiInputFlags" + } + ], + "argsoriginal": "(ImGuiKeyChord key_chord,ImGuiID owner_id=0,ImGuiInputFlags flags=0)", + "call_args": "(key_chord,owner_id,flags)", + "cimguiname": "igShortcut", + "defaults": { + "flags": "0", + "owner_id": "0" + }, + "funcname": "Shortcut", + "location": "imgui_internal:2975", + "namespace": "ImGui", + "ov_cimguiname": "igShortcut", + "ret": "bool", + "signature": "(ImGuiKeyChord,ImGuiID,ImGuiInputFlags)", + "stname": "" + } + ], "igShowAboutWindow": [ { "args": "(bool* p_open)", @@ -28276,7 +30282,7 @@ "p_open": "NULL" }, "funcname": "ShowAboutWindow", - "location": "imgui:311", + "location": "imgui:307", "namespace": "ImGui", "ov_cimguiname": "igShowAboutWindow", "ret": "void", @@ -28284,6 +30290,30 @@ "stname": "" } ], + "igShowDebugLogWindow": [ + { + "args": "(bool* p_open)", + "argsT": [ + { + "name": "p_open", + "type": "bool*" + } + ], + "argsoriginal": "(bool* p_open=((void*)0))", + "call_args": "(p_open)", + "cimguiname": "igShowDebugLogWindow", + "defaults": { + "p_open": "NULL" + }, + "funcname": "ShowDebugLogWindow", + "location": "imgui:305", + "namespace": "ImGui", + "ov_cimguiname": "igShowDebugLogWindow", + "ret": "void", + "signature": "(bool*)", + "stname": "" + } + ], "igShowDemoWindow": [ { "args": "(bool* p_open)", @@ -28300,7 +30330,7 @@ "p_open": "NULL" }, "funcname": "ShowDemoWindow", - "location": "imgui:308", + "location": "imgui:303", "namespace": "ImGui", "ov_cimguiname": "igShowDemoWindow", "ret": "void", @@ -28322,7 +30352,7 @@ "cimguiname": "igShowFontAtlas", "defaults": {}, "funcname": "ShowFontAtlas", - "location": "imgui_internal:2787", + "location": "imgui_internal:3194", "namespace": "ImGui", "ov_cimguiname": "igShowFontAtlas", "ret": "void", @@ -28344,7 +30374,7 @@ "cimguiname": "igShowFontSelector", "defaults": {}, "funcname": "ShowFontSelector", - "location": "imgui:314", + "location": "imgui:310", "namespace": "ImGui", "ov_cimguiname": "igShowFontSelector", "ret": "void", @@ -28368,7 +30398,7 @@ "p_open": "NULL" }, "funcname": "ShowMetricsWindow", - "location": "imgui:309", + "location": "imgui:304", "namespace": "ImGui", "ov_cimguiname": "igShowMetricsWindow", "ret": "void", @@ -28392,7 +30422,7 @@ "p_open": "NULL" }, "funcname": "ShowStackToolWindow", - "location": "imgui:310", + "location": "imgui:306", "namespace": "ImGui", "ov_cimguiname": "igShowStackToolWindow", "ret": "void", @@ -28416,7 +30446,7 @@ "ref": "NULL" }, "funcname": "ShowStyleEditor", - "location": "imgui:312", + "location": "imgui:308", "namespace": "ImGui", "ov_cimguiname": "igShowStyleEditor", "ret": "void", @@ -28438,7 +30468,7 @@ "cimguiname": "igShowStyleSelector", "defaults": {}, "funcname": "ShowStyleSelector", - "location": "imgui:313", + "location": "imgui:309", "namespace": "ImGui", "ov_cimguiname": "igShowStyleSelector", "ret": "bool", @@ -28455,7 +30485,7 @@ "cimguiname": "igShowUserGuide", "defaults": {}, "funcname": "ShowUserGuide", - "location": "imgui:315", + "location": "imgui:311", "namespace": "ImGui", "ov_cimguiname": "igShowUserGuide", "ret": "void", @@ -28485,7 +30515,7 @@ "cimguiname": "igShrinkWidths", "defaults": {}, "funcname": "ShrinkWidths", - "location": "imgui_internal:2518", + "location": "imgui_internal:2849", "namespace": "ImGui", "ov_cimguiname": "igShrinkWidths", "ret": "void", @@ -28495,23 +30525,18 @@ ], "igShutdown": [ { - "args": "(ImGuiContext* context)", - "argsT": [ - { - "name": "context", - "type": "ImGuiContext*" - } - ], - "argsoriginal": "(ImGuiContext* context)", - "call_args": "(context)", + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", "cimguiname": "igShutdown", "defaults": {}, "funcname": "Shutdown", - "location": "imgui_internal:2453", + "location": "imgui_internal:2771", "namespace": "ImGui", "ov_cimguiname": "igShutdown", "ret": "void", - "signature": "(ImGuiContext*)", + "signature": "()", "stname": "" } ], @@ -28554,7 +30579,7 @@ "v_degrees_min": "-360.0f" }, "funcname": "SliderAngle", - "location": "imgui:559", + "location": "imgui:563", "namespace": "ImGui", "ov_cimguiname": "igSliderAngle", "ret": "bool", @@ -28608,7 +30633,7 @@ "cimguiname": "igSliderBehavior", "defaults": {}, "funcname": "SliderBehavior", - "location": "imgui_internal:2733", + "location": "imgui_internal:3131", "namespace": "ImGui", "ov_cimguiname": "igSliderBehavior", "ret": "bool", @@ -28653,7 +30678,7 @@ "format": "\"%.3f\"" }, "funcname": "SliderFloat", - "location": "imgui:555", + "location": "imgui:559", "namespace": "ImGui", "ov_cimguiname": "igSliderFloat", "ret": "bool", @@ -28698,7 +30723,7 @@ "format": "\"%.3f\"" }, "funcname": "SliderFloat2", - "location": "imgui:556", + "location": "imgui:560", "namespace": "ImGui", "ov_cimguiname": "igSliderFloat2", "ret": "bool", @@ -28743,7 +30768,7 @@ "format": "\"%.3f\"" }, "funcname": "SliderFloat3", - "location": "imgui:557", + "location": "imgui:561", "namespace": "ImGui", "ov_cimguiname": "igSliderFloat3", "ret": "bool", @@ -28788,7 +30813,7 @@ "format": "\"%.3f\"" }, "funcname": "SliderFloat4", - "location": "imgui:558", + "location": "imgui:562", "namespace": "ImGui", "ov_cimguiname": "igSliderFloat4", "ret": "bool", @@ -28833,7 +30858,7 @@ "format": "\"%d\"" }, "funcname": "SliderInt", - "location": "imgui:560", + "location": "imgui:564", "namespace": "ImGui", "ov_cimguiname": "igSliderInt", "ret": "bool", @@ -28878,7 +30903,7 @@ "format": "\"%d\"" }, "funcname": "SliderInt2", - "location": "imgui:561", + "location": "imgui:565", "namespace": "ImGui", "ov_cimguiname": "igSliderInt2", "ret": "bool", @@ -28923,7 +30948,7 @@ "format": "\"%d\"" }, "funcname": "SliderInt3", - "location": "imgui:562", + "location": "imgui:566", "namespace": "ImGui", "ov_cimguiname": "igSliderInt3", "ret": "bool", @@ -28968,7 +30993,7 @@ "format": "\"%d\"" }, "funcname": "SliderInt4", - "location": "imgui:563", + "location": "imgui:567", "namespace": "ImGui", "ov_cimguiname": "igSliderInt4", "ret": "bool", @@ -29017,7 +31042,7 @@ "format": "NULL" }, "funcname": "SliderScalar", - "location": "imgui:564", + "location": "imgui:568", "namespace": "ImGui", "ov_cimguiname": "igSliderScalar", "ret": "bool", @@ -29070,7 +31095,7 @@ "format": "NULL" }, "funcname": "SliderScalarN", - "location": "imgui:565", + "location": "imgui:569", "namespace": "ImGui", "ov_cimguiname": "igSliderScalarN", "ret": "bool", @@ -29109,7 +31134,7 @@ "cimguiname": "igSpacing", "defaults": {}, "funcname": "Spacing", - "location": "imgui:443", + "location": "imgui:442", "namespace": "ImGui", "ov_cimguiname": "igSpacing", "ret": "void", @@ -29119,7 +31144,7 @@ ], "igSplitterBehavior": [ { - "args": "(const ImRect bb,ImGuiID id,ImGuiAxis axis,float* size1,float* size2,float min_size1,float min_size2,float hover_extend,float hover_visibility_delay)", + "args": "(const ImRect bb,ImGuiID id,ImGuiAxis axis,float* size1,float* size2,float min_size1,float min_size2,float hover_extend,float hover_visibility_delay,ImU32 bg_col)", "argsT": [ { "name": "bb", @@ -29156,21 +31181,26 @@ { "name": "hover_visibility_delay", "type": "float" + }, + { + "name": "bg_col", + "type": "ImU32" } ], - "argsoriginal": "(const ImRect& bb,ImGuiID id,ImGuiAxis axis,float* size1,float* size2,float min_size1,float min_size2,float hover_extend=0.0f,float hover_visibility_delay=0.0f)", - "call_args": "(bb,id,axis,size1,size2,min_size1,min_size2,hover_extend,hover_visibility_delay)", + "argsoriginal": "(const ImRect& bb,ImGuiID id,ImGuiAxis axis,float* size1,float* size2,float min_size1,float min_size2,float hover_extend=0.0f,float hover_visibility_delay=0.0f,ImU32 bg_col=0)", + "call_args": "(bb,id,axis,size1,size2,min_size1,min_size2,hover_extend,hover_visibility_delay,bg_col)", "cimguiname": "igSplitterBehavior", "defaults": { + "bg_col": "0", "hover_extend": "0.0f", "hover_visibility_delay": "0.0f" }, "funcname": "SplitterBehavior", - "location": "imgui_internal:2734", + "location": "imgui_internal:3132", "namespace": "ImGui", "ov_cimguiname": "igSplitterBehavior", "ret": "bool", - "signature": "(const ImRect,ImGuiID,ImGuiAxis,float*,float*,float,float,float,float)", + "signature": "(const ImRect,ImGuiID,ImGuiAxis,float*,float*,float,float,float,float,ImU32)", "stname": "" } ], @@ -29188,7 +31218,7 @@ "cimguiname": "igStartMouseMovingWindow", "defaults": {}, "funcname": "StartMouseMovingWindow", - "location": "imgui_internal:2457", + "location": "imgui_internal:2776", "namespace": "ImGui", "ov_cimguiname": "igStartMouseMovingWindow", "ret": "void", @@ -29212,7 +31242,7 @@ "dst": "NULL" }, "funcname": "StyleColorsClassic", - "location": "imgui:321", + "location": "imgui:317", "namespace": "ImGui", "ov_cimguiname": "igStyleColorsClassic", "ret": "void", @@ -29236,7 +31266,7 @@ "dst": "NULL" }, "funcname": "StyleColorsDark", - "location": "imgui:319", + "location": "imgui:315", "namespace": "ImGui", "ov_cimguiname": "igStyleColorsDark", "ret": "void", @@ -29260,7 +31290,7 @@ "dst": "NULL" }, "funcname": "StyleColorsLight", - "location": "imgui:320", + "location": "imgui:316", "namespace": "ImGui", "ov_cimguiname": "igStyleColorsLight", "ret": "void", @@ -29286,7 +31316,7 @@ "cimguiname": "igTabBarCloseTab", "defaults": {}, "funcname": "TabBarCloseTab", - "location": "imgui_internal:2675", + "location": "imgui_internal:3074", "namespace": "ImGui", "ov_cimguiname": "igTabBarCloseTab", "ret": "void", @@ -29312,7 +31342,7 @@ "cimguiname": "igTabBarFindTabByID", "defaults": {}, "funcname": "TabBarFindTabByID", - "location": "imgui_internal:2673", + "location": "imgui_internal:3068", "namespace": "ImGui", "ov_cimguiname": "igTabBarFindTabByID", "ret": "ImGuiTabItem*", @@ -29320,6 +31350,106 @@ "stname": "" } ], + "igTabBarFindTabByOrder": [ + { + "args": "(ImGuiTabBar* tab_bar,int order)", + "argsT": [ + { + "name": "tab_bar", + "type": "ImGuiTabBar*" + }, + { + "name": "order", + "type": "int" + } + ], + "argsoriginal": "(ImGuiTabBar* tab_bar,int order)", + "call_args": "(tab_bar,order)", + "cimguiname": "igTabBarFindTabByOrder", + "defaults": {}, + "funcname": "TabBarFindTabByOrder", + "location": "imgui_internal:3069", + "namespace": "ImGui", + "ov_cimguiname": "igTabBarFindTabByOrder", + "ret": "ImGuiTabItem*", + "signature": "(ImGuiTabBar*,int)", + "stname": "" + } + ], + "igTabBarGetCurrentTab": [ + { + "args": "(ImGuiTabBar* tab_bar)", + "argsT": [ + { + "name": "tab_bar", + "type": "ImGuiTabBar*" + } + ], + "argsoriginal": "(ImGuiTabBar* tab_bar)", + "call_args": "(tab_bar)", + "cimguiname": "igTabBarGetCurrentTab", + "defaults": {}, + "funcname": "TabBarGetCurrentTab", + "location": "imgui_internal:3070", + "namespace": "ImGui", + "ov_cimguiname": "igTabBarGetCurrentTab", + "ret": "ImGuiTabItem*", + "signature": "(ImGuiTabBar*)", + "stname": "" + } + ], + "igTabBarGetTabName": [ + { + "args": "(ImGuiTabBar* tab_bar,ImGuiTabItem* tab)", + "argsT": [ + { + "name": "tab_bar", + "type": "ImGuiTabBar*" + }, + { + "name": "tab", + "type": "ImGuiTabItem*" + } + ], + "argsoriginal": "(ImGuiTabBar* tab_bar,ImGuiTabItem* tab)", + "call_args": "(tab_bar,tab)", + "cimguiname": "igTabBarGetTabName", + "defaults": {}, + "funcname": "TabBarGetTabName", + "location": "imgui_internal:3072", + "namespace": "ImGui", + "ov_cimguiname": "igTabBarGetTabName", + "ret": "const char*", + "signature": "(ImGuiTabBar*,ImGuiTabItem*)", + "stname": "" + } + ], + "igTabBarGetTabOrder": [ + { + "args": "(ImGuiTabBar* tab_bar,ImGuiTabItem* tab)", + "argsT": [ + { + "name": "tab_bar", + "type": "ImGuiTabBar*" + }, + { + "name": "tab", + "type": "ImGuiTabItem*" + } + ], + "argsoriginal": "(ImGuiTabBar* tab_bar,ImGuiTabItem* tab)", + "call_args": "(tab_bar,tab)", + "cimguiname": "igTabBarGetTabOrder", + "defaults": {}, + "funcname": "TabBarGetTabOrder", + "location": "imgui_internal:3071", + "namespace": "ImGui", + "ov_cimguiname": "igTabBarGetTabOrder", + "ret": "int", + "signature": "(ImGuiTabBar*,ImGuiTabItem*)", + "stname": "" + } + ], "igTabBarProcessReorder": [ { "args": "(ImGuiTabBar* tab_bar)", @@ -29334,7 +31464,7 @@ "cimguiname": "igTabBarProcessReorder", "defaults": {}, "funcname": "TabBarProcessReorder", - "location": "imgui_internal:2678", + "location": "imgui_internal:3078", "namespace": "ImGui", "ov_cimguiname": "igTabBarProcessReorder", "ret": "bool", @@ -29342,9 +31472,35 @@ "stname": "" } ], + "igTabBarQueueFocus": [ + { + "args": "(ImGuiTabBar* tab_bar,ImGuiTabItem* tab)", + "argsT": [ + { + "name": "tab_bar", + "type": "ImGuiTabBar*" + }, + { + "name": "tab", + "type": "ImGuiTabItem*" + } + ], + "argsoriginal": "(ImGuiTabBar* tab_bar,ImGuiTabItem* tab)", + "call_args": "(tab_bar,tab)", + "cimguiname": "igTabBarQueueFocus", + "defaults": {}, + "funcname": "TabBarQueueFocus", + "location": "imgui_internal:3075", + "namespace": "ImGui", + "ov_cimguiname": "igTabBarQueueFocus", + "ret": "void", + "signature": "(ImGuiTabBar*,ImGuiTabItem*)", + "stname": "" + } + ], "igTabBarQueueReorder": [ { - "args": "(ImGuiTabBar* tab_bar,const ImGuiTabItem* tab,int offset)", + "args": "(ImGuiTabBar* tab_bar,ImGuiTabItem* tab,int offset)", "argsT": [ { "name": "tab_bar", @@ -29352,29 +31508,29 @@ }, { "name": "tab", - "type": "const ImGuiTabItem*" + "type": "ImGuiTabItem*" }, { "name": "offset", "type": "int" } ], - "argsoriginal": "(ImGuiTabBar* tab_bar,const ImGuiTabItem* tab,int offset)", + "argsoriginal": "(ImGuiTabBar* tab_bar,ImGuiTabItem* tab,int offset)", "call_args": "(tab_bar,tab,offset)", "cimguiname": "igTabBarQueueReorder", "defaults": {}, "funcname": "TabBarQueueReorder", - "location": "imgui_internal:2676", + "location": "imgui_internal:3076", "namespace": "ImGui", "ov_cimguiname": "igTabBarQueueReorder", "ret": "void", - "signature": "(ImGuiTabBar*,const ImGuiTabItem*,int)", + "signature": "(ImGuiTabBar*,ImGuiTabItem*,int)", "stname": "" } ], "igTabBarQueueReorderFromMousePos": [ { - "args": "(ImGuiTabBar* tab_bar,const ImGuiTabItem* tab,ImVec2 mouse_pos)", + "args": "(ImGuiTabBar* tab_bar,ImGuiTabItem* tab,ImVec2 mouse_pos)", "argsT": [ { "name": "tab_bar", @@ -29382,23 +31538,23 @@ }, { "name": "tab", - "type": "const ImGuiTabItem*" + "type": "ImGuiTabItem*" }, { "name": "mouse_pos", "type": "ImVec2" } ], - "argsoriginal": "(ImGuiTabBar* tab_bar,const ImGuiTabItem* tab,ImVec2 mouse_pos)", + "argsoriginal": "(ImGuiTabBar* tab_bar,ImGuiTabItem* tab,ImVec2 mouse_pos)", "call_args": "(tab_bar,tab,mouse_pos)", "cimguiname": "igTabBarQueueReorderFromMousePos", "defaults": {}, "funcname": "TabBarQueueReorderFromMousePos", - "location": "imgui_internal:2677", + "location": "imgui_internal:3077", "namespace": "ImGui", "ov_cimguiname": "igTabBarQueueReorderFromMousePos", "ret": "void", - "signature": "(ImGuiTabBar*,const ImGuiTabItem*,ImVec2)", + "signature": "(ImGuiTabBar*,ImGuiTabItem*,ImVec2)", "stname": "" } ], @@ -29420,7 +31576,7 @@ "cimguiname": "igTabBarRemoveTab", "defaults": {}, "funcname": "TabBarRemoveTab", - "location": "imgui_internal:2674", + "location": "imgui_internal:3073", "namespace": "ImGui", "ov_cimguiname": "igTabBarRemoveTab", "ret": "void", @@ -29454,7 +31610,7 @@ "cimguiname": "igTabItemBackground", "defaults": {}, "funcname": "TabItemBackground", - "location": "imgui_internal:2681", + "location": "imgui_internal:3082", "namespace": "ImGui", "ov_cimguiname": "igTabItemBackground", "ret": "void", @@ -29482,7 +31638,7 @@ "flags": "0" }, "funcname": "TabItemButton", - "location": "imgui:791", + "location": "imgui:792", "namespace": "ImGui", "ov_cimguiname": "igTabItemButton", "ret": "bool", @@ -29492,7 +31648,7 @@ ], "igTabItemCalcSize": [ { - "args": "(ImVec2 *pOut,const char* label,bool has_close_button)", + "args": "(ImVec2 *pOut,const char* label,bool has_close_button_or_unsaved_marker)", "argsT": [ { "name": "pOut", @@ -29503,27 +31659,52 @@ "type": "const char*" }, { - "name": "has_close_button", + "name": "has_close_button_or_unsaved_marker", "type": "bool" } ], - "argsoriginal": "(const char* label,bool has_close_button)", - "call_args": "(label,has_close_button)", + "argsoriginal": "(const char* label,bool has_close_button_or_unsaved_marker)", + "call_args": "(label,has_close_button_or_unsaved_marker)", + "cimguiname": "igTabItemCalcSize", + "defaults": {}, + "funcname": "TabItemCalcSize", + "location": "imgui_internal:3080", + "namespace": "ImGui", + "nonUDT": 1, + "ov_cimguiname": "igTabItemCalcSize_Str", + "ret": "void", + "signature": "(const char*,bool)", + "stname": "" + }, + { + "args": "(ImVec2 *pOut,ImGuiWindow* window)", + "argsT": [ + { + "name": "pOut", + "type": "ImVec2*" + }, + { + "name": "window", + "type": "ImGuiWindow*" + } + ], + "argsoriginal": "(ImGuiWindow* window)", + "call_args": "(window)", "cimguiname": "igTabItemCalcSize", "defaults": {}, "funcname": "TabItemCalcSize", - "location": "imgui_internal:2680", + "location": "imgui_internal:3081", "namespace": "ImGui", "nonUDT": 1, - "ov_cimguiname": "igTabItemCalcSize", + "ov_cimguiname": "igTabItemCalcSize_WindowPtr", "ret": "void", - "signature": "(const char*,bool)", + "signature": "(ImGuiWindow*)", "stname": "" } ], "igTabItemEx": [ { - "args": "(ImGuiTabBar* tab_bar,const char* label,bool* p_open,ImGuiTabItemFlags flags)", + "args": "(ImGuiTabBar* tab_bar,const char* label,bool* p_open,ImGuiTabItemFlags flags,ImGuiWindow* docked_window)", "argsT": [ { "name": "tab_bar", @@ -29540,18 +31721,22 @@ { "name": "flags", "type": "ImGuiTabItemFlags" + }, + { + "name": "docked_window", + "type": "ImGuiWindow*" } ], - "argsoriginal": "(ImGuiTabBar* tab_bar,const char* label,bool* p_open,ImGuiTabItemFlags flags)", - "call_args": "(tab_bar,label,p_open,flags)", + "argsoriginal": "(ImGuiTabBar* tab_bar,const char* label,bool* p_open,ImGuiTabItemFlags flags,ImGuiWindow* docked_window)", + "call_args": "(tab_bar,label,p_open,flags,docked_window)", "cimguiname": "igTabItemEx", "defaults": {}, "funcname": "TabItemEx", - "location": "imgui_internal:2679", + "location": "imgui_internal:3079", "namespace": "ImGui", "ov_cimguiname": "igTabItemEx", "ret": "bool", - "signature": "(ImGuiTabBar*,const char*,bool*,ImGuiTabItemFlags)", + "signature": "(ImGuiTabBar*,const char*,bool*,ImGuiTabItemFlags,ImGuiWindow*)", "stname": "" } ], @@ -29605,7 +31790,7 @@ "cimguiname": "igTabItemLabelAndCloseButton", "defaults": {}, "funcname": "TabItemLabelAndCloseButton", - "location": "imgui_internal:2682", + "location": "imgui_internal:3083", "namespace": "ImGui", "ov_cimguiname": "igTabItemLabelAndCloseButton", "ret": "void", @@ -29627,7 +31812,7 @@ "cimguiname": "igTableBeginApplyRequests", "defaults": {}, "funcname": "TableBeginApplyRequests", - "location": "imgui_internal:2634", + "location": "imgui_internal:3025", "namespace": "ImGui", "ov_cimguiname": "igTableBeginApplyRequests", "ret": "void", @@ -29653,7 +31838,7 @@ "cimguiname": "igTableBeginCell", "defaults": {}, "funcname": "TableBeginCell", - "location": "imgui_internal:2649", + "location": "imgui_internal:3043", "namespace": "ImGui", "ov_cimguiname": "igTableBeginCell", "ret": "void", @@ -29661,6 +31846,28 @@ "stname": "" } ], + "igTableBeginContextMenuPopup": [ + { + "args": "(ImGuiTable* table)", + "argsT": [ + { + "name": "table", + "type": "ImGuiTable*" + } + ], + "argsoriginal": "(ImGuiTable* table)", + "call_args": "(table)", + "cimguiname": "igTableBeginContextMenuPopup", + "defaults": {}, + "funcname": "TableBeginContextMenuPopup", + "location": "imgui_internal:3032", + "namespace": "ImGui", + "ov_cimguiname": "igTableBeginContextMenuPopup", + "ret": "bool", + "signature": "(ImGuiTable*)", + "stname": "" + } + ], "igTableBeginInitMemory": [ { "args": "(ImGuiTable* table,int columns_count)", @@ -29679,7 +31886,7 @@ "cimguiname": "igTableBeginInitMemory", "defaults": {}, "funcname": "TableBeginInitMemory", - "location": "imgui_internal:2633", + "location": "imgui_internal:3024", "namespace": "ImGui", "ov_cimguiname": "igTableBeginInitMemory", "ret": "void", @@ -29701,7 +31908,7 @@ "cimguiname": "igTableBeginRow", "defaults": {}, "funcname": "TableBeginRow", - "location": "imgui_internal:2647", + "location": "imgui_internal:3041", "namespace": "ImGui", "ov_cimguiname": "igTableBeginRow", "ret": "void", @@ -29723,7 +31930,7 @@ "cimguiname": "igTableDrawBorders", "defaults": {}, "funcname": "TableDrawBorders", - "location": "imgui_internal:2639", + "location": "imgui_internal:3030", "namespace": "ImGui", "ov_cimguiname": "igTableDrawBorders", "ret": "void", @@ -29745,7 +31952,7 @@ "cimguiname": "igTableDrawContextMenu", "defaults": {}, "funcname": "TableDrawContextMenu", - "location": "imgui_internal:2640", + "location": "imgui_internal:3031", "namespace": "ImGui", "ov_cimguiname": "igTableDrawContextMenu", "ret": "void", @@ -29767,7 +31974,7 @@ "cimguiname": "igTableEndCell", "defaults": {}, "funcname": "TableEndCell", - "location": "imgui_internal:2650", + "location": "imgui_internal:3044", "namespace": "ImGui", "ov_cimguiname": "igTableEndCell", "ret": "void", @@ -29789,7 +31996,7 @@ "cimguiname": "igTableEndRow", "defaults": {}, "funcname": "TableEndRow", - "location": "imgui_internal:2648", + "location": "imgui_internal:3042", "namespace": "ImGui", "ov_cimguiname": "igTableEndRow", "ret": "void", @@ -29811,7 +32018,7 @@ "cimguiname": "igTableFindByID", "defaults": {}, "funcname": "TableFindByID", - "location": "imgui_internal:2631", + "location": "imgui_internal:3022", "namespace": "ImGui", "ov_cimguiname": "igTableFindByID", "ret": "ImGuiTable*", @@ -29837,7 +32044,7 @@ "cimguiname": "igTableFixColumnSortDirection", "defaults": {}, "funcname": "TableFixColumnSortDirection", - "location": "imgui_internal:2645", + "location": "imgui_internal:3039", "namespace": "ImGui", "ov_cimguiname": "igTableFixColumnSortDirection", "ret": "void", @@ -29854,7 +32061,7 @@ "cimguiname": "igTableGcCompactSettings", "defaults": {}, "funcname": "TableGcCompactSettings", - "location": "imgui_internal:2660", + "location": "imgui_internal:3054", "namespace": "ImGui", "ov_cimguiname": "igTableGcCompactSettings", "ret": "void", @@ -29876,7 +32083,7 @@ "cimguiname": "igTableGcCompactTransientBuffers", "defaults": {}, "funcname": "TableGcCompactTransientBuffers", - "location": "imgui_internal:2658", + "location": "imgui_internal:3052", "namespace": "ImGui", "ov_cimguiname": "igTableGcCompactTransientBuffers_TablePtr", "ret": "void", @@ -29896,7 +32103,7 @@ "cimguiname": "igTableGcCompactTransientBuffers", "defaults": {}, "funcname": "TableGcCompactTransientBuffers", - "location": "imgui_internal:2659", + "location": "imgui_internal:3053", "namespace": "ImGui", "ov_cimguiname": "igTableGcCompactTransientBuffers_TableTempDataPtr", "ret": "void", @@ -29918,7 +32125,7 @@ "cimguiname": "igTableGetBoundSettings", "defaults": {}, "funcname": "TableGetBoundSettings", - "location": "imgui_internal:2666", + "location": "imgui_internal:3060", "namespace": "ImGui", "ov_cimguiname": "igTableGetBoundSettings", "ret": "ImGuiTableSettings*", @@ -29948,7 +32155,7 @@ "cimguiname": "igTableGetCellBgRect", "defaults": {}, "funcname": "TableGetCellBgRect", - "location": "imgui_internal:2651", + "location": "imgui_internal:3045", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igTableGetCellBgRect", @@ -30055,7 +32262,7 @@ "cimguiname": "igTableGetColumnName", "defaults": {}, "funcname": "TableGetColumnName", - "location": "imgui_internal:2652", + "location": "imgui_internal:3046", "namespace": "ImGui", "ov_cimguiname": "igTableGetColumnName_TablePtr", "ret": "const char*", @@ -30077,7 +32284,7 @@ "cimguiname": "igTableGetColumnNextSortDirection", "defaults": {}, "funcname": "TableGetColumnNextSortDirection", - "location": "imgui_internal:2644", + "location": "imgui_internal:3038", "namespace": "ImGui", "ov_cimguiname": "igTableGetColumnNextSortDirection", "ret": "ImGuiSortDirection", @@ -30087,11 +32294,11 @@ ], "igTableGetColumnResizeID": [ { - "args": "(const ImGuiTable* table,int column_n,int instance_no)", + "args": "(ImGuiTable* table,int column_n,int instance_no)", "argsT": [ { "name": "table", - "type": "const ImGuiTable*" + "type": "ImGuiTable*" }, { "name": "column_n", @@ -30102,18 +32309,18 @@ "type": "int" } ], - "argsoriginal": "(const ImGuiTable* table,int column_n,int instance_no=0)", + "argsoriginal": "(ImGuiTable* table,int column_n,int instance_no=0)", "call_args": "(table,column_n,instance_no)", "cimguiname": "igTableGetColumnResizeID", "defaults": { "instance_no": "0" }, "funcname": "TableGetColumnResizeID", - "location": "imgui_internal:2653", + "location": "imgui_internal:3047", "namespace": "ImGui", "ov_cimguiname": "igTableGetColumnResizeID", "ret": "ImGuiID", - "signature": "(const ImGuiTable*,int,int)", + "signature": "(ImGuiTable*,int,int)", "stname": "" } ], @@ -30135,7 +32342,7 @@ "cimguiname": "igTableGetColumnWidthAuto", "defaults": {}, "funcname": "TableGetColumnWidthAuto", - "location": "imgui_internal:2646", + "location": "imgui_internal:3040", "namespace": "ImGui", "ov_cimguiname": "igTableGetColumnWidthAuto", "ret": "float", @@ -30152,7 +32359,7 @@ "cimguiname": "igTableGetHeaderRowHeight", "defaults": {}, "funcname": "TableGetHeaderRowHeight", - "location": "imgui_internal:2625", + "location": "imgui_internal:3016", "namespace": "ImGui", "ov_cimguiname": "igTableGetHeaderRowHeight", "ret": "float", @@ -30169,7 +32376,7 @@ "cimguiname": "igTableGetHoveredColumn", "defaults": {}, "funcname": "TableGetHoveredColumn", - "location": "imgui_internal:2624", + "location": "imgui_internal:3015", "namespace": "ImGui", "ov_cimguiname": "igTableGetHoveredColumn", "ret": "int", @@ -30177,6 +32384,58 @@ "stname": "" } ], + "igTableGetInstanceData": [ + { + "args": "(ImGuiTable* table,int instance_no)", + "argsT": [ + { + "name": "table", + "type": "ImGuiTable*" + }, + { + "name": "instance_no", + "type": "int" + } + ], + "argsoriginal": "(ImGuiTable* table,int instance_no)", + "call_args": "(table,instance_no)", + "cimguiname": "igTableGetInstanceData", + "defaults": {}, + "funcname": "TableGetInstanceData", + "location": "imgui_internal:3034", + "namespace": "ImGui", + "ov_cimguiname": "igTableGetInstanceData", + "ret": "ImGuiTableInstanceData*", + "signature": "(ImGuiTable*,int)", + "stname": "" + } + ], + "igTableGetInstanceID": [ + { + "args": "(ImGuiTable* table,int instance_no)", + "argsT": [ + { + "name": "table", + "type": "ImGuiTable*" + }, + { + "name": "instance_no", + "type": "int" + } + ], + "argsoriginal": "(ImGuiTable* table,int instance_no)", + "call_args": "(table,instance_no)", + "cimguiname": "igTableGetInstanceID", + "defaults": {}, + "funcname": "TableGetInstanceID", + "location": "imgui_internal:3035", + "namespace": "ImGui", + "ov_cimguiname": "igTableGetInstanceID", + "ret": "ImGuiID", + "signature": "(ImGuiTable*,int)", + "stname": "" + } + ], "igTableGetMaxColumnWidth": [ { "args": "(const ImGuiTable* table,int column_n)", @@ -30195,7 +32454,7 @@ "cimguiname": "igTableGetMaxColumnWidth", "defaults": {}, "funcname": "TableGetMaxColumnWidth", - "location": "imgui_internal:2654", + "location": "imgui_internal:3048", "namespace": "ImGui", "ov_cimguiname": "igTableGetMaxColumnWidth", "ret": "float", @@ -30229,7 +32488,7 @@ "cimguiname": "igTableGetSortSpecs", "defaults": {}, "funcname": "TableGetSortSpecs", - "location": "imgui:763", + "location": "imgui:766", "namespace": "ImGui", "ov_cimguiname": "igTableGetSortSpecs", "ret": "ImGuiTableSortSpecs*", @@ -30251,7 +32510,7 @@ "cimguiname": "igTableHeader", "defaults": {}, "funcname": "TableHeader", - "location": "imgui:755", + "location": "imgui:758", "namespace": "ImGui", "ov_cimguiname": "igTableHeader", "ret": "void", @@ -30268,7 +32527,7 @@ "cimguiname": "igTableHeadersRow", "defaults": {}, "funcname": "TableHeadersRow", - "location": "imgui:754", + "location": "imgui:757", "namespace": "ImGui", "ov_cimguiname": "igTableHeadersRow", "ret": "void", @@ -30290,7 +32549,7 @@ "cimguiname": "igTableLoadSettings", "defaults": {}, "funcname": "TableLoadSettings", - "location": "imgui_internal:2663", + "location": "imgui_internal:3057", "namespace": "ImGui", "ov_cimguiname": "igTableLoadSettings", "ret": "void", @@ -30312,7 +32571,7 @@ "cimguiname": "igTableMergeDrawChannels", "defaults": {}, "funcname": "TableMergeDrawChannels", - "location": "imgui_internal:2641", + "location": "imgui_internal:3033", "namespace": "ImGui", "ov_cimguiname": "igTableMergeDrawChannels", "ret": "void", @@ -30329,7 +32588,7 @@ "cimguiname": "igTableNextColumn", "defaults": {}, "funcname": "TableNextColumn", - "location": "imgui:741", + "location": "imgui:744", "namespace": "ImGui", "ov_cimguiname": "igTableNextColumn", "ret": "bool", @@ -30358,7 +32617,7 @@ "row_flags": "0" }, "funcname": "TableNextRow", - "location": "imgui:740", + "location": "imgui:743", "namespace": "ImGui", "ov_cimguiname": "igTableNextRow", "ret": "void", @@ -30382,7 +32641,7 @@ "column_n": "-1" }, "funcname": "TableOpenContextMenu", - "location": "imgui_internal:2621", + "location": "imgui_internal:3012", "namespace": "ImGui", "ov_cimguiname": "igTableOpenContextMenu", "ret": "void", @@ -30399,7 +32658,7 @@ "cimguiname": "igTablePopBackgroundChannel", "defaults": {}, "funcname": "TablePopBackgroundChannel", - "location": "imgui_internal:2627", + "location": "imgui_internal:3018", "namespace": "ImGui", "ov_cimguiname": "igTablePopBackgroundChannel", "ret": "void", @@ -30416,7 +32675,7 @@ "cimguiname": "igTablePushBackgroundChannel", "defaults": {}, "funcname": "TablePushBackgroundChannel", - "location": "imgui_internal:2626", + "location": "imgui_internal:3017", "namespace": "ImGui", "ov_cimguiname": "igTablePushBackgroundChannel", "ret": "void", @@ -30438,7 +32697,7 @@ "cimguiname": "igTableRemove", "defaults": {}, "funcname": "TableRemove", - "location": "imgui_internal:2657", + "location": "imgui_internal:3051", "namespace": "ImGui", "ov_cimguiname": "igTableRemove", "ret": "void", @@ -30460,7 +32719,7 @@ "cimguiname": "igTableResetSettings", "defaults": {}, "funcname": "TableResetSettings", - "location": "imgui_internal:2665", + "location": "imgui_internal:3059", "namespace": "ImGui", "ov_cimguiname": "igTableResetSettings", "ret": "void", @@ -30482,7 +32741,7 @@ "cimguiname": "igTableSaveSettings", "defaults": {}, "funcname": "TableSaveSettings", - "location": "imgui_internal:2664", + "location": "imgui_internal:3058", "namespace": "ImGui", "ov_cimguiname": "igTableSaveSettings", "ret": "void", @@ -30562,7 +32821,7 @@ "cimguiname": "igTableSetColumnIndex", "defaults": {}, "funcname": "TableSetColumnIndex", - "location": "imgui:742", + "location": "imgui:745", "namespace": "ImGui", "ov_cimguiname": "igTableSetColumnIndex", "ret": "bool", @@ -30592,7 +32851,7 @@ "cimguiname": "igTableSetColumnSortDirection", "defaults": {}, "funcname": "TableSetColumnSortDirection", - "location": "imgui_internal:2623", + "location": "imgui_internal:3014", "namespace": "ImGui", "ov_cimguiname": "igTableSetColumnSortDirection", "ret": "void", @@ -30618,7 +32877,7 @@ "cimguiname": "igTableSetColumnWidth", "defaults": {}, "funcname": "TableSetColumnWidth", - "location": "imgui_internal:2622", + "location": "imgui_internal:3013", "namespace": "ImGui", "ov_cimguiname": "igTableSetColumnWidth", "ret": "void", @@ -30640,7 +32899,7 @@ "cimguiname": "igTableSetColumnWidthAutoAll", "defaults": {}, "funcname": "TableSetColumnWidthAutoAll", - "location": "imgui_internal:2656", + "location": "imgui_internal:3050", "namespace": "ImGui", "ov_cimguiname": "igTableSetColumnWidthAutoAll", "ret": "void", @@ -30666,7 +32925,7 @@ "cimguiname": "igTableSetColumnWidthAutoSingle", "defaults": {}, "funcname": "TableSetColumnWidthAutoSingle", - "location": "imgui_internal:2655", + "location": "imgui_internal:3049", "namespace": "ImGui", "ov_cimguiname": "igTableSetColumnWidthAutoSingle", "ret": "void", @@ -30674,6 +32933,23 @@ "stname": "" } ], + "igTableSettingsAddSettingsHandler": [ + { + "args": "()", + "argsT": [], + "argsoriginal": "()", + "call_args": "()", + "cimguiname": "igTableSettingsAddSettingsHandler", + "defaults": {}, + "funcname": "TableSettingsAddSettingsHandler", + "location": "imgui_internal:3061", + "namespace": "ImGui", + "ov_cimguiname": "igTableSettingsAddSettingsHandler", + "ret": "void", + "signature": "()", + "stname": "" + } + ], "igTableSettingsCreate": [ { "args": "(ImGuiID id,int columns_count)", @@ -30692,7 +32968,7 @@ "cimguiname": "igTableSettingsCreate", "defaults": {}, "funcname": "TableSettingsCreate", - "location": "imgui_internal:2668", + "location": "imgui_internal:3062", "namespace": "ImGui", "ov_cimguiname": "igTableSettingsCreate", "ret": "ImGuiTableSettings*", @@ -30714,7 +32990,7 @@ "cimguiname": "igTableSettingsFindByID", "defaults": {}, "funcname": "TableSettingsFindByID", - "location": "imgui_internal:2669", + "location": "imgui_internal:3063", "namespace": "ImGui", "ov_cimguiname": "igTableSettingsFindByID", "ret": "ImGuiTableSettings*", @@ -30722,28 +32998,6 @@ "stname": "" } ], - "igTableSettingsInstallHandler": [ - { - "args": "(ImGuiContext* context)", - "argsT": [ - { - "name": "context", - "type": "ImGuiContext*" - } - ], - "argsoriginal": "(ImGuiContext* context)", - "call_args": "(context)", - "cimguiname": "igTableSettingsInstallHandler", - "defaults": {}, - "funcname": "TableSettingsInstallHandler", - "location": "imgui_internal:2667", - "namespace": "ImGui", - "ov_cimguiname": "igTableSettingsInstallHandler", - "ret": "void", - "signature": "(ImGuiContext*)", - "stname": "" - } - ], "igTableSetupColumn": [ { "args": "(const char* label,ImGuiTableColumnFlags flags,float init_width_or_weight,ImGuiID user_id)", @@ -30774,7 +33028,7 @@ "user_id": "0" }, "funcname": "TableSetupColumn", - "location": "imgui:752", + "location": "imgui:755", "namespace": "ImGui", "ov_cimguiname": "igTableSetupColumn", "ret": "void", @@ -30796,7 +33050,7 @@ "cimguiname": "igTableSetupDrawChannels", "defaults": {}, "funcname": "TableSetupDrawChannels", - "location": "imgui_internal:2635", + "location": "imgui_internal:3026", "namespace": "ImGui", "ov_cimguiname": "igTableSetupDrawChannels", "ret": "void", @@ -30822,7 +33076,7 @@ "cimguiname": "igTableSetupScrollFreeze", "defaults": {}, "funcname": "TableSetupScrollFreeze", - "location": "imgui:753", + "location": "imgui:756", "namespace": "ImGui", "ov_cimguiname": "igTableSetupScrollFreeze", "ret": "void", @@ -30844,7 +33098,7 @@ "cimguiname": "igTableSortSpecsBuild", "defaults": {}, "funcname": "TableSortSpecsBuild", - "location": "imgui_internal:2643", + "location": "imgui_internal:3037", "namespace": "ImGui", "ov_cimguiname": "igTableSortSpecsBuild", "ret": "void", @@ -30866,7 +33120,7 @@ "cimguiname": "igTableSortSpecsSanitize", "defaults": {}, "funcname": "TableSortSpecsSanitize", - "location": "imgui_internal:2642", + "location": "imgui_internal:3036", "namespace": "ImGui", "ov_cimguiname": "igTableSortSpecsSanitize", "ret": "void", @@ -30888,7 +33142,7 @@ "cimguiname": "igTableUpdateBorders", "defaults": {}, "funcname": "TableUpdateBorders", - "location": "imgui_internal:2637", + "location": "imgui_internal:3028", "namespace": "ImGui", "ov_cimguiname": "igTableUpdateBorders", "ret": "void", @@ -30910,7 +33164,7 @@ "cimguiname": "igTableUpdateColumnsWeightFromWidth", "defaults": {}, "funcname": "TableUpdateColumnsWeightFromWidth", - "location": "imgui_internal:2638", + "location": "imgui_internal:3029", "namespace": "ImGui", "ov_cimguiname": "igTableUpdateColumnsWeightFromWidth", "ret": "void", @@ -30932,7 +33186,7 @@ "cimguiname": "igTableUpdateLayout", "defaults": {}, "funcname": "TableUpdateLayout", - "location": "imgui_internal:2636", + "location": "imgui_internal:3027", "namespace": "ImGui", "ov_cimguiname": "igTableUpdateLayout", "ret": "void", @@ -30954,7 +33208,7 @@ "cimguiname": "igTempInputIsActive", "defaults": {}, "funcname": "TempInputIsActive", - "location": "imgui_internal:2761", + "location": "imgui_internal:3161", "namespace": "ImGui", "ov_cimguiname": "igTempInputIsActive", "ret": "bool", @@ -31007,7 +33261,7 @@ "p_clamp_min": "NULL" }, "funcname": "TempInputScalar", - "location": "imgui_internal:2760", + "location": "imgui_internal:3160", "namespace": "ImGui", "ov_cimguiname": "igTempInputScalar", "ret": "bool", @@ -31049,7 +33303,7 @@ "cimguiname": "igTempInputText", "defaults": {}, "funcname": "TempInputText", - "location": "imgui_internal:2759", + "location": "imgui_internal:3159", "namespace": "ImGui", "ov_cimguiname": "igTempInputText", "ret": "bool", @@ -31057,6 +33311,58 @@ "stname": "" } ], + "igTestKeyOwner": [ + { + "args": "(ImGuiKey key,ImGuiID owner_id)", + "argsT": [ + { + "name": "key", + "type": "ImGuiKey" + }, + { + "name": "owner_id", + "type": "ImGuiID" + } + ], + "argsoriginal": "(ImGuiKey key,ImGuiID owner_id)", + "call_args": "(key,owner_id)", + "cimguiname": "igTestKeyOwner", + "defaults": {}, + "funcname": "TestKeyOwner", + "location": "imgui_internal:2949", + "namespace": "ImGui", + "ov_cimguiname": "igTestKeyOwner", + "ret": "bool", + "signature": "(ImGuiKey,ImGuiID)", + "stname": "" + } + ], + "igTestShortcutRouting": [ + { + "args": "(ImGuiKeyChord key_chord,ImGuiID owner_id)", + "argsT": [ + { + "name": "key_chord", + "type": "ImGuiKeyChord" + }, + { + "name": "owner_id", + "type": "ImGuiID" + } + ], + "argsoriginal": "(ImGuiKeyChord key_chord,ImGuiID owner_id)", + "call_args": "(key_chord,owner_id)", + "cimguiname": "igTestShortcutRouting", + "defaults": {}, + "funcname": "TestShortcutRouting", + "location": "imgui_internal:2977", + "namespace": "ImGui", + "ov_cimguiname": "igTestShortcutRouting", + "ret": "bool", + "signature": "(ImGuiKeyChord,ImGuiID)", + "stname": "" + } + ], "igText": [ { "args": "(const char* fmt,...)", @@ -31076,7 +33382,7 @@ "defaults": {}, "funcname": "Text", "isvararg": "...)", - "location": "imgui:486", + "location": "imgui:485", "namespace": "ImGui", "ov_cimguiname": "igText", "ret": "void", @@ -31107,7 +33413,7 @@ "defaults": {}, "funcname": "TextColored", "isvararg": "...)", - "location": "imgui:488", + "location": "imgui:487", "namespace": "ImGui", "ov_cimguiname": "igTextColored", "ret": "void", @@ -31137,7 +33443,7 @@ "cimguiname": "igTextColoredV", "defaults": {}, "funcname": "TextColoredV", - "location": "imgui:489", + "location": "imgui:488", "namespace": "ImGui", "ov_cimguiname": "igTextColoredV", "ret": "void", @@ -31164,7 +33470,7 @@ "defaults": {}, "funcname": "TextDisabled", "isvararg": "...)", - "location": "imgui:490", + "location": "imgui:489", "namespace": "ImGui", "ov_cimguiname": "igTextDisabled", "ret": "void", @@ -31190,7 +33496,7 @@ "cimguiname": "igTextDisabledV", "defaults": {}, "funcname": "TextDisabledV", - "location": "imgui:491", + "location": "imgui:490", "namespace": "ImGui", "ov_cimguiname": "igTextDisabledV", "ret": "void", @@ -31223,7 +33529,7 @@ "text_end": "NULL" }, "funcname": "TextEx", - "location": "imgui_internal:2714", + "location": "imgui_internal:3109", "namespace": "ImGui", "ov_cimguiname": "igTextEx", "ret": "void", @@ -31251,7 +33557,7 @@ "text_end": "NULL" }, "funcname": "TextUnformatted", - "location": "imgui:485", + "location": "imgui:484", "namespace": "ImGui", "ov_cimguiname": "igTextUnformatted", "ret": "void", @@ -31277,7 +33583,7 @@ "cimguiname": "igTextV", "defaults": {}, "funcname": "TextV", - "location": "imgui:487", + "location": "imgui:486", "namespace": "ImGui", "ov_cimguiname": "igTextV", "ret": "void", @@ -31304,7 +33610,7 @@ "defaults": {}, "funcname": "TextWrapped", "isvararg": "...)", - "location": "imgui:492", + "location": "imgui:491", "namespace": "ImGui", "ov_cimguiname": "igTextWrapped", "ret": "void", @@ -31330,7 +33636,7 @@ "cimguiname": "igTextWrappedV", "defaults": {}, "funcname": "TextWrappedV", - "location": "imgui:493", + "location": "imgui:492", "namespace": "ImGui", "ov_cimguiname": "igTextWrappedV", "ret": "void", @@ -31352,7 +33658,7 @@ "cimguiname": "igTreeNode", "defaults": {}, "funcname": "TreeNode", - "location": "imgui:600", + "location": "imgui:604", "namespace": "ImGui", "ov_cimguiname": "igTreeNode_Str", "ret": "bool", @@ -31381,7 +33687,7 @@ "defaults": {}, "funcname": "TreeNode", "isvararg": "...)", - "location": "imgui:601", + "location": "imgui:605", "namespace": "ImGui", "ov_cimguiname": "igTreeNode_StrStr", "ret": "bool", @@ -31410,7 +33716,7 @@ "defaults": {}, "funcname": "TreeNode", "isvararg": "...)", - "location": "imgui:602", + "location": "imgui:606", "namespace": "ImGui", "ov_cimguiname": "igTreeNode_Ptr", "ret": "bool", @@ -31446,7 +33752,7 @@ "label_end": "NULL" }, "funcname": "TreeNodeBehavior", - "location": "imgui_internal:2735", + "location": "imgui_internal:3133", "namespace": "ImGui", "ov_cimguiname": "igTreeNodeBehavior", "ret": "bool", @@ -31454,34 +33760,6 @@ "stname": "" } ], - "igTreeNodeBehaviorIsOpen": [ - { - "args": "(ImGuiID id,ImGuiTreeNodeFlags flags)", - "argsT": [ - { - "name": "id", - "type": "ImGuiID" - }, - { - "name": "flags", - "type": "ImGuiTreeNodeFlags" - } - ], - "argsoriginal": "(ImGuiID id,ImGuiTreeNodeFlags flags=0)", - "call_args": "(id,flags)", - "cimguiname": "igTreeNodeBehaviorIsOpen", - "defaults": { - "flags": "0" - }, - "funcname": "TreeNodeBehaviorIsOpen", - "location": "imgui_internal:2736", - "namespace": "ImGui", - "ov_cimguiname": "igTreeNodeBehaviorIsOpen", - "ret": "bool", - "signature": "(ImGuiID,ImGuiTreeNodeFlags)", - "stname": "" - } - ], "igTreeNodeEx": [ { "args": "(const char* label,ImGuiTreeNodeFlags flags)", @@ -31502,7 +33780,7 @@ "flags": "0" }, "funcname": "TreeNodeEx", - "location": "imgui:605", + "location": "imgui:609", "namespace": "ImGui", "ov_cimguiname": "igTreeNodeEx_Str", "ret": "bool", @@ -31535,7 +33813,7 @@ "defaults": {}, "funcname": "TreeNodeEx", "isvararg": "...)", - "location": "imgui:606", + "location": "imgui:610", "namespace": "ImGui", "ov_cimguiname": "igTreeNodeEx_StrStr", "ret": "bool", @@ -31568,7 +33846,7 @@ "defaults": {}, "funcname": "TreeNodeEx", "isvararg": "...)", - "location": "imgui:607", + "location": "imgui:611", "namespace": "ImGui", "ov_cimguiname": "igTreeNodeEx_Ptr", "ret": "bool", @@ -31602,7 +33880,7 @@ "cimguiname": "igTreeNodeExV", "defaults": {}, "funcname": "TreeNodeExV", - "location": "imgui:608", + "location": "imgui:612", "namespace": "ImGui", "ov_cimguiname": "igTreeNodeExV_Str", "ret": "bool", @@ -31634,7 +33912,7 @@ "cimguiname": "igTreeNodeExV", "defaults": {}, "funcname": "TreeNodeExV", - "location": "imgui:609", + "location": "imgui:613", "namespace": "ImGui", "ov_cimguiname": "igTreeNodeExV_Ptr", "ret": "bool", @@ -31642,6 +33920,58 @@ "stname": "" } ], + "igTreeNodeSetOpen": [ + { + "args": "(ImGuiID id,bool open)", + "argsT": [ + { + "name": "id", + "type": "ImGuiID" + }, + { + "name": "open", + "type": "bool" + } + ], + "argsoriginal": "(ImGuiID id,bool open)", + "call_args": "(id,open)", + "cimguiname": "igTreeNodeSetOpen", + "defaults": {}, + "funcname": "TreeNodeSetOpen", + "location": "imgui_internal:3135", + "namespace": "ImGui", + "ov_cimguiname": "igTreeNodeSetOpen", + "ret": "void", + "signature": "(ImGuiID,bool)", + "stname": "" + } + ], + "igTreeNodeUpdateNextOpen": [ + { + "args": "(ImGuiID id,ImGuiTreeNodeFlags flags)", + "argsT": [ + { + "name": "id", + "type": "ImGuiID" + }, + { + "name": "flags", + "type": "ImGuiTreeNodeFlags" + } + ], + "argsoriginal": "(ImGuiID id,ImGuiTreeNodeFlags flags)", + "call_args": "(id,flags)", + "cimguiname": "igTreeNodeUpdateNextOpen", + "defaults": {}, + "funcname": "TreeNodeUpdateNextOpen", + "location": "imgui_internal:3136", + "namespace": "ImGui", + "ov_cimguiname": "igTreeNodeUpdateNextOpen", + "ret": "bool", + "signature": "(ImGuiID,ImGuiTreeNodeFlags)", + "stname": "" + } + ], "igTreeNodeV": [ { "args": "(const char* str_id,const char* fmt,va_list args)", @@ -31664,7 +33994,7 @@ "cimguiname": "igTreeNodeV", "defaults": {}, "funcname": "TreeNodeV", - "location": "imgui:603", + "location": "imgui:607", "namespace": "ImGui", "ov_cimguiname": "igTreeNodeV_Str", "ret": "bool", @@ -31692,7 +34022,7 @@ "cimguiname": "igTreeNodeV", "defaults": {}, "funcname": "TreeNodeV", - "location": "imgui:604", + "location": "imgui:608", "namespace": "ImGui", "ov_cimguiname": "igTreeNodeV_Ptr", "ret": "bool", @@ -31709,7 +34039,7 @@ "cimguiname": "igTreePop", "defaults": {}, "funcname": "TreePop", - "location": "imgui:612", + "location": "imgui:616", "namespace": "ImGui", "ov_cimguiname": "igTreePop", "ret": "void", @@ -31731,7 +34061,7 @@ "cimguiname": "igTreePush", "defaults": {}, "funcname": "TreePush", - "location": "imgui:610", + "location": "imgui:614", "namespace": "ImGui", "ov_cimguiname": "igTreePush_Str", "ret": "void", @@ -31746,14 +34076,12 @@ "type": "const void*" } ], - "argsoriginal": "(const void* ptr_id=((void*)0))", + "argsoriginal": "(const void* ptr_id)", "call_args": "(ptr_id)", "cimguiname": "igTreePush", - "defaults": { - "ptr_id": "NULL" - }, + "defaults": {}, "funcname": "TreePush", - "location": "imgui:611", + "location": "imgui:615", "namespace": "ImGui", "ov_cimguiname": "igTreePush_Ptr", "ret": "void", @@ -31775,7 +34103,7 @@ "cimguiname": "igTreePushOverrideID", "defaults": {}, "funcname": "TreePushOverrideID", - "location": "imgui_internal:2737", + "location": "imgui_internal:3134", "namespace": "ImGui", "ov_cimguiname": "igTreePushOverrideID", "ret": "void", @@ -31799,7 +34127,7 @@ "indent_w": "0.0f" }, "funcname": "Unindent", - "location": "imgui:446", + "location": "imgui:445", "namespace": "ImGui", "ov_cimguiname": "igUnindent", "ret": "void", @@ -31816,7 +34144,7 @@ "cimguiname": "igUpdateHoveredWindowAndCaptureFlags", "defaults": {}, "funcname": "UpdateHoveredWindowAndCaptureFlags", - "location": "imgui_internal:2456", + "location": "imgui_internal:2775", "namespace": "ImGui", "ov_cimguiname": "igUpdateHoveredWindowAndCaptureFlags", "ret": "void", @@ -31824,6 +34152,28 @@ "stname": "" } ], + "igUpdateInputEvents": [ + { + "args": "(bool trickle_fast_inputs)", + "argsT": [ + { + "name": "trickle_fast_inputs", + "type": "bool" + } + ], + "argsoriginal": "(bool trickle_fast_inputs)", + "call_args": "(trickle_fast_inputs)", + "cimguiname": "igUpdateInputEvents", + "defaults": {}, + "funcname": "UpdateInputEvents", + "location": "imgui_internal:2774", + "namespace": "ImGui", + "ov_cimguiname": "igUpdateInputEvents", + "ret": "void", + "signature": "(bool)", + "stname": "" + } + ], "igUpdateMouseMovingWindowEndFrame": [ { "args": "()", @@ -31833,7 +34183,7 @@ "cimguiname": "igUpdateMouseMovingWindowEndFrame", "defaults": {}, "funcname": "UpdateMouseMovingWindowEndFrame", - "location": "imgui_internal:2459", + "location": "imgui_internal:2778", "namespace": "ImGui", "ov_cimguiname": "igUpdateMouseMovingWindowEndFrame", "ret": "void", @@ -31850,7 +34200,7 @@ "cimguiname": "igUpdateMouseMovingWindowNewFrame", "defaults": {}, "funcname": "UpdateMouseMovingWindowNewFrame", - "location": "imgui_internal:2458", + "location": "imgui_internal:2777", "namespace": "ImGui", "ov_cimguiname": "igUpdateMouseMovingWindowNewFrame", "ret": "void", @@ -31880,7 +34230,7 @@ "cimguiname": "igUpdateWindowParentAndRootLinks", "defaults": {}, "funcname": "UpdateWindowParentAndRootLinks", - "location": "imgui_internal:2421", + "location": "imgui_internal:2738", "namespace": "ImGui", "ov_cimguiname": "igUpdateWindowParentAndRootLinks", "ret": "void", @@ -31929,7 +34279,7 @@ "format": "\"%.3f\"" }, "funcname": "VSliderFloat", - "location": "imgui:566", + "location": "imgui:570", "namespace": "ImGui", "ov_cimguiname": "igVSliderFloat", "ret": "bool", @@ -31978,7 +34328,7 @@ "format": "\"%d\"" }, "funcname": "VSliderInt", - "location": "imgui:567", + "location": "imgui:571", "namespace": "ImGui", "ov_cimguiname": "igVSliderInt", "ret": "bool", @@ -32031,7 +34381,7 @@ "format": "NULL" }, "funcname": "VSliderScalar", - "location": "imgui:568", + "location": "imgui:572", "namespace": "ImGui", "ov_cimguiname": "igVSliderScalar", "ret": "bool", @@ -32057,7 +34407,7 @@ "cimguiname": "igValue", "defaults": {}, "funcname": "Value", - "location": "imgui:644", + "location": "imgui:648", "namespace": "ImGui", "ov_cimguiname": "igValue_Bool", "ret": "void", @@ -32081,7 +34431,7 @@ "cimguiname": "igValue", "defaults": {}, "funcname": "Value", - "location": "imgui:645", + "location": "imgui:649", "namespace": "ImGui", "ov_cimguiname": "igValue_Int", "ret": "void", @@ -32105,7 +34455,7 @@ "cimguiname": "igValue", "defaults": {}, "funcname": "Value", - "location": "imgui:646", + "location": "imgui:650", "namespace": "ImGui", "ov_cimguiname": "igValue_Uint", "ret": "void", @@ -32135,7 +34485,7 @@ "float_format": "NULL" }, "funcname": "Value", - "location": "imgui:647", + "location": "imgui:651", "namespace": "ImGui", "ov_cimguiname": "igValue_Float", "ret": "void", @@ -32165,7 +34515,7 @@ "cimguiname": "igWindowRectAbsToRel", "defaults": {}, "funcname": "WindowRectAbsToRel", - "location": "imgui_internal:2431", + "location": "imgui_internal:2749", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igWindowRectAbsToRel", @@ -32196,7 +34546,7 @@ "cimguiname": "igWindowRectRelToAbs", "defaults": {}, "funcname": "WindowRectRelToAbs", - "location": "imgui_internal:2432", + "location": "imgui_internal:2750", "namespace": "ImGui", "nonUDT": 1, "ov_cimguiname": "igWindowRectRelToAbs", diff --git a/Sources/AutoWrapper/Exceptions.swift b/Sources/AutoWrapper/Exceptions.swift index adab721..ee8c0a9 100644 --- a/Sources/AutoWrapper/Exceptions.swift +++ b/Sources/AutoWrapper/Exceptions.swift @@ -52,6 +52,7 @@ public enum Exceptions { "ImVector_max_size", "ImVector_pop_back", "ImVector_reserve", + "ImVector_reserve_discard", "ImVector_resize_Nil", "ImVector_resizeNil", "ImVector_shrink", diff --git a/Sources/CImGui/cimgui.cpp b/Sources/CImGui/cimgui.cpp index e69424a..ea313a5 100644 --- a/Sources/CImGui/cimgui.cpp +++ b/Sources/CImGui/cimgui.cpp @@ -1,5 +1,5 @@ //This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui -//based on imgui.h file version "1.86" from Dear ImGui https://github.com/ocornut/imgui +//based on imgui.h file version "1.89.5" 18950 from Dear ImGui https://github.com/ocornut/imgui //with imgui_internal.h api #ifdef IMGUI_ENABLE_FREETYPE #ifndef CIMGUI_FREETYPE @@ -91,6 +91,10 @@ CIMGUI_API void igShowMetricsWindow(bool* p_open) { return ImGui::ShowMetricsWindow(p_open); } +CIMGUI_API void igShowDebugLogWindow(bool* p_open) +{ + return ImGui::ShowDebugLogWindow(p_open); +} CIMGUI_API void igShowStackToolWindow(bool* p_open) { return ImGui::ShowStackToolWindow(p_open); @@ -211,6 +215,10 @@ CIMGUI_API void igSetNextWindowFocus() { return ImGui::SetNextWindowFocus(); } +CIMGUI_API void igSetNextWindowScroll(const ImVec2 scroll) +{ + return ImGui::SetNextWindowScroll(scroll); +} CIMGUI_API void igSetNextWindowBgAlpha(float alpha) { return ImGui::SetNextWindowBgAlpha(alpha); @@ -339,13 +347,13 @@ CIMGUI_API void igPopStyleVar(int count) { return ImGui::PopStyleVar(count); } -CIMGUI_API void igPushAllowKeyboardFocus(bool allow_keyboard_focus) +CIMGUI_API void igPushTabStop(bool tab_stop) { - return ImGui::PushAllowKeyboardFocus(allow_keyboard_focus); + return ImGui::PushTabStop(tab_stop); } -CIMGUI_API void igPopAllowKeyboardFocus() +CIMGUI_API void igPopTabStop() { - return ImGui::PopAllowKeyboardFocus(); + return ImGui::PopTabStop(); } CIMGUI_API void igPushButtonRepeat(bool repeat) { @@ -601,6 +609,10 @@ CIMGUI_API void igBulletTextV(const char* fmt,va_list args) { return ImGui::BulletTextV(fmt,args); } +CIMGUI_API void igSeparatorText(const char* label) +{ + return ImGui::SeparatorText(label); +} CIMGUI_API bool igButton(const char* label,const ImVec2 size) { return ImGui::Button(label,size); @@ -617,14 +629,6 @@ CIMGUI_API bool igArrowButton(const char* str_id,ImGuiDir dir) { return ImGui::ArrowButton(str_id,dir); } -CIMGUI_API void igImage(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 tint_col,const ImVec4 border_col) -{ - return ImGui::Image(user_texture_id,size,uv0,uv1,tint_col,border_col); -} -CIMGUI_API bool igImageButton(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,int frame_padding,const ImVec4 bg_col,const ImVec4 tint_col) -{ - return ImGui::ImageButton(user_texture_id,size,uv0,uv1,frame_padding,bg_col,tint_col); -} CIMGUI_API bool igCheckbox(const char* label,bool* v) { return ImGui::Checkbox(label,v); @@ -653,6 +657,14 @@ CIMGUI_API void igBullet() { return ImGui::Bullet(); } +CIMGUI_API void igImage(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 tint_col,const ImVec4 border_col) +{ + return ImGui::Image(user_texture_id,size,uv0,uv1,tint_col,border_col); +} +CIMGUI_API bool igImageButton(const char* str_id,ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 bg_col,const ImVec4 tint_col) +{ + return ImGui::ImageButton(str_id,user_texture_id,size,uv0,uv1,bg_col,tint_col); +} CIMGUI_API bool igBeginCombo(const char* label,const char* preview_value,ImGuiComboFlags flags) { return ImGui::BeginCombo(label,preview_value,flags); @@ -849,7 +861,7 @@ CIMGUI_API bool igColorPicker4(const char* label,float col[4],ImGuiColorEditFlag { return ImGui::ColorPicker4(label,col,flags,ref_col); } -CIMGUI_API bool igColorButton(const char* desc_id,const ImVec4 col,ImGuiColorEditFlags flags,ImVec2 size) +CIMGUI_API bool igColorButton(const char* desc_id,const ImVec4 col,ImGuiColorEditFlags flags,const ImVec2 size) { return ImGui::ColorButton(desc_id,col,flags,size); } @@ -1029,7 +1041,7 @@ CIMGUI_API bool igMenuItem_BoolPtr(const char* label,const char* shortcut,bool* { return ImGui::MenuItem(label,shortcut,p_selected,enabled); } -CIMGUI_API void igBeginTooltip() +CIMGUI_API bool igBeginTooltip() { return ImGui::BeginTooltip(); } @@ -1344,6 +1356,10 @@ CIMGUI_API bool igIsAnyItemFocused() { return ImGui::IsAnyItemFocused(); } +CIMGUI_API ImGuiID igGetItemID() +{ + return ImGui::GetItemID(); +} CIMGUI_API void igGetItemRectMin(ImVec2 *pOut) { *pOut = ImGui::GetItemRectMin(); @@ -1364,6 +1380,14 @@ CIMGUI_API ImGuiViewport* igGetMainViewport() { return ImGui::GetMainViewport(); } +CIMGUI_API ImDrawList* igGetBackgroundDrawList_Nil() +{ + return ImGui::GetBackgroundDrawList(); +} +CIMGUI_API ImDrawList* igGetForegroundDrawList_Nil() +{ + return ImGui::GetForegroundDrawList(); +} CIMGUI_API bool igIsRectVisible_Nil(const ImVec2 size) { return ImGui::IsRectVisible(size); @@ -1380,14 +1404,6 @@ CIMGUI_API int igGetFrameCount() { return ImGui::GetFrameCount(); } -CIMGUI_API ImDrawList* igGetBackgroundDrawList_Nil() -{ - return ImGui::GetBackgroundDrawList(); -} -CIMGUI_API ImDrawList* igGetForegroundDrawList_Nil() -{ - return ImGui::GetForegroundDrawList(); -} CIMGUI_API ImDrawListSharedData* igGetDrawListSharedData() { return ImGui::GetDrawListSharedData(); @@ -1432,39 +1448,39 @@ CIMGUI_API void igColorConvertHSVtoRGB(float h,float s,float v,float* out_r,floa { return ImGui::ColorConvertHSVtoRGB(h,s,v,*out_r,*out_g,*out_b); } -CIMGUI_API int igGetKeyIndex(ImGuiKey imgui_key) +CIMGUI_API bool igIsKeyDown_Nil(ImGuiKey key) { - return ImGui::GetKeyIndex(imgui_key); + return ImGui::IsKeyDown(key); } -CIMGUI_API bool igIsKeyDown(int user_key_index) +CIMGUI_API bool igIsKeyPressed_Bool(ImGuiKey key,bool repeat) { - return ImGui::IsKeyDown(user_key_index); + return ImGui::IsKeyPressed(key,repeat); } -CIMGUI_API bool igIsKeyPressed(int user_key_index,bool repeat) +CIMGUI_API bool igIsKeyReleased_Nil(ImGuiKey key) { - return ImGui::IsKeyPressed(user_key_index,repeat); + return ImGui::IsKeyReleased(key); } -CIMGUI_API bool igIsKeyReleased(int user_key_index) +CIMGUI_API int igGetKeyPressedAmount(ImGuiKey key,float repeat_delay,float rate) { - return ImGui::IsKeyReleased(user_key_index); + return ImGui::GetKeyPressedAmount(key,repeat_delay,rate); } -CIMGUI_API int igGetKeyPressedAmount(int key_index,float repeat_delay,float rate) +CIMGUI_API const char* igGetKeyName(ImGuiKey key) { - return ImGui::GetKeyPressedAmount(key_index,repeat_delay,rate); + return ImGui::GetKeyName(key); } -CIMGUI_API void igCaptureKeyboardFromApp(bool want_capture_keyboard_value) +CIMGUI_API void igSetNextFrameWantCaptureKeyboard(bool want_capture_keyboard) { - return ImGui::CaptureKeyboardFromApp(want_capture_keyboard_value); + return ImGui::SetNextFrameWantCaptureKeyboard(want_capture_keyboard); } -CIMGUI_API bool igIsMouseDown(ImGuiMouseButton button) +CIMGUI_API bool igIsMouseDown_Nil(ImGuiMouseButton button) { return ImGui::IsMouseDown(button); } -CIMGUI_API bool igIsMouseClicked(ImGuiMouseButton button,bool repeat) +CIMGUI_API bool igIsMouseClicked_Bool(ImGuiMouseButton button,bool repeat) { return ImGui::IsMouseClicked(button,repeat); } -CIMGUI_API bool igIsMouseReleased(ImGuiMouseButton button) +CIMGUI_API bool igIsMouseReleased_Nil(ImGuiMouseButton button) { return ImGui::IsMouseReleased(button); } @@ -1516,9 +1532,9 @@ CIMGUI_API void igSetMouseCursor(ImGuiMouseCursor cursor_type) { return ImGui::SetMouseCursor(cursor_type); } -CIMGUI_API void igCaptureMouseFromApp(bool want_capture_mouse_value) +CIMGUI_API void igSetNextFrameWantCaptureMouse(bool want_capture_mouse) { - return ImGui::CaptureMouseFromApp(want_capture_mouse_value); + return ImGui::SetNextFrameWantCaptureMouse(want_capture_mouse); } CIMGUI_API const char* igGetClipboardText() { @@ -1544,6 +1560,10 @@ CIMGUI_API const char* igSaveIniSettingsToMemory(size_t* out_ini_size) { return ImGui::SaveIniSettingsToMemory(out_ini_size); } +CIMGUI_API void igDebugTextEncoding(const char* text) +{ + return ImGui::DebugTextEncoding(text); +} CIMGUI_API bool igDebugCheckVersionAndDataLayout(const char* version_str,size_t sz_io,size_t sz_style,size_t sz_vec2,size_t sz_vec4,size_t sz_drawvert,size_t sz_drawidx) { return ImGui::DebugCheckVersionAndDataLayout(version_str,sz_io,sz_style,sz_vec2,sz_vec4,sz_drawvert,sz_drawidx); @@ -1576,6 +1596,34 @@ CIMGUI_API void ImGuiStyle_ScaleAllSizes(ImGuiStyle* self,float scale_factor) { return self->ScaleAllSizes(scale_factor); } +CIMGUI_API void ImGuiIO_AddKeyEvent(ImGuiIO* self,ImGuiKey key,bool down) +{ + return self->AddKeyEvent(key,down); +} +CIMGUI_API void ImGuiIO_AddKeyAnalogEvent(ImGuiIO* self,ImGuiKey key,bool down,float v) +{ + return self->AddKeyAnalogEvent(key,down,v); +} +CIMGUI_API void ImGuiIO_AddMousePosEvent(ImGuiIO* self,float x,float y) +{ + return self->AddMousePosEvent(x,y); +} +CIMGUI_API void ImGuiIO_AddMouseButtonEvent(ImGuiIO* self,int button,bool down) +{ + return self->AddMouseButtonEvent(button,down); +} +CIMGUI_API void ImGuiIO_AddMouseWheelEvent(ImGuiIO* self,float wheel_x,float wheel_y) +{ + return self->AddMouseWheelEvent(wheel_x,wheel_y); +} +CIMGUI_API void ImGuiIO_AddMouseSourceEvent(ImGuiIO* self,ImGuiMouseSource source) +{ + return self->AddMouseSourceEvent(source); +} +CIMGUI_API void ImGuiIO_AddFocusEvent(ImGuiIO* self,bool focused) +{ + return self->AddFocusEvent(focused); +} CIMGUI_API void ImGuiIO_AddInputCharacter(ImGuiIO* self,unsigned int c) { return self->AddInputCharacter(c); @@ -1588,9 +1636,13 @@ CIMGUI_API void ImGuiIO_AddInputCharactersUTF8(ImGuiIO* self,const char* str) { return self->AddInputCharactersUTF8(str); } -CIMGUI_API void ImGuiIO_AddFocusEvent(ImGuiIO* self,bool focused) +CIMGUI_API void ImGuiIO_SetKeyEventNativeData(ImGuiIO* self,ImGuiKey key,int native_keycode,int native_scancode,int native_legacy_index) { - return self->AddFocusEvent(focused); + return self->SetKeyEventNativeData(key,native_keycode,native_scancode,native_legacy_index); +} +CIMGUI_API void ImGuiIO_SetAppAcceptingEvents(ImGuiIO* self,bool accepting_events) +{ + return self->SetAppAcceptingEvents(accepting_events); } CIMGUI_API void ImGuiIO_ClearInputCharacters(ImGuiIO* self) { @@ -1884,21 +1936,21 @@ CIMGUI_API void ImColor_destroy(ImColor* self) { IM_DELETE(self); } -CIMGUI_API ImColor* ImColor_ImColor_Int(int r,int g,int b,int a) +CIMGUI_API ImColor* ImColor_ImColor_Float(float r,float g,float b,float a) { return IM_NEW(ImColor)(r,g,b,a); } -CIMGUI_API ImColor* ImColor_ImColor_U32(ImU32 rgba) +CIMGUI_API ImColor* ImColor_ImColor_Vec4(const ImVec4 col) { - return IM_NEW(ImColor)(rgba); + return IM_NEW(ImColor)(col); } -CIMGUI_API ImColor* ImColor_ImColor_Float(float r,float g,float b,float a) +CIMGUI_API ImColor* ImColor_ImColor_Int(int r,int g,int b,int a) { return IM_NEW(ImColor)(r,g,b,a); } -CIMGUI_API ImColor* ImColor_ImColor_Vec4(const ImVec4 col) +CIMGUI_API ImColor* ImColor_ImColor_U32(ImU32 rgba) { - return IM_NEW(ImColor)(col); + return IM_NEW(ImColor)(rgba); } CIMGUI_API void ImColor_SetHSV(ImColor* self,float h,float s,float v,float a) { @@ -1948,7 +2000,7 @@ CIMGUI_API void ImDrawListSplitter_SetCurrentChannel(ImDrawListSplitter* self,Im { return self->SetCurrentChannel(draw_list,channel_idx); } -CIMGUI_API ImDrawList* ImDrawList_ImDrawList(const ImDrawListSharedData* shared_data) +CIMGUI_API ImDrawList* ImDrawList_ImDrawList(ImDrawListSharedData* shared_data) { return IM_NEW(ImDrawList)(shared_data); } @@ -1956,7 +2008,7 @@ CIMGUI_API void ImDrawList_destroy(ImDrawList* self) { IM_DELETE(self); } -CIMGUI_API void ImDrawList_PushClipRect(ImDrawList* self,ImVec2 clip_rect_min,ImVec2 clip_rect_max,bool intersect_with_current_clip_rect) +CIMGUI_API void ImDrawList_PushClipRect(ImDrawList* self,const ImVec2 clip_rect_min,const ImVec2 clip_rect_max,bool intersect_with_current_clip_rect) { return self->PushClipRect(clip_rect_min,clip_rect_max,intersect_with_current_clip_rect); } @@ -2352,6 +2404,10 @@ CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesDefault(ImFontAtlas* self) { return self->GetGlyphRangesDefault(); } +CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesGreek(ImFontAtlas* self) +{ + return self->GetGlyphRangesGreek(); +} CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesKorean(ImFontAtlas* self) { return self->GetGlyphRangesKorean(); @@ -2436,11 +2492,11 @@ CIMGUI_API const char* ImFont_CalcWordWrapPositionA(ImFont* self,float scale,con { return self->CalcWordWrapPositionA(scale,text,text_end,wrap_width); } -CIMGUI_API void ImFont_RenderChar(ImFont* self,ImDrawList* draw_list,float size,ImVec2 pos,ImU32 col,ImWchar c) +CIMGUI_API void ImFont_RenderChar(ImFont* self,ImDrawList* draw_list,float size,const ImVec2 pos,ImU32 col,ImWchar c) { return self->RenderChar(draw_list,size,pos,col,c); } -CIMGUI_API void ImFont_RenderText(ImFont* self,ImDrawList* draw_list,float size,ImVec2 pos,ImU32 col,const ImVec4 clip_rect,const char* text_begin,const char* text_end,float wrap_width,bool cpu_fine_clip) +CIMGUI_API void ImFont_RenderText(ImFont* self,ImDrawList* draw_list,float size,const ImVec2 pos,ImU32 col,const ImVec4 clip_rect,const char* text_begin,const char* text_end,float wrap_width,bool cpu_fine_clip) { return self->RenderText(draw_list,size,pos,col,clip_rect,text_begin,text_end,wrap_width,cpu_fine_clip); } @@ -2488,11 +2544,23 @@ CIMGUI_API void ImGuiViewport_GetWorkCenter(ImVec2 *pOut,ImGuiViewport* self) { *pOut = self->GetWorkCenter(); } -CIMGUI_API ImGuiID igImHashData(const void* data,size_t data_size,ImU32 seed) +CIMGUI_API ImGuiPlatformImeData* ImGuiPlatformImeData_ImGuiPlatformImeData(void) +{ + return IM_NEW(ImGuiPlatformImeData)(); +} +CIMGUI_API void ImGuiPlatformImeData_destroy(ImGuiPlatformImeData* self) +{ + IM_DELETE(self); +} +CIMGUI_API ImGuiKey igGetKeyIndex(ImGuiKey key) +{ + return ImGui::GetKeyIndex(key); +} +CIMGUI_API ImGuiID igImHashData(const void* data,size_t data_size,ImGuiID seed) { return ImHashData(data,data_size,seed); } -CIMGUI_API ImGuiID igImHashStr(const char* data,size_t data_size,ImU32 seed) +CIMGUI_API ImGuiID igImHashStr(const char* data,size_t data_size,ImGuiID seed) { return ImHashStr(data,data_size,seed); } @@ -2564,6 +2632,18 @@ CIMGUI_API const char* igImStrSkipBlank(const char* str) { return ImStrSkipBlank(str); } +CIMGUI_API char igImToUpper(char c) +{ + return ImToUpper(c); +} +CIMGUI_API bool igImCharIsBlankA(char c) +{ + return ImCharIsBlankA(c); +} +CIMGUI_API bool igImCharIsBlankW(unsigned int c) +{ + return ImCharIsBlankW(c); +} CIMGUI_API int igImFormatString(char* buf,size_t buf_size,const char* fmt,...) { va_list args; @@ -2576,6 +2656,17 @@ CIMGUI_API int igImFormatStringV(char* buf,size_t buf_size,const char* fmt,va_li { return ImFormatStringV(buf,buf_size,fmt,args); } +CIMGUI_API void igImFormatStringToTempBuffer(const char** out_buf,const char** out_buf_end,const char* fmt,...) +{ + va_list args; + va_start(args, fmt); + ImFormatStringToTempBufferV(out_buf,out_buf_end,fmt,args); + va_end(args); +} +CIMGUI_API void igImFormatStringToTempBufferV(const char** out_buf,const char** out_buf_end,const char* fmt,va_list args) +{ + return ImFormatStringToTempBufferV(out_buf,out_buf_end,fmt,args); +} CIMGUI_API const char* igImParseFormatFindStart(const char* format) { return ImParseFormatFindStart(format); @@ -2588,17 +2679,17 @@ CIMGUI_API const char* igImParseFormatTrimDecorations(const char* format,char* b { return ImParseFormatTrimDecorations(format,buf,buf_size); } -CIMGUI_API int igImParseFormatPrecision(const char* format,int default_value) +CIMGUI_API void igImParseFormatSanitizeForPrinting(const char* fmt_in,char* fmt_out,size_t fmt_out_size) { - return ImParseFormatPrecision(format,default_value); + return ImParseFormatSanitizeForPrinting(fmt_in,fmt_out,fmt_out_size); } -CIMGUI_API bool igImCharIsBlankA(char c) +CIMGUI_API const char* igImParseFormatSanitizeForScanning(const char* fmt_in,char* fmt_out,size_t fmt_out_size) { - return ImCharIsBlankA(c); + return ImParseFormatSanitizeForScanning(fmt_in,fmt_out,fmt_out_size); } -CIMGUI_API bool igImCharIsBlankW(unsigned int c) +CIMGUI_API int igImParseFormatPrecision(const char* format,int default_value) { - return ImCharIsBlankW(c); + return ImParseFormatPrecision(format,default_value); } CIMGUI_API const char* igImTextCharToUtf8(char out_buf[5],unsigned int c) { @@ -2740,7 +2831,7 @@ CIMGUI_API float igImFloor_Float(float f) { return ImFloor(f); } -CIMGUI_API float igImFloorSigned(float f) +CIMGUI_API float igImFloorSigned_Float(float f) { return ImFloorSigned(f); } @@ -2748,6 +2839,10 @@ CIMGUI_API void igImFloor_Vec2(ImVec2 *pOut,const ImVec2 v) { *pOut = ImFloor(v); } +CIMGUI_API void igImFloorSigned_Vec2(ImVec2 *pOut,const ImVec2 v) +{ + *pOut = ImFloorSigned(v); +} CIMGUI_API int igImModPositive(int a,int b) { return ImModPositive(a,b); @@ -2772,6 +2867,10 @@ CIMGUI_API bool igImIsFloatAboveGuaranteedIntegerPrecision(float f) { return ImIsFloatAboveGuaranteedIntegerPrecision(f); } +CIMGUI_API float igImExponentialMovingAverage(float avg,float sample,int n) +{ + return ImExponentialMovingAverage(avg,sample,n); +} CIMGUI_API void igImBezierCubicCalc(ImVec2 *pOut,const ImVec2 p1,const ImVec2 p2,const ImVec2 p3,const ImVec2 p4,float t) { *pOut = ImBezierCubicCalc(p1,p2,p3,p4,t); @@ -2956,6 +3055,14 @@ CIMGUI_API void ImRect_ToVec4(ImVec4 *pOut,ImRect* self) { *pOut = self->ToVec4(); } +CIMGUI_API size_t igImBitArrayGetStorageSizeInBytes(int bitcount) +{ + return ImBitArrayGetStorageSizeInBytes(bitcount); +} +CIMGUI_API void igImBitArrayClearAllBits(ImU32* arr,int bitcount) +{ + return ImBitArrayClearAllBits(arr,bitcount); +} CIMGUI_API bool igImBitArrayTestBit(const ImU32* arr,int n) { return ImBitArrayTestBit(arr,n); @@ -2992,6 +3099,26 @@ CIMGUI_API void ImBitVector_ClearBit(ImBitVector* self,int n) { return self->ClearBit(n); } +CIMGUI_API void ImGuiTextIndex_clear(ImGuiTextIndex* self) +{ + return self->clear(); +} +CIMGUI_API int ImGuiTextIndex_size(ImGuiTextIndex* self) +{ + return self->size(); +} +CIMGUI_API const char* ImGuiTextIndex_get_line_begin(ImGuiTextIndex* self,const char* base,int n) +{ + return self->get_line_begin(base,n); +} +CIMGUI_API const char* ImGuiTextIndex_get_line_end(ImGuiTextIndex* self,const char* base,int n) +{ + return self->get_line_end(base,n); +} +CIMGUI_API void ImGuiTextIndex_append(ImGuiTextIndex* self,const char* base,int old_size,int new_size) +{ + return self->append(base,old_size,new_size); +} CIMGUI_API ImDrawListSharedData* ImDrawListSharedData_ImDrawListSharedData(void) { return IM_NEW(ImDrawListSharedData)(); @@ -3020,6 +3147,10 @@ CIMGUI_API void ImDrawDataBuilder_FlattenIntoSingleLayer(ImDrawDataBuilder* self { return self->FlattenIntoSingleLayer(); } +CIMGUI_API void* ImGuiDataVarInfo_GetVarPtr(ImGuiDataVarInfo* self,void* parent) +{ + return self->GetVarPtr(parent); +} CIMGUI_API ImGuiStyleMod* ImGuiStyleMod_ImGuiStyleMod_Int(ImGuiStyleVar idx,int v) { return IM_NEW(ImGuiStyleMod)(idx,v); @@ -3064,6 +3195,18 @@ CIMGUI_API void ImGuiMenuColumns_CalcNextTotalWidth(ImGuiMenuColumns* self,bool { return self->CalcNextTotalWidth(update_offsets); } +CIMGUI_API ImGuiInputTextDeactivatedState* ImGuiInputTextDeactivatedState_ImGuiInputTextDeactivatedState(void) +{ + return IM_NEW(ImGuiInputTextDeactivatedState)(); +} +CIMGUI_API void ImGuiInputTextDeactivatedState_destroy(ImGuiInputTextDeactivatedState* self) +{ + IM_DELETE(self); +} +CIMGUI_API void ImGuiInputTextDeactivatedState_ClearFreeMemory(ImGuiInputTextDeactivatedState* self) +{ + return self->ClearFreeMemory(); +} CIMGUI_API ImGuiInputTextState* ImGuiInputTextState_ImGuiInputTextState(void) { return IM_NEW(ImGuiInputTextState)(); @@ -3172,13 +3315,13 @@ CIMGUI_API void ImGuiStackSizes_destroy(ImGuiStackSizes* self) { IM_DELETE(self); } -CIMGUI_API void ImGuiStackSizes_SetToCurrentState(ImGuiStackSizes* self) +CIMGUI_API void ImGuiStackSizes_SetToContextState(ImGuiStackSizes* self,ImGuiContext* ctx) { - return self->SetToCurrentState(); + return self->SetToContextState(ctx); } -CIMGUI_API void ImGuiStackSizes_CompareWithCurrentState(ImGuiStackSizes* self) +CIMGUI_API void ImGuiStackSizes_CompareWithContextState(ImGuiStackSizes* self,ImGuiContext* ctx) { - return self->CompareWithCurrentState(); + return self->CompareWithContextState(ctx); } CIMGUI_API ImGuiPtrOrIndex* ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(void* ptr) { @@ -3192,6 +3335,42 @@ CIMGUI_API ImGuiPtrOrIndex* ImGuiPtrOrIndex_ImGuiPtrOrIndex_Int(int index) { return IM_NEW(ImGuiPtrOrIndex)(index); } +CIMGUI_API ImGuiInputEvent* ImGuiInputEvent_ImGuiInputEvent(void) +{ + return IM_NEW(ImGuiInputEvent)(); +} +CIMGUI_API void ImGuiInputEvent_destroy(ImGuiInputEvent* self) +{ + IM_DELETE(self); +} +CIMGUI_API ImGuiKeyRoutingData* ImGuiKeyRoutingData_ImGuiKeyRoutingData(void) +{ + return IM_NEW(ImGuiKeyRoutingData)(); +} +CIMGUI_API void ImGuiKeyRoutingData_destroy(ImGuiKeyRoutingData* self) +{ + IM_DELETE(self); +} +CIMGUI_API ImGuiKeyRoutingTable* ImGuiKeyRoutingTable_ImGuiKeyRoutingTable(void) +{ + return IM_NEW(ImGuiKeyRoutingTable)(); +} +CIMGUI_API void ImGuiKeyRoutingTable_destroy(ImGuiKeyRoutingTable* self) +{ + IM_DELETE(self); +} +CIMGUI_API void ImGuiKeyRoutingTable_Clear(ImGuiKeyRoutingTable* self) +{ + return self->Clear(); +} +CIMGUI_API ImGuiKeyOwnerData* ImGuiKeyOwnerData_ImGuiKeyOwnerData(void) +{ + return IM_NEW(ImGuiKeyOwnerData)(); +} +CIMGUI_API void ImGuiKeyOwnerData_destroy(ImGuiKeyOwnerData* self) +{ + IM_DELETE(self); +} CIMGUI_API ImGuiListClipperRange ImGuiListClipperRange_FromIndices(int min,int max) { return ImGuiListClipperRange::FromIndices(min,max); @@ -3292,14 +3471,6 @@ CIMGUI_API void ImGuiSettingsHandler_destroy(ImGuiSettingsHandler* self) { IM_DELETE(self); } -CIMGUI_API ImGuiMetricsConfig* ImGuiMetricsConfig_ImGuiMetricsConfig(void) -{ - return IM_NEW(ImGuiMetricsConfig)(); -} -CIMGUI_API void ImGuiMetricsConfig_destroy(ImGuiMetricsConfig* self) -{ - IM_DELETE(self); -} CIMGUI_API ImGuiStackLevelInfo* ImGuiStackLevelInfo_ImGuiStackLevelInfo(void) { return IM_NEW(ImGuiStackLevelInfo)(); @@ -3352,18 +3523,6 @@ CIMGUI_API ImGuiID ImGuiWindow_GetID_Int(ImGuiWindow* self,int n) { return self->GetID(n); } -CIMGUI_API ImGuiID ImGuiWindow_GetIDNoKeepAlive_Str(ImGuiWindow* self,const char* str,const char* str_end) -{ - return self->GetIDNoKeepAlive(str,str_end); -} -CIMGUI_API ImGuiID ImGuiWindow_GetIDNoKeepAlive_Ptr(ImGuiWindow* self,const void* ptr) -{ - return self->GetIDNoKeepAlive(ptr); -} -CIMGUI_API ImGuiID ImGuiWindow_GetIDNoKeepAlive_Int(ImGuiWindow* self,int n) -{ - return self->GetIDNoKeepAlive(n); -} CIMGUI_API ImGuiID ImGuiWindow_GetIDFromRectangle(ImGuiWindow* self,const ImRect r_abs) { return self->GetIDFromRectangle(r_abs); @@ -3408,19 +3567,19 @@ CIMGUI_API void ImGuiTabBar_destroy(ImGuiTabBar* self) { IM_DELETE(self); } -CIMGUI_API int ImGuiTabBar_GetTabOrder(ImGuiTabBar* self,const ImGuiTabItem* tab) +CIMGUI_API ImGuiTableColumn* ImGuiTableColumn_ImGuiTableColumn(void) { - return self->GetTabOrder(tab); + return IM_NEW(ImGuiTableColumn)(); } -CIMGUI_API const char* ImGuiTabBar_GetTabName(ImGuiTabBar* self,const ImGuiTabItem* tab) +CIMGUI_API void ImGuiTableColumn_destroy(ImGuiTableColumn* self) { - return self->GetTabName(tab); + IM_DELETE(self); } -CIMGUI_API ImGuiTableColumn* ImGuiTableColumn_ImGuiTableColumn(void) +CIMGUI_API ImGuiTableInstanceData* ImGuiTableInstanceData_ImGuiTableInstanceData(void) { - return IM_NEW(ImGuiTableColumn)(); + return IM_NEW(ImGuiTableInstanceData)(); } -CIMGUI_API void ImGuiTableColumn_destroy(ImGuiTableColumn* self) +CIMGUI_API void ImGuiTableInstanceData_destroy(ImGuiTableInstanceData* self) { IM_DELETE(self); } @@ -3516,6 +3675,10 @@ CIMGUI_API void igSetWindowHitTestHole(ImGuiWindow* window,const ImVec2 pos,cons { return ImGui::SetWindowHitTestHole(window,pos,size); } +CIMGUI_API void igSetWindowHiddendAndSkipItemsForCurrentFrame(ImGuiWindow* window) +{ + return ImGui::SetWindowHiddendAndSkipItemsForCurrentFrame(window); +} CIMGUI_API void igWindowRectAbsToRel(ImRect *pOut,ImGuiWindow* window,const ImRect r) { *pOut = ImGui::WindowRectAbsToRel(window,r); @@ -3576,13 +3739,17 @@ CIMGUI_API ImDrawList* igGetForegroundDrawList_ViewportPtr(ImGuiViewport* viewpo { return ImGui::GetForegroundDrawList(viewport); } -CIMGUI_API void igInitialize(ImGuiContext* context) +CIMGUI_API void igInitialize() +{ + return ImGui::Initialize(); +} +CIMGUI_API void igShutdown() { - return ImGui::Initialize(context); + return ImGui::Shutdown(); } -CIMGUI_API void igShutdown(ImGuiContext* context) +CIMGUI_API void igUpdateInputEvents(bool trickle_fast_inputs) { - return ImGui::Shutdown(context); + return ImGui::UpdateInputEvents(trickle_fast_inputs); } CIMGUI_API void igUpdateHoveredWindowAndCaptureFlags() { @@ -3612,6 +3779,10 @@ CIMGUI_API void igCallContextHooks(ImGuiContext* context,ImGuiContextHookType ty { return ImGui::CallContextHooks(context,type); } +CIMGUI_API void igSetWindowViewport(ImGuiWindow* window,ImGuiViewportP* viewport) +{ + return ImGui::SetWindowViewport(window,viewport); +} CIMGUI_API void igMarkIniSettingsDirty_Nil() { return ImGui::MarkIniSettingsDirty(); @@ -3624,25 +3795,41 @@ CIMGUI_API void igClearIniSettings() { return ImGui::ClearIniSettings(); } +CIMGUI_API void igAddSettingsHandler(const ImGuiSettingsHandler* handler) +{ + return ImGui::AddSettingsHandler(handler); +} +CIMGUI_API void igRemoveSettingsHandler(const char* type_name) +{ + return ImGui::RemoveSettingsHandler(type_name); +} +CIMGUI_API ImGuiSettingsHandler* igFindSettingsHandler(const char* type_name) +{ + return ImGui::FindSettingsHandler(type_name); +} CIMGUI_API ImGuiWindowSettings* igCreateNewWindowSettings(const char* name) { return ImGui::CreateNewWindowSettings(name); } -CIMGUI_API ImGuiWindowSettings* igFindWindowSettings(ImGuiID id) +CIMGUI_API ImGuiWindowSettings* igFindWindowSettingsByID(ImGuiID id) { - return ImGui::FindWindowSettings(id); + return ImGui::FindWindowSettingsByID(id); } -CIMGUI_API ImGuiWindowSettings* igFindOrCreateWindowSettings(const char* name) +CIMGUI_API ImGuiWindowSettings* igFindWindowSettingsByWindow(ImGuiWindow* window) { - return ImGui::FindOrCreateWindowSettings(name); + return ImGui::FindWindowSettingsByWindow(window); } -CIMGUI_API ImGuiSettingsHandler* igFindSettingsHandler(const char* type_name) +CIMGUI_API void igClearWindowSettings(const char* name) { - return ImGui::FindSettingsHandler(type_name); + return ImGui::ClearWindowSettings(name); } -CIMGUI_API void igSetNextWindowScroll(const ImVec2 scroll) +CIMGUI_API void igLocalizeRegisterEntries(const ImGuiLocEntry* entries,int count) { - return ImGui::SetNextWindowScroll(scroll); + return ImGui::LocalizeRegisterEntries(entries,count); +} +CIMGUI_API const char* igLocalizeGetMsg(ImGuiLocKey key) +{ + return ImGui::LocalizeGetMsg(key); } CIMGUI_API void igSetScrollX_WindowPtr(ImGuiWindow* window,float scroll_x) { @@ -3676,10 +3863,6 @@ CIMGUI_API void igScrollToBringRectIntoView(ImGuiWindow* window,const ImRect rec { return ImGui::ScrollToBringRectIntoView(window,rect); } -CIMGUI_API ImGuiID igGetItemID() -{ - return ImGui::GetItemID(); -} CIMGUI_API ImGuiItemStatusFlags igGetItemStatusFlags() { return ImGui::GetItemStatusFlags(); @@ -3728,10 +3911,14 @@ CIMGUI_API void igPushOverrideID(ImGuiID id) { return ImGui::PushOverrideID(id); } -CIMGUI_API ImGuiID igGetIDWithSeed(const char* str_id_begin,const char* str_id_end,ImGuiID seed) +CIMGUI_API ImGuiID igGetIDWithSeed_Str(const char* str_id_begin,const char* str_id_end,ImGuiID seed) { return ImGui::GetIDWithSeed(str_id_begin,str_id_end,seed); } +CIMGUI_API ImGuiID igGetIDWithSeed_Int(int n,ImGuiID seed) +{ + return ImGui::GetIDWithSeed(n,seed); +} CIMGUI_API void igItemSize_Vec2(const ImVec2 size,float text_baseline_y) { return ImGui::ItemSize(size,text_baseline_y); @@ -3748,6 +3935,10 @@ CIMGUI_API bool igItemHoverable(const ImRect bb,ImGuiID id) { return ImGui::ItemHoverable(bb,id); } +CIMGUI_API bool igIsWindowContentHoverable(ImGuiWindow* window,ImGuiHoveredFlags flags) +{ + return ImGui::IsWindowContentHoverable(window,flags); +} CIMGUI_API bool igIsClippedEx(const ImRect bb,ImGuiID id) { return ImGui::IsClippedEx(bb,id); @@ -3788,6 +3979,10 @@ CIMGUI_API void igPopItemFlag() { return ImGui::PopItemFlag(); } +CIMGUI_API const ImGuiDataVarInfo* igGetStyleVarInfo(ImGuiStyleVar idx) +{ + return ImGui::GetStyleVarInfo(idx); +} CIMGUI_API void igLogBegin(ImGuiLogType type,int auto_open_depth) { return ImGui::LogBegin(type,auto_open_depth); @@ -3832,7 +4027,7 @@ CIMGUI_API bool igBeginPopupEx(ImGuiID id,ImGuiWindowFlags extra_flags) { return ImGui::BeginPopupEx(id,extra_flags); } -CIMGUI_API void igBeginTooltipEx(ImGuiTooltipFlags tooltip_flags,ImGuiWindowFlags extra_window_flags) +CIMGUI_API bool igBeginTooltipEx(ImGuiTooltipFlags tooltip_flags,ImGuiWindowFlags extra_window_flags) { return ImGui::BeginTooltipEx(tooltip_flags,extra_window_flags); } @@ -3916,81 +4111,177 @@ CIMGUI_API void igNavMoveRequestTryWrapping(ImGuiWindow* window,ImGuiNavMoveFlag { return ImGui::NavMoveRequestTryWrapping(window,move_flags); } -CIMGUI_API float igGetNavInputAmount(ImGuiNavInput n,ImGuiInputReadMode mode) +CIMGUI_API void igActivateItem(ImGuiID id) { - return ImGui::GetNavInputAmount(n,mode); + return ImGui::ActivateItem(id); } -CIMGUI_API void igGetNavInputAmount2d(ImVec2 *pOut,ImGuiNavDirSourceFlags dir_sources,ImGuiInputReadMode mode,float slow_factor,float fast_factor) +CIMGUI_API void igSetNavWindow(ImGuiWindow* window) { - *pOut = ImGui::GetNavInputAmount2d(dir_sources,mode,slow_factor,fast_factor); + return ImGui::SetNavWindow(window); } -CIMGUI_API int igCalcTypematicRepeatAmount(float t0,float t1,float repeat_delay,float repeat_rate) +CIMGUI_API void igSetNavID(ImGuiID id,ImGuiNavLayer nav_layer,ImGuiID focus_scope_id,const ImRect rect_rel) { - return ImGui::CalcTypematicRepeatAmount(t0,t1,repeat_delay,repeat_rate); + return ImGui::SetNavID(id,nav_layer,focus_scope_id,rect_rel); } -CIMGUI_API void igActivateItem(ImGuiID id) +CIMGUI_API bool igIsNamedKey(ImGuiKey key) { - return ImGui::ActivateItem(id); + return ImGui::IsNamedKey(key); } -CIMGUI_API void igSetNavID(ImGuiID id,ImGuiNavLayer nav_layer,ImGuiID focus_scope_id,const ImRect rect_rel) +CIMGUI_API bool igIsNamedKeyOrModKey(ImGuiKey key) { - return ImGui::SetNavID(id,nav_layer,focus_scope_id,rect_rel); + return ImGui::IsNamedKeyOrModKey(key); } -CIMGUI_API void igPushFocusScope(ImGuiID id) +CIMGUI_API bool igIsLegacyKey(ImGuiKey key) { - return ImGui::PushFocusScope(id); + return ImGui::IsLegacyKey(key); } -CIMGUI_API void igPopFocusScope() +CIMGUI_API bool igIsKeyboardKey(ImGuiKey key) { - return ImGui::PopFocusScope(); + return ImGui::IsKeyboardKey(key); } -CIMGUI_API ImGuiID igGetFocusedFocusScope() +CIMGUI_API bool igIsGamepadKey(ImGuiKey key) { - return ImGui::GetFocusedFocusScope(); + return ImGui::IsGamepadKey(key); } -CIMGUI_API ImGuiID igGetFocusScope() +CIMGUI_API bool igIsMouseKey(ImGuiKey key) { - return ImGui::GetFocusScope(); + return ImGui::IsMouseKey(key); } -CIMGUI_API void igSetItemUsingMouseWheel() +CIMGUI_API bool igIsAliasKey(ImGuiKey key) { - return ImGui::SetItemUsingMouseWheel(); + return ImGui::IsAliasKey(key); } -CIMGUI_API void igSetActiveIdUsingNavAndKeys() +CIMGUI_API ImGuiKeyChord igConvertShortcutMod(ImGuiKeyChord key_chord) { - return ImGui::SetActiveIdUsingNavAndKeys(); + return ImGui::ConvertShortcutMod(key_chord); } -CIMGUI_API bool igIsActiveIdUsingNavDir(ImGuiDir dir) +CIMGUI_API ImGuiKey igConvertSingleModFlagToKey(ImGuiContext* ctx,ImGuiKey key) { - return ImGui::IsActiveIdUsingNavDir(dir); + return ImGui::ConvertSingleModFlagToKey(ctx,key); +} +CIMGUI_API ImGuiKeyData* igGetKeyData_ContextPtr(ImGuiContext* ctx,ImGuiKey key) +{ + return ImGui::GetKeyData(ctx,key); +} +CIMGUI_API ImGuiKeyData* igGetKeyData_Key(ImGuiKey key) +{ + return ImGui::GetKeyData(key); } -CIMGUI_API bool igIsActiveIdUsingNavInput(ImGuiNavInput input) +CIMGUI_API void igGetKeyChordName(ImGuiKeyChord key_chord,char* out_buf,int out_buf_size) { - return ImGui::IsActiveIdUsingNavInput(input); + return ImGui::GetKeyChordName(key_chord,out_buf,out_buf_size); } -CIMGUI_API bool igIsActiveIdUsingKey(ImGuiKey key) +CIMGUI_API ImGuiKey igMouseButtonToKey(ImGuiMouseButton button) { - return ImGui::IsActiveIdUsingKey(key); + return ImGui::MouseButtonToKey(button); } CIMGUI_API bool igIsMouseDragPastThreshold(ImGuiMouseButton button,float lock_threshold) { return ImGui::IsMouseDragPastThreshold(button,lock_threshold); } -CIMGUI_API bool igIsKeyPressedMap(ImGuiKey key,bool repeat) +CIMGUI_API void igGetKeyMagnitude2d(ImVec2 *pOut,ImGuiKey key_left,ImGuiKey key_right,ImGuiKey key_up,ImGuiKey key_down) { - return ImGui::IsKeyPressedMap(key,repeat); + *pOut = ImGui::GetKeyMagnitude2d(key_left,key_right,key_up,key_down); +} +CIMGUI_API float igGetNavTweakPressedAmount(ImGuiAxis axis) +{ + return ImGui::GetNavTweakPressedAmount(axis); } -CIMGUI_API bool igIsNavInputDown(ImGuiNavInput n) +CIMGUI_API int igCalcTypematicRepeatAmount(float t0,float t1,float repeat_delay,float repeat_rate) { - return ImGui::IsNavInputDown(n); + return ImGui::CalcTypematicRepeatAmount(t0,t1,repeat_delay,repeat_rate); } -CIMGUI_API bool igIsNavInputTest(ImGuiNavInput n,ImGuiInputReadMode rm) +CIMGUI_API void igGetTypematicRepeatRate(ImGuiInputFlags flags,float* repeat_delay,float* repeat_rate) { - return ImGui::IsNavInputTest(n,rm); + return ImGui::GetTypematicRepeatRate(flags,repeat_delay,repeat_rate); } -CIMGUI_API ImGuiKeyModFlags igGetMergedKeyModFlags() +CIMGUI_API void igSetActiveIdUsingAllKeyboardKeys() { - return ImGui::GetMergedKeyModFlags(); + return ImGui::SetActiveIdUsingAllKeyboardKeys(); +} +CIMGUI_API bool igIsActiveIdUsingNavDir(ImGuiDir dir) +{ + return ImGui::IsActiveIdUsingNavDir(dir); +} +CIMGUI_API ImGuiID igGetKeyOwner(ImGuiKey key) +{ + return ImGui::GetKeyOwner(key); +} +CIMGUI_API void igSetKeyOwner(ImGuiKey key,ImGuiID owner_id,ImGuiInputFlags flags) +{ + return ImGui::SetKeyOwner(key,owner_id,flags); +} +CIMGUI_API void igSetKeyOwnersForKeyChord(ImGuiKeyChord key,ImGuiID owner_id,ImGuiInputFlags flags) +{ + return ImGui::SetKeyOwnersForKeyChord(key,owner_id,flags); +} +CIMGUI_API void igSetItemKeyOwner(ImGuiKey key,ImGuiInputFlags flags) +{ + return ImGui::SetItemKeyOwner(key,flags); +} +CIMGUI_API bool igTestKeyOwner(ImGuiKey key,ImGuiID owner_id) +{ + return ImGui::TestKeyOwner(key,owner_id); +} +CIMGUI_API ImGuiKeyOwnerData* igGetKeyOwnerData(ImGuiContext* ctx,ImGuiKey key) +{ + return ImGui::GetKeyOwnerData(ctx,key); +} +CIMGUI_API bool igIsKeyDown_ID(ImGuiKey key,ImGuiID owner_id) +{ + return ImGui::IsKeyDown(key,owner_id); +} +CIMGUI_API bool igIsKeyPressed_ID(ImGuiKey key,ImGuiID owner_id,ImGuiInputFlags flags) +{ + return ImGui::IsKeyPressed(key,owner_id,flags); +} +CIMGUI_API bool igIsKeyReleased_ID(ImGuiKey key,ImGuiID owner_id) +{ + return ImGui::IsKeyReleased(key,owner_id); +} +CIMGUI_API bool igIsMouseDown_ID(ImGuiMouseButton button,ImGuiID owner_id) +{ + return ImGui::IsMouseDown(button,owner_id); +} +CIMGUI_API bool igIsMouseClicked_ID(ImGuiMouseButton button,ImGuiID owner_id,ImGuiInputFlags flags) +{ + return ImGui::IsMouseClicked(button,owner_id,flags); +} +CIMGUI_API bool igIsMouseReleased_ID(ImGuiMouseButton button,ImGuiID owner_id) +{ + return ImGui::IsMouseReleased(button,owner_id); +} +CIMGUI_API bool igShortcut(ImGuiKeyChord key_chord,ImGuiID owner_id,ImGuiInputFlags flags) +{ + return ImGui::Shortcut(key_chord,owner_id,flags); +} +CIMGUI_API bool igSetShortcutRouting(ImGuiKeyChord key_chord,ImGuiID owner_id,ImGuiInputFlags flags) +{ + return ImGui::SetShortcutRouting(key_chord,owner_id,flags); +} +CIMGUI_API bool igTestShortcutRouting(ImGuiKeyChord key_chord,ImGuiID owner_id) +{ + return ImGui::TestShortcutRouting(key_chord,owner_id); +} +CIMGUI_API ImGuiKeyRoutingData* igGetShortcutRoutingData(ImGuiKeyChord key_chord) +{ + return ImGui::GetShortcutRoutingData(key_chord); +} +CIMGUI_API void igPushFocusScope(ImGuiID id) +{ + return ImGui::PushFocusScope(id); +} +CIMGUI_API void igPopFocusScope() +{ + return ImGui::PopFocusScope(); +} +CIMGUI_API ImGuiID igGetCurrentFocusScope() +{ + return ImGui::GetCurrentFocusScope(); +} +CIMGUI_API bool igIsDragDropActive() +{ + return ImGui::IsDragDropActive(); } CIMGUI_API bool igBeginDragDropTargetCustom(const ImRect bb,ImGuiID id) { @@ -4004,6 +4295,10 @@ CIMGUI_API bool igIsDragDropPayloadBeingAccepted() { return ImGui::IsDragDropPayloadBeingAccepted(); } +CIMGUI_API void igRenderDragDropTargetRect(const ImRect bb) +{ + return ImGui::RenderDragDropTargetRect(bb); +} CIMGUI_API void igSetWindowClipRectBeforeSetChannel(ImGuiWindow* window,const ImRect clip_rect) { return ImGui::SetWindowClipRectBeforeSetChannel(window,clip_rect); @@ -4116,10 +4411,22 @@ CIMGUI_API void igTableDrawContextMenu(ImGuiTable* table) { return ImGui::TableDrawContextMenu(table); } +CIMGUI_API bool igTableBeginContextMenuPopup(ImGuiTable* table) +{ + return ImGui::TableBeginContextMenuPopup(table); +} CIMGUI_API void igTableMergeDrawChannels(ImGuiTable* table) { return ImGui::TableMergeDrawChannels(table); } +CIMGUI_API ImGuiTableInstanceData* igTableGetInstanceData(ImGuiTable* table,int instance_no) +{ + return ImGui::TableGetInstanceData(table,instance_no); +} +CIMGUI_API ImGuiID igTableGetInstanceID(ImGuiTable* table,int instance_no) +{ + return ImGui::TableGetInstanceID(table,instance_no); +} CIMGUI_API void igTableSortSpecsSanitize(ImGuiTable* table) { return ImGui::TableSortSpecsSanitize(table); @@ -4164,7 +4471,7 @@ CIMGUI_API const char* igTableGetColumnName_TablePtr(const ImGuiTable* table,int { return ImGui::TableGetColumnName(table,column_n); } -CIMGUI_API ImGuiID igTableGetColumnResizeID(const ImGuiTable* table,int column_n,int instance_no) +CIMGUI_API ImGuiID igTableGetColumnResizeID(ImGuiTable* table,int column_n,int instance_no) { return ImGui::TableGetColumnResizeID(table,column_n,instance_no); } @@ -4212,9 +4519,9 @@ CIMGUI_API ImGuiTableSettings* igTableGetBoundSettings(ImGuiTable* table) { return ImGui::TableGetBoundSettings(table); } -CIMGUI_API void igTableSettingsInstallHandler(ImGuiContext* context) +CIMGUI_API void igTableSettingsAddSettingsHandler() { - return ImGui::TableSettingsInstallHandler(context); + return ImGui::TableSettingsAddSettingsHandler(); } CIMGUI_API ImGuiTableSettings* igTableSettingsCreate(ImGuiID id,int columns_count) { @@ -4224,6 +4531,10 @@ CIMGUI_API ImGuiTableSettings* igTableSettingsFindByID(ImGuiID id) { return ImGui::TableSettingsFindByID(id); } +CIMGUI_API ImGuiTabBar* igGetCurrentTabBar() +{ + return ImGui::GetCurrentTabBar(); +} CIMGUI_API bool igBeginTabBarEx(ImGuiTabBar* tab_bar,const ImRect bb,ImGuiTabBarFlags flags) { return ImGui::BeginTabBarEx(tab_bar,bb,flags); @@ -4232,6 +4543,22 @@ CIMGUI_API ImGuiTabItem* igTabBarFindTabByID(ImGuiTabBar* tab_bar,ImGuiID tab_id { return ImGui::TabBarFindTabByID(tab_bar,tab_id); } +CIMGUI_API ImGuiTabItem* igTabBarFindTabByOrder(ImGuiTabBar* tab_bar,int order) +{ + return ImGui::TabBarFindTabByOrder(tab_bar,order); +} +CIMGUI_API ImGuiTabItem* igTabBarGetCurrentTab(ImGuiTabBar* tab_bar) +{ + return ImGui::TabBarGetCurrentTab(tab_bar); +} +CIMGUI_API int igTabBarGetTabOrder(ImGuiTabBar* tab_bar,ImGuiTabItem* tab) +{ + return ImGui::TabBarGetTabOrder(tab_bar,tab); +} +CIMGUI_API const char* igTabBarGetTabName(ImGuiTabBar* tab_bar,ImGuiTabItem* tab) +{ + return ImGui::TabBarGetTabName(tab_bar,tab); +} CIMGUI_API void igTabBarRemoveTab(ImGuiTabBar* tab_bar,ImGuiID tab_id) { return ImGui::TabBarRemoveTab(tab_bar,tab_id); @@ -4240,11 +4567,15 @@ CIMGUI_API void igTabBarCloseTab(ImGuiTabBar* tab_bar,ImGuiTabItem* tab) { return ImGui::TabBarCloseTab(tab_bar,tab); } -CIMGUI_API void igTabBarQueueReorder(ImGuiTabBar* tab_bar,const ImGuiTabItem* tab,int offset) +CIMGUI_API void igTabBarQueueFocus(ImGuiTabBar* tab_bar,ImGuiTabItem* tab) +{ + return ImGui::TabBarQueueFocus(tab_bar,tab); +} +CIMGUI_API void igTabBarQueueReorder(ImGuiTabBar* tab_bar,ImGuiTabItem* tab,int offset) { return ImGui::TabBarQueueReorder(tab_bar,tab,offset); } -CIMGUI_API void igTabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar,const ImGuiTabItem* tab,ImVec2 mouse_pos) +CIMGUI_API void igTabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar,ImGuiTabItem* tab,ImVec2 mouse_pos) { return ImGui::TabBarQueueReorderFromMousePos(tab_bar,tab,mouse_pos); } @@ -4252,13 +4583,17 @@ CIMGUI_API bool igTabBarProcessReorder(ImGuiTabBar* tab_bar) { return ImGui::TabBarProcessReorder(tab_bar); } -CIMGUI_API bool igTabItemEx(ImGuiTabBar* tab_bar,const char* label,bool* p_open,ImGuiTabItemFlags flags) +CIMGUI_API bool igTabItemEx(ImGuiTabBar* tab_bar,const char* label,bool* p_open,ImGuiTabItemFlags flags,ImGuiWindow* docked_window) { - return ImGui::TabItemEx(tab_bar,label,p_open,flags); + return ImGui::TabItemEx(tab_bar,label,p_open,flags,docked_window); } -CIMGUI_API void igTabItemCalcSize(ImVec2 *pOut,const char* label,bool has_close_button) +CIMGUI_API void igTabItemCalcSize_Str(ImVec2 *pOut,const char* label,bool has_close_button_or_unsaved_marker) { - *pOut = ImGui::TabItemCalcSize(label,has_close_button); + *pOut = ImGui::TabItemCalcSize(label,has_close_button_or_unsaved_marker); +} +CIMGUI_API void igTabItemCalcSize_WindowPtr(ImVec2 *pOut,ImGuiWindow* window) +{ + *pOut = ImGui::TabItemCalcSize(window); } CIMGUI_API void igTabItemBackground(ImDrawList* draw_list,const ImRect bb,ImGuiTabItemFlags flags,ImU32 col) { @@ -4308,6 +4643,10 @@ CIMGUI_API const char* igFindRenderedTextEnd(const char* text,const char* text_e { return ImGui::FindRenderedTextEnd(text,text_end); } +CIMGUI_API void igRenderMouseCursor(ImVec2 pos,float scale,ImGuiMouseCursor mouse_cursor,ImU32 col_fill,ImU32 col_border,ImU32 col_shadow) +{ + return ImGui::RenderMouseCursor(pos,scale,mouse_cursor,col_fill,col_border,col_shadow); +} CIMGUI_API void igRenderArrow(ImDrawList* draw_list,ImVec2 pos,ImU32 col,ImGuiDir dir,float scale) { return ImGui::RenderArrow(draw_list,pos,col,dir,scale); @@ -4320,10 +4659,6 @@ CIMGUI_API void igRenderCheckMark(ImDrawList* draw_list,ImVec2 pos,ImU32 col,flo { return ImGui::RenderCheckMark(draw_list,pos,col,sz); } -CIMGUI_API void igRenderMouseCursor(ImDrawList* draw_list,ImVec2 pos,float scale,ImGuiMouseCursor mouse_cursor,ImU32 col_fill,ImU32 col_border,ImU32 col_shadow) -{ - return ImGui::RenderMouseCursor(draw_list,pos,scale,mouse_cursor,col_fill,col_border,col_shadow); -} CIMGUI_API void igRenderArrowPointingAt(ImDrawList* draw_list,ImVec2 pos,ImVec2 half_sz,ImGuiDir direction,ImU32 col) { return ImGui::RenderArrowPointingAt(draw_list,pos,half_sz,direction,col); @@ -4332,7 +4667,7 @@ CIMGUI_API void igRenderRectFilledRangeH(ImDrawList* draw_list,const ImRect rect { return ImGui::RenderRectFilledRangeH(draw_list,rect,col,x_start_norm,x_end_norm,rounding); } -CIMGUI_API void igRenderRectFilledWithHole(ImDrawList* draw_list,ImRect outer,ImRect inner,ImU32 col,float rounding) +CIMGUI_API void igRenderRectFilledWithHole(ImDrawList* draw_list,const ImRect outer,const ImRect inner,ImU32 col,float rounding) { return ImGui::RenderRectFilledWithHole(draw_list,outer,inner,col,rounding); } @@ -4344,6 +4679,30 @@ CIMGUI_API bool igButtonEx(const char* label,const ImVec2 size_arg,ImGuiButtonFl { return ImGui::ButtonEx(label,size_arg,flags); } +CIMGUI_API bool igArrowButtonEx(const char* str_id,ImGuiDir dir,ImVec2 size_arg,ImGuiButtonFlags flags) +{ + return ImGui::ArrowButtonEx(str_id,dir,size_arg,flags); +} +CIMGUI_API bool igImageButtonEx(ImGuiID id,ImTextureID texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 bg_col,const ImVec4 tint_col,ImGuiButtonFlags flags) +{ + return ImGui::ImageButtonEx(id,texture_id,size,uv0,uv1,bg_col,tint_col,flags); +} +CIMGUI_API void igSeparatorEx(ImGuiSeparatorFlags flags) +{ + return ImGui::SeparatorEx(flags); +} +CIMGUI_API void igSeparatorTextEx(ImGuiID id,const char* label,const char* label_end,float extra_width) +{ + return ImGui::SeparatorTextEx(id,label,label_end,extra_width); +} +CIMGUI_API bool igCheckboxFlags_S64Ptr(const char* label,ImS64* flags,ImS64 flags_value) +{ + return ImGui::CheckboxFlags(label,flags,flags_value); +} +CIMGUI_API bool igCheckboxFlags_U64Ptr(const char* label,ImU64* flags,ImU64 flags_value) +{ + return ImGui::CheckboxFlags(label,flags,flags_value); +} CIMGUI_API bool igCloseButton(ImGuiID id,const ImVec2 pos) { return ImGui::CloseButton(id,pos); @@ -4352,10 +4711,6 @@ CIMGUI_API bool igCollapseButton(ImGuiID id,const ImVec2 pos) { return ImGui::CollapseButton(id,pos); } -CIMGUI_API bool igArrowButtonEx(const char* str_id,ImGuiDir dir,ImVec2 size_arg,ImGuiButtonFlags flags) -{ - return ImGui::ArrowButtonEx(str_id,dir,size_arg,flags); -} CIMGUI_API void igScrollbar(ImGuiAxis axis) { return ImGui::Scrollbar(axis); @@ -4364,10 +4719,6 @@ CIMGUI_API bool igScrollbarEx(const ImRect bb,ImGuiID id,ImGuiAxis axis,ImS64* p { return ImGui::ScrollbarEx(bb,id,axis,p_scroll_v,avail_v,contents_v,flags); } -CIMGUI_API bool igImageButtonEx(ImGuiID id,ImTextureID texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec2 padding,const ImVec4 bg_col,const ImVec4 tint_col) -{ - return ImGui::ImageButtonEx(id,texture_id,size,uv0,uv1,padding,bg_col,tint_col); -} CIMGUI_API void igGetWindowScrollbarRect(ImRect *pOut,ImGuiWindow* window,ImGuiAxis axis) { *pOut = ImGui::GetWindowScrollbarRect(window,axis); @@ -4384,18 +4735,6 @@ CIMGUI_API ImGuiID igGetWindowResizeBorderID(ImGuiWindow* window,ImGuiDir dir) { return ImGui::GetWindowResizeBorderID(window,dir); } -CIMGUI_API void igSeparatorEx(ImGuiSeparatorFlags flags) -{ - return ImGui::SeparatorEx(flags); -} -CIMGUI_API bool igCheckboxFlags_S64Ptr(const char* label,ImS64* flags,ImS64 flags_value) -{ - return ImGui::CheckboxFlags(label,flags,flags_value); -} -CIMGUI_API bool igCheckboxFlags_U64Ptr(const char* label,ImU64* flags,ImU64 flags_value) -{ - return ImGui::CheckboxFlags(label,flags,flags_value); -} CIMGUI_API bool igButtonBehavior(const ImRect bb,ImGuiID id,bool* out_hovered,bool* out_held,ImGuiButtonFlags flags) { return ImGui::ButtonBehavior(bb,id,out_hovered,out_held,flags); @@ -4408,22 +4747,26 @@ CIMGUI_API bool igSliderBehavior(const ImRect bb,ImGuiID id,ImGuiDataType data_t { return ImGui::SliderBehavior(bb,id,data_type,p_v,p_min,p_max,format,flags,out_grab_bb); } -CIMGUI_API bool igSplitterBehavior(const ImRect bb,ImGuiID id,ImGuiAxis axis,float* size1,float* size2,float min_size1,float min_size2,float hover_extend,float hover_visibility_delay) +CIMGUI_API bool igSplitterBehavior(const ImRect bb,ImGuiID id,ImGuiAxis axis,float* size1,float* size2,float min_size1,float min_size2,float hover_extend,float hover_visibility_delay,ImU32 bg_col) { - return ImGui::SplitterBehavior(bb,id,axis,size1,size2,min_size1,min_size2,hover_extend,hover_visibility_delay); + return ImGui::SplitterBehavior(bb,id,axis,size1,size2,min_size1,min_size2,hover_extend,hover_visibility_delay,bg_col); } CIMGUI_API bool igTreeNodeBehavior(ImGuiID id,ImGuiTreeNodeFlags flags,const char* label,const char* label_end) { return ImGui::TreeNodeBehavior(id,flags,label,label_end); } -CIMGUI_API bool igTreeNodeBehaviorIsOpen(ImGuiID id,ImGuiTreeNodeFlags flags) -{ - return ImGui::TreeNodeBehaviorIsOpen(id,flags); -} CIMGUI_API void igTreePushOverrideID(ImGuiID id) { return ImGui::TreePushOverrideID(id); } +CIMGUI_API void igTreeNodeSetOpen(ImGuiID id,bool open) +{ + return ImGui::TreeNodeSetOpen(id,open); +} +CIMGUI_API bool igTreeNodeUpdateNextOpen(ImGuiID id,ImGuiTreeNodeFlags flags) +{ + return ImGui::TreeNodeUpdateNextOpen(id,flags); +} CIMGUI_API const ImGuiDataTypeInfo* igDataTypeGetInfo(ImGuiDataType data_type) { return ImGui::DataTypeGetInfo(data_type); @@ -4436,9 +4779,9 @@ CIMGUI_API void igDataTypeApplyOp(ImGuiDataType data_type,int op,void* output,co { return ImGui::DataTypeApplyOp(data_type,op,output,arg_1,arg_2); } -CIMGUI_API bool igDataTypeApplyOpFromText(const char* buf,const char* initial_value_buf,ImGuiDataType data_type,void* p_data,const char* format) +CIMGUI_API bool igDataTypeApplyFromText(const char* buf,ImGuiDataType data_type,void* p_data,const char* format) { - return ImGui::DataTypeApplyOpFromText(buf,initial_value_buf,data_type,p_data,format); + return ImGui::DataTypeApplyFromText(buf,data_type,p_data,format); } CIMGUI_API int igDataTypeCompare(ImGuiDataType data_type,const void* arg_1,const void* arg_2) { @@ -4452,6 +4795,10 @@ CIMGUI_API bool igInputTextEx(const char* label,const char* hint,char* buf,int b { return ImGui::InputTextEx(label,hint,buf,buf_size,size_arg,flags,callback,user_data); } +CIMGUI_API void igInputTextDeactivateHook(ImGuiID id) +{ + return ImGui::InputTextDeactivateHook(id); +} CIMGUI_API bool igTempInputText(const ImRect bb,ImGuiID id,const char* label,char* buf,int buf_size,ImGuiInputTextFlags flags) { return ImGui::TempInputText(bb,id,label,buf,buf_size,flags); @@ -4480,9 +4827,9 @@ CIMGUI_API void igColorPickerOptionsPopup(const float* ref_col,ImGuiColorEditFla { return ImGui::ColorPickerOptionsPopup(ref_col,flags); } -CIMGUI_API int igPlotEx(ImGuiPlotType plot_type,const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 frame_size) +CIMGUI_API int igPlotEx(ImGuiPlotType plot_type,const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,const ImVec2 size_arg) { - return ImGui::PlotEx(plot_type,label,values_getter,data,values_count,values_offset,overlay_text,scale_min,scale_max,frame_size); + return ImGui::PlotEx(plot_type,label,values_getter,data,values_count,values_offset,overlay_text,scale_min,scale_max,size_arg); } CIMGUI_API void igShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list,int vert_start_idx,int vert_end_idx,ImVec2 gradient_p0,ImVec2 gradient_p1,ImU32 col0,ImU32 col1) { @@ -4504,6 +4851,17 @@ CIMGUI_API void igGcAwakeTransientWindowBuffers(ImGuiWindow* window) { return ImGui::GcAwakeTransientWindowBuffers(window); } +CIMGUI_API void igDebugLog(const char* fmt,...) +{ + va_list args; + va_start(args, fmt); + ImGui::DebugLogV(fmt,args); + va_end(args); +} +CIMGUI_API void igDebugLogV(const char* fmt,va_list args) +{ + return ImGui::DebugLogV(fmt,args); +} CIMGUI_API void igErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback,void* user_data) { return ImGui::ErrorCheckEndFrameRecover(log_callback,user_data); @@ -4512,6 +4870,22 @@ CIMGUI_API void igErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, { return ImGui::ErrorCheckEndWindowRecover(log_callback,user_data); } +CIMGUI_API void igErrorCheckUsingSetCursorPosToExtendParentBoundaries() +{ + return ImGui::ErrorCheckUsingSetCursorPosToExtendParentBoundaries(); +} +CIMGUI_API void igDebugLocateItem(ImGuiID target_id) +{ + return ImGui::DebugLocateItem(target_id); +} +CIMGUI_API void igDebugLocateItemOnHover(ImGuiID target_id) +{ + return ImGui::DebugLocateItemOnHover(target_id); +} +CIMGUI_API void igDebugLocateItemResolveWithLastItem() +{ + return ImGui::DebugLocateItemResolveWithLastItem(); +} CIMGUI_API void igDebugDrawItemRect(ImU32 col) { return ImGui::DebugDrawItemRect(col); @@ -4544,6 +4918,10 @@ CIMGUI_API void igDebugNodeFont(ImFont* font) { return ImGui::DebugNodeFont(font); } +CIMGUI_API void igDebugNodeFontGlyph(ImFont* font,const ImFontGlyph* glyph) +{ + return ImGui::DebugNodeFontGlyph(font,glyph); +} CIMGUI_API void igDebugNodeStorage(ImGuiStorage* storage,const char* label) { return ImGui::DebugNodeStorage(storage,label); @@ -4560,6 +4938,10 @@ CIMGUI_API void igDebugNodeTableSettings(ImGuiTableSettings* settings) { return ImGui::DebugNodeTableSettings(settings); } +CIMGUI_API void igDebugNodeInputTextState(ImGuiInputTextState* state) +{ + return ImGui::DebugNodeInputTextState(state); +} CIMGUI_API void igDebugNodeWindow(ImGuiWindow* window,const char* label) { return ImGui::DebugNodeWindow(window,label); @@ -4580,10 +4962,18 @@ CIMGUI_API void igDebugNodeViewport(ImGuiViewportP* viewport) { return ImGui::DebugNodeViewport(viewport); } +CIMGUI_API void igDebugRenderKeyboardPreview(ImDrawList* draw_list) +{ + return ImGui::DebugRenderKeyboardPreview(draw_list); +} CIMGUI_API void igDebugRenderViewportThumbnail(ImDrawList* draw_list,ImGuiViewportP* viewport,const ImRect bb) { return ImGui::DebugRenderViewportThumbnail(draw_list,viewport,bb); } +CIMGUI_API bool igIsKeyPressedMap(ImGuiKey key,bool repeat) +{ + return ImGui::IsKeyPressedMap(key,repeat); +} CIMGUI_API const ImFontBuilderIO* igImFontAtlasGetBuilderForStbTruetype() { return ImFontAtlasGetBuilderForStbTruetype(); diff --git a/Sources/CImGui/imgui/imconfig.h b/Sources/CImGui/imgui/imconfig.h index 7082c55..876cf32 100644 --- a/Sources/CImGui/imgui/imconfig.h +++ b/Sources/CImGui/imgui/imconfig.h @@ -28,12 +28,13 @@ //---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS +//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions. -//---- Disable all of Dear ImGui or don't implement standard windows. -// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp. +//---- Disable all of Dear ImGui or don't implement standard windows/tools. +// It is very strongly recommended to NOT disable the demo windows and debug tool during development. They are extremely useful in day to day work. Please read comments in imgui_demo.cpp. //#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty. -//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended. -//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger and other debug tools: ShowMetricsWindow() and ShowStackToolWindow() will be empty. +//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. +//#define IMGUI_DISABLE_DEBUG_TOOLS // Disable metrics/debugger and other debug tools: ShowMetricsWindow(), ShowDebugLogWindow() and ShowStackToolWindow() will be empty (this was called IMGUI_DISABLE_METRICS_WINDOW before 1.88). //---- Don't implement some functions to reduce linkage requirements. //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a) @@ -61,12 +62,13 @@ // By default the embedded implementations are declared static and not available outside of Dear ImGui sources files. //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" +//#define IMGUI_STB_SPRINTF_FILENAME "my_folder/stb_sprintf.h" // only used if enabled //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION -//---- Use stb_printf's faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined) -// Requires 'stb_sprintf.h' to be available in the include path. Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by STB sprintf. -// #define IMGUI_USE_STB_SPRINTF +//---- Use stb_sprintf.h for a faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined) +// Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by stb_sprintf.h. +//#define IMGUI_USE_STB_SPRINTF //---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui) // Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided). @@ -80,14 +82,16 @@ //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. // This will be inlined as part of ImVec2 and ImVec4 class declarations. /* -#define IM_VEC2_CLASS_EXTRA \ - ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ +#define IM_VEC2_CLASS_EXTRA \ + constexpr ImVec2(const MyVec2& f) : x(f.x), y(f.y) {} \ operator MyVec2() const { return MyVec2(x,y); } -#define IM_VEC4_CLASS_EXTRA \ - ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ +#define IM_VEC4_CLASS_EXTRA \ + constexpr ImVec4(const MyVec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {} \ operator MyVec4() const { return MyVec4(x,y,z,w); } */ +//---- ...Or use Dear ImGui's own very basic math operators. +//#define IMGUI_DEFINE_MATH_OPERATORS //---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices. // Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices). @@ -106,11 +110,6 @@ //#define IM_DEBUG_BREAK IM_ASSERT(0) //#define IM_DEBUG_BREAK __debugbreak() -//---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(), -// (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.) -// This adds a small runtime cost which is why it is not enabled by default. -//#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX - //---- Debug Tools: Enable slower asserts //#define IMGUI_DEBUG_PARANOID diff --git a/Sources/CImGui/imgui/imgui.cpp b/Sources/CImGui/imgui/imgui.cpp index d7653d4..6272b72 100644 --- a/Sources/CImGui/imgui/imgui.cpp +++ b/Sources/CImGui/imgui/imgui.cpp @@ -1,17 +1,17 @@ -// dear imgui, v1.86 +// dear imgui, v1.89.5 // (main code and documentation) // Help: -// - Read FAQ at http://dearimgui.org/faq +// - Read FAQ at http://dearimgui.com/faq // - Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase. // - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications in examples/ are doing that. // Read imgui.cpp for details, links and comments. // Resources: -// - FAQ http://dearimgui.org/faq +// - FAQ http://dearimgui.com/faq // - Homepage & latest https://github.com/ocornut/imgui // - Releases & changelog https://github.com/ocornut/imgui/releases -// - Gallery https://github.com/ocornut/imgui/issues/4451 (please post your screenshots/video there!) +// - Gallery https://github.com/ocornut/imgui/issues/5886 (please post your screenshots/video there!) // - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there) // - Glossary https://github.com/ocornut/imgui/wiki/Glossary // - Issues & support https://github.com/ocornut/imgui/issues @@ -39,17 +39,16 @@ Index of this file: DOCUMENTATION - MISSION STATEMENT -- END-USER GUIDE +- CONTROLS GUIDE - PROGRAMMER GUIDE - READ FIRST - HOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI - GETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE - HOW A SIMPLE APPLICATION MAY LOOK LIKE - HOW A SIMPLE RENDERING FUNCTION MAY LOOK LIKE - - USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS - API BREAKING CHANGES (read me when you update!) - FREQUENTLY ASKED QUESTIONS (FAQ) - - Read all answers online: https://www.dearimgui.org/faq, or in docs/FAQ.md (with a Markdown viewer) + - Read all answers online: https://www.dearimgui.com/faq, or in docs/FAQ.md (with a Markdown viewer) CODE (search for "[SECTION]" in the code to find them) @@ -65,11 +64,13 @@ CODE // [SECTION] MISC HELPERS/UTILITIES (Color functions) // [SECTION] ImGuiStorage // [SECTION] ImGuiTextFilter -// [SECTION] ImGuiTextBuffer +// [SECTION] ImGuiTextBuffer, ImGuiTextIndex // [SECTION] ImGuiListClipper // [SECTION] STYLING // [SECTION] RENDER HELPERS +// [SECTION] INITIALIZATION, SHUTDOWN // [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!) +// [SECTION] INPUTS // [SECTION] ERROR CHECKING // [SECTION] LAYOUT // [SECTION] SCROLLING @@ -79,9 +80,11 @@ CODE // [SECTION] DRAG AND DROP // [SECTION] LOGGING/CAPTURING // [SECTION] SETTINGS -// [SECTION] VIEWPORTS +// [SECTION] LOCALIZATION +// [SECTION] VIEWPORTS, PLATFORM WINDOWS // [SECTION] PLATFORM DEPENDENT HELPERS // [SECTION] METRICS/DEBUGGER WINDOW +// [SECTION] DEBUG LOG WINDOW // [SECTION] OTHER DEBUG TOOLS (ITEM PICKER, STACK TOOL) */ @@ -100,6 +103,7 @@ CODE - Easy to hack and improve. - Minimize setup and maintenance. - Minimize state storage on user side. + - Minimize state synchronization. - Portable, minimize dependencies, run on target (consoles, phones, etc.). - Efficient runtime and memory consumption. @@ -109,28 +113,73 @@ CODE - Limited layout features, intricate layouts are typically crafted in code. - END-USER GUIDE + CONTROLS GUIDE ============== - - Double-click on title bar to collapse window. - - Click upper right corner to close a window, available when 'bool* p_open' is passed to ImGui::Begin(). - - Click and drag on lower right corner to resize window (double-click to auto fit window to its contents). - - Click and drag on any empty space to move window. - - TAB/SHIFT+TAB to cycle through keyboard editable fields. - - CTRL+Click on a slider or drag box to input value as text. - - Use mouse wheel to scroll. - - Text editor: - - Hold SHIFT or use mouse to select text. - - CTRL+Left/Right to word jump. - - CTRL+Shift+Left/Right to select words. - - CTRL+A our Double-Click to select all. - - CTRL+X,CTRL+C,CTRL+V to use OS clipboard/ - - CTRL+Z,CTRL+Y to undo/redo. - - ESCAPE to revert text to its original value. - - You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!) - - Controls are automatically adjusted for OSX to match standard OSX text editing operations. - - General Keyboard controls: enable with ImGuiConfigFlags_NavEnableKeyboard. - - General Gamepad controls: enable with ImGuiConfigFlags_NavEnableGamepad. See suggested mappings in imgui.h ImGuiNavInput_ + download PNG/PSD at http://dearimgui.org/controls_sheets + - MOUSE CONTROLS + - Mouse wheel: Scroll vertically. + - SHIFT+Mouse wheel: Scroll horizontally. + - Click [X]: Close a window, available when 'bool* p_open' is passed to ImGui::Begin(). + - Click ^, Double-Click title: Collapse window. + - Drag on corner/border: Resize window (double-click to auto fit window to its contents). + - Drag on any empty space: Move window (unless io.ConfigWindowsMoveFromTitleBarOnly = true). + - Left-click outside popup: Close popup stack (right-click over underlying popup: Partially close popup stack). + + - TEXT EDITOR + - Hold SHIFT or Drag Mouse: Select text. + - CTRL+Left/Right: Word jump. + - CTRL+Shift+Left/Right: Select words. + - CTRL+A or Double-Click: Select All. + - CTRL+X, CTRL+C, CTRL+V: Use OS clipboard. + - CTRL+Z, CTRL+Y: Undo, Redo. + - ESCAPE: Revert text to its original value. + - On OSX, controls are automatically adjusted to match standard OSX text editing shortcuts and behaviors. + + - KEYBOARD CONTROLS + - Basic: + - Tab, SHIFT+Tab Cycle through text editable fields. + - CTRL+Tab, CTRL+Shift+Tab Cycle through windows. + - CTRL+Click Input text into a Slider or Drag widget. + - Extended features with `io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard`: + - Tab, SHIFT+Tab: Cycle through every items. + - Arrow keys Move through items using directional navigation. Tweak value. + - Arrow keys + Alt, Shift Tweak slower, tweak faster (when using arrow keys). + - Enter Activate item (prefer text input when possible). + - Space Activate item (prefer tweaking with arrows when possible). + - Escape Deactivate item, leave child window, close popup. + - Page Up, Page Down Previous page, next page. + - Home, End Scroll to top, scroll to bottom. + - Alt Toggle between scrolling layer and menu layer. + - CTRL+Tab then Ctrl+Arrows Move window. Hold SHIFT to resize instead of moving. + - Output when ImGuiConfigFlags_NavEnableKeyboard set, + - io.WantCaptureKeyboard flag is set when keyboard is claimed. + - io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set. + - io.NavVisible: true when the navigation cursor is visible (usually goes to back false when mouse is used). + + - GAMEPAD CONTROLS + - Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. + - Particularly useful to use Dear ImGui on a console system (e.g. PlayStation, Switch, Xbox) without a mouse! + - Download controller mapping PNG/PSD at http://dearimgui.com/controls_sheets + - Backend support: backend needs to: + - Set 'io.BackendFlags |= ImGuiBackendFlags_HasGamepad' + call io.AddKeyEvent/AddKeyAnalogEvent() with ImGuiKey_Gamepad_XXX keys. + - For analog values (0.0f to 1.0f), backend is responsible to handling a dead-zone and rescaling inputs accordingly. + Backend code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.). + - BEFORE 1.87, BACKENDS USED TO WRITE TO io.NavInputs[]. This is now obsolete. Please call io functions instead! + - If you need to share inputs between your game and the Dear ImGui interface, the easiest approach is to go all-or-nothing, + with a buttons combo to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved. + + - REMOTE INPUTS SHARING & MOUSE EMULATION + - PS4/PS5 users: Consider emulating a mouse cursor with DualShock touch pad or a spare analog stick as a mouse-emulation fallback. + - Consoles/Tablet/Phone users: Consider using a Synergy 1.x server (on your PC) + run examples/libs/synergy/uSynergy.c (on your console/tablet/phone app) + in order to share your PC mouse/keyboard. + - See https://github.com/ocornut/imgui/wiki/Useful-Extensions#remoting for other remoting solutions. + - On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the ImGuiConfigFlags_NavEnableSetMousePos flag. + Enabling ImGuiConfigFlags_NavEnableSetMousePos + ImGuiBackendFlags_HasSetMousePos instructs Dear ImGui to move your mouse cursor along with navigation movements. + When enabled, the NewFrame() function may alter 'io.MousePos' and set 'io.WantSetMousePos' to notify you that it wants the mouse cursor to be moved. + When that happens your backend NEEDS to move the OS or underlying mouse cursor on the next frame. Some of the backends in examples/ do that. + (If you set the NavEnableSetMousePos flag but don't honor 'io.WantSetMousePos' properly, Dear ImGui will misbehave as it will see your mouse moving back & forth!) + (In a setup when you may not have easy control over the mouse cursor, e.g. uSynergy.c doesn't expose moving remote mouse cursor, you may want + to set a boolean to ignore your other external mouse positions until the external source is moved again.) PROGRAMMER GUIDE @@ -237,7 +286,7 @@ CODE // Build and load the texture atlas into a texture // (In the examples/ app this is usually done within the ImGui_ImplXXX_Init() function from one of the demo Renderer) int width, height; - unsigned char* pixels = NULL; + unsigned char* pixels = nullptr; io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // At this point you've got the texture data and you need to upload that to your graphic system: @@ -254,9 +303,9 @@ CODE io.DeltaTime = 1.0f/60.0f; // set the time elapsed since the previous frame (in seconds) io.DisplaySize.x = 1920.0f; // set the current display width io.DisplaySize.y = 1280.0f; // set the current display height here - io.MousePos = my_mouse_pos; // set the mouse position - io.MouseDown[0] = my_mouse_buttons[0]; // set the mouse button states - io.MouseDown[1] = my_mouse_buttons[1]; + io.AddMousePosEvent(mouse_x, mouse_y); // update mouse position + io.AddMouseButtonEvent(0, mouse_b[0]); // update mouse button states + io.AddMouseButtonEvent(1, mouse_b[1]); // update mouse button states // Call NewFrame(), after this point you can use ImGui::* functions anytime // (So you want to try calling NewFrame() as early as you can in your main loop to be able to use Dear ImGui everywhere) @@ -288,12 +337,14 @@ CODE --------------------------------------------- The backends in impl_impl_XXX.cpp files contain many working implementations of a rendering function. - void void MyImGuiRenderFunction(ImDrawData* draw_data) + void MyImGuiRenderFunction(ImDrawData* draw_data) { // TODO: Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled + // TODO: Setup texture sampling state: sample with bilinear filtering (NOT point/nearest filtering). Use 'io.Fonts->Flags |= ImFontAtlasFlags_NoBakedLines;' to allow point/nearest filtering. // TODO: Setup viewport covering draw_data->DisplayPos to draw_data->DisplayPos + draw_data->DisplaySize // TODO: Setup orthographic projection matrix cover draw_data->DisplayPos to draw_data->DisplayPos + draw_data->DisplaySize // TODO: Setup shader: vertex { float2 pos, float2 uv, u32 color }, fragment shader sample color from 1 texture, multiply by vertex color. + ImVec2 clip_off = draw_data->DisplayPos; for (int n = 0; n < draw_data->CmdListsCount; n++) { const ImDrawList* cmd_list = draw_data->CmdLists[n]; @@ -308,9 +359,11 @@ CODE } else { - // The texture for the draw call is specified by pcmd->GetTexID(). - // The vast majority of draw calls will use the Dear ImGui texture atlas, which value you have set yourself during initialization. - MyEngineBindTexture((MyTexture*)pcmd->GetTexID()); + // Project scissor/clipping rectangles into framebuffer space + ImVec2 clip_min(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y); + ImVec2 clip_max(pcmd->ClipRect.z - clip_off.x, pcmd->ClipRect.w - clip_off.y); + if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y) + continue; // We are using scissoring to clip some objects. All low-level graphics API should support it. // - If your engine doesn't support scissoring yet, you may ignore this at first. You will get some small glitches @@ -321,57 +374,21 @@ CODE // - In the interest of supporting multi-viewport applications (see 'docking' branch on github), // always subtract draw_data->DisplayPos from clipping bounds to convert them to your viewport space. // - Note that pcmd->ClipRect contains Min+Max bounds. Some graphics API may use Min+Max, other may use Min+Size (size being Max-Min) - ImVec2 pos = draw_data->DisplayPos; - MyEngineScissor((int)(pcmd->ClipRect.x - pos.x), (int)(pcmd->ClipRect.y - pos.y), (int)(pcmd->ClipRect.z - pos.x), (int)(pcmd->ClipRect.w - pos.y)); + MyEngineSetScissor(clip_min.x, clip_min.y, clip_max.x, clip_max.y); + + // The texture for the draw call is specified by pcmd->GetTexID(). + // The vast majority of draw calls will use the Dear ImGui texture atlas, which value you have set yourself during initialization. + MyEngineBindTexture((MyTexture*)pcmd->GetTexID()); // Render 'pcmd->ElemCount/3' indexed triangles. // By default the indices ImDrawIdx are 16-bit, you can change them to 32-bit in imconfig.h if your engine doesn't support 16-bit indices. - MyEngineDrawIndexedTriangles(pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer, vtx_buffer); + MyEngineDrawIndexedTriangles(pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer + pcmd->IdxOffset, vtx_buffer, pcmd->VtxOffset); } - idx_buffer += pcmd->ElemCount; } } } - USING GAMEPAD/KEYBOARD NAVIGATION CONTROLS - ------------------------------------------ - - The gamepad/keyboard navigation is fairly functional and keeps being improved. - - Gamepad support is particularly useful to use Dear ImGui on a console system (e.g. PS4, Switch, XB1) without a mouse! - - You can ask questions and report issues at https://github.com/ocornut/imgui/issues/787 - - The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable. - - Keyboard: - - Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. - NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays. - - When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag - will be set. For more advanced uses, you may want to read from: - - io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set. - - io.NavVisible: true when the navigation cursor is visible (and usually goes false when mouse is used). - - or query focus information with e.g. IsWindowFocused(ImGuiFocusedFlags_AnyWindow), IsItemFocused() etc. functions. - Please reach out if you think the game vs navigation input sharing could be improved. - - Gamepad: - - Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. - - Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + fill the io.NavInputs[] fields before calling NewFrame(). - Note that io.NavInputs[] is cleared by EndFrame(). - - See 'enum ImGuiNavInput_' in imgui.h for a description of inputs. For each entry of io.NavInputs[], set the following values: - 0.0f= not held. 1.0f= fully held. Pass intermediate 0.0f..1.0f values for analog triggers/sticks. - - We use a simple >0.0f test for activation testing, and won't attempt to test for a dead-zone. - Your code will probably need to transform your raw inputs (such as e.g. remapping your 0.2..0.9 raw input range to 0.0..1.0 imgui range, etc.). - - You can download PNG/PSD files depicting the gamepad controls for common controllers at: http://dearimgui.org/controls_sheets - - If you need to share inputs between your game and the imgui parts, the easiest approach is to go all-or-nothing, with a buttons combo - to toggle the target. Please reach out if you think the game vs navigation input sharing could be improved. - - Mouse: - - PS4 users: Consider emulating a mouse cursor with DualShock4 touch pad or a spare analog stick as a mouse-emulation fallback. - - Consoles/Tablet/Phone users: Consider using a Synergy 1.x server (on your PC) + uSynergy.c (on your console/tablet/phone app) to share your PC mouse/keyboard. - - On a TV/console system where readability may be lower or mouse inputs may be awkward, you may want to set the ImGuiConfigFlags_NavEnableSetMousePos flag. - Enabling ImGuiConfigFlags_NavEnableSetMousePos + ImGuiBackendFlags_HasSetMousePos instructs dear imgui to move your mouse cursor along with navigation movements. - When enabled, the NewFrame() function may alter 'io.MousePos' and set 'io.WantSetMousePos' to notify you that it wants the mouse cursor to be moved. - When that happens your backend NEEDS to move the OS or underlying mouse cursor on the next frame. Some of the backends in examples/ do that. - (If you set the NavEnableSetMousePos flag but don't honor 'io.WantSetMousePos' properly, imgui will misbehave as it will see your mouse moving back and forth!) - (In a setup when you may not have easy control over the mouse cursor, e.g. uSynergy.c doesn't expose moving remote mouse cursor, you may want - to set a boolean to ignore your other external mouse positions until the external source is moved again.) - - API BREAKING CHANGES ==================== @@ -380,6 +397,93 @@ CODE When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files. You can read releases logs https://github.com/ocornut/imgui/releases for more details. + - 2023/03/14 (1.89.4) - commented out redirecting enums/functions names that were marked obsolete two years ago: + - ImGuiSliderFlags_ClampOnInput -> use ImGuiSliderFlags_AlwaysClamp + - ImGuiInputTextFlags_AlwaysInsertMode -> use ImGuiInputTextFlags_AlwaysOverwrite + - ImDrawList::AddBezierCurve() -> use ImDrawList::AddBezierCubic() + - ImDrawList::PathBezierCurveTo() -> use ImDrawList::PathBezierCubicCurveTo() + - 2023/03/09 (1.89.4) - renamed PushAllowKeyboardFocus()/PopAllowKeyboardFocus() to PushTabStop()/PopTabStop(). Kept inline redirection functions (will obsolete). + - 2023/03/09 (1.89.4) - tooltips: Added 'bool' return value to BeginTooltip() for API consistency. Please only submit contents and call EndTooltip() if BeginTooltip() returns true. In reality the function will _currently_ always return true, but further changes down the line may change this, best to clarify API sooner. + - 2023/02/15 (1.89.4) - moved the optional "courtesy maths operators" implementation from imgui_internal.h in imgui.h. + Even though we encourage using your own maths types and operators by setting up IM_VEC2_CLASS_EXTRA, + it has been frequently requested by people to use our own. We had an opt-in define which was + previously fulfilled in imgui_internal.h. It is now fulfilled in imgui.h. (#6164) + - OK: #define IMGUI_DEFINE_MATH_OPERATORS / #include "imgui.h" / #include "imgui_internal.h" + - Error: #include "imgui.h" / #define IMGUI_DEFINE_MATH_OPERATORS / #include "imgui_internal.h" + - 2023/02/07 (1.89.3) - backends: renamed "imgui_impl_sdl.cpp" to "imgui_impl_sdl2.cpp" and "imgui_impl_sdl.h" to "imgui_impl_sdl2.h". (#6146) This is in prevision for the future release of SDL3. + - 2022/10/26 (1.89) - commented out redirecting OpenPopupContextItem() which was briefly the name of OpenPopupOnItemClick() from 1.77 to 1.79. + - 2022/10/12 (1.89) - removed runtime patching of invalid "%f"/"%0.f" format strings for DragInt()/SliderInt(). This was obsoleted in 1.61 (May 2018). See 1.61 changelog for details. + - 2022/09/26 (1.89) - renamed and merged keyboard modifiers key enums and flags into a same set. Kept inline redirection enums (will obsolete). + - ImGuiKey_ModCtrl and ImGuiModFlags_Ctrl -> ImGuiMod_Ctrl + - ImGuiKey_ModShift and ImGuiModFlags_Shift -> ImGuiMod_Shift + - ImGuiKey_ModAlt and ImGuiModFlags_Alt -> ImGuiMod_Alt + - ImGuiKey_ModSuper and ImGuiModFlags_Super -> ImGuiMod_Super + the ImGuiKey_ModXXX were introduced in 1.87 and mostly used by backends. + the ImGuiModFlags_XXX have been exposed in imgui.h but not really used by any public api only by third-party extensions. + exceptionally commenting out the older ImGuiKeyModFlags_XXX names ahead of obsolescence schedule to reduce confusion and because they were not meant to be used anyway. + - 2022/09/20 (1.89) - ImGuiKey is now a typed enum, allowing ImGuiKey_XXX symbols to be named in debuggers. + this will require uses of legacy backend-dependent indices to be casted, e.g. + - with imgui_impl_glfw: IsKeyPressed(GLFW_KEY_A) -> IsKeyPressed((ImGuiKey)GLFW_KEY_A); + - with imgui_impl_win32: IsKeyPressed('A') -> IsKeyPressed((ImGuiKey)'A') + - etc. However if you are upgrading code you might well use the better, backend-agnostic IsKeyPressed(ImGuiKey_A) now! + - 2022/09/12 (1.89) - removed the bizarre legacy default argument for 'TreePush(const void* ptr = NULL)', always pass a pointer value explicitly. NULL/nullptr is ok but require cast, e.g. TreePush((void*)nullptr); + - 2022/09/05 (1.89) - commented out redirecting functions/enums names that were marked obsolete in 1.77 and 1.78 (June 2020): + - DragScalar(), DragScalarN(), DragFloat(), DragFloat2(), DragFloat3(), DragFloat4(): For old signatures ending with (..., const char* format, float power = 1.0f) -> use (..., format ImGuiSliderFlags_Logarithmic) if power != 1.0f. + - SliderScalar(), SliderScalarN(), SliderFloat(), SliderFloat2(), SliderFloat3(), SliderFloat4(): For old signatures ending with (..., const char* format, float power = 1.0f) -> use (..., format ImGuiSliderFlags_Logarithmic) if power != 1.0f. + - BeginPopupContextWindow(const char*, ImGuiMouseButton, bool) -> use BeginPopupContextWindow(const char*, ImGuiPopupFlags) + - 2022/09/02 (1.89) - obsoleted using SetCursorPos()/SetCursorScreenPos() to extend parent window/cell boundaries. + this relates to when moving the cursor position beyond current boundaries WITHOUT submitting an item. + - previously this would make the window content size ~200x200: + Begin(...) + SetCursorScreenPos(GetCursorScreenPos() + ImVec2(200,200)) + End(); + - instead, please submit an item: + Begin(...) + SetCursorScreenPos(GetCursorScreenPos() + ImVec2(200,200)) + Dummy(ImVec2(0,0)) + End(); + - alternative: + Begin(...) + Dummy(ImVec2(200,200)) + End(); + - content size is now only extended when submitting an item! + - with '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' this will now be detected and assert. + - without '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' this will silently be fixed until we obsolete it. + - 2022/08/03 (1.89) - changed signature of ImageButton() function. Kept redirection function (will obsolete). + - added 'const char* str_id' parameter + removed 'int frame_padding = -1' parameter. + - old signature: bool ImageButton(ImTextureID tex_id, ImVec2 size, ImVec2 uv0 = ImVec2(0,0), ImVec2 uv1 = ImVec2(1,1), int frame_padding = -1, ImVec4 bg_col = ImVec4(0,0,0,0), ImVec4 tint_col = ImVec4(1,1,1,1)); + - used the ImTextureID value to create an ID. This was inconsistent with other functions, led to ID conflicts, and caused problems with engines using transient ImTextureID values. + - had a FramePadding override which was inconsistent with other functions and made the already-long signature even longer. + - new signature: bool ImageButton(const char* str_id, ImTextureID tex_id, ImVec2 size, ImVec2 uv0 = ImVec2(0,0), ImVec2 uv1 = ImVec2(1,1), ImVec4 bg_col = ImVec4(0,0,0,0), ImVec4 tint_col = ImVec4(1,1,1,1)); + - requires an explicit identifier. You may still use e.g. PushID() calls and then pass an empty identifier. + - always uses style.FramePadding for padding, to be consistent with other buttons. You may use PushStyleVar() to alter this. + - 2022/07/08 (1.89) - inputs: removed io.NavInputs[] and ImGuiNavInput enum (following 1.87 changes). + - Official backends from 1.87+ -> no issue. + - Official backends from 1.60 to 1.86 -> will build and convert gamepad inputs, unless IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Need updating! + - Custom backends not writing to io.NavInputs[] -> no issue. + - Custom backends writing to io.NavInputs[] -> will build and convert gamepad inputs, unless IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Need fixing! + - TL;DR: Backends should call io.AddKeyEvent()/io.AddKeyAnalogEvent() with ImGuiKey_GamepadXXX values instead of filling io.NavInput[]. + - 2022/06/15 (1.88) - renamed IMGUI_DISABLE_METRICS_WINDOW to IMGUI_DISABLE_DEBUG_TOOLS for correctness. kept support for old define (will obsolete). + - 2022/05/03 (1.88) - backends: osx: removed ImGui_ImplOSX_HandleEvent() from backend API in favor of backend automatically handling event capture. All ImGui_ImplOSX_HandleEvent() calls should be removed as they are now unnecessary. + - 2022/04/05 (1.88) - inputs: renamed ImGuiKeyModFlags to ImGuiModFlags. Kept inline redirection enums (will obsolete). This was never used in public API functions but technically present in imgui.h and ImGuiIO. + - 2022/01/20 (1.87) - inputs: reworded gamepad IO. + - Backend writing to io.NavInputs[] -> backend should call io.AddKeyEvent()/io.AddKeyAnalogEvent() with ImGuiKey_GamepadXXX values. + - 2022/01/19 (1.87) - sliders, drags: removed support for legacy arithmetic operators (+,+-,*,/) when inputing text. This doesn't break any api/code but a feature that used to be accessible by end-users (which seemingly no one used). + - 2022/01/17 (1.87) - inputs: reworked mouse IO. + - Backend writing to io.MousePos -> backend should call io.AddMousePosEvent() + - Backend writing to io.MouseDown[] -> backend should call io.AddMouseButtonEvent() + - Backend writing to io.MouseWheel -> backend should call io.AddMouseWheelEvent() + - Backend writing to io.MouseHoveredViewport -> backend should call io.AddMouseViewportEvent() [Docking branch w/ multi-viewports only] + note: for all calls to IO new functions, the Dear ImGui context should be bound/current. + read https://github.com/ocornut/imgui/issues/4921 for details. + - 2022/01/10 (1.87) - inputs: reworked keyboard IO. Removed io.KeyMap[], io.KeysDown[] in favor of calling io.AddKeyEvent(). Removed GetKeyIndex(), now unecessary. All IsKeyXXX() functions now take ImGuiKey values. All features are still functional until IMGUI_DISABLE_OBSOLETE_KEYIO is defined. Read Changelog and Release Notes for details. + - IsKeyPressed(MY_NATIVE_KEY_XXX) -> use IsKeyPressed(ImGuiKey_XXX) + - IsKeyPressed(GetKeyIndex(ImGuiKey_XXX)) -> use IsKeyPressed(ImGuiKey_XXX) + - Backend writing to io.KeyMap[],io.KeysDown[] -> backend should call io.AddKeyEvent() (+ call io.SetKeyEventNativeData() if you want legacy user code to stil function with legacy key codes). + - Backend writing to io.KeyCtrl, io.KeyShift.. -> backend should call io.AddKeyEvent() with ImGuiMod_XXX values. *IF YOU PULLED CODE BETWEEN 2021/01/10 and 2021/01/27: We used to have a io.AddKeyModsEvent() function which was now replaced by io.AddKeyEvent() with ImGuiMod_XXX values.* + - one case won't work with backward compatibility: if your custom backend used ImGuiKey as mock native indices (e.g. "io.KeyMap[ImGuiKey_A] = ImGuiKey_A") because those values are now larger than the legacy KeyDown[] array. Will assert. + - inputs: added ImGuiKey_ModCtrl/ImGuiKey_ModShift/ImGuiKey_ModAlt/ImGuiKey_ModSuper values to submit keyboard modifiers using io.AddKeyEvent(), instead of writing directly to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper. + - 2022/01/05 (1.87) - inputs: renamed ImGuiKey_KeyPadEnter to ImGuiKey_KeypadEnter to align with new symbols. Kept redirection enum. + - 2022/01/05 (1.87) - removed io.ImeSetInputScreenPosFn() in favor of more flexible io.SetPlatformImeDataFn(). Removed 'void* io.ImeWindowHandle' in favor of writing to 'void* ImGuiViewport::PlatformHandleRaw'. + - 2022/01/01 (1.87) - commented out redirecting functions/enums names that were marked obsolete in 1.69, 1.70, 1.71, 1.72 (March-July 2019) + - ImGui::SetNextTreeNodeOpen() -> use ImGui::SetNextItemOpen() + - ImGui::GetContentRegionAvailWidth() -> use ImGui::GetContentRegionAvail().x + - ImGui::TreeAdvanceToLabelPos() -> use ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetTreeNodeToLabelSpacing()); + - ImFontAtlas::CustomRect -> use ImFontAtlasCustomRect + - ImGuiColorEditFlags_RGB/HSV/HEX -> use ImGuiColorEditFlags_DisplayRGB/HSV/Hex - 2021/12/20 (1.86) - backends: removed obsolete Marmalade backend (imgui_impl_marmalade.cpp) + example. Find last supported version at https://github.com/ocornut/imgui/wiki/Bindings - 2021/11/04 (1.86) - removed CalcListClipping() function. Prefer using ImGuiListClipper which can return non-contiguous ranges. Please open an issue if you think you really need this function. - 2021/08/23 (1.85) - removed GetWindowContentRegionWidth() function. keep inline redirection helper. can use 'GetWindowContentRegionMax().x - GetWindowContentRegionMin().x' instead for generally 'GetContentRegionAvail().x' is more useful. @@ -679,7 +783,7 @@ CODE ================================ Read all answers online: - https://www.dearimgui.org/faq or https://github.com/ocornut/imgui/blob/master/docs/FAQ.md (same url) + https://www.dearimgui.com/faq or https://github.com/ocornut/imgui/blob/master/docs/FAQ.md (same url) Read all answers locally (with a text editor or ideally a Markdown viewer): docs/FAQ.md Some answers are copied down here to facilitate searching in code. @@ -703,7 +807,7 @@ CODE Q: What is this library called? Q: Which version should I get? >> This library is called "Dear ImGui", please don't call it "ImGui" :) - >> See https://www.dearimgui.org/faq for details. + >> See https://www.dearimgui.com/faq for details. Q&A: Integration ================ @@ -713,14 +817,14 @@ CODE Q: How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application? A: You should read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags! - >> See https://www.dearimgui.org/faq for a fully detailed answer. You really want to read this. + >> See https://www.dearimgui.com/faq for a fully detailed answer. You really want to read this. Q. How can I enable keyboard controls? Q: How can I use this without a mouse, without a keyboard or without a screen? (gamepad, input share, remote display) Q: I integrated Dear ImGui in my engine and little squares are showing instead of text... Q: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around... Q: I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries... - >> See https://www.dearimgui.org/faq + >> See https://www.dearimgui.com/faq Q&A: Usage ---------- @@ -730,11 +834,11 @@ CODE - How can I have widgets with an empty label? - How can I have multiple widgets with the same label? - How can I have multiple windows with the same label? - Q: How can I display an image? What is ImTextureID, how does it works? + Q: How can I display an image? What is ImTextureID, how does it work? Q: How can I use my own math types instead of ImVec2/ImVec4? Q: How can I interact with standard C++ types (such as std::string and std::vector)? Q: How can I display custom shapes? (using low-level ImDrawList API) - >> See https://www.dearimgui.org/faq + >> See https://www.dearimgui.com/faq Q&A: Fonts, Text ================ @@ -744,7 +848,7 @@ CODE Q: How can I easily use icons in my application? Q: How can I load multiple fonts? Q: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic? - >> See https://www.dearimgui.org/faq and https://github.com/ocornut/imgui/edit/master/docs/FONTS.md + >> See https://www.dearimgui.com/faq and https://github.com/ocornut/imgui/edit/master/docs/FONTS.md Q&A: Concerns ============= @@ -753,7 +857,7 @@ CODE Q: Can you create elaborate/serious tools with Dear ImGui? Q: Can you reskin the look of Dear ImGui? Q: Why using C++ (as opposed to C)? - >> See https://www.dearimgui.org/faq + >> See https://www.dearimgui.com/faq Q&A: Community ============== @@ -780,16 +884,15 @@ CODE #define _CRT_SECURE_NO_WARNINGS #endif -#include "imgui.h" -#ifndef IMGUI_DISABLE - #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif + +#include "imgui.h" +#ifndef IMGUI_DISABLE #include "imgui_internal.h" // System includes -#include // toupper #include // vsnprintf, sscanf, printf #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier #include // intptr_t @@ -836,7 +939,7 @@ CODE #if defined(_MSC_VER) && _MSC_VER >= 1922 // MSVC 2019 16.2 or later #pragma warning (disable: 5054) // operator '|': deprecated between enumerations of different types #endif -#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2). +#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to an 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2). #pragma warning (disable: 26495) // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6). #pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3). #endif @@ -859,7 +962,7 @@ CODE #pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double. #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision #elif defined(__GNUC__) -// We disable -Wpragmas because GCC doesn't provide an has_warning equivalent and some forks/patches may not following the warning/version association. +// We disable -Wpragmas because GCC doesn't provide a has_warning equivalent and some forks/patches may not follow the warning/version association. #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size @@ -883,7 +986,7 @@ static const float NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15f; // Time // Window resizing from edges (when io.ConfigWindowsResizeFromEdges = true and ImGuiBackendFlags_HasMouseCursors is set in io.BackendFlags by backend) static const float WINDOWS_HOVER_PADDING = 4.0f; // Extend outside window for hovering/resizing (maxxed with TouchPadding) and inside windows for borders. Affect FindHoveredWindow(). static const float WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER = 0.04f; // Reduce visual noise by only highlighting the border after a certain time. -static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 2.00f; // Lock scrolled window (so it doesn't pick child windows that are scrolling through) for a certain time, unless mouse moved. +static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 0.70f; // Lock scrolled window (so it doesn't pick child windows that are scrolling through) for a certain time, unless mouse moved. //------------------------------------------------------------------------- // [SECTION] FORWARD DECLARATIONS @@ -905,9 +1008,9 @@ static void WindowSettingsHandler_ApplyAll(ImGuiContext*, ImGuiSetti static void WindowSettingsHandler_WriteAll(ImGuiContext*, ImGuiSettingsHandler*, ImGuiTextBuffer* buf); // Platform Dependents default implementation for IO functions -static const char* GetClipboardTextFn_DefaultImpl(void* user_data); -static void SetClipboardTextFn_DefaultImpl(void* user_data, const char* text); -static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y); +static const char* GetClipboardTextFn_DefaultImpl(void* user_data_ctx); +static void SetClipboardTextFn_DefaultImpl(void* user_data_ctx, const char* text); +static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport* viewport, ImGuiPlatformImeData* data); namespace ImGui { @@ -925,7 +1028,7 @@ static void NavEndFrame(); static bool NavScoreItem(ImGuiNavItemData* result); static void NavApplyItemToResult(ImGuiNavItemData* result); static void NavProcessItem(); -static void NavProcessItemForTabbingRequest(ImGuiID id); +static void NavProcessItemForTabbingRequest(ImGuiID id, ImGuiItemFlags item_flags, ImGuiNavMoveFlags move_flags); static ImVec2 NavCalcPreferredRefPos(); static void NavSaveLastChildNavWindowIntoParent(ImGuiWindow* nav_window); static ImGuiWindow* NavRestoreLastChildNavWindow(ImGuiWindow* window); @@ -939,13 +1042,17 @@ static void ErrorCheckEndFrameSanityChecks(); static void UpdateDebugToolItemPicker(); static void UpdateDebugToolStackQueries(); -// Misc -static void UpdateSettings(); +// Inputs +static void UpdateKeyboardInputs(); static void UpdateMouseInputs(); static void UpdateMouseWheel(); +static void UpdateKeyRoutingTable(ImGuiKeyRoutingTable* rt); + +// Misc +static void UpdateSettings(); static bool UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect); static void RenderWindowOuterBorders(ImGuiWindow* window); -static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size); +static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size); static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open); static void RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 col); static void RenderDimmedBackgrounds(); @@ -1027,20 +1134,23 @@ ImGuiStyle::ImGuiStyle() ColumnsMinSpacing = 6.0f; // Minimum horizontal spacing between two columns. Preferably > (FramePadding.x + 1). ScrollbarSize = 14.0f; // Width of the vertical scrollbar, Height of the horizontal scrollbar ScrollbarRounding = 9.0f; // Radius of grab corners rounding for scrollbar - GrabMinSize = 10.0f; // Minimum width/height of a grab box for slider/scrollbar + GrabMinSize = 12.0f; // Minimum width/height of a grab box for slider/scrollbar GrabRounding = 0.0f; // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs. LogSliderDeadzone = 4.0f; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero. TabRounding = 4.0f; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. TabBorderSize = 0.0f; // Thickness of border around tabs. - TabMinWidthForCloseButton = 0.0f; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected. + TabMinWidthForCloseButton = 0.0f; // Minimum width for close button to appear on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected. ColorButtonPosition = ImGuiDir_Right; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text. SelectableTextAlign = ImVec2(0.0f,0.0f);// Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line. + SeparatorTextBorderSize = 3.0f; // Thickkness of border in SeparatorText() + SeparatorTextAlign = ImVec2(0.0f,0.5f);// Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center). + SeparatorTextPadding = ImVec2(20.0f,3.f);// Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y. DisplayWindowPadding = ImVec2(19,19); // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows. DisplaySafeAreaPadding = ImVec2(3,3); // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows. MouseCursorScale = 1.0f; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. AntiAliasedLines = true; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. - AntiAliasedLinesUseTex = true; // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering. + AntiAliasedLinesUseTex = true; // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). AntiAliasedFill = true; // Enable anti-aliased filled shapes (rounded rectangles, circles, etc.). CurveTessellationTol = 1.25f; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. CircleTessellationMaxError = 0.30f; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. @@ -1073,6 +1183,7 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor) LogSliderDeadzone = ImFloor(LogSliderDeadzone * scale_factor); TabRounding = ImFloor(TabRounding * scale_factor); TabMinWidthForCloseButton = (TabMinWidthForCloseButton != FLT_MAX) ? ImFloor(TabMinWidthForCloseButton * scale_factor) : FLT_MAX; + SeparatorTextPadding = ImFloor(SeparatorTextPadding * scale_factor); DisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor); DisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor); MouseCursorScale = ImFloor(MouseCursorScale * scale_factor); @@ -1082,7 +1193,7 @@ ImGuiIO::ImGuiIO() { // Most fields are initialized with zero memset(this, 0, sizeof(*this)); - IM_ASSERT(IM_ARRAYSIZE(ImGuiIO::MouseDown) == ImGuiMouseButton_COUNT && IM_ARRAYSIZE(ImGuiIO::MouseClicked) == ImGuiMouseButton_COUNT); // Our pre-C++11 IM_STATIC_ASSERT() macros triggers warning on modern compilers so we don't use it here. + IM_STATIC_ASSERT(IM_ARRAYSIZE(ImGuiIO::MouseDown) == ImGuiMouseButton_COUNT && IM_ARRAYSIZE(ImGuiIO::MouseClicked) == ImGuiMouseButton_COUNT); // Settings ConfigFlags = ImGuiConfigFlags_None; @@ -1094,10 +1205,14 @@ ImGuiIO::ImGuiIO() LogFilename = "imgui_log.txt"; MouseDoubleClickTime = 0.30f; MouseDoubleClickMaxDist = 6.0f; +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO for (int i = 0; i < ImGuiKey_COUNT; i++) KeyMap[i] = -1; +#endif KeyRepeatDelay = 0.275f; KeyRepeatRate = 0.050f; + HoverDelayNormal = 0.30f; + HoverDelayShort = 0.10f; UserData = NULL; Fonts = NULL; @@ -1113,49 +1228,63 @@ ImGuiIO::ImGuiIO() #else ConfigMacOSXBehaviors = false; #endif + ConfigInputTrickleEventQueue = true; ConfigInputTextCursorBlink = true; + ConfigInputTextEnterKeepActive = false; + ConfigDragClickToInputText = false; ConfigWindowsResizeFromEdges = true; ConfigWindowsMoveFromTitleBarOnly = false; ConfigMemoryCompactTimer = 60.0f; + ConfigDebugBeginReturnValueOnce = false; + ConfigDebugBeginReturnValueLoop = false; // Platform Functions + // Note: Initialize() will setup default clipboard/ime handlers. BackendPlatformName = BackendRendererName = NULL; BackendPlatformUserData = BackendRendererUserData = BackendLanguageUserData = NULL; - GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations - SetClipboardTextFn = SetClipboardTextFn_DefaultImpl; - ClipboardUserData = NULL; - ImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl; - ImeWindowHandle = NULL; // Input (NB: we already have memset zero the entire structure!) MousePos = ImVec2(-FLT_MAX, -FLT_MAX); MousePosPrev = ImVec2(-FLT_MAX, -FLT_MAX); + MouseSource = ImGuiMouseSource_Mouse; MouseDragThreshold = 6.0f; for (int i = 0; i < IM_ARRAYSIZE(MouseDownDuration); i++) MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f; - for (int i = 0; i < IM_ARRAYSIZE(KeysDownDuration); i++) KeysDownDuration[i] = KeysDownDurationPrev[i] = -1.0f; - for (int i = 0; i < IM_ARRAYSIZE(NavInputsDownDuration); i++) NavInputsDownDuration[i] = -1.0f; + for (int i = 0; i < IM_ARRAYSIZE(KeysData); i++) { KeysData[i].DownDuration = KeysData[i].DownDurationPrev = -1.0f; } + AppAcceptingEvents = true; + BackendUsingLegacyKeyArrays = (ImS8)-1; + BackendUsingLegacyNavInputArray = true; // assume using legacy array until proven wrong } // Pass in translated ASCII characters for text input. // - with glfw you can get those from the callback set in glfwSetCharCallback() // - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message +// FIXME: Should in theory be called "AddCharacterEvent()" to be consistent with new API void ImGuiIO::AddInputCharacter(unsigned int c) { - if (c != 0) - InputQueueCharacters.push_back(c <= IM_UNICODE_CODEPOINT_MAX ? (ImWchar)c : IM_UNICODE_CODEPOINT_INVALID); + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; + if (c == 0 || !AppAcceptingEvents) + return; + + ImGuiInputEvent e; + e.Type = ImGuiInputEventType_Text; + e.Source = ImGuiInputSource_Keyboard; + e.EventId = g.InputEventsNextEventId++; + e.Text.Char = c; + g.InputEventsQueue.push_back(e); } // UTF16 strings use surrogate pairs to encode codepoints >= 0x10000, so // we should save the high surrogate. void ImGuiIO::AddInputCharacterUTF16(ImWchar16 c) { - if (c == 0 && InputQueueSurrogate == 0) + if ((c == 0 && InputQueueSurrogate == 0) || !AppAcceptingEvents) return; if ((c & 0xFC00) == 0xD800) // High surrogate, must save { if (InputQueueSurrogate != 0) - InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID); + AddInputCharacter(IM_UNICODE_CODEPOINT_INVALID); InputQueueSurrogate = c; return; } @@ -1165,7 +1294,7 @@ void ImGuiIO::AddInputCharacterUTF16(ImWchar16 c) { if ((c & 0xFC00) != 0xDC00) // Invalid low surrogate { - InputQueueCharacters.push_back(IM_UNICODE_CODEPOINT_INVALID); + AddInputCharacter(IM_UNICODE_CODEPOINT_INVALID); } else { @@ -1178,41 +1307,248 @@ void ImGuiIO::AddInputCharacterUTF16(ImWchar16 c) InputQueueSurrogate = 0; } - InputQueueCharacters.push_back(cp); + AddInputCharacter((unsigned)cp); } void ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars) { + if (!AppAcceptingEvents) + return; while (*utf8_chars != 0) { unsigned int c = 0; utf8_chars += ImTextCharFromUtf8(&c, utf8_chars, NULL); - if (c != 0) - InputQueueCharacters.push_back((ImWchar)c); + AddInputCharacter(c); } } +// FIXME: Perhaps we could clear queued events as well? void ImGuiIO::ClearInputCharacters() { InputQueueCharacters.resize(0); } +// FIXME: Perhaps we could clear queued events as well? void ImGuiIO::ClearInputKeys() { +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO memset(KeysDown, 0, sizeof(KeysDown)); - for (int n = 0; n < IM_ARRAYSIZE(KeysDownDuration); n++) - KeysDownDuration[n] = KeysDownDurationPrev[n] = -1.0f; +#endif + for (int n = 0; n < IM_ARRAYSIZE(KeysData); n++) + { + KeysData[n].Down = false; + KeysData[n].DownDuration = -1.0f; + KeysData[n].DownDurationPrev = -1.0f; + } KeyCtrl = KeyShift = KeyAlt = KeySuper = false; - KeyMods = KeyModsPrev = ImGuiKeyModFlags_None; - for (int n = 0; n < IM_ARRAYSIZE(NavInputsDownDuration); n++) - NavInputsDownDuration[n] = NavInputsDownDurationPrev[n] = -1.0f; + KeyMods = ImGuiMod_None; + MousePos = ImVec2(-FLT_MAX, -FLT_MAX); + for (int n = 0; n < IM_ARRAYSIZE(MouseDown); n++) + { + MouseDown[n] = false; + MouseDownDuration[n] = MouseDownDurationPrev[n] = -1.0f; + } + MouseWheel = MouseWheelH = 0.0f; +} + +static ImGuiInputEvent* FindLatestInputEvent(ImGuiContext* ctx, ImGuiInputEventType type, int arg = -1) +{ + ImGuiContext& g = *ctx; + for (int n = g.InputEventsQueue.Size - 1; n >= 0; n--) + { + ImGuiInputEvent* e = &g.InputEventsQueue[n]; + if (e->Type != type) + continue; + if (type == ImGuiInputEventType_Key && e->Key.Key != arg) + continue; + if (type == ImGuiInputEventType_MouseButton && e->MouseButton.Button != arg) + continue; + return e; + } + return NULL; +} + +// Queue a new key down/up event. +// - ImGuiKey key: Translated key (as in, generally ImGuiKey_A matches the key end-user would use to emit an 'A' character) +// - bool down: Is the key down? use false to signify a key release. +// - float analog_value: 0.0f..1.0f +// IMPORTANT: THIS FUNCTION AND OTHER "ADD" GRABS THE CONTEXT FROM OUR INSTANCE. +// WE NEED TO ENSURE THAT ALL FUNCTION CALLS ARE FULLFILLING THIS, WHICH IS WHY GetKeyData() HAS AN EXPLICIT CONTEXT. +void ImGuiIO::AddKeyAnalogEvent(ImGuiKey key, bool down, float analog_value) +{ + //if (e->Down) { IMGUI_DEBUG_LOG_IO("AddKeyEvent() Key='%s' %d, NativeKeycode = %d, NativeScancode = %d\n", ImGui::GetKeyName(e->Key), e->Down, e->NativeKeycode, e->NativeScancode); } + IM_ASSERT(Ctx != NULL); + if (key == ImGuiKey_None || !AppAcceptingEvents) + return; + ImGuiContext& g = *Ctx; + IM_ASSERT(ImGui::IsNamedKeyOrModKey(key)); // Backend needs to pass a valid ImGuiKey_ constant. 0..511 values are legacy native key codes which are not accepted by this API. + IM_ASSERT(ImGui::IsAliasKey(key) == false); // Backend cannot submit ImGuiKey_MouseXXX values they are automatically inferred from AddMouseXXX() events. + IM_ASSERT(key != ImGuiMod_Shortcut); // We could easily support the translation here but it seems saner to not accept it (TestEngine perform a translation itself) + + // Verify that backend isn't mixing up using new io.AddKeyEvent() api and old io.KeysDown[] + io.KeyMap[] data. +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + IM_ASSERT((BackendUsingLegacyKeyArrays == -1 || BackendUsingLegacyKeyArrays == 0) && "Backend needs to either only use io.AddKeyEvent(), either only fill legacy io.KeysDown[] + io.KeyMap[]. Not both!"); + if (BackendUsingLegacyKeyArrays == -1) + for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_NamedKey_END; n++) + IM_ASSERT(KeyMap[n] == -1 && "Backend needs to either only use io.AddKeyEvent(), either only fill legacy io.KeysDown[] + io.KeyMap[]. Not both!"); + BackendUsingLegacyKeyArrays = 0; +#endif + if (ImGui::IsGamepadKey(key)) + BackendUsingLegacyNavInputArray = false; + + // Filter duplicate (in particular: key mods and gamepad analog values are commonly spammed) + const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_Key, (int)key); + const ImGuiKeyData* key_data = ImGui::GetKeyData(&g, key); + const bool latest_key_down = latest_event ? latest_event->Key.Down : key_data->Down; + const float latest_key_analog = latest_event ? latest_event->Key.AnalogValue : key_data->AnalogValue; + if (latest_key_down == down && latest_key_analog == analog_value) + return; + + // Add event + ImGuiInputEvent e; + e.Type = ImGuiInputEventType_Key; + e.Source = ImGui::IsGamepadKey(key) ? ImGuiInputSource_Gamepad : ImGuiInputSource_Keyboard; + e.EventId = g.InputEventsNextEventId++; + e.Key.Key = key; + e.Key.Down = down; + e.Key.AnalogValue = analog_value; + g.InputEventsQueue.push_back(e); +} + +void ImGuiIO::AddKeyEvent(ImGuiKey key, bool down) +{ + if (!AppAcceptingEvents) + return; + AddKeyAnalogEvent(key, down, down ? 1.0f : 0.0f); +} + +// [Optional] Call after AddKeyEvent(). +// Specify native keycode, scancode + Specify index for legacy <1.87 IsKeyXXX() functions with native indices. +// If you are writing a backend in 2022 or don't use IsKeyXXX() with native values that are not ImGuiKey values, you can avoid calling this. +void ImGuiIO::SetKeyEventNativeData(ImGuiKey key, int native_keycode, int native_scancode, int native_legacy_index) +{ + if (key == ImGuiKey_None) + return; + IM_ASSERT(ImGui::IsNamedKey(key)); // >= 512 + IM_ASSERT(native_legacy_index == -1 || ImGui::IsLegacyKey((ImGuiKey)native_legacy_index)); // >= 0 && <= 511 + IM_UNUSED(native_keycode); // Yet unused + IM_UNUSED(native_scancode); // Yet unused + + // Build native->imgui map so old user code can still call key functions with native 0..511 values. +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + const int legacy_key = (native_legacy_index != -1) ? native_legacy_index : native_keycode; + if (!ImGui::IsLegacyKey((ImGuiKey)legacy_key)) + return; + KeyMap[legacy_key] = key; + KeyMap[key] = legacy_key; +#else + IM_UNUSED(key); + IM_UNUSED(native_legacy_index); +#endif +} + +// Set master flag for accepting key/mouse/text events (default to true). Useful if you have native dialog boxes that are interrupting your application loop/refresh, and you want to disable events being queued while your app is frozen. +void ImGuiIO::SetAppAcceptingEvents(bool accepting_events) +{ + AppAcceptingEvents = accepting_events; +} + +// Queue a mouse move event +void ImGuiIO::AddMousePosEvent(float x, float y) +{ + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; + if (!AppAcceptingEvents) + return; + + // Apply same flooring as UpdateMouseInputs() + ImVec2 pos((x > -FLT_MAX) ? ImFloorSigned(x) : x, (y > -FLT_MAX) ? ImFloorSigned(y) : y); + + // Filter duplicate + const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_MousePos); + const ImVec2 latest_pos = latest_event ? ImVec2(latest_event->MousePos.PosX, latest_event->MousePos.PosY) : g.IO.MousePos; + if (latest_pos.x == pos.x && latest_pos.y == pos.y) + return; + + ImGuiInputEvent e; + e.Type = ImGuiInputEventType_MousePos; + e.Source = ImGuiInputSource_Mouse; + e.EventId = g.InputEventsNextEventId++; + e.MousePos.PosX = pos.x; + e.MousePos.PosY = pos.y; + e.MouseWheel.MouseSource = g.InputEventsNextMouseSource; + g.InputEventsQueue.push_back(e); +} + +void ImGuiIO::AddMouseButtonEvent(int mouse_button, bool down) +{ + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; + IM_ASSERT(mouse_button >= 0 && mouse_button < ImGuiMouseButton_COUNT); + if (!AppAcceptingEvents) + return; + + // Filter duplicate + const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_MouseButton, (int)mouse_button); + const bool latest_button_down = latest_event ? latest_event->MouseButton.Down : g.IO.MouseDown[mouse_button]; + if (latest_button_down == down) + return; + + ImGuiInputEvent e; + e.Type = ImGuiInputEventType_MouseButton; + e.Source = ImGuiInputSource_Mouse; + e.EventId = g.InputEventsNextEventId++; + e.MouseButton.Button = mouse_button; + e.MouseButton.Down = down; + e.MouseWheel.MouseSource = g.InputEventsNextMouseSource; + g.InputEventsQueue.push_back(e); +} + +// Queue a mouse wheel event (some mouse/API may only have a Y component) +void ImGuiIO::AddMouseWheelEvent(float wheel_x, float wheel_y) +{ + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; + + // Filter duplicate (unlike most events, wheel values are relative and easy to filter) + if (!AppAcceptingEvents || (wheel_x == 0.0f && wheel_y == 0.0f)) + return; + + ImGuiInputEvent e; + e.Type = ImGuiInputEventType_MouseWheel; + e.Source = ImGuiInputSource_Mouse; + e.EventId = g.InputEventsNextEventId++; + e.MouseWheel.WheelX = wheel_x; + e.MouseWheel.WheelY = wheel_y; + e.MouseWheel.MouseSource = g.InputEventsNextMouseSource; + g.InputEventsQueue.push_back(e); +} + +// This is not a real event, the data is latched in order to be stored in actual Mouse events. +// This is so that duplicate events (e.g. Windows sending extraneous WM_MOUSEMOVE) gets filtered and are not leading to actual source changes. +void ImGuiIO::AddMouseSourceEvent(ImGuiMouseSource source) +{ + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; + g.InputEventsNextMouseSource = source; } void ImGuiIO::AddFocusEvent(bool focused) { - // We intentionally overwrite this and process in NewFrame(), in order to give a chance - // to multi-viewports backends to queue AddFocusEvent(false),AddFocusEvent(true) in same frame. - AppFocusLost = !focused; + IM_ASSERT(Ctx != NULL); + ImGuiContext& g = *Ctx; + + // Filter duplicate + const ImGuiInputEvent* latest_event = FindLatestInputEvent(&g, ImGuiInputEventType_Focus); + const bool latest_focused = latest_event ? latest_event->AppFocused.Focused : !g.IO.AppFocusLost; + if (latest_focused == focused) + return; + + ImGuiInputEvent e; + e.Type = ImGuiInputEventType_Focus; + e.EventId = g.InputEventsNextEventId++; + e.AppFocused.Focused = focused; + g.InputEventsQueue.push_back(e); } //----------------------------------------------------------------------------- @@ -1343,14 +1679,14 @@ ImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, int ImStricmp(const char* str1, const char* str2) { int d; - while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; } + while ((d = ImToUpper(*str2) - ImToUpper(*str1)) == 0 && *str1) { str1++; str2++; } return d; } int ImStrnicmp(const char* str1, const char* str2, size_t count) { int d = 0; - while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; } + while (count > 0 && (d = ImToUpper(*str2) - ImToUpper(*str1)) == 0 && *str1) { str1++; str2++; count--; } return d; } @@ -1417,14 +1753,14 @@ const char* ImStristr(const char* haystack, const char* haystack_end, const char if (!needle_end) needle_end = needle + strlen(needle); - const char un0 = (char)toupper(*needle); + const char un0 = (char)ImToUpper(*needle); while ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end)) { - if (toupper(*haystack) == un0) + if (ImToUpper(*haystack) == un0) { const char* b = needle + 1; for (const char* a = haystack + 1; b < needle_end; a++, b++) - if (toupper(*a) != toupper(*b)) + if (ImToUpper(*a) != ImToUpper(*b)) break; if (b == needle_end) return haystack; @@ -1468,8 +1804,12 @@ const char* ImStrSkipBlank(const char* str) // designed using two-passes worst case, which probably could be improved using the stbsp_vsprintfcb() function.) #ifdef IMGUI_USE_STB_SPRINTF #define STB_SPRINTF_IMPLEMENTATION +#ifdef IMGUI_STB_SPRINTF_FILENAME +#include IMGUI_STB_SPRINTF_FILENAME +#else #include "stb_sprintf.h" #endif +#endif #if defined(_MSC_VER) && !defined(vsnprintf) #define vsnprintf _vsnprintf @@ -1509,6 +1849,43 @@ int ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args) } #endif // #ifdef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS +void ImFormatStringToTempBuffer(const char** out_buf, const char** out_buf_end, const char* fmt, ...) +{ + ImGuiContext& g = *GImGui; + va_list args; + va_start(args, fmt); + if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0) + { + const char* buf = va_arg(args, const char*); // Skip formatting when using "%s" + *out_buf = buf; + if (out_buf_end) { *out_buf_end = buf + strlen(buf); } + } + else + { + int buf_len = ImFormatStringV(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args); + *out_buf = g.TempBuffer.Data; + if (out_buf_end) { *out_buf_end = g.TempBuffer.Data + buf_len; } + } + va_end(args); +} + +void ImFormatStringToTempBufferV(const char** out_buf, const char** out_buf_end, const char* fmt, va_list args) +{ + ImGuiContext& g = *GImGui; + if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0) + { + const char* buf = va_arg(args, const char*); // Skip formatting when using "%s" + *out_buf = buf; + if (out_buf_end) { *out_buf_end = buf + strlen(buf); } + } + else + { + int buf_len = ImFormatStringV(g.TempBuffer.Data, g.TempBuffer.Size, fmt, args); + *out_buf = g.TempBuffer.Data; + if (out_buf_end) { *out_buf_end = g.TempBuffer.Data + buf_len; } + } +} + // CRC32 needs a 1KB lookup table (not cache friendly) // Although the code to generate the table is simple and shorter than the table itself, using a const table allows us to easily: // - avoid an unnecessary branch/memory tap, - keep the ImHashXXX functions usable by static constructors, - make it thread-safe. @@ -1535,7 +1912,7 @@ static const ImU32 GCrc32LookupTable[256] = // Known size hash // It is ok to call ImHashData on a string with known length but the ### operator won't be supported. // FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements. -ImGuiID ImHashData(const void* data_p, size_t data_size, ImU32 seed) +ImGuiID ImHashData(const void* data_p, size_t data_size, ImGuiID seed) { ImU32 crc = ~seed; const unsigned char* data = (const unsigned char*)data_p; @@ -1551,7 +1928,7 @@ ImGuiID ImHashData(const void* data_p, size_t data_size, ImU32 seed) // - If we reach ### in the string we discard the hash so far and reset to the seed. // - We don't do 'current += 2; continue;' after handling ### to keep the code smaller/faster (measured ~10% diff in Debug build) // FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements. -ImGuiID ImHashStr(const char* data_p, size_t data_size, ImU32 seed) +ImGuiID ImHashStr(const char* data_p, size_t data_size, ImGuiID seed) { seed = ~seed; ImU32 crc = seed; @@ -1593,7 +1970,7 @@ ImFileHandle ImFileOpen(const char* filename, const char* mode) // Previously we used ImTextCountCharsFromUtf8/ImTextStrFromUtf8 here but we now need to support ImWchar16 and ImWchar32! const int filename_wsize = ::MultiByteToWideChar(CP_UTF8, 0, filename, -1, NULL, 0); const int mode_wsize = ::MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0); - ImVector buf; + ImVector buf; buf.resize(filename_wsize + mode_wsize); ::MultiByteToWideChar(CP_UTF8, 0, filename, -1, (wchar_t*)&buf[0], filename_wsize); ::MultiByteToWideChar(CP_UTF8, 0, mode, -1, (wchar_t*)&buf[filename_wsize], mode_wsize); @@ -1656,6 +2033,8 @@ void* ImFileLoadToMemory(const char* filename, const char* mode, size_t* out_f // [SECTION] MISC HELPERS/UTILITIES (ImText* functions) //----------------------------------------------------------------------------- +IM_MSVC_RUNTIME_CHECKS_OFF + // Convert UTF-8 to 32-bit character, process single character input. // A nearly-branchless UTF-8 decoder, based on work of Christopher Wellons (https://github.com/skeeto/branchless-utf8). // We handle UTF-8 decoding error by skipping forward. @@ -1667,7 +2046,7 @@ int ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* static const int shiftc[] = { 0, 18, 12, 6, 0 }; static const int shifte[] = { 0, 6, 4, 2, 0 }; int len = lengths[*(const unsigned char*)in_text >> 3]; - int wanted = len + !len; + int wanted = len + (len ? 0 : 1); if (in_text_end == NULL) in_text_end = in_text + wanted; // Max length, nulls will be taken into account. @@ -1719,8 +2098,6 @@ int ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const cha { unsigned int c; in_text += ImTextCharFromUtf8(&c, in_text, in_text_end); - if (c == 0) - break; *buf_out++ = (ImWchar)c; } *buf_out = 0; @@ -1736,8 +2113,6 @@ int ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end) { unsigned int c; in_text += ImTextCharFromUtf8(&c, in_text, in_text_end); - if (c == 0) - break; char_count++; } return char_count; @@ -1831,6 +2206,7 @@ int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_e } return bytes_count; } +IM_MSVC_RUNTIME_CHECKS_RESTORE //----------------------------------------------------------------------------- // [SECTION] MISC HELPERS/UTILITIES (Color functions) @@ -2070,18 +2446,15 @@ void ImGuiStorage::SetAllInt(int v) //----------------------------------------------------------------------------- // Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]" -ImGuiTextFilter::ImGuiTextFilter(const char* default_filter) +ImGuiTextFilter::ImGuiTextFilter(const char* default_filter) //-V1077 { + InputBuf[0] = 0; + CountGrep = 0; if (default_filter) { ImStrncpy(InputBuf, default_filter, IM_ARRAYSIZE(InputBuf)); Build(); } - else - { - InputBuf[0] = 0; - CountGrep = 0; - } } bool ImGuiTextFilter::Draw(const char* label, float width) @@ -2168,7 +2541,7 @@ bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const } //----------------------------------------------------------------------------- -// [SECTION] ImGuiTextBuffer +// [SECTION] ImGuiTextBuffer, ImGuiTextIndex //----------------------------------------------------------------------------- // On some platform vsnprintf() takes va_list by reference and modifies it. @@ -2236,6 +2609,20 @@ void ImGuiTextBuffer::appendfv(const char* fmt, va_list args) va_end(args_copy); } +void ImGuiTextIndex::append(const char* base, int old_size, int new_size) +{ + IM_ASSERT(old_size >= 0 && new_size >= old_size && new_size >= EndOffset); + if (old_size == new_size) + return; + if (EndOffset == 0 || base[EndOffset - 1] == '\n') + LineOffsets.push_back(EndOffset); + const char* base_end = base + new_size; + for (const char* p = base + old_size; (p = (const char*)memchr(p, '\n', base_end - p)) != 0; ) + if (++p < base_end) // Don't push a trailing offset on last \n + LineOffsets.push_back((int)(intptr_t)(p - base)); + EndOffset = ImMax(EndOffset, new_size); +} + //----------------------------------------------------------------------------- // [SECTION] ImGuiListClipper // This is currently not as flexible/powerful as it should be and really confusing/spaghetti, mostly because we changed @@ -2252,7 +2639,7 @@ static bool GetSkipItemForListClipping() #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS // Legacy helper to calculate coarse clipping of large list of evenly sized items. -// This legacy API is not ideal because it assume we will return a single contiguous rectangle. +// This legacy API is not ideal because it assumes we will return a single contiguous rectangle. // Prefer using ImGuiListClipper which can returns non-contiguous ranges. void ImGui::CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end) { @@ -2359,6 +2746,8 @@ static void ImGuiListClipper_SeekCursorForItem(ImGuiListClipper* clipper, int it ImGuiListClipper::ImGuiListClipper() { memset(this, 0, sizeof(*this)); + Ctx = ImGui::GetCurrentContext(); + IM_ASSERT(Ctx != NULL); ItemsCount = -1; } @@ -2367,13 +2756,11 @@ ImGuiListClipper::~ImGuiListClipper() End(); } -// Use case A: Begin() called from constructor with items_height<0, then called again from Step() in StepNo 1 -// Use case B: Begin() called from constructor with items_height>0 -// FIXME-LEGACY: Ideally we should remove the Begin/End functions but they are part of the legacy API we still support. This is why some of the code in Step() calling Begin() and reassign some fields, spaghetti style. void ImGuiListClipper::Begin(int items_count, float items_height) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *Ctx; ImGuiWindow* window = g.CurrentWindow; + IMGUI_DEBUG_LOG_CLIPPER("Clipper: Begin(%d,%.2f) in '%s'\n", items_count, items_height, window->Name); if (ImGuiTable* table = g.CurrentTable) if (table->IsInsideRow) @@ -2396,15 +2783,15 @@ void ImGuiListClipper::Begin(int items_count, float items_height) void ImGuiListClipper::End() { - // In theory here we should assert that we are already at the right position, but it seems saner to just seek at the end and not assert/crash the user. - ImGuiContext& g = *GImGui; - if (ItemsCount >= 0 && ItemsCount < INT_MAX && DisplayStart >= 0) - ImGuiListClipper_SeekCursorForItem(this, ItemsCount); - ItemsCount = -1; - - // Restore temporary buffer and fix back pointers which may be invalidated when nesting + ImGuiContext& g = *Ctx; if (ImGuiListClipperData* data = (ImGuiListClipperData*)TempData) { + // In theory here we should assert that we are already at the right position, but it seems saner to just seek at the end and not assert/crash the user. + IMGUI_DEBUG_LOG_CLIPPER("Clipper: End() in '%s'\n", g.CurrentWindow->Name); + if (ItemsCount >= 0 && ItemsCount < INT_MAX && DisplayStart >= 0) + ImGuiListClipper_SeekCursorForItem(this, ItemsCount); + + // Restore temporary buffer and fix back pointers which may be invalidated when nesting IM_ASSERT(data->ListClipper == this); data->StepNo = data->Ranges.Size; if (--g.ClipperTempDataStacked > 0) @@ -2414,6 +2801,7 @@ void ImGuiListClipper::End() } TempData = NULL; } + ItemsCount = -1; } void ImGuiListClipper::ForceDisplayRangeByIndices(int item_min, int item_max) @@ -2425,29 +2813,29 @@ void ImGuiListClipper::ForceDisplayRangeByIndices(int item_min, int item_max) data->Ranges.push_back(ImGuiListClipperRange::FromIndices(item_min, item_max)); } -bool ImGuiListClipper::Step() +static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *clipper->Ctx; ImGuiWindow* window = g.CurrentWindow; - ImGuiListClipperData* data = (ImGuiListClipperData*)TempData; + ImGuiListClipperData* data = (ImGuiListClipperData*)clipper->TempData; + IM_ASSERT(data != NULL && "Called ImGuiListClipper::Step() too many times, or before ImGuiListClipper::Begin() ?"); ImGuiTable* table = g.CurrentTable; if (table && table->IsInsideRow) ImGui::TableEndRow(table); // No items - if (ItemsCount == 0 || GetSkipItemForListClipping()) - return (void)End(), false; + if (clipper->ItemsCount == 0 || GetSkipItemForListClipping()) + return false; // While we are in frozen row state, keep displaying items one by one, unclipped // FIXME: Could be stored as a table-agnostic state. if (data->StepNo == 0 && table != NULL && !table->IsUnfrozenRows) { - DisplayStart = data->ItemsFrozen; - DisplayEnd = data->ItemsFrozen + 1; - if (DisplayStart >= ItemsCount) - return (void)End(), false; - data->ItemsFrozen++; + clipper->DisplayStart = data->ItemsFrozen; + clipper->DisplayEnd = ImMin(data->ItemsFrozen + 1, clipper->ItemsCount); + if (clipper->DisplayStart < clipper->DisplayEnd) + data->ItemsFrozen++; return true; } @@ -2455,15 +2843,13 @@ bool ImGuiListClipper::Step() bool calc_clipping = false; if (data->StepNo == 0) { - StartPosY = window->DC.CursorPos.y; - if (ItemsHeight <= 0.0f) + clipper->StartPosY = window->DC.CursorPos.y; + if (clipper->ItemsHeight <= 0.0f) { // Submit the first item (or range) so we can measure its height (generally the first range is 0..1) data->Ranges.push_front(ImGuiListClipperRange::FromIndices(data->ItemsFrozen, data->ItemsFrozen + 1)); - DisplayStart = ImMax(data->Ranges[0].Min, data->ItemsFrozen); - DisplayEnd = ImMin(data->Ranges[0].Max, ItemsCount); - if (DisplayStart == DisplayEnd) - return (void)End(), false; + clipper->DisplayStart = ImMax(data->Ranges[0].Min, data->ItemsFrozen); + clipper->DisplayEnd = ImMin(data->Ranges[0].Max, clipper->ItemsCount); data->StepNo = 1; return true; } @@ -2471,29 +2857,29 @@ bool ImGuiListClipper::Step() } // Step 1: Let the clipper infer height from first range - if (ItemsHeight <= 0.0f) + if (clipper->ItemsHeight <= 0.0f) { IM_ASSERT(data->StepNo == 1); if (table) - IM_ASSERT(table->RowPosY1 == StartPosY && table->RowPosY2 == window->DC.CursorPos.y); + IM_ASSERT(table->RowPosY1 == clipper->StartPosY && table->RowPosY2 == window->DC.CursorPos.y); - ItemsHeight = (window->DC.CursorPos.y - StartPosY) / (float)(DisplayEnd - DisplayStart); - bool affected_by_floating_point_precision = ImIsFloatAboveGuaranteedIntegerPrecision(StartPosY) || ImIsFloatAboveGuaranteedIntegerPrecision(window->DC.CursorPos.y); + clipper->ItemsHeight = (window->DC.CursorPos.y - clipper->StartPosY) / (float)(clipper->DisplayEnd - clipper->DisplayStart); + bool affected_by_floating_point_precision = ImIsFloatAboveGuaranteedIntegerPrecision(clipper->StartPosY) || ImIsFloatAboveGuaranteedIntegerPrecision(window->DC.CursorPos.y); if (affected_by_floating_point_precision) - ItemsHeight = window->DC.PrevLineSize.y + g.Style.ItemSpacing.y; // FIXME: Technically wouldn't allow multi-line entries. + clipper->ItemsHeight = window->DC.PrevLineSize.y + g.Style.ItemSpacing.y; // FIXME: Technically wouldn't allow multi-line entries. - IM_ASSERT(ItemsHeight > 0.0f && "Unable to calculate item height! First item hasn't moved the cursor vertically!"); + IM_ASSERT(clipper->ItemsHeight > 0.0f && "Unable to calculate item height! First item hasn't moved the cursor vertically!"); calc_clipping = true; // If item height had to be calculated, calculate clipping afterwards. } // Step 0 or 1: Calculate the actual ranges of visible elements. - const int already_submitted = DisplayEnd; + const int already_submitted = clipper->DisplayEnd; if (calc_clipping) { if (g.LogEnabled) { // If logging is active, do not perform any clipping - data->Ranges.push_back(ImGuiListClipperRange::FromIndices(0, ItemsCount)); + data->Ranges.push_back(ImGuiListClipperRange::FromIndices(0, clipper->ItemsCount)); } else { @@ -2502,7 +2888,7 @@ bool ImGuiListClipper::Step() if (is_nav_request) data->Ranges.push_back(ImGuiListClipperRange::FromPositions(g.NavScoringNoClipRect.Min.y, g.NavScoringNoClipRect.Max.y, 0, 0)); if (is_nav_request && (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) && g.NavTabbingDir == -1) - data->Ranges.push_back(ImGuiListClipperRange::FromIndices(ItemsCount - 1, ItemsCount)); + data->Ranges.push_back(ImGuiListClipperRange::FromIndices(clipper->ItemsCount - 1, clipper->ItemsCount)); // Add focused/active item ImRect nav_rect_abs = ImGui::WindowRectRelToAbs(window, window->NavRectRel[0]); @@ -2522,10 +2908,10 @@ bool ImGuiListClipper::Step() for (int i = 0; i < data->Ranges.Size; i++) if (data->Ranges[i].PosToIndexConvert) { - int m1 = (int)(((double)data->Ranges[i].Min - window->DC.CursorPos.y - data->LossynessOffset) / ItemsHeight); - int m2 = (int)((((double)data->Ranges[i].Max - window->DC.CursorPos.y - data->LossynessOffset) / ItemsHeight) + 0.999999f); - data->Ranges[i].Min = ImClamp(already_submitted + m1 + data->Ranges[i].PosToIndexOffsetMin, already_submitted, ItemsCount - 1); - data->Ranges[i].Max = ImClamp(already_submitted + m2 + data->Ranges[i].PosToIndexOffsetMax, data->Ranges[i].Min + 1, ItemsCount); + int m1 = (int)(((double)data->Ranges[i].Min - window->DC.CursorPos.y - data->LossynessOffset) / clipper->ItemsHeight); + int m2 = (int)((((double)data->Ranges[i].Max - window->DC.CursorPos.y - data->LossynessOffset) / clipper->ItemsHeight) + 0.999999f); + data->Ranges[i].Min = ImClamp(already_submitted + m1 + data->Ranges[i].PosToIndexOffsetMin, already_submitted, clipper->ItemsCount - 1); + data->Ranges[i].Max = ImClamp(already_submitted + m2 + data->Ranges[i].PosToIndexOffsetMax, data->Ranges[i].Min + 1, clipper->ItemsCount); data->Ranges[i].PosToIndexConvert = false; } ImGuiListClipper_SortAndFuseRanges(data->Ranges, data->StepNo); @@ -2534,23 +2920,45 @@ bool ImGuiListClipper::Step() // Step 0+ (if item height is given in advance) or 1+: Display the next range in line. if (data->StepNo < data->Ranges.Size) { - DisplayStart = ImMax(data->Ranges[data->StepNo].Min, already_submitted); - DisplayEnd = ImMin(data->Ranges[data->StepNo].Max, ItemsCount); - if (DisplayStart > already_submitted) //-V1051 - ImGuiListClipper_SeekCursorForItem(this, DisplayStart); + clipper->DisplayStart = ImMax(data->Ranges[data->StepNo].Min, already_submitted); + clipper->DisplayEnd = ImMin(data->Ranges[data->StepNo].Max, clipper->ItemsCount); + if (clipper->DisplayStart > already_submitted) //-V1051 + ImGuiListClipper_SeekCursorForItem(clipper, clipper->DisplayStart); data->StepNo++; return true; } // After the last step: Let the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), // Advance the cursor to the end of the list and then returns 'false' to end the loop. - if (ItemsCount < INT_MAX) - ImGuiListClipper_SeekCursorForItem(this, ItemsCount); - ItemsCount = -1; + if (clipper->ItemsCount < INT_MAX) + ImGuiListClipper_SeekCursorForItem(clipper, clipper->ItemsCount); return false; } +bool ImGuiListClipper::Step() +{ + ImGuiContext& g = *Ctx; + bool need_items_height = (ItemsHeight <= 0.0f); + bool ret = ImGuiListClipper_StepInternal(this); + if (ret && (DisplayStart == DisplayEnd)) + ret = false; + if (g.CurrentTable && g.CurrentTable->IsUnfrozenRows == false) + IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): inside frozen table row.\n"); + if (need_items_height && ItemsHeight > 0.0f) + IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): computed ItemsHeight: %.2f.\n", ItemsHeight); + if (ret) + { + IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): display %d to %d.\n", DisplayStart, DisplayEnd); + } + else + { + IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): End.\n"); + End(); + } + return ret; +} + //----------------------------------------------------------------------------- // [SECTION] STYLING //----------------------------------------------------------------------------- @@ -2617,6 +3025,11 @@ void ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col) void ImGui::PopStyleColor(int count) { ImGuiContext& g = *GImGui; + if (g.ColorStack.Size < count) + { + IM_ASSERT_USER_ERROR(g.ColorStack.Size > count, "Calling PopStyleColor() too many times: stack underflow."); + count = g.ColorStack.Size; + } while (count > 0) { ImGuiColorMod& backup = g.ColorStack.back(); @@ -2626,15 +3039,7 @@ void ImGui::PopStyleColor(int count) } } -struct ImGuiStyleVarInfo -{ - ImGuiDataType Type; - ImU32 Count; - ImU32 Offset; - void* GetVarPtr(ImGuiStyle* style) const { return (void*)((unsigned char*)style + Offset); } -}; - -static const ImGuiStyleVarInfo GStyleVarInfo[] = +static const ImGuiDataVarInfo GStyleVarInfo[] = { { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, Alpha) }, // ImGuiStyleVar_Alpha { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, DisabledAlpha) }, // ImGuiStyleVar_DisabledAlpha @@ -2661,51 +3066,59 @@ static const ImGuiStyleVarInfo GStyleVarInfo[] = { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, TabRounding) }, // ImGuiStyleVar_TabRounding { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ButtonTextAlign) }, // ImGuiStyleVar_ButtonTextAlign { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SelectableTextAlign) }, // ImGuiStyleVar_SelectableTextAlign + { ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, SeparatorTextBorderSize) },// ImGuiStyleVar_SeparatorTextBorderSize + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SeparatorTextAlign) }, // ImGuiStyleVar_SeparatorTextAlign + { ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, SeparatorTextPadding) }, // ImGuiStyleVar_SeparatorTextPadding }; -static const ImGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx) +const ImGuiDataVarInfo* ImGui::GetStyleVarInfo(ImGuiStyleVar idx) { IM_ASSERT(idx >= 0 && idx < ImGuiStyleVar_COUNT); - IM_ASSERT(IM_ARRAYSIZE(GStyleVarInfo) == ImGuiStyleVar_COUNT); + IM_STATIC_ASSERT(IM_ARRAYSIZE(GStyleVarInfo) == ImGuiStyleVar_COUNT); return &GStyleVarInfo[idx]; } void ImGui::PushStyleVar(ImGuiStyleVar idx, float val) { - const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx); + ImGuiContext& g = *GImGui; + const ImGuiDataVarInfo* var_info = GetStyleVarInfo(idx); if (var_info->Type == ImGuiDataType_Float && var_info->Count == 1) { - ImGuiContext& g = *GImGui; float* pvar = (float*)var_info->GetVarPtr(&g.Style); g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar)); *pvar = val; return; } - IM_ASSERT(0 && "Called PushStyleVar() float variant but variable is not a float!"); + IM_ASSERT_USER_ERROR(0, "Called PushStyleVar() variant with wrong type!"); } void ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val) { - const ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx); + ImGuiContext& g = *GImGui; + const ImGuiDataVarInfo* var_info = GetStyleVarInfo(idx); if (var_info->Type == ImGuiDataType_Float && var_info->Count == 2) { - ImGuiContext& g = *GImGui; ImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style); g.StyleVarStack.push_back(ImGuiStyleMod(idx, *pvar)); *pvar = val; return; } - IM_ASSERT(0 && "Called PushStyleVar() ImVec2 variant but variable is not a ImVec2!"); + IM_ASSERT_USER_ERROR(0, "Called PushStyleVar() variant with wrong type!"); } void ImGui::PopStyleVar(int count) { ImGuiContext& g = *GImGui; + if (g.StyleVarStack.Size < count) + { + IM_ASSERT_USER_ERROR(g.StyleVarStack.Size > count, "Calling PopStyleVar() too many times: stack underflow."); + count = g.StyleVarStack.Size; + } while (count > 0) { // We avoid a generic memcpy(data, &backup.Backup.., GDataTypeSize[info->Type] * info->Count), the overhead in Debug is not worth it. ImGuiStyleMod& backup = g.StyleVarStack.back(); - const ImGuiStyleVarInfo* info = GetStyleVarInfo(backup.VarIdx); + const ImGuiDataVarInfo* info = GetStyleVarInfo(backup.VarIdx); void* data = info->GetVarPtr(&g.Style); if (info->Type == ImGuiDataType_Float && info->Count == 1) { ((float*)data)[0] = backup.BackupFloat[0]; } else if (info->Type == ImGuiDataType_Float && info->Count == 2) { ((float*)data)[0] = backup.BackupFloat[0]; ((float*)data)[1] = backup.BackupFloat[1]; } @@ -2842,6 +3255,9 @@ void ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end // Default clip_rect uses (pos_min,pos_max) // Handle clipping on CPU immediately (vs typically let the GPU clip the triangles that are overlapping the clipping rectangle edges) +// FIXME-OPT: Since we have or calculate text_size we could coarse clip whole block immediately, especally for text above draw_list->DrawList. +// Effectively as this is called from widget doing their own coarse clipping it's not very valuable presently. Next time function will take +// better advantage of the render function taking size into account for coarse clipping. void ImGui::RenderTextClippedEx(ImDrawList* draw_list, const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_display_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect) { // Perform CPU side clipping for single clipped element to avoid using scissor state @@ -2885,7 +3301,6 @@ void ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, cons LogRenderedText(&pos_min, text, text_display_end); } - // Another overly complex function until we reorganize everything into a nice all-in-one helper. // This is made more complex because we have dissociated the layout rectangle (pos_min..pos_max) which define _where_ the ellipsis is, from actual clipping of text and limit of the ellipsis display. // This is because in the context of tabs we selectively hide part of the text when the Close Button appears, but we don't want the ellipsis to move. @@ -2909,30 +3324,12 @@ void ImGui::RenderTextEllipsis(ImDrawList* draw_list, const ImVec2& pos_min, con const ImFont* font = draw_list->_Data->Font; const float font_size = draw_list->_Data->FontSize; + const float font_scale = font_size / font->FontSize; const char* text_end_ellipsis = NULL; - - ImWchar ellipsis_char = font->EllipsisChar; - int ellipsis_char_count = 1; - if (ellipsis_char == (ImWchar)-1) - { - ellipsis_char = font->DotChar; - ellipsis_char_count = 3; - } - const ImFontGlyph* glyph = font->FindGlyph(ellipsis_char); - - float ellipsis_glyph_width = glyph->X1; // Width of the glyph with no padding on either side - float ellipsis_total_width = ellipsis_glyph_width; // Full width of entire ellipsis - - if (ellipsis_char_count > 1) - { - // Full ellipsis size without free spacing after it. - const float spacing_between_dots = 1.0f * (draw_list->_Data->FontSize / font->FontSize); - ellipsis_glyph_width = glyph->X1 - glyph->X0 + spacing_between_dots; - ellipsis_total_width = ellipsis_glyph_width * (float)ellipsis_char_count - spacing_between_dots; - } + const float ellipsis_width = font->EllipsisWidth * font_scale; // We can now claim the space between pos_max.x and ellipsis_max.x - const float text_avail_width = ImMax((ImMax(pos_max.x, ellipsis_max_x) - ellipsis_total_width) - pos_min.x, 1.0f); + const float text_avail_width = ImMax((ImMax(pos_max.x, ellipsis_max_x) - ellipsis_width) - pos_min.x, 1.0f); float text_size_clipped_x = font->CalcTextSizeA(font_size, text_avail_width, 0.0f, text, text_end_full, &text_end_ellipsis).x; if (text == text_end_ellipsis && text_end_ellipsis < text_end_full) { @@ -2949,13 +3346,10 @@ void ImGui::RenderTextEllipsis(ImDrawList* draw_list, const ImVec2& pos_min, con // Render text, render ellipsis RenderTextClippedEx(draw_list, pos_min, ImVec2(clip_max_x, pos_max.y), text, text_end_ellipsis, &text_size, ImVec2(0.0f, 0.0f)); - float ellipsis_x = pos_min.x + text_size_clipped_x; - if (ellipsis_x + ellipsis_total_width <= ellipsis_max_x) - for (int i = 0; i < ellipsis_char_count; i++) - { - font->RenderChar(draw_list, font_size, ImVec2(ellipsis_x, pos_min.y), GetColorU32(ImGuiCol_Text), ellipsis_char); - ellipsis_x += ellipsis_glyph_width; - } + ImVec2 ellipsis_pos = ImFloor(ImVec2(pos_min.x + text_size_clipped_x, pos_min.y)); + if (ellipsis_pos.x + ellipsis_width <= ellipsis_max_x) + for (int i = 0; i < font->EllipsisCharCount; i++, ellipsis_pos.x += font->EllipsisCharStep * font_scale) + font->RenderChar(draw_list, font_size, ellipsis_pos, GetColorU32(ImGuiCol_Text), font->EllipsisChar); } else { @@ -3024,99 +3418,311 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFl } } +void ImGui::RenderMouseCursor(ImVec2 base_pos, float base_scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT); + ImFontAtlas* font_atlas = g.DrawListSharedData.Font->ContainerAtlas; + for (int n = 0; n < g.Viewports.Size; n++) + { + // We scale cursor with current viewport/monitor, however Windows 10 for its own hardware cursor seems to be using a different scale factor. + ImVec2 offset, size, uv[4]; + if (!font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2])) + continue; + ImGuiViewportP* viewport = g.Viewports[n]; + const ImVec2 pos = base_pos - offset; + const float scale = base_scale; + if (!viewport->GetMainRect().Overlaps(ImRect(pos, pos + ImVec2(size.x + 2, size.y + 2) * scale))) + continue; + ImDrawList* draw_list = GetForegroundDrawList(viewport); + ImTextureID tex_id = font_atlas->TexID; + draw_list->PushTextureID(tex_id); + draw_list->AddImage(tex_id, pos + ImVec2(1, 0) * scale, pos + (ImVec2(1, 0) + size) * scale, uv[2], uv[3], col_shadow); + draw_list->AddImage(tex_id, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv[2], uv[3], col_shadow); + draw_list->AddImage(tex_id, pos, pos + size * scale, uv[2], uv[3], col_border); + draw_list->AddImage(tex_id, pos, pos + size * scale, uv[0], uv[1], col_fill); + draw_list->PopTextureID(); + } +} + //----------------------------------------------------------------------------- -// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!) +// [SECTION] INITIALIZATION, SHUTDOWN //----------------------------------------------------------------------------- -// ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods -ImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name) : DrawListInst(NULL) +// Internal state access - if you want to share Dear ImGui state between modules (e.g. DLL) or allocate it yourself +// Note that we still point to some static data and members (such as GFontAtlas), so the state instance you end up using will point to the static data within its module +ImGuiContext* ImGui::GetCurrentContext() { - memset(this, 0, sizeof(*this)); - Name = ImStrdup(name); - NameBufLen = (int)strlen(name) + 1; - ID = ImHashStr(name); - IDStack.push_back(ID); - MoveId = GetID("#MOVE"); - ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); - ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f); - AutoFitFramesX = AutoFitFramesY = -1; - AutoPosLastDirection = ImGuiDir_None; - SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; - SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX); - LastFrameActive = -1; - LastTimeActive = -1.0f; - FontWindowScale = 1.0f; - SettingsOffset = -1; - DrawList = &DrawListInst; - DrawList->_Data = &context->DrawListSharedData; - DrawList->_OwnerName = Name; + return GImGui; } -ImGuiWindow::~ImGuiWindow() +void ImGui::SetCurrentContext(ImGuiContext* ctx) { - IM_ASSERT(DrawList == &DrawListInst); - IM_DELETE(Name); - ColumnsStorage.clear_destruct(); +#ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC + IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx); // For custom thread-based hackery you may want to have control over this. +#else + GImGui = ctx; +#endif } -ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end) +void ImGui::SetAllocatorFunctions(ImGuiMemAllocFunc alloc_func, ImGuiMemFreeFunc free_func, void* user_data) { - ImGuiID seed = IDStack.back(); - ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed); - ImGui::KeepAliveID(id); - ImGuiContext& g = *GImGui; - if (g.DebugHookIdInfo == id) - ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end); - return id; + GImAllocatorAllocFunc = alloc_func; + GImAllocatorFreeFunc = free_func; + GImAllocatorUserData = user_data; } -ImGuiID ImGuiWindow::GetID(const void* ptr) +// This is provided to facilitate copying allocators from one static/DLL boundary to another (e.g. retrieve default allocator of your executable address space) +void ImGui::GetAllocatorFunctions(ImGuiMemAllocFunc* p_alloc_func, ImGuiMemFreeFunc* p_free_func, void** p_user_data) { - ImGuiID seed = IDStack.back(); - ImGuiID id = ImHashData(&ptr, sizeof(void*), seed); - ImGui::KeepAliveID(id); - ImGuiContext& g = *GImGui; - if (g.DebugHookIdInfo == id) - ImGui::DebugHookIdInfo(id, ImGuiDataType_Pointer, ptr, NULL); - return id; + *p_alloc_func = GImAllocatorAllocFunc; + *p_free_func = GImAllocatorFreeFunc; + *p_user_data = GImAllocatorUserData; } -ImGuiID ImGuiWindow::GetID(int n) +ImGuiContext* ImGui::CreateContext(ImFontAtlas* shared_font_atlas) { - ImGuiID seed = IDStack.back(); - ImGuiID id = ImHashData(&n, sizeof(n), seed); - ImGui::KeepAliveID(id); - ImGuiContext& g = *GImGui; - if (g.DebugHookIdInfo == id) - ImGui::DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL); - return id; + ImGuiContext* prev_ctx = GetCurrentContext(); + ImGuiContext* ctx = IM_NEW(ImGuiContext)(shared_font_atlas); + SetCurrentContext(ctx); + Initialize(); + if (prev_ctx != NULL) + SetCurrentContext(prev_ctx); // Restore previous context if any, else keep new one. + return ctx; } -ImGuiID ImGuiWindow::GetIDNoKeepAlive(const char* str, const char* str_end) +void ImGui::DestroyContext(ImGuiContext* ctx) { - ImGuiID seed = IDStack.back(); - ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed); - ImGuiContext& g = *GImGui; - if (g.DebugHookIdInfo == id) - ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end); - return id; + ImGuiContext* prev_ctx = GetCurrentContext(); + if (ctx == NULL) //-V1051 + ctx = prev_ctx; + SetCurrentContext(ctx); + Shutdown(); + SetCurrentContext((prev_ctx != ctx) ? prev_ctx : NULL); + IM_DELETE(ctx); } -ImGuiID ImGuiWindow::GetIDNoKeepAlive(const void* ptr) +// IMPORTANT: ###xxx suffixes must be same in ALL languages +static const ImGuiLocEntry GLocalizationEntriesEnUS[] = +{ + { ImGuiLocKey_TableSizeOne, "Size column to fit###SizeOne" }, + { ImGuiLocKey_TableSizeAllFit, "Size all columns to fit###SizeAll" }, + { ImGuiLocKey_TableSizeAllDefault, "Size all columns to default###SizeAll" }, + { ImGuiLocKey_TableResetOrder, "Reset order###ResetOrder" }, + { ImGuiLocKey_WindowingMainMenuBar, "(Main menu bar)" }, + { ImGuiLocKey_WindowingPopup, "(Popup)" }, + { ImGuiLocKey_WindowingUntitled, "(Untitled)" }, +}; + +void ImGui::Initialize() { - ImGuiID seed = IDStack.back(); - ImGuiID id = ImHashData(&ptr, sizeof(void*), seed); ImGuiContext& g = *GImGui; + IM_ASSERT(!g.Initialized && !g.SettingsLoaded); + + // Add .ini handle for ImGuiWindow and ImGuiTable types + { + ImGuiSettingsHandler ini_handler; + ini_handler.TypeName = "Window"; + ini_handler.TypeHash = ImHashStr("Window"); + ini_handler.ClearAllFn = WindowSettingsHandler_ClearAll; + ini_handler.ReadOpenFn = WindowSettingsHandler_ReadOpen; + ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine; + ini_handler.ApplyAllFn = WindowSettingsHandler_ApplyAll; + ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll; + AddSettingsHandler(&ini_handler); + } + TableSettingsAddSettingsHandler(); + + // Setup default localization table + LocalizeRegisterEntries(GLocalizationEntriesEnUS, IM_ARRAYSIZE(GLocalizationEntriesEnUS)); + + // Setup default platform clipboard/IME handlers. + g.IO.GetClipboardTextFn = GetClipboardTextFn_DefaultImpl; // Platform dependent default implementations + g.IO.SetClipboardTextFn = SetClipboardTextFn_DefaultImpl; + g.IO.ClipboardUserData = (void*)&g; // Default implementation use the ImGuiContext as user data (ideally those would be arguments to the function) + g.IO.SetPlatformImeDataFn = SetPlatformImeDataFn_DefaultImpl; + + // Create default viewport + ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)(); + g.Viewports.push_back(viewport); + g.TempBuffer.resize(1024 * 3 + 1, 0); + +#ifdef IMGUI_HAS_DOCK +#endif + + g.Initialized = true; +} + +// This function is merely here to free heap allocations. +void ImGui::Shutdown() +{ + // The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame) + ImGuiContext& g = *GImGui; + if (g.IO.Fonts && g.FontAtlasOwnedByContext) + { + g.IO.Fonts->Locked = false; + IM_DELETE(g.IO.Fonts); + } + g.IO.Fonts = NULL; + g.DrawListSharedData.TempBuffer.clear(); + + // Cleanup of other data are conditional on actually having initialized Dear ImGui. + if (!g.Initialized) + return; + + // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) + if (g.SettingsLoaded && g.IO.IniFilename != NULL) + SaveIniSettingsToDisk(g.IO.IniFilename); + + CallContextHooks(&g, ImGuiContextHookType_Shutdown); + + // Clear everything else + g.Windows.clear_delete(); + g.WindowsFocusOrder.clear(); + g.WindowsTempSortBuffer.clear(); + g.CurrentWindow = NULL; + g.CurrentWindowStack.clear(); + g.WindowsById.Clear(); + g.NavWindow = NULL; + g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; + g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL; + g.MovingWindow = NULL; + + g.KeysRoutingTable.Clear(); + + g.ColorStack.clear(); + g.StyleVarStack.clear(); + g.FontStack.clear(); + g.OpenPopupStack.clear(); + g.BeginPopupStack.clear(); + + g.Viewports.clear_delete(); + + g.TabBars.Clear(); + g.CurrentTabBarStack.clear(); + g.ShrinkWidthBuffer.clear(); + + g.ClipperTempData.clear_destruct(); + + g.Tables.Clear(); + g.TablesTempData.clear_destruct(); + g.DrawChannelsTempMergeBuffer.clear(); + + g.ClipboardHandlerData.clear(); + g.MenusIdSubmittedThisFrame.clear(); + g.InputTextState.ClearFreeMemory(); + g.InputTextDeactivatedState.ClearFreeMemory(); + + g.SettingsWindows.clear(); + g.SettingsHandlers.clear(); + + if (g.LogFile) + { +#ifndef IMGUI_DISABLE_TTY_FUNCTIONS + if (g.LogFile != stdout) +#endif + ImFileClose(g.LogFile); + g.LogFile = NULL; + } + g.LogBuffer.clear(); + g.DebugLogBuf.clear(); + g.DebugLogIndex.clear(); + + g.Initialized = false; +} + +// No specific ordering/dependency support, will see as needed +ImGuiID ImGui::AddContextHook(ImGuiContext* ctx, const ImGuiContextHook* hook) +{ + ImGuiContext& g = *ctx; + IM_ASSERT(hook->Callback != NULL && hook->HookId == 0 && hook->Type != ImGuiContextHookType_PendingRemoval_); + g.Hooks.push_back(*hook); + g.Hooks.back().HookId = ++g.HookIdNext; + return g.HookIdNext; +} + +// Deferred removal, avoiding issue with changing vector while iterating it +void ImGui::RemoveContextHook(ImGuiContext* ctx, ImGuiID hook_id) +{ + ImGuiContext& g = *ctx; + IM_ASSERT(hook_id != 0); + for (int n = 0; n < g.Hooks.Size; n++) + if (g.Hooks[n].HookId == hook_id) + g.Hooks[n].Type = ImGuiContextHookType_PendingRemoval_; +} + +// Call context hooks (used by e.g. test engine) +// We assume a small number of hooks so all stored in same array +void ImGui::CallContextHooks(ImGuiContext* ctx, ImGuiContextHookType hook_type) +{ + ImGuiContext& g = *ctx; + for (int n = 0; n < g.Hooks.Size; n++) + if (g.Hooks[n].Type == hook_type) + g.Hooks[n].Callback(&g, &g.Hooks[n]); +} + + +//----------------------------------------------------------------------------- +// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!) +//----------------------------------------------------------------------------- + +// ImGuiWindow is mostly a dumb struct. It merely has a constructor and a few helper methods +ImGuiWindow::ImGuiWindow(ImGuiContext* ctx, const char* name) : DrawListInst(NULL) +{ + memset(this, 0, sizeof(*this)); + Ctx = ctx; + Name = ImStrdup(name); + NameBufLen = (int)strlen(name) + 1; + ID = ImHashStr(name); + IDStack.push_back(ID); + MoveId = GetID("#MOVE"); + ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); + ScrollTargetCenterRatio = ImVec2(0.5f, 0.5f); + AutoFitFramesX = AutoFitFramesY = -1; + AutoPosLastDirection = ImGuiDir_None; + SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = 0; + SetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX); + LastFrameActive = -1; + LastTimeActive = -1.0f; + FontWindowScale = 1.0f; + SettingsOffset = -1; + DrawList = &DrawListInst; + DrawList->_Data = &Ctx->DrawListSharedData; + DrawList->_OwnerName = Name; +} + +ImGuiWindow::~ImGuiWindow() +{ + IM_ASSERT(DrawList == &DrawListInst); + IM_DELETE(Name); + ColumnsStorage.clear_destruct(); +} + +ImGuiID ImGuiWindow::GetID(const char* str, const char* str_end) +{ + ImGuiID seed = IDStack.back(); + ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed); + ImGuiContext& g = *Ctx; + if (g.DebugHookIdInfo == id) + ImGui::DebugHookIdInfo(id, ImGuiDataType_String, str, str_end); + return id; +} + +ImGuiID ImGuiWindow::GetID(const void* ptr) +{ + ImGuiID seed = IDStack.back(); + ImGuiID id = ImHashData(&ptr, sizeof(void*), seed); + ImGuiContext& g = *Ctx; if (g.DebugHookIdInfo == id) ImGui::DebugHookIdInfo(id, ImGuiDataType_Pointer, ptr, NULL); return id; } -ImGuiID ImGuiWindow::GetIDNoKeepAlive(int n) +ImGuiID ImGuiWindow::GetID(int n) { ImGuiID seed = IDStack.back(); ImGuiID id = ImHashData(&n, sizeof(n), seed); - ImGuiContext& g = *GImGui; + ImGuiContext& g = *Ctx; if (g.DebugHookIdInfo == id) ImGui::DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL); return id; @@ -3128,7 +3734,6 @@ ImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs) ImGuiID seed = IDStack.back(); ImRect r_rel = ImGui::WindowRectAbsToRel(this, r_abs); ImGuiID id = ImHashData(&r_rel, sizeof(r_rel), seed); - ImGui::KeepAliveID(id); return id; } @@ -3178,9 +3783,31 @@ void ImGui::GcAwakeTransientWindowBuffers(ImGuiWindow* window) void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window) { ImGuiContext& g = *GImGui; + + // Clear previous active id + if (g.ActiveId != 0) + { + // While most behaved code would make an effort to not steal active id during window move/drag operations, + // we at least need to be resilient to it. Canceling the move is rather aggressive and users of 'master' branch + // may prefer the weird ill-defined half working situation ('docking' did assert), so may need to rework that. + if (g.MovingWindow != NULL && g.ActiveId == g.MovingWindow->MoveId) + { + IMGUI_DEBUG_LOG_ACTIVEID("SetActiveID() cancel MovingWindow\n"); + g.MovingWindow = NULL; + } + + // This could be written in a more general way (e.g associate a hook to ActiveId), + // but since this is currently quite an exception we'll leave it as is. + // One common scenario leading to this is: pressing Key ->NavMoveRequestApplyResult() -> ClearActiveId() + if (g.InputTextState.ID == g.ActiveId) + InputTextDeactivateHook(g.ActiveId); + } + + // Set active id g.ActiveIdIsJustActivated = (g.ActiveId != id); if (g.ActiveIdIsJustActivated) { + IMGUI_DEBUG_LOG_ACTIVEID("SetActiveID() old:0x%08X (window \"%s\") -> new:0x%08X (window \"%s\")\n", g.ActiveId, g.ActiveIdWindow ? g.ActiveIdWindow->Name : "", id, window ? window->Name : ""); g.ActiveIdTimer = 0.0f; g.ActiveIdHasBeenPressedBefore = false; g.ActiveIdHasBeenEditedBefore = false; @@ -3199,15 +3826,17 @@ void ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window) if (id) { g.ActiveIdIsAlive = id; - g.ActiveIdSource = (g.NavActivateId == id || g.NavActivateInputId == id || g.NavJustMovedToId == id) ? ImGuiInputSource_Nav : ImGuiInputSource_Mouse; + g.ActiveIdSource = (g.NavActivateId == id || g.NavJustMovedToId == id) ? g.NavInputSource : ImGuiInputSource_Mouse; + IM_ASSERT(g.ActiveIdSource != ImGuiInputSource_None); } // Clear declaration of inputs claimed by the widget // (Please note that this is WIP and not all keys/inputs are thoroughly declared by all widgets yet) - g.ActiveIdUsingMouseWheel = false; g.ActiveIdUsingNavDirMask = 0x00; + g.ActiveIdUsingAllKeyboardKeys = false; +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO g.ActiveIdUsingNavInputMask = 0x00; - g.ActiveIdUsingKeyInputMask = 0x00; +#endif } void ImGui::ClearActiveID() @@ -3220,7 +3849,6 @@ void ImGui::SetHoveredID(ImGuiID id) ImGuiContext& g = *GImGui; g.HoveredId = id; g.HoveredIdAllowOverlap = false; - g.HoveredIdUsingMouseWheel = false; if (id != 0 && g.HoveredIdPreviousFrame != id) g.HoveredIdTimer = g.HoveredIdNotActiveTimer = 0.0f; } @@ -3231,6 +3859,8 @@ ImGuiID ImGui::GetHoveredID() return g.HoveredId ? g.HoveredId : g.HoveredIdPreviousFrame; } +// This is called by ItemAdd(). +// Code not using ItemAdd() may need to call this manually otherwise ActiveId will be cleared. In IMGUI_VERSION_NUM < 18717 this was called by GetID(). void ImGui::KeepAliveID(ImGuiID id) { ImGuiContext& g = *GImGui; @@ -3243,17 +3873,23 @@ void ImGui::KeepAliveID(ImGuiID id) void ImGui::MarkItemEdited(ImGuiID id) { // This marking is solely to be able to provide info for IsItemDeactivatedAfterEdit(). - // ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need need to fill the data. + // ActiveId might have been released by the time we call this (as in the typical press/release button behavior) but still need to fill the data. ImGuiContext& g = *GImGui; - IM_ASSERT(g.ActiveId == id || g.ActiveId == 0 || g.DragDropActive); - IM_UNUSED(id); // Avoid unused variable warnings when asserts are compiled out. + if (g.ActiveId == id || g.ActiveId == 0) + { + g.ActiveIdHasBeenEditedThisFrame = true; + g.ActiveIdHasBeenEditedBefore = true; + } + + // We accept a MarkItemEdited() on drag and drop targets (see https://github.com/ocornut/imgui/issues/1875#issuecomment-978243343) + // We accept 'ActiveIdPreviousFrame == id' for InputText() returning an edit after it has been taken ActiveId away (#4714) + IM_ASSERT(g.DragDropActive || g.ActiveId == id || g.ActiveId == 0 || g.ActiveIdPreviousFrame == id); + //IM_ASSERT(g.CurrentWindow->DC.LastItemId == id); - g.ActiveIdHasBeenEditedThisFrame = true; - g.ActiveIdHasBeenEditedBefore = true; g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_Edited; } -static inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags) +bool ImGui::IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags) { // An active popup disable hovering on other windows (apart from its own children) // FIXME-OPT: This could be cached/stored within the window. @@ -3263,11 +3899,17 @@ static inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFla if (focused_root_window->WasActive && focused_root_window != window->RootWindow) { // For the purpose of those flags we differentiate "standard popup" from "modal popup" - // NB: The order of those two tests is important because Modal windows are also Popups. + // NB: The 'else' is important because Modal windows are also Popups. + bool want_inhibit = false; if (focused_root_window->Flags & ImGuiWindowFlags_Modal) - return false; - if ((focused_root_window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiHoveredFlags_AllowWhenBlockedByPopup)) - return false; + want_inhibit = true; + else if ((focused_root_window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiHoveredFlags_AllowWhenBlockedByPopup)) + want_inhibit = true; + + // Inhibit hover unless the window is within the stack of our modal/popup + if (want_inhibit) + if (!ImGui::IsWindowWithinBeginStackOf(window->RootWindow, focused_root_window)) + return false; } return true; } @@ -3279,7 +3921,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - if (g.NavDisableMouseHover && !g.NavDisableHighlight) + if (g.NavDisableMouseHover && !g.NavDisableHighlight && !(flags & ImGuiHoveredFlags_NoNavOverride)) { if ((g.LastItemData.InFlags & ImGuiItemFlags_Disabled) && !(flags & ImGuiHoveredFlags_AllowWhenDisabled)) return false; @@ -3294,6 +3936,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) return false; IM_ASSERT((flags & (ImGuiHoveredFlags_AnyWindow | ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_NoPopupHierarchy)) == 0); // Flags not supported by this function + // Done with rectangle culling so we can perform heavier checks now // Test if we are hovering the right window (our window could be behind another window) // [2021/03/02] Reworked / reverted the revert, finally. Note we want e.g. BeginGroup/ItemAdd/EndGroup to work as well. (#3851) // [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable @@ -3310,7 +3953,7 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) // Test if interactions on this window are blocked by an active popup or modal. // The ImGuiHoveredFlags_AllowWhenBlockedByPopup flag will be tested here. - if (!IsWindowContentHoverable(window, flags)) + if (!IsWindowContentHoverable(window, flags) && !(g.LastItemData.InFlags & ImGuiItemFlags_NoWindowHoverableCheck)) return false; // Test if the item is disabled @@ -3318,11 +3961,29 @@ bool ImGui::IsItemHovered(ImGuiHoveredFlags flags) return false; // Special handling for calling after Begin() which represent the title bar or tab. - // When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case. + // When the window is skipped/collapsed (SkipItems==true) that last item will never be overwritten so we need to detect the case. if (g.LastItemData.ID == window->MoveId && window->WriteAccessed) return false; } + // Handle hover delay + // (some ideas: https://www.nngroup.com/articles/timing-exposing-content) + float delay; + if (flags & ImGuiHoveredFlags_DelayNormal) + delay = g.IO.HoverDelayNormal; + else if (flags & ImGuiHoveredFlags_DelayShort) + delay = g.IO.HoverDelayShort; + else + delay = 0.0f; + if (delay > 0.0f) + { + ImGuiID hover_delay_id = (g.LastItemData.ID != 0) ? g.LastItemData.ID : window->GetIDFromRectangle(g.LastItemData.Rect); + if ((flags & ImGuiHoveredFlags_NoSharedDelay) && (g.HoverDelayIdPreviousFrame != hover_delay_id)) + g.HoverDelayTimer = 0.0f; + g.HoverDelayId = hover_delay_id; + return g.HoverDelayTimer >= delay; + } + return true; } @@ -3340,9 +4001,10 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id) return false; if (!IsMouseHoveringRect(bb.Min, bb.Max)) return false; - if (g.NavDisableMouseHover) - return false; - if (!IsWindowContentHoverable(window, ImGuiHoveredFlags_None)) + + // Done with rectangle culling so we can perform heavier checks now. + ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.InFlags : g.CurrentItemFlags); + if (!(item_flags & ImGuiItemFlags_NoWindowHoverableCheck) && !IsWindowContentHoverable(window, ImGuiHoveredFlags_None)) { g.HoveredIdDisabled = true; return false; @@ -3354,7 +4016,6 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id) SetHoveredID(id); // When disabled we'll return false but still set HoveredId - ImGuiItemFlags item_flags = (g.LastItemData.ID == id ? g.LastItemData.InFlags : g.CurrentItemFlags); if (item_flags & ImGuiItemFlags_Disabled) { // Release active id if turning disabled @@ -3369,17 +4030,20 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id) // [DEBUG] Item Picker tool! // We perform the check here because SetHoveredID() is not frequently called (1~ time a frame), making // the cost of this tool near-zero. We can get slightly better call-stack and support picking non-hovered - // items if we perform the test in ItemAdd(), but that would incur a small runtime cost. - // #define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX in imconfig.h if you want this check to also be performed in ItemAdd(). + // items if we performed the test in ItemAdd(), but that would incur a small runtime cost. if (g.DebugItemPickerActive && g.HoveredIdPreviousFrame == id) GetForegroundDrawList()->AddRect(bb.Min, bb.Max, IM_COL32(255, 255, 0, 255)); if (g.DebugItemPickerBreakId == id) IM_DEBUG_BREAK(); } + if (g.NavDisableMouseHover) + return false; + return true; } +// FIXME: This is inlined/duplicated in ItemAdd() bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id) { ImGuiContext& g = *GImGui; @@ -3392,14 +4056,14 @@ bool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id) } // This is also inlined in ItemAdd() -// Note: if ImGuiItemStatusFlags_HasDisplayRect is set, user needs to set window->DC.LastItemDisplayRect! +// Note: if ImGuiItemStatusFlags_HasDisplayRect is set, user needs to set g.LastItemData.DisplayRect. void ImGui::SetLastItemData(ImGuiID item_id, ImGuiItemFlags in_flags, ImGuiItemStatusFlags item_flags, const ImRect& item_rect) { ImGuiContext& g = *GImGui; g.LastItemData.ID = item_id; g.LastItemData.InFlags = in_flags; g.LastItemData.StatusFlags = item_flags; - g.LastItemData.Rect = item_rect; + g.LastItemData.Rect = g.LastItemData.NavRect = item_rect; } float ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x) @@ -3461,132 +4125,52 @@ const char* ImGui::GetVersion() return IMGUI_VERSION; } -// Internal state access - if you want to share Dear ImGui state between modules (e.g. DLL) or allocate it yourself -// Note that we still point to some static data and members (such as GFontAtlas), so the state instance you end up using will point to the static data within its module -ImGuiContext* ImGui::GetCurrentContext() +ImGuiIO& ImGui::GetIO() { - return GImGui; + IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?"); + return GImGui->IO; } -void ImGui::SetCurrentContext(ImGuiContext* ctx) +// Pass this to your backend rendering function! Valid after Render() and until the next call to NewFrame() +ImDrawData* ImGui::GetDrawData() { -#ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC - IMGUI_SET_CURRENT_CONTEXT_FUNC(ctx); // For custom thread-based hackery you may want to have control over this. -#else - GImGui = ctx; -#endif + ImGuiContext& g = *GImGui; + ImGuiViewportP* viewport = g.Viewports[0]; + return viewport->DrawDataP.Valid ? &viewport->DrawDataP : NULL; } -void ImGui::SetAllocatorFunctions(ImGuiMemAllocFunc alloc_func, ImGuiMemFreeFunc free_func, void* user_data) +double ImGui::GetTime() { - GImAllocatorAllocFunc = alloc_func; - GImAllocatorFreeFunc = free_func; - GImAllocatorUserData = user_data; + return GImGui->Time; } -// This is provided to facilitate copying allocators from one static/DLL boundary to another (e.g. retrieve default allocator of your executable address space) -void ImGui::GetAllocatorFunctions(ImGuiMemAllocFunc* p_alloc_func, ImGuiMemFreeFunc* p_free_func, void** p_user_data) +int ImGui::GetFrameCount() { - *p_alloc_func = GImAllocatorAllocFunc; - *p_free_func = GImAllocatorFreeFunc; - *p_user_data = GImAllocatorUserData; + return GImGui->FrameCount; } -ImGuiContext* ImGui::CreateContext(ImFontAtlas* shared_font_atlas) +static ImDrawList* GetViewportDrawList(ImGuiViewportP* viewport, size_t drawlist_no, const char* drawlist_name) { - ImGuiContext* ctx = IM_NEW(ImGuiContext)(shared_font_atlas); - if (GImGui == NULL) - SetCurrentContext(ctx); - Initialize(ctx); - return ctx; -} - -void ImGui::DestroyContext(ImGuiContext* ctx) -{ - if (ctx == NULL) - ctx = GImGui; - Shutdown(ctx); - if (GImGui == ctx) - SetCurrentContext(NULL); - IM_DELETE(ctx); -} - -// No specific ordering/dependency support, will see as needed -ImGuiID ImGui::AddContextHook(ImGuiContext* ctx, const ImGuiContextHook* hook) -{ - ImGuiContext& g = *ctx; - IM_ASSERT(hook->Callback != NULL && hook->HookId == 0 && hook->Type != ImGuiContextHookType_PendingRemoval_); - g.Hooks.push_back(*hook); - g.Hooks.back().HookId = ++g.HookIdNext; - return g.HookIdNext; -} - -// Deferred removal, avoiding issue with changing vector while iterating it -void ImGui::RemoveContextHook(ImGuiContext* ctx, ImGuiID hook_id) -{ - ImGuiContext& g = *ctx; - IM_ASSERT(hook_id != 0); - for (int n = 0; n < g.Hooks.Size; n++) - if (g.Hooks[n].HookId == hook_id) - g.Hooks[n].Type = ImGuiContextHookType_PendingRemoval_; -} - -// Call context hooks (used by e.g. test engine) -// We assume a small number of hooks so all stored in same array -void ImGui::CallContextHooks(ImGuiContext* ctx, ImGuiContextHookType hook_type) -{ - ImGuiContext& g = *ctx; - for (int n = 0; n < g.Hooks.Size; n++) - if (g.Hooks[n].Type == hook_type) - g.Hooks[n].Callback(&g, &g.Hooks[n]); -} - -ImGuiIO& ImGui::GetIO() -{ - IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?"); - return GImGui->IO; -} - -// Pass this to your backend rendering function! Valid after Render() and until the next call to NewFrame() -ImDrawData* ImGui::GetDrawData() -{ - ImGuiContext& g = *GImGui; - ImGuiViewportP* viewport = g.Viewports[0]; - return viewport->DrawDataP.Valid ? &viewport->DrawDataP : NULL; -} - -double ImGui::GetTime() -{ - return GImGui->Time; -} - -int ImGui::GetFrameCount() -{ - return GImGui->FrameCount; -} - -static ImDrawList* GetViewportDrawList(ImGuiViewportP* viewport, size_t drawlist_no, const char* drawlist_name) -{ - // Create the draw list on demand, because they are not frequently used for all viewports - ImGuiContext& g = *GImGui; - IM_ASSERT(drawlist_no < IM_ARRAYSIZE(viewport->DrawLists)); - ImDrawList* draw_list = viewport->DrawLists[drawlist_no]; - if (draw_list == NULL) - { - draw_list = IM_NEW(ImDrawList)(&g.DrawListSharedData); - draw_list->_OwnerName = drawlist_name; - viewport->DrawLists[drawlist_no] = draw_list; - } - - // Our ImDrawList system requires that there is always a command - if (viewport->DrawListsLastFrame[drawlist_no] != g.FrameCount) - { - draw_list->_ResetForNewFrame(); - draw_list->PushTextureID(g.IO.Fonts->TexID); - draw_list->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size, false); - viewport->DrawListsLastFrame[drawlist_no] = g.FrameCount; - } - return draw_list; + // Create the draw list on demand, because they are not frequently used for all viewports + ImGuiContext& g = *GImGui; + IM_ASSERT(drawlist_no < IM_ARRAYSIZE(viewport->DrawLists)); + ImDrawList* draw_list = viewport->DrawLists[drawlist_no]; + if (draw_list == NULL) + { + draw_list = IM_NEW(ImDrawList)(&g.DrawListSharedData); + draw_list->_OwnerName = drawlist_name; + viewport->DrawLists[drawlist_no] = draw_list; + } + + // Our ImDrawList system requires that there is always a command + if (viewport->DrawListsLastFrame[drawlist_no] != g.FrameCount) + { + draw_list->_ResetForNewFrame(); + draw_list->PushTextureID(g.IO.Fonts->TexID); + draw_list->PushClipRect(viewport->Pos, viewport->Pos + viewport->Size, false); + viewport->DrawListsLastFrame[drawlist_no] = g.FrameCount; + } + return draw_list; } ImDrawList* ImGui::GetBackgroundDrawList(ImGuiViewport* viewport) @@ -3627,7 +4211,7 @@ void ImGui::StartMouseMovingWindow(ImGuiWindow* window) g.NavDisableHighlight = true; g.ActiveIdClickOffset = g.IO.MouseClickedPos[0] - window->RootWindow->Pos; g.ActiveIdNoClearOnFocusLoss = true; - SetActiveIdUsingNavAndKeys(); + SetActiveIdUsingAllKeyboardKeys(); bool can_move_window = true; if ((window->Flags & ImGuiWindowFlags_NoMove) || (window->RootWindow->Flags & ImGuiWindowFlags_NoMove)) @@ -3654,11 +4238,7 @@ void ImGui::UpdateMouseMovingWindowNewFrame() if (g.IO.MouseDown[0] && IsMousePosValid(&g.IO.MousePos)) { ImVec2 pos = g.IO.MousePos - g.ActiveIdClickOffset; - if (moving_window->Pos.x != pos.x || moving_window->Pos.y != pos.y) - { - MarkIniSettingsDirty(moving_window); - SetWindowPos(moving_window, pos, ImGuiCond_Always); - } + SetWindowPos(moving_window, pos, ImGuiCond_Always); FocusWindow(g.MovingWindow); } else @@ -3738,164 +4318,6 @@ static bool IsWindowActiveAndVisible(ImGuiWindow* window) return (window->Active) && (!window->Hidden); } -static void ImGui::UpdateMouseInputs() -{ - ImGuiContext& g = *GImGui; - - // Round mouse position to avoid spreading non-rounded position (e.g. UpdateManualResize doesn't support them well) - if (IsMousePosValid(&g.IO.MousePos)) - g.IO.MousePos = g.MouseLastValidPos = ImFloor(g.IO.MousePos); - - // If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta - if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MousePosPrev)) - g.IO.MouseDelta = g.IO.MousePos - g.IO.MousePosPrev; - else - g.IO.MouseDelta = ImVec2(0.0f, 0.0f); - - // If mouse moved we re-enable mouse hovering in case it was disabled by gamepad/keyboard. In theory should use a >0.0f threshold but would need to reset in everywhere we set this to true. - if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f) - g.NavDisableMouseHover = false; - - g.IO.MousePosPrev = g.IO.MousePos; - for (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++) - { - g.IO.MouseClicked[i] = g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] < 0.0f; - g.IO.MouseClickedCount[i] = 0; // Will be filled below - g.IO.MouseReleased[i] = !g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] >= 0.0f; - g.IO.MouseDownDurationPrev[i] = g.IO.MouseDownDuration[i]; - g.IO.MouseDownDuration[i] = g.IO.MouseDown[i] ? (g.IO.MouseDownDuration[i] < 0.0f ? 0.0f : g.IO.MouseDownDuration[i] + g.IO.DeltaTime) : -1.0f; - if (g.IO.MouseClicked[i]) - { - bool is_repeated_click = false; - if ((float)(g.Time - g.IO.MouseClickedTime[i]) < g.IO.MouseDoubleClickTime) - { - ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f); - if (ImLengthSqr(delta_from_click_pos) < g.IO.MouseDoubleClickMaxDist * g.IO.MouseDoubleClickMaxDist) - is_repeated_click = true; - } - if (is_repeated_click) - g.IO.MouseClickedLastCount[i]++; - else - g.IO.MouseClickedLastCount[i] = 1; - g.IO.MouseClickedTime[i] = g.Time; - g.IO.MouseClickedPos[i] = g.IO.MousePos; - g.IO.MouseClickedCount[i] = g.IO.MouseClickedLastCount[i]; - g.IO.MouseDragMaxDistanceAbs[i] = ImVec2(0.0f, 0.0f); - g.IO.MouseDragMaxDistanceSqr[i] = 0.0f; - } - else if (g.IO.MouseDown[i]) - { - // Maintain the maximum distance we reaching from the initial click position, which is used with dragging threshold - ImVec2 delta_from_click_pos = IsMousePosValid(&g.IO.MousePos) ? (g.IO.MousePos - g.IO.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f); - g.IO.MouseDragMaxDistanceSqr[i] = ImMax(g.IO.MouseDragMaxDistanceSqr[i], ImLengthSqr(delta_from_click_pos)); - g.IO.MouseDragMaxDistanceAbs[i].x = ImMax(g.IO.MouseDragMaxDistanceAbs[i].x, delta_from_click_pos.x < 0.0f ? -delta_from_click_pos.x : delta_from_click_pos.x); - g.IO.MouseDragMaxDistanceAbs[i].y = ImMax(g.IO.MouseDragMaxDistanceAbs[i].y, delta_from_click_pos.y < 0.0f ? -delta_from_click_pos.y : delta_from_click_pos.y); - } - - // We provide io.MouseDoubleClicked[] as a legacy service - g.IO.MouseDoubleClicked[i] = (g.IO.MouseClickedCount[i] == 2); - - // Clicking any mouse button reactivate mouse hovering which may have been deactivated by gamepad/keyboard navigation - if (g.IO.MouseClicked[i]) - g.NavDisableMouseHover = false; - } -} - -static void StartLockWheelingWindow(ImGuiWindow* window) -{ - ImGuiContext& g = *GImGui; - if (g.WheelingWindow == window) - return; - g.WheelingWindow = window; - g.WheelingWindowRefMousePos = g.IO.MousePos; - g.WheelingWindowTimer = WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER; -} - -void ImGui::UpdateMouseWheel() -{ - ImGuiContext& g = *GImGui; - - // Reset the locked window if we move the mouse or after the timer elapses - if (g.WheelingWindow != NULL) - { - g.WheelingWindowTimer -= g.IO.DeltaTime; - if (IsMousePosValid() && ImLengthSqr(g.IO.MousePos - g.WheelingWindowRefMousePos) > g.IO.MouseDragThreshold * g.IO.MouseDragThreshold) - g.WheelingWindowTimer = 0.0f; - if (g.WheelingWindowTimer <= 0.0f) - { - g.WheelingWindow = NULL; - g.WheelingWindowTimer = 0.0f; - } - } - - if (g.IO.MouseWheel == 0.0f && g.IO.MouseWheelH == 0.0f) - return; - - if ((g.ActiveId != 0 && g.ActiveIdUsingMouseWheel) || (g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrameUsingMouseWheel)) - return; - - ImGuiWindow* window = g.WheelingWindow ? g.WheelingWindow : g.HoveredWindow; - if (!window || window->Collapsed) - return; - - // Zoom / Scale window - // FIXME-OBSOLETE: This is an old feature, it still works but pretty much nobody is using it and may be best redesigned. - if (g.IO.MouseWheel != 0.0f && g.IO.KeyCtrl && g.IO.FontAllowUserScaling) - { - StartLockWheelingWindow(window); - const float new_font_scale = ImClamp(window->FontWindowScale + g.IO.MouseWheel * 0.10f, 0.50f, 2.50f); - const float scale = new_font_scale / window->FontWindowScale; - window->FontWindowScale = new_font_scale; - if (window == window->RootWindow) - { - const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size; - SetWindowPos(window, window->Pos + offset, 0); - window->Size = ImFloor(window->Size * scale); - window->SizeFull = ImFloor(window->SizeFull * scale); - } - return; - } - - // Mouse wheel scrolling - // If a child window has the ImGuiWindowFlags_NoScrollWithMouse flag, we give a chance to scroll its parent - if (g.IO.KeyCtrl) - return; - - // As a standard behavior holding SHIFT while using Vertical Mouse Wheel triggers Horizontal scroll instead - // (we avoid doing it on OSX as it the OS input layer handles this already) - const bool swap_axis = g.IO.KeyShift && !g.IO.ConfigMacOSXBehaviors; - const float wheel_y = swap_axis ? 0.0f : g.IO.MouseWheel; - const float wheel_x = swap_axis ? g.IO.MouseWheel : g.IO.MouseWheelH; - - // Vertical Mouse Wheel scrolling - if (wheel_y != 0.0f) - { - StartLockWheelingWindow(window); - while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.y == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs)))) - window = window->ParentWindow; - if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs)) - { - float max_step = window->InnerRect.GetHeight() * 0.67f; - float scroll_step = ImFloor(ImMin(5 * window->CalcFontSize(), max_step)); - SetScrollY(window, window->Scroll.y - wheel_y * scroll_step); - } - } - - // Horizontal Mouse Wheel scrolling, or Vertical Mouse Wheel w/ Shift held - if (wheel_x != 0.0f) - { - StartLockWheelingWindow(window); - while ((window->Flags & ImGuiWindowFlags_ChildWindow) && ((window->ScrollMax.x == 0.0f) || ((window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs)))) - window = window->ParentWindow; - if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs)) - { - float max_step = window->InnerRect.GetWidth() * 0.67f; - float scroll_step = ImFloor(ImMin(2 * window->CalcFontSize(), max_step)); - SetScrollX(window, window->Scroll.x - wheel_x * scroll_step); - } - } -} - // The reason this is exposed in imgui_internal.h is: on touch-based system that don't have hovering, we want to dispatch inputs to the right target (imgui vs imgui+app) void ImGui::UpdateHoveredWindowAndCaptureFlags() { @@ -3973,17 +4395,6 @@ void ImGui::UpdateHoveredWindowAndCaptureFlags() io.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : false; } -ImGuiKeyModFlags ImGui::GetMergedKeyModFlags() -{ - ImGuiContext& g = *GImGui; - ImGuiKeyModFlags key_mod_flags = ImGuiKeyModFlags_None; - if (g.IO.KeyCtrl) { key_mod_flags |= ImGuiKeyModFlags_Ctrl; } - if (g.IO.KeyShift) { key_mod_flags |= ImGuiKeyModFlags_Shift; } - if (g.IO.KeyAlt) { key_mod_flags |= ImGuiKeyModFlags_Alt; } - if (g.IO.KeySuper) { key_mod_flags |= ImGuiKeyModFlags_Super; } - return key_mod_flags; -} - void ImGui::NewFrame() { IM_ASSERT(GImGui != NULL && "No current context. Did you call ImGui::CreateContext() and ImGui::SetCurrentContext() ?"); @@ -4017,6 +4428,11 @@ void ImGui::NewFrame() g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_ARRAYSIZE(g.FramerateSecPerFrame)); g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX; + // Process input queue (trickle as many events as possible), turn events into writes to IO structure + g.InputEventsTrail.resize(0); + UpdateInputEvents(g.IO.ConfigInputTrickleEventQueue); + + // Update viewports (after processing input queue, so io.MouseHoveredViewport is set) UpdateViewportsNewFrame(); // Setup current font and draw list shared data @@ -4060,15 +4476,20 @@ void ImGui::NewFrame() if (g.HoveredId && g.ActiveId != g.HoveredId) g.HoveredIdNotActiveTimer += g.IO.DeltaTime; g.HoveredIdPreviousFrame = g.HoveredId; - g.HoveredIdPreviousFrameUsingMouseWheel = g.HoveredIdUsingMouseWheel; g.HoveredId = 0; g.HoveredIdAllowOverlap = false; - g.HoveredIdUsingMouseWheel = false; g.HoveredIdDisabled = false; - // Update ActiveId data (clear reference to active widget if the widget isn't alive anymore) - if (g.ActiveIdIsAlive != g.ActiveId && g.ActiveIdPreviousFrame == g.ActiveId && g.ActiveId != 0) + // Clear ActiveID if the item is not alive anymore. + // In 1.87, the common most call to KeepAliveID() was moved from GetID() to ItemAdd(). + // As a result, custom widget using ButtonBehavior() _without_ ItemAdd() need to call KeepAliveID() themselves. + if (g.ActiveId != 0 && g.ActiveIdIsAlive != g.ActiveId && g.ActiveIdPreviousFrame == g.ActiveId) + { + IMGUI_DEBUG_LOG_ACTIVEID("NewFrame(): ClearActiveID() because it isn't marked alive anymore!\n"); ClearActiveID(); + } + + // Update ActiveId data (clear reference to active widget if the widget isn't alive anymore) if (g.ActiveId) g.ActiveIdTimer += g.IO.DeltaTime; g.LastActiveIdTimer += g.IO.DeltaTime; @@ -4084,8 +4505,41 @@ void ImGui::NewFrame() if (g.ActiveId == 0) { g.ActiveIdUsingNavDirMask = 0x00; + g.ActiveIdUsingAllKeyboardKeys = false; +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO g.ActiveIdUsingNavInputMask = 0x00; - g.ActiveIdUsingKeyInputMask = 0x00; +#endif + } + +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + if (g.ActiveId == 0) + g.ActiveIdUsingNavInputMask = 0; + else if (g.ActiveIdUsingNavInputMask != 0) + { + // If your custom widget code used: { g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel); } + // Since IMGUI_VERSION_NUM >= 18804 it should be: { SetKeyOwner(ImGuiKey_Escape, g.ActiveId); SetKeyOwner(ImGuiKey_NavGamepadCancel, g.ActiveId); } + if (g.ActiveIdUsingNavInputMask & (1 << ImGuiNavInput_Cancel)) + SetKeyOwner(ImGuiKey_Escape, g.ActiveId); + if (g.ActiveIdUsingNavInputMask & ~(1 << ImGuiNavInput_Cancel)) + IM_ASSERT(0); // Other values unsupported + } +#endif + + // Update hover delay for IsItemHovered() with delays and tooltips + g.HoverDelayIdPreviousFrame = g.HoverDelayId; + if (g.HoverDelayId != 0) + { + //if (g.IO.MouseDelta.x == 0.0f && g.IO.MouseDelta.y == 0.0f) // Need design/flags + g.HoverDelayTimer += g.IO.DeltaTime; + g.HoverDelayClearTimer = 0.0f; + g.HoverDelayId = 0; + } + else if (g.HoverDelayTimer > 0.0f) + { + // This gives a little bit of leeway before clearing the hover timer, allowing mouse to cross gaps + g.HoverDelayClearTimer += g.IO.DeltaTime; + if (g.HoverDelayClearTimer >= ImMax(0.20f, g.IO.DeltaTime * 2.0f)) // ~6 frames at 30 Hz + allow for low framerate + g.HoverDelayTimer = g.HoverDelayClearTimer = 0.0f; // May want a decaying timer, in which case need to clamp at max first, based on max of caller last requested timer. } // Drag and drop @@ -4100,20 +4554,13 @@ void ImGui::NewFrame() //if (g.IO.AppFocusLost) // ClosePopupsExceptModals(); - // Clear buttons state when focus is lost - // (this is useful so e.g. releasing Alt after focus loss on Alt-Tab doesn't trigger the Alt menu toggle) - if (g.IO.AppFocusLost) - { - g.IO.ClearInputKeys(); - g.IO.AppFocusLost = false; - } - // Update keyboard input state - // Synchronize io.KeyMods with individual modifiers io.KeyXXX bools - g.IO.KeyMods = GetMergedKeyModFlags(); - memcpy(g.IO.KeysDownDurationPrev, g.IO.KeysDownDuration, sizeof(g.IO.KeysDownDuration)); - for (int i = 0; i < IM_ARRAYSIZE(g.IO.KeysDown); i++) - g.IO.KeysDownDuration[i] = g.IO.KeysDown[i] ? (g.IO.KeysDownDuration[i] < 0.0f ? 0.0f : g.IO.KeysDownDuration[i] + g.IO.DeltaTime) : -1.0f; + UpdateKeyboardInputs(); + + //IM_ASSERT(g.IO.KeyCtrl == IsKeyDown(ImGuiKey_LeftCtrl) || IsKeyDown(ImGuiKey_RightCtrl)); + //IM_ASSERT(g.IO.KeyShift == IsKeyDown(ImGuiKey_LeftShift) || IsKeyDown(ImGuiKey_RightShift)); + //IM_ASSERT(g.IO.KeyAlt == IsKeyDown(ImGuiKey_LeftAlt) || IsKeyDown(ImGuiKey_RightAlt)); + //IM_ASSERT(g.IO.KeySuper == IsKeyDown(ImGuiKey_LeftSuper) || IsKeyDown(ImGuiKey_RightSuper)); // Update gamepad/keyboard navigation NavUpdate(); @@ -4136,7 +4583,10 @@ void ImGui::NewFrame() g.MouseCursor = ImGuiMouseCursor_Arrow; g.WantCaptureMouseNextFrame = g.WantCaptureKeyboardNextFrame = g.WantTextInputNextFrame = -1; - g.PlatformImePos = ImVec2(1.0f, 1.0f); // OS Input Method Editor showing on top-left of our window by default + + // Platform IME data: reset for the frame + g.PlatformImeDataPrev = g.PlatformImeData; + g.PlatformImeData.WantVisible = false; // Mouse wheel scrolling, scale UpdateMouseWheel(); @@ -4148,9 +4598,10 @@ void ImGui::NewFrame() { ImGuiWindow* window = g.Windows[i]; window->WasActive = window->Active; - window->BeginCount = 0; window->Active = false; window->WriteAccessed = false; + window->BeginCountPreviousFrame = window->BeginCount; + window->BeginCount = 0; // Garbage collect transient buffers of recently unused windows if (!window->WasActive && !window->MemoryCompacted && window->LastTimeActive < memory_compact_start_time) @@ -4183,160 +4634,66 @@ void ImGui::NewFrame() // [DEBUG] Update debug features UpdateDebugToolItemPicker(); UpdateDebugToolStackQueries(); + if (g.DebugLocateFrames > 0 && --g.DebugLocateFrames == 0) + g.DebugLocateId = 0; + if (g.DebugLogClipperAutoDisableFrames > 0 && --g.DebugLogClipperAutoDisableFrames == 0) + { + DebugLog("(Auto-disabled ImGuiDebugLogFlags_EventClipper to avoid spamming)\n"); + g.DebugLogFlags &= ~ImGuiDebugLogFlags_EventClipper; + } // Create implicit/fallback window - which we will only render it if the user has added something to it. // We don't use "Debug" to avoid colliding with user trying to create a "Debug" window with custom flags. - // This fallback is particularly important as it avoid ImGui:: calls from crashing. + // This fallback is particularly important as it prevents ImGui:: calls from crashing. g.WithinFrameScopeWithImplicitWindow = true; SetNextWindowSize(ImVec2(400, 400), ImGuiCond_FirstUseEver); Begin("Debug##Default"); IM_ASSERT(g.CurrentWindow->IsFallbackWindow == true); + // [DEBUG] When io.ConfigDebugBeginReturnValue is set, we make Begin()/BeginChild() return false at different level of the window-stack, + // allowing to validate correct Begin/End behavior in user code. + if (g.IO.ConfigDebugBeginReturnValueLoop) + g.DebugBeginReturnValueCullDepth = (g.DebugBeginReturnValueCullDepth == -1) ? 0 : ((g.DebugBeginReturnValueCullDepth + ((g.FrameCount % 4) == 0 ? 1 : 0)) % 10); + else + g.DebugBeginReturnValueCullDepth = -1; + CallContextHooks(&g, ImGuiContextHookType_NewFramePost); } -void ImGui::Initialize(ImGuiContext* context) +// FIXME: Add a more explicit sort order in the window structure. +static int IMGUI_CDECL ChildWindowComparer(const void* lhs, const void* rhs) { - ImGuiContext& g = *context; - IM_ASSERT(!g.Initialized && !g.SettingsLoaded); + const ImGuiWindow* const a = *(const ImGuiWindow* const *)lhs; + const ImGuiWindow* const b = *(const ImGuiWindow* const *)rhs; + if (int d = (a->Flags & ImGuiWindowFlags_Popup) - (b->Flags & ImGuiWindowFlags_Popup)) + return d; + if (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip)) + return d; + return (a->BeginOrderWithinParent - b->BeginOrderWithinParent); +} - // Add .ini handle for ImGuiWindow type +static void AddWindowToSortBuffer(ImVector* out_sorted_windows, ImGuiWindow* window) +{ + out_sorted_windows->push_back(window); + if (window->Active) { - ImGuiSettingsHandler ini_handler; - ini_handler.TypeName = "Window"; - ini_handler.TypeHash = ImHashStr("Window"); - ini_handler.ClearAllFn = WindowSettingsHandler_ClearAll; - ini_handler.ReadOpenFn = WindowSettingsHandler_ReadOpen; - ini_handler.ReadLineFn = WindowSettingsHandler_ReadLine; - ini_handler.ApplyAllFn = WindowSettingsHandler_ApplyAll; - ini_handler.WriteAllFn = WindowSettingsHandler_WriteAll; - g.SettingsHandlers.push_back(ini_handler); + int count = window->DC.ChildWindows.Size; + ImQsort(window->DC.ChildWindows.Data, (size_t)count, sizeof(ImGuiWindow*), ChildWindowComparer); + for (int i = 0; i < count; i++) + { + ImGuiWindow* child = window->DC.ChildWindows[i]; + if (child->Active) + AddWindowToSortBuffer(out_sorted_windows, child); + } } - - // Add .ini handle for ImGuiTable type - TableSettingsInstallHandler(context); - - // Create default viewport - ImGuiViewportP* viewport = IM_NEW(ImGuiViewportP)(); - g.Viewports.push_back(viewport); - -#ifdef IMGUI_HAS_DOCK -#endif - - g.Initialized = true; } -// This function is merely here to free heap allocations. -void ImGui::Shutdown(ImGuiContext* context) +static void AddDrawListToDrawData(ImVector* out_list, ImDrawList* draw_list) { - // The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame) - ImGuiContext& g = *context; - if (g.IO.Fonts && g.FontAtlasOwnedByContext) - { - g.IO.Fonts->Locked = false; - IM_DELETE(g.IO.Fonts); - } - g.IO.Fonts = NULL; - - // Cleanup of other data are conditional on actually having initialized Dear ImGui. - if (!g.Initialized) - return; - - // Save settings (unless we haven't attempted to load them: CreateContext/DestroyContext without a call to NewFrame shouldn't save an empty file) - if (g.SettingsLoaded && g.IO.IniFilename != NULL) - { - ImGuiContext* backup_context = GImGui; - SetCurrentContext(&g); - SaveIniSettingsToDisk(g.IO.IniFilename); - SetCurrentContext(backup_context); - } - - CallContextHooks(&g, ImGuiContextHookType_Shutdown); - - // Clear everything else - g.Windows.clear_delete(); - g.WindowsFocusOrder.clear(); - g.WindowsTempSortBuffer.clear(); - g.CurrentWindow = NULL; - g.CurrentWindowStack.clear(); - g.WindowsById.Clear(); - g.NavWindow = NULL; - g.HoveredWindow = g.HoveredWindowUnderMovingWindow = NULL; - g.ActiveIdWindow = g.ActiveIdPreviousFrameWindow = NULL; - g.MovingWindow = NULL; - g.ColorStack.clear(); - g.StyleVarStack.clear(); - g.FontStack.clear(); - g.OpenPopupStack.clear(); - g.BeginPopupStack.clear(); - - g.Viewports.clear_delete(); - - g.TabBars.Clear(); - g.CurrentTabBarStack.clear(); - g.ShrinkWidthBuffer.clear(); - - g.ClipperTempData.clear_destruct(); - - g.Tables.Clear(); - g.TablesTempData.clear_destruct(); - g.DrawChannelsTempMergeBuffer.clear(); - - g.ClipboardHandlerData.clear(); - g.MenusIdSubmittedThisFrame.clear(); - g.InputTextState.ClearFreeMemory(); - - g.SettingsWindows.clear(); - g.SettingsHandlers.clear(); - - if (g.LogFile) - { -#ifndef IMGUI_DISABLE_TTY_FUNCTIONS - if (g.LogFile != stdout) -#endif - ImFileClose(g.LogFile); - g.LogFile = NULL; - } - g.LogBuffer.clear(); - - g.Initialized = false; -} - -// FIXME: Add a more explicit sort order in the window structure. -static int IMGUI_CDECL ChildWindowComparer(const void* lhs, const void* rhs) -{ - const ImGuiWindow* const a = *(const ImGuiWindow* const *)lhs; - const ImGuiWindow* const b = *(const ImGuiWindow* const *)rhs; - if (int d = (a->Flags & ImGuiWindowFlags_Popup) - (b->Flags & ImGuiWindowFlags_Popup)) - return d; - if (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip)) - return d; - return (a->BeginOrderWithinParent - b->BeginOrderWithinParent); -} - -static void AddWindowToSortBuffer(ImVector* out_sorted_windows, ImGuiWindow* window) -{ - out_sorted_windows->push_back(window); - if (window->Active) - { - int count = window->DC.ChildWindows.Size; - ImQsort(window->DC.ChildWindows.Data, (size_t)count, sizeof(ImGuiWindow*), ChildWindowComparer); - for (int i = 0; i < count; i++) - { - ImGuiWindow* child = window->DC.ChildWindows[i]; - if (child->Active) - AddWindowToSortBuffer(out_sorted_windows, child); - } - } -} - -static void AddDrawListToDrawData(ImVector* out_list, ImDrawList* draw_list) -{ - // Remove trailing command if unused. - // Technically we could return directly instead of popping, but this make things looks neat in Metrics/Debugger window as well. - draw_list->_PopUnusedDrawCmd(); if (draw_list->CmdBuffer.Size == 0) return; + if (draw_list->CmdBuffer.Size == 1 && draw_list->CmdBuffer[0].ElemCount == 0 && draw_list->CmdBuffer[0].UserCallback == NULL) + return; // Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. // May trigger for you if you are using PrimXXX functions incorrectly. @@ -4422,8 +4779,10 @@ static void SetupViewportDrawData(ImGuiViewportP* viewport, ImVectorFramebufferScale = io.DisplayFramebufferScale; for (int n = 0; n < draw_lists->Size; n++) { - draw_data->TotalVtxCount += draw_lists->Data[n]->VtxBuffer.Size; - draw_data->TotalIdxCount += draw_lists->Data[n]->IdxBuffer.Size; + ImDrawList* draw_list = draw_lists->Data[n]; + draw_list->_PopUnusedDrawCmd(); + draw_data->TotalVtxCount += draw_list->VtxBuffer.Size; + draw_data->TotalIdxCount += draw_list->IdxBuffer.Size; } } @@ -4459,6 +4818,7 @@ static void ImGui::RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 { // We've already called AddWindowToDrawData() which called DrawList->ChannelsMerge() on DockNodeHost windows, // and draw list have been trimmed already, hence the explicit recreation of a draw command if missing. + // FIXME: This is creating complication, might be simpler if we could inject a drawlist in drawdata at a given position and not attempt to manipulate ImDrawCmd order. ImDrawList* draw_list = window->RootWindow->DrawList; if (draw_list->CmdBuffer.Size == 0) draw_list->AddDrawCmd(); @@ -4469,6 +4829,7 @@ static void ImGui::RenderDimmedBackgroundBehindWindow(ImGuiWindow* window, ImU32 draw_list->CmdBuffer.pop_back(); draw_list->CmdBuffer.push_front(cmd); draw_list->PopClipRect(); + draw_list->AddDrawCmd(); // We need to create a command as CmdBuffer.back().IdxOffset won't be correct if we append to same command. } } @@ -4493,6 +4854,8 @@ static void ImGui::RenderDimmedBackgrounds() { ImGuiContext& g = *GImGui; ImGuiWindow* modal_window = GetTopMostAndVisiblePopupModal(); + if (g.DimBgRatio <= 0.0f && g.NavWindowingHighlightAlpha <= 0.0f) + return; const bool dim_bg_for_modal = (modal_window != NULL); const bool dim_bg_for_window_list = (g.NavWindowingTargetAnim != NULL && g.NavWindowingTargetAnim->Active); if (!dim_bg_for_modal && !dim_bg_for_window_list) @@ -4540,11 +4903,24 @@ void ImGui::EndFrame() ErrorCheckEndFrameSanityChecks(); - // Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) - if (g.IO.ImeSetInputScreenPosFn && (g.PlatformImeLastPos.x == FLT_MAX || ImLengthSqr(g.PlatformImeLastPos - g.PlatformImePos) > 0.0001f)) + // Notify Platform/OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) + ImGuiPlatformImeData* ime_data = &g.PlatformImeData; + if (g.IO.SetPlatformImeDataFn && memcmp(ime_data, &g.PlatformImeDataPrev, sizeof(ImGuiPlatformImeData)) != 0) { - g.IO.ImeSetInputScreenPosFn((int)g.PlatformImePos.x, (int)g.PlatformImePos.y); - g.PlatformImeLastPos = g.PlatformImePos; + IMGUI_DEBUG_LOG_IO("Calling io.SetPlatformImeDataFn(): WantVisible: %d, InputPos (%.2f,%.2f)\n", ime_data->WantVisible, ime_data->InputPos.x, ime_data->InputPos.y); + ImGuiViewport* viewport = GetMainViewport(); +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + if (viewport->PlatformHandleRaw == NULL && g.IO.ImeWindowHandle != NULL) + { + viewport->PlatformHandleRaw = g.IO.ImeWindowHandle; + g.IO.SetPlatformImeDataFn(viewport, ime_data); + viewport->PlatformHandleRaw = NULL; + } + else +#endif + { + g.IO.SetPlatformImeDataFn(viewport, ime_data); + } } // Hide implicit/fallback "Debug" window if it hasn't been used @@ -4601,10 +4977,9 @@ void ImGui::EndFrame() g.IO.Fonts->Locked = false; // Clear Input data for next frame + g.IO.AppFocusLost = false; g.IO.MouseWheel = g.IO.MouseWheelH = 0.0f; g.IO.InputQueueCharacters.resize(0); - g.IO.KeyModsPrev = g.IO.KeyMods; // doing it here is better than in NewFrame() as we'll tolerate backend writing to KeyMods. If we want to firmly disallow it we should detect it. - memset(g.IO.NavInputs, 0, sizeof(g.IO.NavInputs)); CallContextHooks(&g, ImGuiContextHookType_EndFramePost); } @@ -4653,6 +5028,10 @@ void ImGui::Render() if (windows_to_render_top_most[n] && IsWindowActiveAndVisible(windows_to_render_top_most[n])) // NavWindowingTarget is always temporarily displayed as the top-most window AddRootWindowToDrawData(windows_to_render_top_most[n]); + // Draw software mouse cursor if requested by io.MouseDrawCursor flag + if (g.IO.MouseDrawCursor && first_render_of_frame && g.MouseCursor != ImGuiMouseCursor_None) + RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48)); + // Setup ImDrawData structures for end-user g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = 0; for (int n = 0; n < g.Viewports.Size; n++) @@ -4660,10 +5039,6 @@ void ImGui::Render() ImGuiViewportP* viewport = g.Viewports[n]; viewport->DrawDataBuilder.FlattenIntoSingleLayer(); - // Draw software mouse cursor if requested by io.MouseDrawCursor flag - if (g.IO.MouseDrawCursor && first_render_of_frame) - RenderMouseCursor(GetForegroundDrawList(viewport), g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48)); - // Add foreground ImDrawList (for each active viewport) if (viewport->DrawLists[1] != NULL) AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetForegroundDrawList(viewport)); @@ -4761,372 +5136,136 @@ static void FindHoveredWindow() g.HoveredWindowUnderMovingWindow = hovered_window_ignoring_moving_window; } -// Test if mouse cursor is hovering given rectangle -// NB- Rectangle is clipped by our current clip setting -// NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding) -bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip) +bool ImGui::IsItemActive() { ImGuiContext& g = *GImGui; - - // Clip - ImRect rect_clipped(r_min, r_max); - if (clip) - rect_clipped.ClipWith(g.CurrentWindow->ClipRect); - - // Expand for touch input - const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding); - if (!rect_for_touch.Contains(g.IO.MousePos)) - return false; - return true; + if (g.ActiveId) + return g.ActiveId == g.LastItemData.ID; + return false; } -int ImGui::GetKeyIndex(ImGuiKey imgui_key) +bool ImGui::IsItemActivated() { - IM_ASSERT(imgui_key >= 0 && imgui_key < ImGuiKey_COUNT); ImGuiContext& g = *GImGui; - return g.IO.KeyMap[imgui_key]; + if (g.ActiveId) + if (g.ActiveId == g.LastItemData.ID && g.ActiveIdPreviousFrame != g.LastItemData.ID) + return true; + return false; } -// Note that dear imgui doesn't know the semantic of each entry of io.KeysDown[]! -// Use your own indices/enums according to how your backend/engine stored them into io.KeysDown[]! -bool ImGui::IsKeyDown(int user_key_index) +bool ImGui::IsItemDeactivated() { - if (user_key_index < 0) - return false; ImGuiContext& g = *GImGui; - IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown)); - return g.IO.KeysDown[user_key_index]; + if (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasDeactivated) + return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Deactivated) != 0; + return (g.ActiveIdPreviousFrame == g.LastItemData.ID && g.ActiveIdPreviousFrame != 0 && g.ActiveId != g.LastItemData.ID); } -// t0 = previous time (e.g.: g.Time - g.IO.DeltaTime) -// t1 = current time (e.g.: g.Time) -// An event is triggered at: -// t = 0.0f t = repeat_delay, t = repeat_delay + repeat_rate*N -int ImGui::CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate) +bool ImGui::IsItemDeactivatedAfterEdit() { - if (t1 == 0.0f) - return 1; - if (t0 >= t1) - return 0; - if (repeat_rate <= 0.0f) - return (t0 < repeat_delay) && (t1 >= repeat_delay); - const int count_t0 = (t0 < repeat_delay) ? -1 : (int)((t0 - repeat_delay) / repeat_rate); - const int count_t1 = (t1 < repeat_delay) ? -1 : (int)((t1 - repeat_delay) / repeat_rate); - const int count = count_t1 - count_t0; - return count; + ImGuiContext& g = *GImGui; + return IsItemDeactivated() && (g.ActiveIdPreviousFrameHasBeenEditedBefore || (g.ActiveId == 0 && g.ActiveIdHasBeenEditedBefore)); } -int ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_rate) +// == GetItemID() == GetFocusID() +bool ImGui::IsItemFocused() { ImGuiContext& g = *GImGui; - if (key_index < 0) - return 0; - IM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown)); - const float t = g.IO.KeysDownDuration[key_index]; - return CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, repeat_delay, repeat_rate); + if (g.NavId != g.LastItemData.ID || g.NavId == 0) + return false; + return true; } -bool ImGui::IsKeyPressed(int user_key_index, bool repeat) +// Important: this can be useful but it is NOT equivalent to the behavior of e.g.Button()! +// Most widgets have specific reactions based on mouse-up/down state, mouse position etc. +bool ImGui::IsItemClicked(ImGuiMouseButton mouse_button) { - ImGuiContext& g = *GImGui; - if (user_key_index < 0) - return false; - IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown)); - const float t = g.IO.KeysDownDuration[user_key_index]; - if (t == 0.0f) - return true; - if (repeat && t > g.IO.KeyRepeatDelay) - return GetKeyPressedAmount(user_key_index, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0; - return false; + return IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_None); } -bool ImGui::IsKeyReleased(int user_key_index) +bool ImGui::IsItemToggledOpen() { ImGuiContext& g = *GImGui; - if (user_key_index < 0) return false; - IM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown)); - return g.IO.KeysDownDurationPrev[user_key_index] >= 0.0f && !g.IO.KeysDown[user_key_index]; + return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_ToggledOpen) ? true : false; } -bool ImGui::IsMouseDown(ImGuiMouseButton button) +bool ImGui::IsItemToggledSelection() { ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - return g.IO.MouseDown[button]; + return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_ToggledSelection) ? true : false; } -bool ImGui::IsMouseClicked(ImGuiMouseButton button, bool repeat) +bool ImGui::IsAnyItemHovered() { ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - const float t = g.IO.MouseDownDuration[button]; - if (t == 0.0f) - return true; - - if (repeat && t > g.IO.KeyRepeatDelay) - { - // FIXME: 2019/05/03: Our old repeat code was wrong here and led to doubling the repeat rate, which made it an ok rate for repeat on mouse hold. - int amount = CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate * 0.50f); - if (amount > 0) - return true; - } - return false; + return g.HoveredId != 0 || g.HoveredIdPreviousFrame != 0; } -bool ImGui::IsMouseReleased(ImGuiMouseButton button) +bool ImGui::IsAnyItemActive() { ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - return g.IO.MouseReleased[button]; + return g.ActiveId != 0; } -bool ImGui::IsMouseDoubleClicked(ImGuiMouseButton button) +bool ImGui::IsAnyItemFocused() { ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - return g.IO.MouseClickedCount[button] == 2; + return g.NavId != 0 && !g.NavDisableHighlight; } -int ImGui::GetMouseClickedCount(ImGuiMouseButton button) +bool ImGui::IsItemVisible() { ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - return g.IO.MouseClickedCount[button]; + return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Visible) != 0; } -// Return if a mouse click/drag went past the given threshold. Valid to call during the MouseReleased frame. -// [Internal] This doesn't test if the button is pressed -bool ImGui::IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold) +bool ImGui::IsItemEdited() { ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - if (lock_threshold < 0.0f) - lock_threshold = g.IO.MouseDragThreshold; - return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold; + return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Edited) != 0; } -bool ImGui::IsMouseDragging(ImGuiMouseButton button, float lock_threshold) +// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority. +// FIXME: Although this is exposed, its interaction and ideal idiom with using ImGuiButtonFlags_AllowItemOverlap flag are extremely confusing, need rework. +void ImGui::SetItemAllowOverlap() { ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - if (!g.IO.MouseDown[button]) - return false; - return IsMouseDragPastThreshold(button, lock_threshold); + ImGuiID id = g.LastItemData.ID; + if (g.HoveredId == id) + g.HoveredIdAllowOverlap = true; + if (g.ActiveId == id) + g.ActiveIdAllowOverlap = true; } -ImVec2 ImGui::GetMousePos() +// FIXME: It might be undesirable that this will likely disable KeyOwner-aware shortcuts systems. Consider a more fine-tuned version for the two users of this function. +void ImGui::SetActiveIdUsingAllKeyboardKeys() { ImGuiContext& g = *GImGui; - return g.IO.MousePos; + IM_ASSERT(g.ActiveId != 0); + g.ActiveIdUsingNavDirMask = (1 << ImGuiDir_COUNT) - 1; + g.ActiveIdUsingAllKeyboardKeys = true; + NavMoveRequestCancel(); } -// NB: prefer to call right after BeginPopup(). At the time Selectable/MenuItem is activated, the popup is already closed! -ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup() +ImGuiID ImGui::GetItemID() { ImGuiContext& g = *GImGui; - if (g.BeginPopupStack.Size > 0) - return g.OpenPopupStack[g.BeginPopupStack.Size - 1].OpenMousePos; - return g.IO.MousePos; + return g.LastItemData.ID; } -// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position. -bool ImGui::IsMousePosValid(const ImVec2* mouse_pos) +ImVec2 ImGui::GetItemRectMin() { - // The assert is only to silence a false-positive in XCode Static Analysis. - // Because GImGui is not dereferenced in every code path, the static analyzer assume that it may be NULL (which it doesn't for other functions). - IM_ASSERT(GImGui != NULL); - const float MOUSE_INVALID = -256000.0f; - ImVec2 p = mouse_pos ? *mouse_pos : GImGui->IO.MousePos; - return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID; + ImGuiContext& g = *GImGui; + return g.LastItemData.Rect.Min; } -bool ImGui::IsAnyMouseDown() +ImVec2 ImGui::GetItemRectMax() { ImGuiContext& g = *GImGui; - for (int n = 0; n < IM_ARRAYSIZE(g.IO.MouseDown); n++) - if (g.IO.MouseDown[n]) - return true; - return false; + return g.LastItemData.Rect.Max; } -// Return the delta from the initial clicking position while the mouse button is clicked or was just released. -// This is locked and return 0.0f until the mouse moves past a distance threshold at least once. -// NB: This is only valid if IsMousePosValid(). backends in theory should always keep mouse position valid when dragging even outside the client window. -ImVec2 ImGui::GetMouseDragDelta(ImGuiMouseButton button, float lock_threshold) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - if (lock_threshold < 0.0f) - lock_threshold = g.IO.MouseDragThreshold; - if (g.IO.MouseDown[button] || g.IO.MouseReleased[button]) - if (g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold) - if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MouseClickedPos[button])) - return g.IO.MousePos - g.IO.MouseClickedPos[button]; - return ImVec2(0.0f, 0.0f); -} - -void ImGui::ResetMouseDragDelta(ImGuiMouseButton button) -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); - // NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr - g.IO.MouseClickedPos[button] = g.IO.MousePos; -} - -ImGuiMouseCursor ImGui::GetMouseCursor() -{ - return GImGui->MouseCursor; -} - -void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type) -{ - GImGui->MouseCursor = cursor_type; -} - -void ImGui::CaptureKeyboardFromApp(bool capture) -{ - GImGui->WantCaptureKeyboardNextFrame = capture ? 1 : 0; -} - -void ImGui::CaptureMouseFromApp(bool capture) -{ - GImGui->WantCaptureMouseNextFrame = capture ? 1 : 0; -} - -bool ImGui::IsItemActive() -{ - ImGuiContext& g = *GImGui; - if (g.ActiveId) - return g.ActiveId == g.LastItemData.ID; - return false; -} - -bool ImGui::IsItemActivated() -{ - ImGuiContext& g = *GImGui; - if (g.ActiveId) - if (g.ActiveId == g.LastItemData.ID && g.ActiveIdPreviousFrame != g.LastItemData.ID) - return true; - return false; -} - -bool ImGui::IsItemDeactivated() -{ - ImGuiContext& g = *GImGui; - if (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasDeactivated) - return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Deactivated) != 0; - return (g.ActiveIdPreviousFrame == g.LastItemData.ID && g.ActiveIdPreviousFrame != 0 && g.ActiveId != g.LastItemData.ID); -} - -bool ImGui::IsItemDeactivatedAfterEdit() -{ - ImGuiContext& g = *GImGui; - return IsItemDeactivated() && (g.ActiveIdPreviousFrameHasBeenEditedBefore || (g.ActiveId == 0 && g.ActiveIdHasBeenEditedBefore)); -} - -// == GetItemID() == GetFocusID() -bool ImGui::IsItemFocused() -{ - ImGuiContext& g = *GImGui; - if (g.NavId != g.LastItemData.ID || g.NavId == 0) - return false; - return true; -} - -// Important: this can be useful but it is NOT equivalent to the behavior of e.g.Button()! -// Most widgets have specific reactions based on mouse-up/down state, mouse position etc. -bool ImGui::IsItemClicked(ImGuiMouseButton mouse_button) -{ - return IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_None); -} - -bool ImGui::IsItemToggledOpen() -{ - ImGuiContext& g = *GImGui; - return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_ToggledOpen) ? true : false; -} - -bool ImGui::IsItemToggledSelection() -{ - ImGuiContext& g = *GImGui; - return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_ToggledSelection) ? true : false; -} - -bool ImGui::IsAnyItemHovered() -{ - ImGuiContext& g = *GImGui; - return g.HoveredId != 0 || g.HoveredIdPreviousFrame != 0; -} - -bool ImGui::IsAnyItemActive() -{ - ImGuiContext& g = *GImGui; - return g.ActiveId != 0; -} - -bool ImGui::IsAnyItemFocused() -{ - ImGuiContext& g = *GImGui; - return g.NavId != 0 && !g.NavDisableHighlight; -} - -bool ImGui::IsItemVisible() -{ - ImGuiContext& g = *GImGui; - return g.CurrentWindow->ClipRect.Overlaps(g.LastItemData.Rect); -} - -bool ImGui::IsItemEdited() -{ - ImGuiContext& g = *GImGui; - return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Edited) != 0; -} - -// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority. -// FIXME: Although this is exposed, its interaction and ideal idiom with using ImGuiButtonFlags_AllowItemOverlap flag are extremely confusing, need rework. -void ImGui::SetItemAllowOverlap() -{ - ImGuiContext& g = *GImGui; - ImGuiID id = g.LastItemData.ID; - if (g.HoveredId == id) - g.HoveredIdAllowOverlap = true; - if (g.ActiveId == id) - g.ActiveIdAllowOverlap = true; -} - -void ImGui::SetItemUsingMouseWheel() -{ - ImGuiContext& g = *GImGui; - ImGuiID id = g.LastItemData.ID; - if (g.HoveredId == id) - g.HoveredIdUsingMouseWheel = true; - if (g.ActiveId == id) - g.ActiveIdUsingMouseWheel = true; -} - -void ImGui::SetActiveIdUsingNavAndKeys() -{ - ImGuiContext& g = *GImGui; - IM_ASSERT(g.ActiveId != 0); - g.ActiveIdUsingNavDirMask = ~(ImU32)0; - g.ActiveIdUsingNavInputMask = ~(ImU32)0; - g.ActiveIdUsingKeyInputMask = ~(ImU64)0; - NavMoveRequestCancel(); -} - -ImVec2 ImGui::GetItemRectMin() -{ - ImGuiContext& g = *GImGui; - return g.LastItemData.Rect.Min; -} - -ImVec2 ImGui::GetItemRectMax() -{ - ImGuiContext& g = *GImGui; - return g.LastItemData.Rect.Max; -} - -ImVec2 ImGui::GetItemRectSize() +ImVec2 ImGui::GetItemRectSize() { ImGuiContext& g = *GImGui; return g.LastItemData.Rect.GetSize(); @@ -5145,21 +5284,22 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b ImVec2 size = ImFloor(size_arg); const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00); if (size.x <= 0.0f) - size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too much issues) + size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too many issues) if (size.y <= 0.0f) size.y = ImMax(content_avail.y + size.y, 4.0f); SetNextWindowSize(size); // Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value. + const char* temp_window_name; if (name) - ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%s/%s_%08X", parent_window->Name, name, id); + ImFormatStringToTempBuffer(&temp_window_name, NULL, "%s/%s_%08X", parent_window->Name, name, id); else - ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%s/%08X", parent_window->Name, id); + ImFormatStringToTempBuffer(&temp_window_name, NULL, "%s/%08X", parent_window->Name, id); const float backup_border_size = g.Style.ChildBorderSize; if (!border) g.Style.ChildBorderSize = 0.0f; - bool ret = Begin(g.TempBuffer, NULL, flags); + bool ret = Begin(temp_window_name, NULL, flags); g.Style.ChildBorderSize = backup_border_size; ImGuiWindow* child_window = g.CurrentWindow; @@ -5177,7 +5317,7 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b FocusWindow(child_window); NavInitWindow(child_window, false); SetActiveID(id + 1, child_window); // Steal ActiveId with another arbitrary id so that key-press won't activate child item - g.ActiveIdSource = ImGuiInputSource_Nav; + g.ActiveIdSource = g.NavInputSource; } return ret; } @@ -5291,7 +5431,7 @@ static void UpdateWindowInFocusOrderList(ImGuiWindow* window, bool just_created, { ImGuiContext& g = *GImGui; - const bool new_is_explicit_child = (new_flags & ImGuiWindowFlags_ChildWindow) != 0; + const bool new_is_explicit_child = (new_flags & ImGuiWindowFlags_ChildWindow) != 0 && ((new_flags & ImGuiWindowFlags_Popup) == 0 || (new_flags & ImGuiWindowFlags_ChildMenu) != 0); const bool child_flag_changed = new_is_explicit_child != window->IsExplicitChild; if ((just_created || child_flag_changed) && !new_is_explicit_child) { @@ -5310,32 +5450,22 @@ static void UpdateWindowInFocusOrderList(ImGuiWindow* window, bool just_created, window->IsExplicitChild = new_is_explicit_child; } -static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags) +static void InitOrLoadWindowSettings(ImGuiWindow* window, ImGuiWindowSettings* settings) { - ImGuiContext& g = *GImGui; - //IMGUI_DEBUG_LOG("CreateNewWindow '%s', flags = 0x%08X\n", name, flags); - - // Create window the first time - ImGuiWindow* window = IM_NEW(ImGuiWindow)(&g, name); - window->Flags = flags; - g.WindowsById.SetVoidPtr(window->ID, window); - - // Default/arbitrary window position. Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. + // Initial window state with e.g. default/arbitrary window position + // Use SetNextWindowPos() with the appropriate condition flag to change the initial position of a window. const ImGuiViewport* main_viewport = ImGui::GetMainViewport(); window->Pos = main_viewport->Pos + ImVec2(60, 60); + window->SetWindowPosAllowFlags = window->SetWindowSizeAllowFlags = window->SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing; - // User can disable loading and saving of settings. Tooltip and child windows also don't store settings. - if (!(flags & ImGuiWindowFlags_NoSavedSettings)) - if (ImGuiWindowSettings* settings = ImGui::FindWindowSettings(window->ID)) - { - // Retrieve settings from .ini file - window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings); - SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false); - ApplyWindowSettings(window, settings); - } - window->DC.CursorStartPos = window->DC.CursorMaxPos = window->Pos; // So first call to CalcContentSize() doesn't return crazy values + if (settings != NULL) + { + SetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false); + ApplyWindowSettings(window, settings); + } + window->DC.CursorStartPos = window->DC.CursorMaxPos = window->DC.IdealMaxPos = window->Pos; // So first call to CalcWindowContentSizes() doesn't return crazy values - if ((flags & ImGuiWindowFlags_AlwaysAutoResize) != 0) + if ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0) { window->AutoFitFramesX = window->AutoFitFramesY = 2; window->AutoFitOnlyGrows = false; @@ -5348,12 +5478,28 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags) window->AutoFitFramesY = 2; window->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0); } +} + +static ImGuiWindow* CreateNewWindow(const char* name, ImGuiWindowFlags flags) +{ + // Create window the first time + //IMGUI_DEBUG_LOG("CreateNewWindow '%s', flags = 0x%08X\n", name, flags); + ImGuiContext& g = *GImGui; + ImGuiWindow* window = IM_NEW(ImGuiWindow)(&g, name); + window->Flags = flags; + g.WindowsById.SetVoidPtr(window->ID, window); + + ImGuiWindowSettings* settings = NULL; + if (!(flags & ImGuiWindowFlags_NoSavedSettings)) + if ((settings = ImGui::FindWindowSettingsByWindow(window)) != 0) + window->SettingsOffset = g.SettingsWindows.offset_from_ptr(settings); + + InitOrLoadWindowSettings(window, settings); if (flags & ImGuiWindowFlags_NoBringToFrontOnFocus) g.Windows.push_front(window); // Quite slow but rare and only once else g.Windows.push_back(window); - UpdateWindowInFocusOrderList(window, true, window->Flags); return window; } @@ -5386,9 +5532,9 @@ static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, const ImVec2& s if (!(window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysAutoResize))) { ImGuiWindow* window_for_height = window; - const float decoration_up_height = window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight(); new_size = ImMax(new_size, g.Style.WindowMinSize); - new_size.y = ImMax(new_size.y, decoration_up_height + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows + const float minimum_height = window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f); + new_size.y = ImMax(new_size.y, minimum_height); // Reduce artifacts with very small windows } return new_size; } @@ -5417,9 +5563,10 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont { ImGuiContext& g = *GImGui; ImGuiStyle& style = g.Style; - const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight(); + const float decoration_w_without_scrollbars = window->DecoOuterSizeX1 + window->DecoOuterSizeX2 - window->ScrollbarSizes.x; + const float decoration_h_without_scrollbars = window->DecoOuterSizeY1 + window->DecoOuterSizeY2 - window->ScrollbarSizes.y; ImVec2 size_pad = window->WindowPadding * 2.0f; - ImVec2 size_desired = size_contents + size_pad + ImVec2(0.0f, decoration_up_height); + ImVec2 size_desired = size_contents + size_pad + ImVec2(decoration_w_without_scrollbars, decoration_h_without_scrollbars); if (window->Flags & ImGuiWindowFlags_Tooltip) { // Tooltip always resize @@ -5434,15 +5581,14 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont if (is_popup || is_menu) // Popups and menus bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups) size_min = ImMin(size_min, ImVec2(4.0f, 4.0f)); - // FIXME-VIEWPORT-WORKAREA: May want to use GetWorkSize() instead of Size depending on the type of windows? - ImVec2 avail_size = ImGui::GetMainViewport()->Size; + ImVec2 avail_size = ImGui::GetMainViewport()->WorkSize; ImVec2 size_auto_fit = ImClamp(size_desired, size_min, ImMax(size_min, avail_size - style.DisplaySafeAreaPadding * 2.0f)); // When the window cannot fit all contents (either because of constraints, either because screen is too small), // we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than ViewportSize-WindowPadding. ImVec2 size_auto_fit_after_constraint = CalcWindowSizeAfterConstraint(window, size_auto_fit); - bool will_have_scrollbar_x = (size_auto_fit_after_constraint.x - size_pad.x - 0.0f < size_contents.x && !(window->Flags & ImGuiWindowFlags_NoScrollbar) && (window->Flags & ImGuiWindowFlags_HorizontalScrollbar)) || (window->Flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar); - bool will_have_scrollbar_y = (size_auto_fit_after_constraint.y - size_pad.y - decoration_up_height < size_contents.y && !(window->Flags & ImGuiWindowFlags_NoScrollbar)) || (window->Flags & ImGuiWindowFlags_AlwaysVerticalScrollbar); + bool will_have_scrollbar_x = (size_auto_fit_after_constraint.x - size_pad.x - decoration_w_without_scrollbars < size_contents.x && !(window->Flags & ImGuiWindowFlags_NoScrollbar) && (window->Flags & ImGuiWindowFlags_HorizontalScrollbar)) || (window->Flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar); + bool will_have_scrollbar_y = (size_auto_fit_after_constraint.y - size_pad.y - decoration_h_without_scrollbars < size_contents.y && !(window->Flags & ImGuiWindowFlags_NoScrollbar)) || (window->Flags & ImGuiWindowFlags_AlwaysVerticalScrollbar); if (will_have_scrollbar_x) size_auto_fit.y += style.ScrollbarSize; if (will_have_scrollbar_y) @@ -5549,7 +5695,7 @@ ImGuiID ImGui::GetWindowResizeBorderID(ImGuiWindow* window, ImGuiDir dir) } // Handle resize for: Resize Grips, Borders, Gamepad -// Return true when using auto-fit (double click on resize grip) +// Return true when using auto-fit (double-click on resize grip) static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect) { ImGuiContext& g = *GImGui; @@ -5557,7 +5703,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s if ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0) return false; - if (window->WasActive == false) // Early out to avoid running this code for e.g. an hidden implicit/fallback Debug window. + if (window->WasActive == false) // Early out to avoid running this code for e.g. a hidden implicit/fallback Debug window. return false; bool ret_auto_fit = false; @@ -5585,6 +5731,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s if (resize_rect.Min.x > resize_rect.Max.x) ImSwap(resize_rect.Min.x, resize_rect.Max.x); if (resize_rect.Min.y > resize_rect.Max.y) ImSwap(resize_rect.Min.y, resize_rect.Max.y); ImGuiID resize_grip_id = window->GetID(resize_grip_n); // == GetWindowResizeCornerID() + ItemAdd(resize_rect, resize_grip_id, NULL, ImGuiItemFlags_NoNav); ButtonBehavior(resize_rect, resize_grip_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus); //GetForegroundDrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255)); if (hovered || held) @@ -5620,6 +5767,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s bool hovered, held; ImRect border_rect = GetResizeBorderRect(window, border_n, grip_hover_inner_size, WINDOWS_HOVER_PADDING); ImGuiID border_id = window->GetID(border_n + 4); // == GetWindowResizeBorderID() + ItemAdd(border_rect, border_id, NULL, ImGuiItemFlags_NoNav); ButtonBehavior(border_rect, border_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus); //GetForegroundDrawLists(window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255)); if ((hovered && g.HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER) || held) @@ -5644,23 +5792,31 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s window->DC.NavLayerCurrent = ImGuiNavLayer_Main; // Navigation resize (keyboard/gamepad) + // FIXME: This cannot be moved to NavUpdateWindowing() because CalcWindowSizeAfterConstraint() need to callback into user. + // Not even sure the callback works here. if (g.NavWindowingTarget && g.NavWindowingTarget->RootWindow == window) { - ImVec2 nav_resize_delta; + ImVec2 nav_resize_dir; if (g.NavInputSource == ImGuiInputSource_Keyboard && g.IO.KeyShift) - nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_RawKeyboard, ImGuiInputReadMode_Down); + nav_resize_dir = GetKeyMagnitude2d(ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow); if (g.NavInputSource == ImGuiInputSource_Gamepad) - nav_resize_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_Down); - if (nav_resize_delta.x != 0.0f || nav_resize_delta.y != 0.0f) + nav_resize_dir = GetKeyMagnitude2d(ImGuiKey_GamepadDpadLeft, ImGuiKey_GamepadDpadRight, ImGuiKey_GamepadDpadUp, ImGuiKey_GamepadDpadDown); + if (nav_resize_dir.x != 0.0f || nav_resize_dir.y != 0.0f) { const float NAV_RESIZE_SPEED = 600.0f; - nav_resize_delta *= ImFloor(NAV_RESIZE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y)); - nav_resize_delta = ImMax(nav_resize_delta, visibility_rect.Min - window->Pos - window->Size); + const float resize_step = NAV_RESIZE_SPEED * g.IO.DeltaTime * ImMin(g.IO.DisplayFramebufferScale.x, g.IO.DisplayFramebufferScale.y); + g.NavWindowingAccumDeltaSize += nav_resize_dir * resize_step; + g.NavWindowingAccumDeltaSize = ImMax(g.NavWindowingAccumDeltaSize, visibility_rect.Min - window->Pos - window->Size); // We need Pos+Size >= visibility_rect.Min, so Size >= visibility_rect.Min - Pos, so size_delta >= visibility_rect.Min - window->Pos - window->Size g.NavWindowingToggleLayer = false; g.NavDisableMouseHover = true; resize_grip_col[0] = GetColorU32(ImGuiCol_ResizeGripActive); - // FIXME-NAV: Should store and accumulate into a separate size buffer to handle sizing constraints properly, right now a constraint will make us stuck. - size_target = CalcWindowSizeAfterConstraint(window, window->SizeFull + nav_resize_delta); + ImVec2 accum_floored = ImFloor(g.NavWindowingAccumDeltaSize); + if (accum_floored.x != 0.0f || accum_floored.y != 0.0f) + { + // FIXME-NAV: Should store and accumulate into a separate size buffer to handle sizing constraints properly, right now a constraint will make us stuck. + size_target = CalcWindowSizeAfterConstraint(window, window->SizeFull + accum_floored); + g.NavWindowingAccumDeltaSize -= accum_floored; + } } } @@ -5680,7 +5836,7 @@ static bool ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& s return ret_auto_fit; } -static inline void ClampWindowRect(ImGuiWindow* window, const ImRect& visibility_rect) +static inline void ClampWindowPos(ImGuiWindow* window, const ImRect& visibility_rect) { ImGuiContext& g = *GImGui; ImVec2 size_for_clamping = window->Size; @@ -5715,7 +5871,7 @@ static void ImGui::RenderWindowOuterBorders(ImGuiWindow* window) // Draw background and borders // Draw and handle scrollbars -void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size) +void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size) { ImGuiContext& g = *GImGui; ImGuiStyle& style = g.Style; @@ -5726,13 +5882,13 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar window->SkipItems = false; // Draw window + handle manual resize - // As we highlight the title bar when want_focus is set, multiple reappearing windows will have have their title bar highlighted on their reappearing frame. + // As we highlight the title bar when want_focus is set, multiple reappearing windows will have their title bar highlighted on their reappearing frame. const float window_rounding = window->WindowRounding; const float window_border_size = window->WindowBorderSize; if (window->Collapsed) { // Title bar only - float backup_border_size = style.FrameBorderSize; + const float backup_border_size = style.FrameBorderSize; g.Style.FrameBorderSize = window->WindowBorderSize; ImU32 title_bar_col = GetColorU32((title_bar_is_highlight && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed); RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding); @@ -5780,21 +5936,25 @@ void ImGui::RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar Scrollbar(ImGuiAxis_Y); // Render resize grips (after their input handling so we don't have a frame of latency) - if (!(flags & ImGuiWindowFlags_NoResize)) + if (handle_borders_and_resize_grips && !(flags & ImGuiWindowFlags_NoResize)) { for (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++) { + const ImU32 col = resize_grip_col[resize_grip_n]; + if ((col & IM_COL32_A_MASK) == 0) + continue; const ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n]; const ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPosN); window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(window_border_size, resize_grip_draw_size) : ImVec2(resize_grip_draw_size, window_border_size))); window->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(resize_grip_draw_size, window_border_size) : ImVec2(window_border_size, resize_grip_draw_size))); window->DrawList->PathArcToFast(ImVec2(corner.x + grip.InnerDir.x * (window_rounding + window_border_size), corner.y + grip.InnerDir.y * (window_rounding + window_border_size)), window_rounding, grip.AngleMin12, grip.AngleMax12); - window->DrawList->PathFillConvex(resize_grip_col[resize_grip_n]); + window->DrawList->PathFillConvex(col); } } // Borders - RenderWindowOuterBorders(window); + if (handle_borders_and_resize_grips) + RenderWindowOuterBorders(window); } } @@ -5923,7 +6083,9 @@ static ImGuiWindow* ImGui::FindBlockingModal(ImGuiWindow* window) for (int i = g.OpenPopupStack.Size - 1; i >= 0; i--) { ImGuiWindow* popup_window = g.OpenPopupStack.Data[i].Window; - if (popup_window == NULL || !popup_window->WasActive || !(popup_window->Flags & ImGuiWindowFlags_Modal)) // Check WasActive, because this code may run before popup renders on current frame. + if (popup_window == NULL || !(popup_window->Flags & ImGuiWindowFlags_Modal)) + continue; + if (!popup_window->Active && !popup_window->WasActive) // Check WasActive, because this code may run before popup renders on current frame, also check Active to handle newly created windows. continue; if (IsWindowWithinBeginStackOf(window, popup_window)) // Window is rendered over last modal, no render order change needed. break; @@ -5954,8 +6116,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) const bool window_just_created = (window == NULL); if (window_just_created) window = CreateNewWindow(name, flags); - else - UpdateWindowInFocusOrderList(window, window_just_created, flags); // Automatically disable manual moving/resizing when NoInputs is set if ((flags & ImGuiWindowFlags_NoInputs) == ImGuiWindowFlags_NoInputs) @@ -5983,6 +6143,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // Update Flags, LastFrameActive, BeginOrderXXX fields if (first_begin_of_the_frame) { + UpdateWindowInFocusOrderList(window, window_just_created, flags); window->Flags = (ImGuiWindowFlags)flags; window->LastFrameActive = current_frame; window->LastTimeActive = (float)g.Time; @@ -6009,27 +6170,33 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) ImGuiWindowStackData window_stack_data; window_stack_data.Window = window; window_stack_data.ParentLastItemDataBackup = g.LastItemData; - window_stack_data.StackSizesOnBegin.SetToCurrentState(); + window_stack_data.StackSizesOnBegin.SetToContextState(&g); g.CurrentWindowStack.push_back(window_stack_data); - g.CurrentWindow = NULL; if (flags & ImGuiWindowFlags_ChildMenu) g.BeginMenuCount++; + // Update ->RootWindow and others pointers (before any possible call to FocusWindow) + if (first_begin_of_the_frame) + { + UpdateWindowParentAndRootLinks(window, flags, parent_window); + window->ParentWindowInBeginStack = parent_window_in_stack; + } + + // Add to focus scope stack + PushFocusScope(window->ID); + window->NavRootFocusScopeId = g.CurrentFocusScopeId; + g.CurrentWindow = NULL; + + // Add to popup stack if (flags & ImGuiWindowFlags_Popup) { ImGuiPopupData& popup_ref = g.OpenPopupStack[g.BeginPopupStack.Size]; popup_ref.Window = window; + popup_ref.ParentNavLayer = parent_window_in_stack->DC.NavLayerCurrent; g.BeginPopupStack.push_back(popup_ref); window->PopupId = popup_ref.PopupId; } - // Update ->RootWindow and others pointers (before any possible call to FocusWindow) - if (first_begin_of_the_frame) - { - UpdateWindowParentAndRootLinks(window, flags, parent_window); - window->ParentWindowInBeginStack = parent_window_in_stack; - } - // Process SetNextWindow***() calls // (FIXME: Consider splitting the HasXXX flags into X/Y components bool window_pos_set_by_api = false; @@ -6085,6 +6252,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) { // Initialize const bool window_is_child_tooltip = (flags & ImGuiWindowFlags_ChildWindow) && (flags & ImGuiWindowFlags_Tooltip); // FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345) + const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesCannotSkipItems > 0); window->Active = true; window->HasCloseButton = (p_open != NULL); window->ClipRect = ImVec4(-FLT_MAX, -FLT_MAX, +FLT_MAX, +FLT_MAX); @@ -6111,7 +6279,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // UPDATE CONTENTS SIZE, UPDATE HIDDEN STATUS // Update contents size from last frame for auto-fitting (or use explicit size) - const bool window_just_appearing_after_hidden_for_resize = (window->HiddenFramesCannotSkipItems > 0); CalcWindowContentSizes(window, &window->ContentSize, &window->ContentSizeIdeal); if (window->HiddenFramesCanSkipItems > 0) window->HiddenFramesCanSkipItems--; @@ -6141,6 +6308,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // SELECT VIEWPORT // FIXME-VIEWPORT: In the docking/viewport branch, this is the point where we select the current viewport (which may affect the style) + + ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)GetMainViewport(); + SetWindowViewport(window, viewport); SetCurrentWindow(window); // LOCK BORDER SIZE AND PADDING FOR THE FRAME (so that altering them doesn't cause inconsistencies) @@ -6157,6 +6327,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->DC.MenuBarOffset.x = ImMax(ImMax(window->WindowPadding.x, style.ItemSpacing.x), g.NextWindowData.MenuBarOffsetMinVal.x); window->DC.MenuBarOffset.y = g.NextWindowData.MenuBarOffsetMinVal.y; + bool use_current_size_for_scrollbar_x = window_just_created; + bool use_current_size_for_scrollbar_y = window_just_created; + // Collapse window by double-clicking on title bar // At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing if (!(flags & ImGuiWindowFlags_NoTitleBar) && !(flags & ImGuiWindowFlags_NoCollapse)) @@ -6168,6 +6341,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) if (window->WantCollapseToggle) { window->Collapsed = !window->Collapsed; + if (!window->Collapsed) + use_current_size_for_scrollbar_y = true; MarkIniSettingsDirty(window); } } @@ -6179,10 +6354,17 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // SIZE + // Outer Decoration Sizes + // (we need to clear ScrollbarSize immediatly as CalcWindowAutoFitSize() needs it and can be called from other locations). + const ImVec2 scrollbar_sizes_from_last_frame = window->ScrollbarSizes; + window->DecoOuterSizeX1 = 0.0f; + window->DecoOuterSizeX2 = 0.0f; + window->DecoOuterSizeY1 = window->TitleBarHeight() + window->MenuBarHeight(); + window->DecoOuterSizeY2 = 0.0f; + window->ScrollbarSizes = ImVec2(0.0f, 0.0f); + // Calculate auto-fit size, handle automatic resize const ImVec2 size_auto_fit = CalcWindowAutoFitSize(window, window->ContentSizeIdeal); - bool use_current_size_for_scrollbar_x = window_just_created; - bool use_current_size_for_scrollbar_y = window_just_created; if ((flags & ImGuiWindowFlags_AlwaysAutoResize) && !window->Collapsed) { // Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc. @@ -6219,9 +6401,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->SizeFull = CalcWindowSizeAfterConstraint(window, window->SizeFull); window->Size = window->Collapsed && !(flags & ImGuiWindowFlags_ChildWindow) ? window->TitleBarRect().GetSize() : window->SizeFull; - // Decoration size - const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight(); - // POSITION // Popup latch its initial position, will position itself when it appears next frame @@ -6254,7 +6433,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // Calculate the range of allowed position for that window (to be movable and visible past safe area padding) // When clamping to stay visible, we will enforce that window->Pos stays inside of visibility_rect. - ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)GetMainViewport(); ImRect viewport_rect(viewport->GetMainRect()); ImRect viewport_work_rect(viewport->GetWorkRect()); ImVec2 visibility_padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding); @@ -6262,9 +6440,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // Clamp position/size so window stays visible within its viewport or monitor // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing. - if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0) + if (!window_pos_set_by_api && !(flags & ImGuiWindowFlags_ChildWindow)) if (viewport_rect.GetWidth() > 0.0f && viewport_rect.GetHeight() > 0.0f) - ClampWindowRect(window, visibility_rect); + ClampWindowPos(window, visibility_rect); window->Pos = ImFloor(window->Pos); // Lock window rounding for the frame (so that altering them doesn't cause inconsistencies) @@ -6301,6 +6479,18 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) } } + // [Test Engine] Register whole window in the item system (before submitting further decorations) +#ifdef IMGUI_ENABLE_TEST_ENGINE + if (g.TestEngineHookItems) + { + IM_ASSERT(window->IDStack.Size == 1); + window->IDStack.Size = 0; // As window->IDStack[0] == window->ID here, make sure TestEngine doesn't erroneously see window as parent of itself. + IMGUI_TEST_ENGINE_ITEM_ADD(window->ID, window->Rect(), NULL); + IMGUI_TEST_ENGINE_ITEM_INFO(window->ID, window->Name, (g.HoveredWindow == window) ? ImGuiItemStatusFlags_HoveredRect : 0); + window->IDStack.Size = 1; + } +#endif + // Handle manual resize: Resize Grips, Borders, Gamepad int border_held = -1; ImU32 resize_grip_col[4] = {}; @@ -6317,9 +6507,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) if (!window->Collapsed) { // When reading the current size we need to read it after size constraints have been applied. - // When we use InnerRect here we are intentionally reading last frame size, same for ScrollbarSizes values before we set them again. - ImVec2 avail_size_from_current_frame = ImVec2(window->SizeFull.x, window->SizeFull.y - decoration_up_height); - ImVec2 avail_size_from_last_frame = window->InnerRect.GetSize() + window->ScrollbarSizes; + // Intentionally use previous frame values for InnerRect and ScrollbarSizes. + // And when we use window->DecorationUp here it doesn't have ScrollbarSizes.y applied yet. + ImVec2 avail_size_from_current_frame = ImVec2(window->SizeFull.x, window->SizeFull.y - (window->DecoOuterSizeY1 + window->DecoOuterSizeY2)); + ImVec2 avail_size_from_last_frame = window->InnerRect.GetSize() + scrollbar_sizes_from_last_frame; ImVec2 needed_size_from_last_frame = window_just_created ? ImVec2(0, 0) : window->ContentSize + window->WindowPadding * 2.0f; float size_x_for_scrollbars = use_current_size_for_scrollbar_x ? avail_size_from_current_frame.x : avail_size_from_last_frame.x; float size_y_for_scrollbars = use_current_size_for_scrollbar_y ? avail_size_from_current_frame.y : avail_size_from_last_frame.y; @@ -6329,10 +6520,14 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) if (window->ScrollbarX && !window->ScrollbarY) window->ScrollbarY = (needed_size_from_last_frame.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar); window->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f); + + // Amend the partially filled window->DecorationXXX values. + window->DecoOuterSizeX2 += window->ScrollbarSizes.x; + window->DecoOuterSizeY2 += window->ScrollbarSizes.y; } // UPDATE RECTANGLES (1- THOSE NOT AFFECTED BY SCROLLING) - // Update various regions. Variables they depends on should be set above in this function. + // Update various regions. Variables they depend on should be set above in this function. // We set this up after processing the resize grip so that our rectangles doesn't lag by a frame. // Outer rectangle @@ -6352,10 +6547,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // - ScrollToRectEx() // - NavUpdatePageUpPageDown() // - Scrollbar() - window->InnerRect.Min.x = window->Pos.x; - window->InnerRect.Min.y = window->Pos.y + decoration_up_height; - window->InnerRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x; - window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->ScrollbarSizes.y; + window->InnerRect.Min.x = window->Pos.x + window->DecoOuterSizeX1; + window->InnerRect.Min.y = window->Pos.y + window->DecoOuterSizeY1; + window->InnerRect.Max.x = window->Pos.x + window->Size.x - window->DecoOuterSizeX2; + window->InnerRect.Max.y = window->Pos.y + window->Size.y - window->DecoOuterSizeY2; // Inner clipping rectangle. // Will extend a little bit outside the normal work region. @@ -6388,6 +6583,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // Apply scrolling window->Scroll = CalcNextScrollFromScrollTargetAndClamp(window); window->ScrollTarget = ImVec2(FLT_MAX, FLT_MAX); + window->DecoInnerSizeX1 = window->DecoInnerSizeY1 = 0.0f; // DRAWING @@ -6417,7 +6613,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // Handle title bar, scrollbar, resize grips and resize borders const ImGuiWindow* window_to_highlight = g.NavWindowingTarget ? g.NavWindowingTarget : g.NavWindow; const bool title_bar_is_highlight = want_focus || (window_to_highlight && window->RootWindowForTitleBarHighlight == window_to_highlight->RootWindowForTitleBarHighlight); - RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, resize_grip_count, resize_grip_col, resize_grip_draw_size); + const bool handle_borders_and_resize_grips = true; // This exists to facilitate merge with 'docking' branch. + RenderWindowDecorations(window, title_bar_rect, title_bar_is_highlight, handle_borders_and_resize_grips, resize_grip_count, resize_grip_col, resize_grip_draw_size); if (render_decorations_in_parent) window->DrawList = &window->DrawListInst; @@ -6432,8 +6629,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // - BeginTabBar() for right-most edge const bool allow_scrollbar_x = !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar); const bool allow_scrollbar_y = !(flags & ImGuiWindowFlags_NoScrollbar); - const float work_rect_size_x = (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : ImMax(allow_scrollbar_x ? window->ContentSize.x : 0.0f, window->Size.x - window->WindowPadding.x * 2.0f - window->ScrollbarSizes.x)); - const float work_rect_size_y = (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : ImMax(allow_scrollbar_y ? window->ContentSize.y : 0.0f, window->Size.y - window->WindowPadding.y * 2.0f - decoration_up_height - window->ScrollbarSizes.y)); + const float work_rect_size_x = (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : ImMax(allow_scrollbar_x ? window->ContentSize.x : 0.0f, window->Size.x - window->WindowPadding.x * 2.0f - (window->DecoOuterSizeX1 + window->DecoOuterSizeX2))); + const float work_rect_size_y = (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : ImMax(allow_scrollbar_y ? window->ContentSize.y : 0.0f, window->Size.y - window->WindowPadding.y * 2.0f - (window->DecoOuterSizeY1 + window->DecoOuterSizeY2))); window->WorkRect.Min.x = ImFloor(window->InnerRect.Min.x - window->Scroll.x + ImMax(window->WindowPadding.x, window->WindowBorderSize)); window->WorkRect.Min.y = ImFloor(window->InnerRect.Min.y - window->Scroll.y + ImMax(window->WindowPadding.y, window->WindowBorderSize)); window->WorkRect.Max.x = window->WorkRect.Min.x + work_rect_size_x; @@ -6444,21 +6641,21 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // FIXME-OBSOLETE: window->ContentRegionRect.Max is currently very misleading / partly faulty, but some BeginChild() patterns relies on it. // Used by: // - Mouse wheel scrolling + many other things - window->ContentRegionRect.Min.x = window->Pos.x - window->Scroll.x + window->WindowPadding.x; - window->ContentRegionRect.Min.y = window->Pos.y - window->Scroll.y + window->WindowPadding.y + decoration_up_height; - window->ContentRegionRect.Max.x = window->ContentRegionRect.Min.x + (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : (window->Size.x - window->WindowPadding.x * 2.0f - window->ScrollbarSizes.x)); - window->ContentRegionRect.Max.y = window->ContentRegionRect.Min.y + (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : (window->Size.y - window->WindowPadding.y * 2.0f - decoration_up_height - window->ScrollbarSizes.y)); + window->ContentRegionRect.Min.x = window->Pos.x - window->Scroll.x + window->WindowPadding.x + window->DecoOuterSizeX1; + window->ContentRegionRect.Min.y = window->Pos.y - window->Scroll.y + window->WindowPadding.y + window->DecoOuterSizeY1; + window->ContentRegionRect.Max.x = window->ContentRegionRect.Min.x + (window->ContentSizeExplicit.x != 0.0f ? window->ContentSizeExplicit.x : (window->Size.x - window->WindowPadding.x * 2.0f - (window->DecoOuterSizeX1 + window->DecoOuterSizeX2))); + window->ContentRegionRect.Max.y = window->ContentRegionRect.Min.y + (window->ContentSizeExplicit.y != 0.0f ? window->ContentSizeExplicit.y : (window->Size.y - window->WindowPadding.y * 2.0f - (window->DecoOuterSizeY1 + window->DecoOuterSizeY2))); // Setup drawing context // (NB: That term "drawing context / DC" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.) - window->DC.Indent.x = 0.0f + window->WindowPadding.x - window->Scroll.x; + window->DC.Indent.x = window->DecoOuterSizeX1 + window->WindowPadding.x - window->Scroll.x; window->DC.GroupOffset.x = 0.0f; window->DC.ColumnsOffset.x = 0.0f; // Record the loss of precision of CursorStartPos which can happen due to really large scrolling amount. // This is used by clipper to compensate and fix the most common use case of large scroll area. Easy and cheap, next best thing compared to switching everything to double or ImU64. - double start_pos_highp_x = (double)window->Pos.x + window->WindowPadding.x - (double)window->Scroll.x + window->DC.ColumnsOffset.x; - double start_pos_highp_y = (double)window->Pos.y + window->WindowPadding.y - (double)window->Scroll.y + decoration_up_height; + double start_pos_highp_x = (double)window->Pos.x + window->WindowPadding.x - (double)window->Scroll.x + window->DecoOuterSizeX1 + window->DC.ColumnsOffset.x; + double start_pos_highp_y = (double)window->Pos.y + window->WindowPadding.y - (double)window->Scroll.y + window->DecoOuterSizeY1; window->DC.CursorStartPos = ImVec2((float)start_pos_highp_x, (float)start_pos_highp_y); window->DC.CursorStartPosLossyness = ImVec2((float)(start_pos_highp_x - window->DC.CursorStartPos.x), (float)(start_pos_highp_y - window->DC.CursorStartPos.y)); window->DC.CursorPos = window->DC.CursorStartPos; @@ -6467,6 +6664,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->DC.IdealMaxPos = window->DC.CursorStartPos; window->DC.CurrLineSize = window->DC.PrevLineSize = ImVec2(0.0f, 0.0f); window->DC.CurrLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f; + window->DC.IsSameLine = window->DC.IsSetPos = false; window->DC.NavLayerCurrent = ImGuiNavLayer_Main; window->DC.NavLayersActiveMask = window->DC.NavLayersActiveMaskNext; @@ -6514,7 +6712,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) /* //if (g.NavWindow == window && g.ActiveId == 0) if (g.ActiveId == window->MoveId) - if (g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_C)) + if (g.IO.KeyCtrl && IsKeyPressed(ImGuiKey_C)) LogToClipboard(); */ @@ -6522,9 +6720,16 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) // This is useful to allow creating context menus on title bar only, etc. SetLastItemData(window->MoveId, g.CurrentItemFlags, IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false) ? ImGuiItemStatusFlags_HoveredRect : 0, title_bar_rect); + // [DEBUG] +#ifndef IMGUI_DISABLE_DEBUG_TOOLS + if (g.DebugLocateId != 0 && (window->ID == g.DebugLocateId || window->MoveId == g.DebugLocateId)) + DebugLocateItemResolveWithLastItem(); +#endif + + // [Test Engine] Register title bar / tab with MoveId. #ifdef IMGUI_ENABLE_TEST_ENGINE if (!(window->Flags & ImGuiWindowFlags_NoTitleBar)) - IMGUI_TEST_ENGINE_ITEM_ADD(g.LastItemData.Rect, g.LastItemData.ID); + IMGUI_TEST_ENGINE_ITEM_ADD(g.LastItemData.ID, g.LastItemData.Rect, &g.LastItemData); #endif } else @@ -6533,9 +6738,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) SetCurrentWindow(window); } - // Pull/inherit current state - window->DC.NavFocusScopeIdCurrent = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->DC.NavFocusScopeIdCurrent : window->GetID("#FOCUSSCOPE"); // Inherit from parent only // -V595 - PushClipRect(window->InnerClipRect.Min, window->InnerClipRect.Max, true); // Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default "Debug" window is unused) @@ -6589,6 +6791,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->SkipItems = skip_items; } + // [DEBUG] io.ConfigDebugBeginReturnValue override return value to test Begin/End and BeginChild/EndChild behaviors. + // (The implicit fallback window is NOT automatically ended allowing it to always be able to receive commands without crashing) + if (!window->IsFallbackWindow && ((g.IO.ConfigDebugBeginReturnValueOnce && window_just_created) || (g.IO.ConfigDebugBeginReturnValueLoop && g.DebugBeginReturnValueCullDepth == g.CurrentWindowStack.Size))) + { + if (window->AutoFitFramesX > 0) { window->AutoFitFramesX++; } + if (window->AutoFitFramesY > 0) { window->AutoFitFramesY++; } + return false; + } + return !window->SkipItems; } @@ -6613,18 +6824,22 @@ void ImGui::End() if (window->DC.CurrentColumns) EndColumns(); PopClipRect(); // Inner window clip rectangle + PopFocusScope(); // Stop logging if (!(window->Flags & ImGuiWindowFlags_ChildWindow)) // FIXME: add more options for scope of logging LogFinish(); + if (window->DC.IsSetPos) + ErrorCheckUsingSetCursorPosToExtendParentBoundaries(); + // Pop from window stack g.LastItemData = g.CurrentWindowStack.back().ParentLastItemDataBackup; if (window->Flags & ImGuiWindowFlags_ChildMenu) g.BeginMenuCount--; if (window->Flags & ImGuiWindowFlags_Popup) g.BeginPopupStack.pop_back(); - g.CurrentWindowStack.back().StackSizesOnBegin.CompareWithCurrentState(); + g.CurrentWindowStack.back().StackSizesOnBegin.CompareWithContextState(&g); g.CurrentWindowStack.pop_back(); SetCurrentWindow(g.CurrentWindowStack.Size == 0 ? NULL : g.CurrentWindowStack.back().Window); } @@ -6714,20 +6929,17 @@ void ImGui::FocusWindow(ImGuiWindow* window) if (g.NavWindow != window) { - g.NavWindow = window; + SetNavWindow(window); if (window && g.NavDisableMouseHover) g.NavMousePosDirty = true; g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId - g.NavFocusScopeId = 0; - g.NavIdIsAlive = false; g.NavLayer = ImGuiNavLayer_Main; - g.NavInitRequest = g.NavMoveSubmitted = g.NavMoveScoringItems = false; - NavUpdateAnyRequestFlag(); - //IMGUI_DEBUG_LOG("FocusWindow(\"%s\")\n", window ? window->Name : NULL); - } + g.NavFocusScopeId = window ? window->NavRootFocusScopeId : 0; + g.NavIdIsAlive = false; - // Close popups if any - ClosePopupsOverWindow(window, false); + // Close popups if any + ClosePopupsOverWindow(window, false); + } // Move the root window to the top of the pile IM_ASSERT(window == NULL || window->RootWindow != NULL); @@ -6872,13 +7084,12 @@ void ImGui::EndDisabled() g.Style.Alpha = g.DisabledAlphaBackup; //PopStyleVar(); } -// FIXME: Look into renaming this once we have settled the new Focus/Activation/TabStop system. -void ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus) +void ImGui::PushTabStop(bool tab_stop) { - PushItemFlag(ImGuiItemFlags_NoTabStop, !allow_keyboard_focus); + PushItemFlag(ImGuiItemFlags_NoTabStop, !tab_stop); } -void ImGui::PopAllowKeyboardFocus() +void ImGui::PopTabStop() { PopItemFlag(); } @@ -7065,6 +7276,9 @@ void ImGui::SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond) const ImVec2 old_pos = window->Pos; window->Pos = ImFloor(pos); ImVec2 offset = window->Pos - old_pos; + if (offset.x == 0.0f && offset.y == 0.0f) + return; + MarkIniSettingsDirty(window); window->DC.CursorPos += offset; // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor window->DC.CursorMaxPos += offset; // And more importantly we need to offset CursorMaxPos/CursorStartPos this so ContentSize calculation doesn't get affected. window->DC.IdealMaxPos += offset; @@ -7099,26 +7313,19 @@ void ImGui::SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond con window->SetWindowSizeAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing); // Set - if (size.x > 0.0f) - { - window->AutoFitFramesX = 0; - window->SizeFull.x = IM_FLOOR(size.x); - } + ImVec2 old_size = window->SizeFull; + window->AutoFitFramesX = (size.x <= 0.0f) ? 2 : 0; + window->AutoFitFramesY = (size.y <= 0.0f) ? 2 : 0; + if (size.x <= 0.0f) + window->AutoFitOnlyGrows = false; else - { - window->AutoFitFramesX = 2; + window->SizeFull.x = IM_FLOOR(size.x); + if (size.y <= 0.0f) window->AutoFitOnlyGrows = false; - } - if (size.y > 0.0f) - { - window->AutoFitFramesY = 0; + else window->SizeFull.y = IM_FLOOR(size.y); - } - else - { - window->AutoFitFramesY = 2; - window->AutoFitOnlyGrows = false; - } + if (old_size.x != window->SizeFull.x || old_size.y != window->SizeFull.y) + MarkIniSettingsDirty(window); } void ImGui::SetWindowSize(const ImVec2& size, ImGuiCond cond) @@ -7150,6 +7357,12 @@ void ImGui::SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const I window->HitTestHoleOffset = ImVec2ih(pos - window->Pos); } +void ImGui::SetWindowHiddendAndSkipItemsForCurrentFrame(ImGuiWindow* window) +{ + window->Hidden = window->SkipItems = true; + window->HiddenFramesCanSkipItems = 1; +} + void ImGui::SetWindowCollapsed(bool collapsed, ImGuiCond cond) { SetWindowCollapsed(GImGui->CurrentWindow, collapsed, cond); @@ -7297,26 +7510,38 @@ void ImGui::ActivateItem(ImGuiID id) void ImGui::PushFocusScope(ImGuiID id) { ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - g.FocusScopeStack.push_back(window->DC.NavFocusScopeIdCurrent); - window->DC.NavFocusScopeIdCurrent = id; + g.FocusScopeStack.push_back(id); + g.CurrentFocusScopeId = id; } void ImGui::PopFocusScope() { ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; IM_ASSERT(g.FocusScopeStack.Size > 0); // Too many PopFocusScope() ? - window->DC.NavFocusScopeIdCurrent = g.FocusScopeStack.back(); g.FocusScopeStack.pop_back(); + g.CurrentFocusScopeId = g.FocusScopeStack.Size ? g.FocusScopeStack.back() : 0; } +// Note: this will likely be called ActivateItem() once we rework our Focus/Activation system! void ImGui::SetKeyboardFocusHere(int offset) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; IM_ASSERT(offset >= -1); // -1 is allowed but not below - g.NavWindow = window; + IMGUI_DEBUG_LOG_ACTIVEID("SetKeyboardFocusHere(%d) in window \"%s\"\n", offset, window->Name); + + // It makes sense in the vast majority of cases to never interrupt a drag and drop. + // When we refactor this function into ActivateItem() we may want to make this an option. + // MovingWindow is protected from most user inputs using SetActiveIdUsingNavAndKeys(), but + // is also automatically dropped in the event g.ActiveId is stolen. + if (g.DragDropActive || g.MovingWindow != NULL) + { + IMGUI_DEBUG_LOG_ACTIVEID("SetKeyboardFocusHere() ignored while DragDropActive!\n"); + return; + } + + SetNavWindow(window); + ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY; NavMoveRequestSubmit(ImGuiDir_None, offset < 0 ? ImGuiDir_Up : ImGuiDir_Down, ImGuiNavMoveFlags_Tabbing | ImGuiNavMoveFlags_FocusApi, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. if (offset == -1) @@ -7344,8 +7569,8 @@ void ImGui::SetItemDefaultFocus() g.NavInitResultRectRel = WindowRectAbsToRel(window, g.LastItemData.Rect); NavUpdateAnyRequestFlag(); - // Scroll could be done in NavInitRequestApplyResult() via a opt-in flag (we however don't want regular init requests to scroll) - if (!IsItemVisible()) + // Scroll could be done in NavInitRequestApplyResult() via an opt-in flag (we however don't want regular init requests to scroll) + if (!window->ClipRect.Contains(g.LastItemData.Rect)) ScrollToRectEx(window, g.LastItemData.Rect, ImGuiScrollFlags_None); } @@ -7365,7 +7590,7 @@ void ImGui::PushID(const char* str_id) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - ImGuiID id = window->GetIDNoKeepAlive(str_id); + ImGuiID id = window->GetID(str_id); window->IDStack.push_back(id); } @@ -7373,7 +7598,7 @@ void ImGui::PushID(const char* str_id_begin, const char* str_id_end) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - ImGuiID id = window->GetIDNoKeepAlive(str_id_begin, str_id_end); + ImGuiID id = window->GetID(str_id_begin, str_id_end); window->IDStack.push_back(id); } @@ -7381,76 +7606,1354 @@ void ImGui::PushID(const void* ptr_id) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - ImGuiID id = window->GetIDNoKeepAlive(ptr_id); + ImGuiID id = window->GetID(ptr_id); + window->IDStack.push_back(id); +} + +void ImGui::PushID(int int_id) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + ImGuiID id = window->GetID(int_id); + window->IDStack.push_back(id); +} + +// Push a given id value ignoring the ID stack as a seed. +void ImGui::PushOverrideID(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + if (g.DebugHookIdInfo == id) + DebugHookIdInfo(id, ImGuiDataType_ID, NULL, NULL); window->IDStack.push_back(id); } -void ImGui::PushID(int int_id) +// Helper to avoid a common series of PushOverrideID -> GetID() -> PopID() call +// (note that when using this pattern, TestEngine's "Stack Tool" will tend to not display the intermediate stack level. +// for that to work we would need to do PushOverrideID() -> ItemAdd() -> PopID() which would alter widget code a little more) +ImGuiID ImGui::GetIDWithSeed(const char* str, const char* str_end, ImGuiID seed) +{ + ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed); + ImGuiContext& g = *GImGui; + if (g.DebugHookIdInfo == id) + DebugHookIdInfo(id, ImGuiDataType_String, str, str_end); + return id; +} + +ImGuiID ImGui::GetIDWithSeed(int n, ImGuiID seed) +{ + ImGuiID id = ImHashData(&n, sizeof(n), seed); + ImGuiContext& g = *GImGui; + if (g.DebugHookIdInfo == id) + DebugHookIdInfo(id, ImGuiDataType_S32, (void*)(intptr_t)n, NULL); + return id; +} + +void ImGui::PopID() +{ + ImGuiWindow* window = GImGui->CurrentWindow; + IM_ASSERT(window->IDStack.Size > 1); // Too many PopID(), or could be popping in a wrong/different window? + window->IDStack.pop_back(); +} + +ImGuiID ImGui::GetID(const char* str_id) +{ + ImGuiWindow* window = GImGui->CurrentWindow; + return window->GetID(str_id); +} + +ImGuiID ImGui::GetID(const char* str_id_begin, const char* str_id_end) +{ + ImGuiWindow* window = GImGui->CurrentWindow; + return window->GetID(str_id_begin, str_id_end); +} + +ImGuiID ImGui::GetID(const void* ptr_id) +{ + ImGuiWindow* window = GImGui->CurrentWindow; + return window->GetID(ptr_id); +} + +bool ImGui::IsRectVisible(const ImVec2& size) +{ + ImGuiWindow* window = GImGui->CurrentWindow; + return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size)); +} + +bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max) +{ + ImGuiWindow* window = GImGui->CurrentWindow; + return window->ClipRect.Overlaps(ImRect(rect_min, rect_max)); +} + + +//----------------------------------------------------------------------------- +// [SECTION] INPUTS +//----------------------------------------------------------------------------- +// - GetKeyData() [Internal] +// - GetKeyIndex() [Internal] +// - GetKeyName() +// - GetKeyChordName() [Internal] +// - CalcTypematicRepeatAmount() [Internal] +// - GetTypematicRepeatRate() [Internal] +// - GetKeyPressedAmount() [Internal] +// - GetKeyMagnitude2d() [Internal] +//----------------------------------------------------------------------------- +// - UpdateKeyRoutingTable() [Internal] +// - GetRoutingIdFromOwnerId() [Internal] +// - GetShortcutRoutingData() [Internal] +// - CalcRoutingScore() [Internal] +// - SetShortcutRouting() [Internal] +// - TestShortcutRouting() [Internal] +//----------------------------------------------------------------------------- +// - IsKeyDown() +// - IsKeyPressed() +// - IsKeyReleased() +//----------------------------------------------------------------------------- +// - IsMouseDown() +// - IsMouseClicked() +// - IsMouseReleased() +// - IsMouseDoubleClicked() +// - GetMouseClickedCount() +// - IsMouseHoveringRect() [Internal] +// - IsMouseDragPastThreshold() [Internal] +// - IsMouseDragging() +// - GetMousePos() +// - GetMousePosOnOpeningCurrentPopup() +// - IsMousePosValid() +// - IsAnyMouseDown() +// - GetMouseDragDelta() +// - ResetMouseDragDelta() +// - GetMouseCursor() +// - SetMouseCursor() +//----------------------------------------------------------------------------- +// - UpdateAliasKey() +// - GetMergedModsFromKeys() +// - UpdateKeyboardInputs() +// - UpdateMouseInputs() +//----------------------------------------------------------------------------- +// - LockWheelingWindow [Internal] +// - FindBestWheelingWindow [Internal] +// - UpdateMouseWheel() [Internal] +//----------------------------------------------------------------------------- +// - SetNextFrameWantCaptureKeyboard() +// - SetNextFrameWantCaptureMouse() +//----------------------------------------------------------------------------- +// - GetInputSourceName() [Internal] +// - DebugPrintInputEvent() [Internal] +// - UpdateInputEvents() [Internal] +//----------------------------------------------------------------------------- +// - GetKeyOwner() [Internal] +// - TestKeyOwner() [Internal] +// - SetKeyOwner() [Internal] +// - SetItemKeyOwner() [Internal] +// - Shortcut() [Internal] +//----------------------------------------------------------------------------- + +ImGuiKeyData* ImGui::GetKeyData(ImGuiContext* ctx, ImGuiKey key) +{ + ImGuiContext& g = *ctx; + + // Special storage location for mods + if (key & ImGuiMod_Mask_) + key = ConvertSingleModFlagToKey(ctx, key); + +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + IM_ASSERT(key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_NamedKey_END); + if (IsLegacyKey(key) && g.IO.KeyMap[key] != -1) + key = (ImGuiKey)g.IO.KeyMap[key]; // Remap native->imgui or imgui->native +#else + IM_ASSERT(IsNamedKey(key) && "Support for user key indices was dropped in favor of ImGuiKey. Please update backend & user code."); +#endif + return &g.IO.KeysData[key - ImGuiKey_KeysData_OFFSET]; +} + +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO +ImGuiKey ImGui::GetKeyIndex(ImGuiKey key) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(IsNamedKey(key)); + const ImGuiKeyData* key_data = GetKeyData(key); + return (ImGuiKey)(key_data - g.IO.KeysData); +} +#endif + +// Those names a provided for debugging purpose and are not meant to be saved persistently not compared. +static const char* const GKeyNames[] = +{ + "Tab", "LeftArrow", "RightArrow", "UpArrow", "DownArrow", "PageUp", "PageDown", + "Home", "End", "Insert", "Delete", "Backspace", "Space", "Enter", "Escape", + "LeftCtrl", "LeftShift", "LeftAlt", "LeftSuper", "RightCtrl", "RightShift", "RightAlt", "RightSuper", "Menu", + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", + "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", + "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", + "Apostrophe", "Comma", "Minus", "Period", "Slash", "Semicolon", "Equal", "LeftBracket", + "Backslash", "RightBracket", "GraveAccent", "CapsLock", "ScrollLock", "NumLock", "PrintScreen", + "Pause", "Keypad0", "Keypad1", "Keypad2", "Keypad3", "Keypad4", "Keypad5", "Keypad6", + "Keypad7", "Keypad8", "Keypad9", "KeypadDecimal", "KeypadDivide", "KeypadMultiply", + "KeypadSubtract", "KeypadAdd", "KeypadEnter", "KeypadEqual", + "GamepadStart", "GamepadBack", + "GamepadFaceLeft", "GamepadFaceRight", "GamepadFaceUp", "GamepadFaceDown", + "GamepadDpadLeft", "GamepadDpadRight", "GamepadDpadUp", "GamepadDpadDown", + "GamepadL1", "GamepadR1", "GamepadL2", "GamepadR2", "GamepadL3", "GamepadR3", + "GamepadLStickLeft", "GamepadLStickRight", "GamepadLStickUp", "GamepadLStickDown", + "GamepadRStickLeft", "GamepadRStickRight", "GamepadRStickUp", "GamepadRStickDown", + "MouseLeft", "MouseRight", "MouseMiddle", "MouseX1", "MouseX2", "MouseWheelX", "MouseWheelY", + "ModCtrl", "ModShift", "ModAlt", "ModSuper", // ReservedForModXXX are showing the ModXXX names. +}; +IM_STATIC_ASSERT(ImGuiKey_NamedKey_COUNT == IM_ARRAYSIZE(GKeyNames)); + +const char* ImGui::GetKeyName(ImGuiKey key) +{ + ImGuiContext& g = *GImGui; +#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO + IM_ASSERT((IsNamedKey(key) || key == ImGuiKey_None) && "Support for user key indices was dropped in favor of ImGuiKey. Please update backend and user code."); +#else + if (IsLegacyKey(key)) + { + if (g.IO.KeyMap[key] == -1) + return "N/A"; + IM_ASSERT(IsNamedKey((ImGuiKey)g.IO.KeyMap[key])); + key = (ImGuiKey)g.IO.KeyMap[key]; + } +#endif + if (key == ImGuiKey_None) + return "None"; + if (key & ImGuiMod_Mask_) + key = ConvertSingleModFlagToKey(&g, key); + if (!IsNamedKey(key)) + return "Unknown"; + + return GKeyNames[key - ImGuiKey_NamedKey_BEGIN]; +} + +// ImGuiMod_Shortcut is translated to either Ctrl or Super. +void ImGui::GetKeyChordName(ImGuiKeyChord key_chord, char* out_buf, int out_buf_size) +{ + ImGuiContext& g = *GImGui; + if (key_chord & ImGuiMod_Shortcut) + key_chord = ConvertShortcutMod(key_chord); + ImFormatString(out_buf, (size_t)out_buf_size, "%s%s%s%s%s", + (key_chord & ImGuiMod_Ctrl) ? "Ctrl+" : "", + (key_chord & ImGuiMod_Shift) ? "Shift+" : "", + (key_chord & ImGuiMod_Alt) ? "Alt+" : "", + (key_chord & ImGuiMod_Super) ? (g.IO.ConfigMacOSXBehaviors ? "Cmd+" : "Super+") : "", + GetKeyName((ImGuiKey)(key_chord & ~ImGuiMod_Mask_))); +} + +// t0 = previous time (e.g.: g.Time - g.IO.DeltaTime) +// t1 = current time (e.g.: g.Time) +// An event is triggered at: +// t = 0.0f t = repeat_delay, t = repeat_delay + repeat_rate*N +int ImGui::CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate) +{ + if (t1 == 0.0f) + return 1; + if (t0 >= t1) + return 0; + if (repeat_rate <= 0.0f) + return (t0 < repeat_delay) && (t1 >= repeat_delay); + const int count_t0 = (t0 < repeat_delay) ? -1 : (int)((t0 - repeat_delay) / repeat_rate); + const int count_t1 = (t1 < repeat_delay) ? -1 : (int)((t1 - repeat_delay) / repeat_rate); + const int count = count_t1 - count_t0; + return count; +} + +void ImGui::GetTypematicRepeatRate(ImGuiInputFlags flags, float* repeat_delay, float* repeat_rate) +{ + ImGuiContext& g = *GImGui; + switch (flags & ImGuiInputFlags_RepeatRateMask_) + { + case ImGuiInputFlags_RepeatRateNavMove: *repeat_delay = g.IO.KeyRepeatDelay * 0.72f; *repeat_rate = g.IO.KeyRepeatRate * 0.80f; return; + case ImGuiInputFlags_RepeatRateNavTweak: *repeat_delay = g.IO.KeyRepeatDelay * 0.72f; *repeat_rate = g.IO.KeyRepeatRate * 0.30f; return; + case ImGuiInputFlags_RepeatRateDefault: default: *repeat_delay = g.IO.KeyRepeatDelay * 1.00f; *repeat_rate = g.IO.KeyRepeatRate * 1.00f; return; + } +} + +// Return value representing the number of presses in the last time period, for the given repeat rate +// (most often returns 0 or 1. The result is generally only >1 when RepeatRate is smaller than DeltaTime, aka large DeltaTime or fast RepeatRate) +int ImGui::GetKeyPressedAmount(ImGuiKey key, float repeat_delay, float repeat_rate) +{ + ImGuiContext& g = *GImGui; + const ImGuiKeyData* key_data = GetKeyData(key); + if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on key ownership) + return 0; + const float t = key_data->DownDuration; + return CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, repeat_delay, repeat_rate); +} + +// Return 2D vector representing the combination of four cardinal direction, with analog value support (for e.g. ImGuiKey_GamepadLStick* values). +ImVec2 ImGui::GetKeyMagnitude2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down) +{ + return ImVec2( + GetKeyData(key_right)->AnalogValue - GetKeyData(key_left)->AnalogValue, + GetKeyData(key_down)->AnalogValue - GetKeyData(key_up)->AnalogValue); +} + +// Rewrite routing data buffers to strip old entries + sort by key to make queries not touch scattered data. +// Entries D,A,B,B,A,C,B --> A,A,B,B,B,C,D +// Index A:1 B:2 C:5 D:0 --> A:0 B:2 C:5 D:6 +// See 'Metrics->Key Owners & Shortcut Routing' to visualize the result of that operation. +static void ImGui::UpdateKeyRoutingTable(ImGuiKeyRoutingTable* rt) +{ + ImGuiContext& g = *GImGui; + rt->EntriesNext.resize(0); + for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) + { + const int new_routing_start_idx = rt->EntriesNext.Size; + ImGuiKeyRoutingData* routing_entry; + for (int old_routing_idx = rt->Index[key - ImGuiKey_NamedKey_BEGIN]; old_routing_idx != -1; old_routing_idx = routing_entry->NextEntryIndex) + { + routing_entry = &rt->Entries[old_routing_idx]; + routing_entry->RoutingCurr = routing_entry->RoutingNext; // Update entry + routing_entry->RoutingNext = ImGuiKeyOwner_None; + routing_entry->RoutingNextScore = 255; + if (routing_entry->RoutingCurr == ImGuiKeyOwner_None) + continue; + rt->EntriesNext.push_back(*routing_entry); // Write alive ones into new buffer + + // Apply routing to owner if there's no owner already (RoutingCurr == None at this point) + if (routing_entry->Mods == g.IO.KeyMods) + { + ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key); + if (owner_data->OwnerCurr == ImGuiKeyOwner_None) + owner_data->OwnerCurr = routing_entry->RoutingCurr; + } + } + + // Rewrite linked-list + rt->Index[key - ImGuiKey_NamedKey_BEGIN] = (ImGuiKeyRoutingIndex)(new_routing_start_idx < rt->EntriesNext.Size ? new_routing_start_idx : -1); + for (int n = new_routing_start_idx; n < rt->EntriesNext.Size; n++) + rt->EntriesNext[n].NextEntryIndex = (ImGuiKeyRoutingIndex)((n + 1 < rt->EntriesNext.Size) ? n + 1 : -1); + } + rt->Entries.swap(rt->EntriesNext); // Swap new and old indexes +} + +// owner_id may be None/Any, but routing_id needs to be always be set, so we default to GetCurrentFocusScope(). +static inline ImGuiID GetRoutingIdFromOwnerId(ImGuiID owner_id) +{ + ImGuiContext& g = *GImGui; + return (owner_id != ImGuiKeyOwner_None && owner_id != ImGuiKeyOwner_Any) ? owner_id : g.CurrentFocusScopeId; +} + +ImGuiKeyRoutingData* ImGui::GetShortcutRoutingData(ImGuiKeyChord key_chord) +{ + // Majority of shortcuts will be Key + any number of Mods + // We accept _Single_ mod with ImGuiKey_None. + // - Shortcut(ImGuiKey_S | ImGuiMod_Ctrl); // Legal + // - Shortcut(ImGuiKey_S | ImGuiMod_Ctrl | ImGuiMod_Shift); // Legal + // - Shortcut(ImGuiMod_Ctrl); // Legal + // - Shortcut(ImGuiMod_Ctrl | ImGuiMod_Shift); // Not legal + ImGuiContext& g = *GImGui; + ImGuiKeyRoutingTable* rt = &g.KeysRoutingTable; + ImGuiKeyRoutingData* routing_data; + if (key_chord & ImGuiMod_Shortcut) + key_chord = ConvertShortcutMod(key_chord); + ImGuiKey key = (ImGuiKey)(key_chord & ~ImGuiMod_Mask_); + ImGuiKey mods = (ImGuiKey)(key_chord & ImGuiMod_Mask_); + if (key == ImGuiKey_None) + key = ConvertSingleModFlagToKey(&g, mods); + IM_ASSERT(IsNamedKey(key)); + + // Get (in the majority of case, the linked list will have one element so this should be 2 reads. + // Subsequent elements will be contiguous in memory as list is sorted/rebuilt in NewFrame). + for (ImGuiKeyRoutingIndex idx = rt->Index[key - ImGuiKey_NamedKey_BEGIN]; idx != -1; idx = routing_data->NextEntryIndex) + { + routing_data = &rt->Entries[idx]; + if (routing_data->Mods == mods) + return routing_data; + } + + // Add to linked-list + ImGuiKeyRoutingIndex routing_data_idx = (ImGuiKeyRoutingIndex)rt->Entries.Size; + rt->Entries.push_back(ImGuiKeyRoutingData()); + routing_data = &rt->Entries[routing_data_idx]; + routing_data->Mods = (ImU16)mods; + routing_data->NextEntryIndex = rt->Index[key - ImGuiKey_NamedKey_BEGIN]; // Setup linked list + rt->Index[key - ImGuiKey_NamedKey_BEGIN] = routing_data_idx; + return routing_data; +} + +// Current score encoding (lower is highest priority): +// - 0: ImGuiInputFlags_RouteGlobalHigh +// - 1: ImGuiInputFlags_RouteFocused (if item active) +// - 2: ImGuiInputFlags_RouteGlobal +// - 3+: ImGuiInputFlags_RouteFocused (if window in focus-stack) +// - 254: ImGuiInputFlags_RouteGlobalLow +// - 255: never route +// 'flags' should include an explicit routing policy +static int CalcRoutingScore(ImGuiWindow* location, ImGuiID owner_id, ImGuiInputFlags flags) +{ + if (flags & ImGuiInputFlags_RouteFocused) + { + ImGuiContext& g = *GImGui; + ImGuiWindow* focused = g.NavWindow; + + // ActiveID gets top priority + // (we don't check g.ActiveIdUsingAllKeys here. Routing is applied but if input ownership is tested later it may discard it) + if (owner_id != 0 && g.ActiveId == owner_id) + return 1; + + // Score based on distance to focused window (lower is better) + // Assuming both windows are submitting a routing request, + // - When Window....... is focused -> Window scores 3 (best), Window/ChildB scores 255 (no match) + // - When Window/ChildB is focused -> Window scores 4, Window/ChildB scores 3 (best) + // Assuming only WindowA is submitting a routing request, + // - When Window/ChildB is focused -> Window scores 4 (best), Window/ChildB doesn't have a score. + if (focused != NULL && focused->RootWindow == location->RootWindow) + for (int next_score = 3; focused != NULL; next_score++) + { + if (focused == location) + { + IM_ASSERT(next_score < 255); + return next_score; + } + focused = (focused->RootWindow != focused) ? focused->ParentWindow : NULL; // FIXME: This could be later abstracted as a focus path + } + return 255; + } + + // ImGuiInputFlags_RouteGlobalHigh is default, so calls without flags are not conditional + if (flags & ImGuiInputFlags_RouteGlobal) + return 2; + if (flags & ImGuiInputFlags_RouteGlobalLow) + return 254; + return 0; +} + +// Request a desired route for an input chord (key + mods). +// Return true if the route is available this frame. +// - Routes and key ownership are attributed at the beginning of next frame based on best score and mod state. +// (Conceptually this does a "Submit for next frame" + "Test for current frame". +// As such, it could be called TrySetXXX or SubmitXXX, or the Submit and Test operations should be separate.) +// - Using 'owner_id == ImGuiKeyOwner_Any/0': auto-assign an owner based on current focus scope (each window has its focus scope by default) +// - Using 'owner_id == ImGuiKeyOwner_None': allows disabling/locking a shortcut. +bool ImGui::SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags) +{ + ImGuiContext& g = *GImGui; + if ((flags & ImGuiInputFlags_RouteMask_) == 0) + flags |= ImGuiInputFlags_RouteGlobalHigh; // IMPORTANT: This is the default for SetShortcutRouting() but NOT Shortcut() + else + IM_ASSERT(ImIsPowerOfTwo(flags & ImGuiInputFlags_RouteMask_)); // Check that only 1 routing flag is used + + if (flags & ImGuiInputFlags_RouteUnlessBgFocused) + if (g.NavWindow == NULL) + return false; + if (flags & ImGuiInputFlags_RouteAlways) + return true; + + const int score = CalcRoutingScore(g.CurrentWindow, owner_id, flags); + if (score == 255) + return false; + + // Submit routing for NEXT frame (assuming score is sufficient) + // FIXME: Could expose a way to use a "serve last" policy for same score resolution (using <= instead of <). + ImGuiKeyRoutingData* routing_data = GetShortcutRoutingData(key_chord); + const ImGuiID routing_id = GetRoutingIdFromOwnerId(owner_id); + //const bool set_route = (flags & ImGuiInputFlags_ServeLast) ? (score <= routing_data->RoutingNextScore) : (score < routing_data->RoutingNextScore); + if (score < routing_data->RoutingNextScore) + { + routing_data->RoutingNext = routing_id; + routing_data->RoutingNextScore = (ImU8)score; + } + + // Return routing state for CURRENT frame + return routing_data->RoutingCurr == routing_id; +} + +// Currently unused by core (but used by tests) +// Note: this cannot be turned into GetShortcutRouting() because we do the owner_id->routing_id translation, name would be more misleading. +bool ImGui::TestShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id) +{ + const ImGuiID routing_id = GetRoutingIdFromOwnerId(owner_id); + ImGuiKeyRoutingData* routing_data = GetShortcutRoutingData(key_chord); // FIXME: Could avoid creating entry. + return routing_data->RoutingCurr == routing_id; +} + +// Note that Dear ImGui doesn't know the meaning/semantic of ImGuiKey from 0..511: they are legacy native keycodes. +// Consider transitioning from 'IsKeyDown(MY_ENGINE_KEY_A)' (<1.87) to IsKeyDown(ImGuiKey_A) (>= 1.87) +bool ImGui::IsKeyDown(ImGuiKey key) +{ + return IsKeyDown(key, ImGuiKeyOwner_Any); +} + +bool ImGui::IsKeyDown(ImGuiKey key, ImGuiID owner_id) +{ + const ImGuiKeyData* key_data = GetKeyData(key); + if (!key_data->Down) + return false; + if (!TestKeyOwner(key, owner_id)) + return false; + return true; +} + +bool ImGui::IsKeyPressed(ImGuiKey key, bool repeat) +{ + return IsKeyPressed(key, ImGuiKeyOwner_Any, repeat ? ImGuiInputFlags_Repeat : ImGuiInputFlags_None); +} + +// Important: unless legacy IsKeyPressed(ImGuiKey, bool repeat=true) which DEFAULT to repeat, this requires EXPLICIT repeat. +bool ImGui::IsKeyPressed(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags) +{ + const ImGuiKeyData* key_data = GetKeyData(key); + if (!key_data->Down) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on key ownership) + return false; + const float t = key_data->DownDuration; + if (t < 0.0f) + return false; + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedByIsKeyPressed) == 0); // Passing flags not supported by this function! + + bool pressed = (t == 0.0f); + if (!pressed && ((flags & ImGuiInputFlags_Repeat) != 0)) + { + float repeat_delay, repeat_rate; + GetTypematicRepeatRate(flags, &repeat_delay, &repeat_rate); + pressed = (t > repeat_delay) && GetKeyPressedAmount(key, repeat_delay, repeat_rate) > 0; + } + if (!pressed) + return false; + if (!TestKeyOwner(key, owner_id)) + return false; + return true; +} + +bool ImGui::IsKeyReleased(ImGuiKey key) +{ + return IsKeyReleased(key, ImGuiKeyOwner_Any); +} + +bool ImGui::IsKeyReleased(ImGuiKey key, ImGuiID owner_id) +{ + const ImGuiKeyData* key_data = GetKeyData(key); + if (key_data->DownDurationPrev < 0.0f || key_data->Down) + return false; + if (!TestKeyOwner(key, owner_id)) + return false; + return true; +} + +bool ImGui::IsMouseDown(ImGuiMouseButton button) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseDown[button] && TestKeyOwner(MouseButtonToKey(button), ImGuiKeyOwner_Any); // should be same as IsKeyDown(MouseButtonToKey(button), ImGuiKeyOwner_Any), but this allows legacy code hijacking the io.Mousedown[] array. +} + +bool ImGui::IsMouseDown(ImGuiMouseButton button, ImGuiID owner_id) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseDown[button] && TestKeyOwner(MouseButtonToKey(button), owner_id); // Should be same as IsKeyDown(MouseButtonToKey(button), owner_id), but this allows legacy code hijacking the io.Mousedown[] array. +} + +bool ImGui::IsMouseClicked(ImGuiMouseButton button, bool repeat) +{ + return IsMouseClicked(button, ImGuiKeyOwner_Any, repeat ? ImGuiInputFlags_Repeat : ImGuiInputFlags_None); +} + +bool ImGui::IsMouseClicked(ImGuiMouseButton button, ImGuiID owner_id, ImGuiInputFlags flags) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + if (!g.IO.MouseDown[button]) // In theory this should already be encoded as (DownDuration < 0.0f), but testing this facilitates eating mechanism (until we finish work on key ownership) + return false; + const float t = g.IO.MouseDownDuration[button]; + if (t < 0.0f) + return false; + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedByIsKeyPressed) == 0); // Passing flags not supported by this function! + + const bool repeat = (flags & ImGuiInputFlags_Repeat) != 0; + const bool pressed = (t == 0.0f) || (repeat && t > g.IO.KeyRepeatDelay && CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0); + if (!pressed) + return false; + + if (!TestKeyOwner(MouseButtonToKey(button), owner_id)) + return false; + + return true; +} + +bool ImGui::IsMouseReleased(ImGuiMouseButton button) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseReleased[button] && TestKeyOwner(MouseButtonToKey(button), ImGuiKeyOwner_Any); // Should be same as IsKeyReleased(MouseButtonToKey(button), ImGuiKeyOwner_Any) +} + +bool ImGui::IsMouseReleased(ImGuiMouseButton button, ImGuiID owner_id) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseReleased[button] && TestKeyOwner(MouseButtonToKey(button), owner_id); // Should be same as IsKeyReleased(MouseButtonToKey(button), owner_id) +} + +bool ImGui::IsMouseDoubleClicked(ImGuiMouseButton button) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseClickedCount[button] == 2 && TestKeyOwner(MouseButtonToKey(button), ImGuiKeyOwner_Any); +} + +int ImGui::GetMouseClickedCount(ImGuiMouseButton button) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + return g.IO.MouseClickedCount[button]; +} + +// Test if mouse cursor is hovering given rectangle +// NB- Rectangle is clipped by our current clip setting +// NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding) +bool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip) +{ + ImGuiContext& g = *GImGui; + + // Clip + ImRect rect_clipped(r_min, r_max); + if (clip) + rect_clipped.ClipWith(g.CurrentWindow->ClipRect); + + // Expand for touch input + const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding); + if (!rect_for_touch.Contains(g.IO.MousePos)) + return false; + return true; +} + +// Return if a mouse click/drag went past the given threshold. Valid to call during the MouseReleased frame. +// [Internal] This doesn't test if the button is pressed +bool ImGui::IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + if (lock_threshold < 0.0f) + lock_threshold = g.IO.MouseDragThreshold; + return g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold; +} + +bool ImGui::IsMouseDragging(ImGuiMouseButton button, float lock_threshold) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + if (!g.IO.MouseDown[button]) + return false; + return IsMouseDragPastThreshold(button, lock_threshold); +} + +ImVec2 ImGui::GetMousePos() +{ + ImGuiContext& g = *GImGui; + return g.IO.MousePos; +} + +// NB: prefer to call right after BeginPopup(). At the time Selectable/MenuItem is activated, the popup is already closed! +ImVec2 ImGui::GetMousePosOnOpeningCurrentPopup() +{ + ImGuiContext& g = *GImGui; + if (g.BeginPopupStack.Size > 0) + return g.OpenPopupStack[g.BeginPopupStack.Size - 1].OpenMousePos; + return g.IO.MousePos; +} + +// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position. +bool ImGui::IsMousePosValid(const ImVec2* mouse_pos) +{ + // The assert is only to silence a false-positive in XCode Static Analysis. + // Because GImGui is not dereferenced in every code path, the static analyzer assume that it may be NULL (which it doesn't for other functions). + IM_ASSERT(GImGui != NULL); + const float MOUSE_INVALID = -256000.0f; + ImVec2 p = mouse_pos ? *mouse_pos : GImGui->IO.MousePos; + return p.x >= MOUSE_INVALID && p.y >= MOUSE_INVALID; +} + +// [WILL OBSOLETE] This was designed for backends, but prefer having backend maintain a mask of held mouse buttons, because upcoming input queue system will make this invalid. +bool ImGui::IsAnyMouseDown() +{ + ImGuiContext& g = *GImGui; + for (int n = 0; n < IM_ARRAYSIZE(g.IO.MouseDown); n++) + if (g.IO.MouseDown[n]) + return true; + return false; +} + +// Return the delta from the initial clicking position while the mouse button is clicked or was just released. +// This is locked and return 0.0f until the mouse moves past a distance threshold at least once. +// NB: This is only valid if IsMousePosValid(). backends in theory should always keep mouse position valid when dragging even outside the client window. +ImVec2 ImGui::GetMouseDragDelta(ImGuiMouseButton button, float lock_threshold) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + if (lock_threshold < 0.0f) + lock_threshold = g.IO.MouseDragThreshold; + if (g.IO.MouseDown[button] || g.IO.MouseReleased[button]) + if (g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold) + if (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MouseClickedPos[button])) + return g.IO.MousePos - g.IO.MouseClickedPos[button]; + return ImVec2(0.0f, 0.0f); +} + +void ImGui::ResetMouseDragDelta(ImGuiMouseButton button) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown)); + // NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr + g.IO.MouseClickedPos[button] = g.IO.MousePos; +} + +// Get desired mouse cursor shape. +// Important: this is meant to be used by a platform backend, it is reset in ImGui::NewFrame(), +// updated during the frame, and locked in EndFrame()/Render(). +// If you use software rendering by setting io.MouseDrawCursor then Dear ImGui will render those for you +ImGuiMouseCursor ImGui::GetMouseCursor() +{ + ImGuiContext& g = *GImGui; + return g.MouseCursor; +} + +void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type) +{ + ImGuiContext& g = *GImGui; + g.MouseCursor = cursor_type; +} + +static void UpdateAliasKey(ImGuiKey key, bool v, float analog_value) +{ + IM_ASSERT(ImGui::IsAliasKey(key)); + ImGuiKeyData* key_data = ImGui::GetKeyData(key); + key_data->Down = v; + key_data->AnalogValue = analog_value; +} + +// [Internal] Do not use directly +static ImGuiKeyChord GetMergedModsFromKeys() +{ + ImGuiKeyChord mods = 0; + if (ImGui::IsKeyDown(ImGuiMod_Ctrl)) { mods |= ImGuiMod_Ctrl; } + if (ImGui::IsKeyDown(ImGuiMod_Shift)) { mods |= ImGuiMod_Shift; } + if (ImGui::IsKeyDown(ImGuiMod_Alt)) { mods |= ImGuiMod_Alt; } + if (ImGui::IsKeyDown(ImGuiMod_Super)) { mods |= ImGuiMod_Super; } + return mods; +} + +static void ImGui::UpdateKeyboardInputs() +{ + ImGuiContext& g = *GImGui; + ImGuiIO& io = g.IO; + + // Import legacy keys or verify they are not used +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + if (io.BackendUsingLegacyKeyArrays == 0) + { + // Backend used new io.AddKeyEvent() API: Good! Verify that old arrays are never written to externally. + for (int n = 0; n < ImGuiKey_LegacyNativeKey_END; n++) + IM_ASSERT((io.KeysDown[n] == false || IsKeyDown((ImGuiKey)n)) && "Backend needs to either only use io.AddKeyEvent(), either only fill legacy io.KeysDown[] + io.KeyMap[]. Not both!"); + } + else + { + if (g.FrameCount == 0) + for (int n = ImGuiKey_LegacyNativeKey_BEGIN; n < ImGuiKey_LegacyNativeKey_END; n++) + IM_ASSERT(g.IO.KeyMap[n] == -1 && "Backend is not allowed to write to io.KeyMap[0..511]!"); + + // Build reverse KeyMap (Named -> Legacy) + for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_NamedKey_END; n++) + if (io.KeyMap[n] != -1) + { + IM_ASSERT(IsLegacyKey((ImGuiKey)io.KeyMap[n])); + io.KeyMap[io.KeyMap[n]] = n; + } + + // Import legacy keys into new ones + for (int n = ImGuiKey_LegacyNativeKey_BEGIN; n < ImGuiKey_LegacyNativeKey_END; n++) + if (io.KeysDown[n] || io.BackendUsingLegacyKeyArrays == 1) + { + const ImGuiKey key = (ImGuiKey)(io.KeyMap[n] != -1 ? io.KeyMap[n] : n); + IM_ASSERT(io.KeyMap[n] == -1 || IsNamedKey(key)); + io.KeysData[key].Down = io.KeysDown[n]; + if (key != n) + io.KeysDown[key] = io.KeysDown[n]; // Allow legacy code using io.KeysDown[GetKeyIndex()] with old backends + io.BackendUsingLegacyKeyArrays = 1; + } + if (io.BackendUsingLegacyKeyArrays == 1) + { + GetKeyData(ImGuiMod_Ctrl)->Down = io.KeyCtrl; + GetKeyData(ImGuiMod_Shift)->Down = io.KeyShift; + GetKeyData(ImGuiMod_Alt)->Down = io.KeyAlt; + GetKeyData(ImGuiMod_Super)->Down = io.KeySuper; + } + } + +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; + if (io.BackendUsingLegacyNavInputArray && nav_gamepad_active) + { + #define MAP_LEGACY_NAV_INPUT_TO_KEY1(_KEY, _NAV1) do { io.KeysData[_KEY].Down = (io.NavInputs[_NAV1] > 0.0f); io.KeysData[_KEY].AnalogValue = io.NavInputs[_NAV1]; } while (0) + #define MAP_LEGACY_NAV_INPUT_TO_KEY2(_KEY, _NAV1, _NAV2) do { io.KeysData[_KEY].Down = (io.NavInputs[_NAV1] > 0.0f) || (io.NavInputs[_NAV2] > 0.0f); io.KeysData[_KEY].AnalogValue = ImMax(io.NavInputs[_NAV1], io.NavInputs[_NAV2]); } while (0) + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceDown, ImGuiNavInput_Activate); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceRight, ImGuiNavInput_Cancel); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceLeft, ImGuiNavInput_Menu); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadFaceUp, ImGuiNavInput_Input); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadLeft, ImGuiNavInput_DpadLeft); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadRight, ImGuiNavInput_DpadRight); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadUp, ImGuiNavInput_DpadUp); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadDpadDown, ImGuiNavInput_DpadDown); + MAP_LEGACY_NAV_INPUT_TO_KEY2(ImGuiKey_GamepadL1, ImGuiNavInput_FocusPrev, ImGuiNavInput_TweakSlow); + MAP_LEGACY_NAV_INPUT_TO_KEY2(ImGuiKey_GamepadR1, ImGuiNavInput_FocusNext, ImGuiNavInput_TweakFast); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickLeft, ImGuiNavInput_LStickLeft); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickRight, ImGuiNavInput_LStickRight); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickUp, ImGuiNavInput_LStickUp); + MAP_LEGACY_NAV_INPUT_TO_KEY1(ImGuiKey_GamepadLStickDown, ImGuiNavInput_LStickDown); + #undef NAV_MAP_KEY + } +#endif +#endif + + // Update aliases + for (int n = 0; n < ImGuiMouseButton_COUNT; n++) + UpdateAliasKey(MouseButtonToKey(n), io.MouseDown[n], io.MouseDown[n] ? 1.0f : 0.0f); + UpdateAliasKey(ImGuiKey_MouseWheelX, io.MouseWheelH != 0.0f, io.MouseWheelH); + UpdateAliasKey(ImGuiKey_MouseWheelY, io.MouseWheel != 0.0f, io.MouseWheel); + + // Synchronize io.KeyMods and io.KeyXXX values. + // - New backends (1.87+): send io.AddKeyEvent(ImGuiMod_XXX) -> -> (here) deriving io.KeyMods + io.KeyXXX from key array. + // - Legacy backends: set io.KeyXXX bools -> (above) set key array from io.KeyXXX -> (here) deriving io.KeyMods + io.KeyXXX from key array. + // So with legacy backends the 4 values will do a unnecessary back-and-forth but it makes the code simpler and future facing. + io.KeyMods = GetMergedModsFromKeys(); + io.KeyCtrl = (io.KeyMods & ImGuiMod_Ctrl) != 0; + io.KeyShift = (io.KeyMods & ImGuiMod_Shift) != 0; + io.KeyAlt = (io.KeyMods & ImGuiMod_Alt) != 0; + io.KeySuper = (io.KeyMods & ImGuiMod_Super) != 0; + + // Clear gamepad data if disabled + if ((io.BackendFlags & ImGuiBackendFlags_HasGamepad) == 0) + for (int i = ImGuiKey_Gamepad_BEGIN; i < ImGuiKey_Gamepad_END; i++) + { + io.KeysData[i - ImGuiKey_KeysData_OFFSET].Down = false; + io.KeysData[i - ImGuiKey_KeysData_OFFSET].AnalogValue = 0.0f; + } + + // Update keys + for (int i = 0; i < ImGuiKey_KeysData_SIZE; i++) + { + ImGuiKeyData* key_data = &io.KeysData[i]; + key_data->DownDurationPrev = key_data->DownDuration; + key_data->DownDuration = key_data->Down ? (key_data->DownDuration < 0.0f ? 0.0f : key_data->DownDuration + io.DeltaTime) : -1.0f; + } + + // Update keys/input owner (named keys only): one entry per key + for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) + { + ImGuiKeyData* key_data = &io.KeysData[key - ImGuiKey_KeysData_OFFSET]; + ImGuiKeyOwnerData* owner_data = &g.KeysOwnerData[key - ImGuiKey_NamedKey_BEGIN]; + owner_data->OwnerCurr = owner_data->OwnerNext; + if (!key_data->Down) // Important: ownership is released on the frame after a release. Ensure a 'MouseDown -> CloseWindow -> MouseUp' chain doesn't lead to someone else seeing the MouseUp. + owner_data->OwnerNext = ImGuiKeyOwner_None; + owner_data->LockThisFrame = owner_data->LockUntilRelease = owner_data->LockUntilRelease && key_data->Down; // Clear LockUntilRelease when key is not Down anymore + } + + UpdateKeyRoutingTable(&g.KeysRoutingTable); +} + +static void ImGui::UpdateMouseInputs() +{ + ImGuiContext& g = *GImGui; + ImGuiIO& io = g.IO; + + // Mouse Wheel swapping flag + // As a standard behavior holding SHIFT while using Vertical Mouse Wheel triggers Horizontal scroll instead + // - We avoid doing it on OSX as it the OS input layer handles this already. + // - FIXME: However this means when running on OSX over Emscripten, Shift+WheelY will incur two swapping (1 in OS, 1 here), canceling the feature. + // - FIXME: When we can distinguish e.g. touchpad scroll events from mouse ones, we'll set this accordingly based on input source. + io.MouseWheelRequestAxisSwap = io.KeyShift && !io.ConfigMacOSXBehaviors; + + // Round mouse position to avoid spreading non-rounded position (e.g. UpdateManualResize doesn't support them well) + if (IsMousePosValid(&io.MousePos)) + io.MousePos = g.MouseLastValidPos = ImFloorSigned(io.MousePos); + + // If mouse just appeared or disappeared (usually denoted by -FLT_MAX components) we cancel out movement in MouseDelta + if (IsMousePosValid(&io.MousePos) && IsMousePosValid(&io.MousePosPrev)) + io.MouseDelta = io.MousePos - io.MousePosPrev; + else + io.MouseDelta = ImVec2(0.0f, 0.0f); + + // If mouse moved we re-enable mouse hovering in case it was disabled by gamepad/keyboard. In theory should use a >0.0f threshold but would need to reset in everywhere we set this to true. + if (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f) + g.NavDisableMouseHover = false; + + io.MousePosPrev = io.MousePos; + for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) + { + io.MouseClicked[i] = io.MouseDown[i] && io.MouseDownDuration[i] < 0.0f; + io.MouseClickedCount[i] = 0; // Will be filled below + io.MouseReleased[i] = !io.MouseDown[i] && io.MouseDownDuration[i] >= 0.0f; + io.MouseDownDurationPrev[i] = io.MouseDownDuration[i]; + io.MouseDownDuration[i] = io.MouseDown[i] ? (io.MouseDownDuration[i] < 0.0f ? 0.0f : io.MouseDownDuration[i] + io.DeltaTime) : -1.0f; + if (io.MouseClicked[i]) + { + bool is_repeated_click = false; + if ((float)(g.Time - io.MouseClickedTime[i]) < io.MouseDoubleClickTime) + { + ImVec2 delta_from_click_pos = IsMousePosValid(&io.MousePos) ? (io.MousePos - io.MouseClickedPos[i]) : ImVec2(0.0f, 0.0f); + if (ImLengthSqr(delta_from_click_pos) < io.MouseDoubleClickMaxDist * io.MouseDoubleClickMaxDist) + is_repeated_click = true; + } + if (is_repeated_click) + io.MouseClickedLastCount[i]++; + else + io.MouseClickedLastCount[i] = 1; + io.MouseClickedTime[i] = g.Time; + io.MouseClickedPos[i] = io.MousePos; + io.MouseClickedCount[i] = io.MouseClickedLastCount[i]; + io.MouseDragMaxDistanceSqr[i] = 0.0f; + } + else if (io.MouseDown[i]) + { + // Maintain the maximum distance we reaching from the initial click position, which is used with dragging threshold + float delta_sqr_click_pos = IsMousePosValid(&io.MousePos) ? ImLengthSqr(io.MousePos - io.MouseClickedPos[i]) : 0.0f; + io.MouseDragMaxDistanceSqr[i] = ImMax(io.MouseDragMaxDistanceSqr[i], delta_sqr_click_pos); + } + + // We provide io.MouseDoubleClicked[] as a legacy service + io.MouseDoubleClicked[i] = (io.MouseClickedCount[i] == 2); + + // Clicking any mouse button reactivate mouse hovering which may have been deactivated by gamepad/keyboard navigation + if (io.MouseClicked[i]) + g.NavDisableMouseHover = false; + } +} + +static void LockWheelingWindow(ImGuiWindow* window, float wheel_amount) +{ + ImGuiContext& g = *GImGui; + if (window) + g.WheelingWindowReleaseTimer = ImMin(g.WheelingWindowReleaseTimer + ImAbs(wheel_amount) * WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER, WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER); + else + g.WheelingWindowReleaseTimer = 0.0f; + if (g.WheelingWindow == window) + return; + IMGUI_DEBUG_LOG_IO("LockWheelingWindow() \"%s\"\n", window ? window->Name : "NULL"); + g.WheelingWindow = window; + g.WheelingWindowRefMousePos = g.IO.MousePos; + if (window == NULL) + { + g.WheelingWindowStartFrame = -1; + g.WheelingAxisAvg = ImVec2(0.0f, 0.0f); + } +} + +static ImGuiWindow* FindBestWheelingWindow(const ImVec2& wheel) +{ + // For each axis, find window in the hierarchy that may want to use scrolling + ImGuiContext& g = *GImGui; + ImGuiWindow* windows[2] = { NULL, NULL }; + for (int axis = 0; axis < 2; axis++) + if (wheel[axis] != 0.0f) + for (ImGuiWindow* window = windows[axis] = g.HoveredWindow; window->Flags & ImGuiWindowFlags_ChildWindow; window = windows[axis] = window->ParentWindow) + { + // Bubble up into parent window if: + // - a child window doesn't allow any scrolling. + // - a child window has the ImGuiWindowFlags_NoScrollWithMouse flag. + //// - a child window doesn't need scrolling because it is already at the edge for the direction we are going in (FIXME-WIP) + const bool has_scrolling = (window->ScrollMax[axis] != 0.0f); + const bool inputs_disabled = (window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs); + //const bool scrolling_past_limits = (wheel_v < 0.0f) ? (window->Scroll[axis] <= 0.0f) : (window->Scroll[axis] >= window->ScrollMax[axis]); + if (has_scrolling && !inputs_disabled) // && !scrolling_past_limits) + break; // select this window + } + if (windows[0] == NULL && windows[1] == NULL) + return NULL; + + // If there's only one window or only one axis then there's no ambiguity + if (windows[0] == windows[1] || windows[0] == NULL || windows[1] == NULL) + return windows[1] ? windows[1] : windows[0]; + + // If candidate are different windows we need to decide which one to prioritize + // - First frame: only find a winner if one axis is zero. + // - Subsequent frames: only find a winner when one is more than the other. + if (g.WheelingWindowStartFrame == -1) + g.WheelingWindowStartFrame = g.FrameCount; + if ((g.WheelingWindowStartFrame == g.FrameCount && wheel.x != 0.0f && wheel.y != 0.0f) || (g.WheelingAxisAvg.x == g.WheelingAxisAvg.y)) + { + g.WheelingWindowWheelRemainder = wheel; + return NULL; + } + return (g.WheelingAxisAvg.x > g.WheelingAxisAvg.y) ? windows[0] : windows[1]; +} + +// Called by NewFrame() +void ImGui::UpdateMouseWheel() +{ + // Reset the locked window if we move the mouse or after the timer elapses. + // FIXME: Ideally we could refactor to have one timer for "changing window w/ same axis" and a shorter timer for "changing window or axis w/ other axis" (#3795) + ImGuiContext& g = *GImGui; + if (g.WheelingWindow != NULL) + { + g.WheelingWindowReleaseTimer -= g.IO.DeltaTime; + if (IsMousePosValid() && ImLengthSqr(g.IO.MousePos - g.WheelingWindowRefMousePos) > g.IO.MouseDragThreshold * g.IO.MouseDragThreshold) + g.WheelingWindowReleaseTimer = 0.0f; + if (g.WheelingWindowReleaseTimer <= 0.0f) + LockWheelingWindow(NULL, 0.0f); + } + + ImVec2 wheel; + wheel.x = TestKeyOwner(ImGuiKey_MouseWheelX, ImGuiKeyOwner_None) ? g.IO.MouseWheelH : 0.0f; + wheel.y = TestKeyOwner(ImGuiKey_MouseWheelY, ImGuiKeyOwner_None) ? g.IO.MouseWheel : 0.0f; + + //IMGUI_DEBUG_LOG("MouseWheel X:%.3f Y:%.3f\n", wheel_x, wheel_y); + ImGuiWindow* mouse_window = g.WheelingWindow ? g.WheelingWindow : g.HoveredWindow; + if (!mouse_window || mouse_window->Collapsed) + return; + + // Zoom / Scale window + // FIXME-OBSOLETE: This is an old feature, it still works but pretty much nobody is using it and may be best redesigned. + if (wheel.y != 0.0f && g.IO.KeyCtrl && g.IO.FontAllowUserScaling) + { + LockWheelingWindow(mouse_window, wheel.y); + ImGuiWindow* window = mouse_window; + const float new_font_scale = ImClamp(window->FontWindowScale + g.IO.MouseWheel * 0.10f, 0.50f, 2.50f); + const float scale = new_font_scale / window->FontWindowScale; + window->FontWindowScale = new_font_scale; + if (window == window->RootWindow) + { + const ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size; + SetWindowPos(window, window->Pos + offset, 0); + window->Size = ImFloor(window->Size * scale); + window->SizeFull = ImFloor(window->SizeFull * scale); + } + return; + } + if (g.IO.KeyCtrl) + return; + + // Mouse wheel scrolling + // Read about io.MouseWheelRequestAxisSwap and its issue on Mac+Emscripten in UpdateMouseInputs() + if (g.IO.MouseWheelRequestAxisSwap) + wheel = ImVec2(wheel.y, 0.0f); + + // Maintain a rough average of moving magnitude on both axises + // FIXME: should by based on wall clock time rather than frame-counter + g.WheelingAxisAvg.x = ImExponentialMovingAverage(g.WheelingAxisAvg.x, ImAbs(wheel.x), 30); + g.WheelingAxisAvg.y = ImExponentialMovingAverage(g.WheelingAxisAvg.y, ImAbs(wheel.y), 30); + + // In the rare situation where FindBestWheelingWindow() had to defer first frame of wheeling due to ambiguous main axis, reinject it now. + wheel += g.WheelingWindowWheelRemainder; + g.WheelingWindowWheelRemainder = ImVec2(0.0f, 0.0f); + if (wheel.x == 0.0f && wheel.y == 0.0f) + return; + + // Mouse wheel scrolling: find target and apply + // - don't renew lock if axis doesn't apply on the window. + // - select a main axis when both axises are being moved. + if (ImGuiWindow* window = (g.WheelingWindow ? g.WheelingWindow : FindBestWheelingWindow(wheel))) + if (!(window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(window->Flags & ImGuiWindowFlags_NoMouseInputs)) + { + bool do_scroll[2] = { wheel.x != 0.0f && window->ScrollMax.x != 0.0f, wheel.y != 0.0f && window->ScrollMax.y != 0.0f }; + if (do_scroll[ImGuiAxis_X] && do_scroll[ImGuiAxis_Y]) + do_scroll[(g.WheelingAxisAvg.x > g.WheelingAxisAvg.y) ? ImGuiAxis_Y : ImGuiAxis_X] = false; + if (do_scroll[ImGuiAxis_X]) + { + LockWheelingWindow(window, wheel.x); + float max_step = window->InnerRect.GetWidth() * 0.67f; + float scroll_step = ImFloor(ImMin(2 * window->CalcFontSize(), max_step)); + SetScrollX(window, window->Scroll.x - wheel.x * scroll_step); + } + if (do_scroll[ImGuiAxis_Y]) + { + LockWheelingWindow(window, wheel.y); + float max_step = window->InnerRect.GetHeight() * 0.67f; + float scroll_step = ImFloor(ImMin(5 * window->CalcFontSize(), max_step)); + SetScrollY(window, window->Scroll.y - wheel.y * scroll_step); + } + } +} + +void ImGui::SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard) +{ + ImGuiContext& g = *GImGui; + g.WantCaptureKeyboardNextFrame = want_capture_keyboard ? 1 : 0; +} + +void ImGui::SetNextFrameWantCaptureMouse(bool want_capture_mouse) +{ + ImGuiContext& g = *GImGui; + g.WantCaptureMouseNextFrame = want_capture_mouse ? 1 : 0; +} + +#ifndef IMGUI_DISABLE_DEBUG_TOOLS +static const char* GetInputSourceName(ImGuiInputSource source) +{ + const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad", "Clipboard" }; + IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT && source >= 0 && source < ImGuiInputSource_COUNT); + return input_source_names[source]; +} +static const char* GetMouseSourceName(ImGuiMouseSource source) +{ + const char* mouse_source_names[] = { "Mouse", "TouchScreen", "Pen" }; + IM_ASSERT(IM_ARRAYSIZE(mouse_source_names) == ImGuiMouseSource_COUNT && source >= 0 && source < ImGuiMouseSource_COUNT); + return mouse_source_names[source]; +} +static void DebugPrintInputEvent(const char* prefix, const ImGuiInputEvent* e) +{ + ImGuiContext& g = *GImGui; + if (e->Type == ImGuiInputEventType_MousePos) { if (e->MousePos.PosX == -FLT_MAX && e->MousePos.PosY == -FLT_MAX) IMGUI_DEBUG_LOG_IO("%s: MousePos (-FLT_MAX, -FLT_MAX)\n", prefix); else IMGUI_DEBUG_LOG_IO("%s: MousePos (%.1f, %.1f) (%s)\n", prefix, e->MousePos.PosX, e->MousePos.PosY, GetMouseSourceName(e->MouseWheel.MouseSource)); return; } + if (e->Type == ImGuiInputEventType_MouseButton) { IMGUI_DEBUG_LOG_IO("%s: MouseButton %d %s (%s)\n", prefix, e->MouseButton.Button, e->MouseButton.Down ? "Down" : "Up", GetMouseSourceName(e->MouseWheel.MouseSource)); return; } + if (e->Type == ImGuiInputEventType_MouseWheel) { IMGUI_DEBUG_LOG_IO("%s: MouseWheel (%.3f, %.3f) (%s)\n", prefix, e->MouseWheel.WheelX, e->MouseWheel.WheelY, GetMouseSourceName(e->MouseWheel.MouseSource)); return; } + if (e->Type == ImGuiInputEventType_Key) { IMGUI_DEBUG_LOG_IO("%s: Key \"%s\" %s\n", prefix, ImGui::GetKeyName(e->Key.Key), e->Key.Down ? "Down" : "Up"); return; } + if (e->Type == ImGuiInputEventType_Text) { IMGUI_DEBUG_LOG_IO("%s: Text: %c (U+%08X)\n", prefix, e->Text.Char, e->Text.Char); return; } + if (e->Type == ImGuiInputEventType_Focus) { IMGUI_DEBUG_LOG_IO("%s: AppFocused %d\n", prefix, e->AppFocused.Focused); return; } +} +#endif + +// Process input queue +// We always call this with the value of 'bool g.IO.ConfigInputTrickleEventQueue'. +// - trickle_fast_inputs = false : process all events, turn into flattened input state (e.g. successive down/up/down/up will be lost) +// - trickle_fast_inputs = true : process as many events as possible (successive down/up/down/up will be trickled over several frames so nothing is lost) (new feature in 1.87) +void ImGui::UpdateInputEvents(bool trickle_fast_inputs) +{ + ImGuiContext& g = *GImGui; + ImGuiIO& io = g.IO; + + // Only trickle chars<>key when working with InputText() + // FIXME: InputText() could parse event trail? + // FIXME: Could specialize chars<>keys trickling rules for control keys (those not typically associated to characters) + const bool trickle_interleaved_keys_and_text = (trickle_fast_inputs && g.WantTextInputNextFrame == 1); + + bool mouse_moved = false, mouse_wheeled = false, key_changed = false, text_inputted = false; + int mouse_button_changed = 0x00; + ImBitArray key_changed_mask; + + int event_n = 0; + for (; event_n < g.InputEventsQueue.Size; event_n++) + { + ImGuiInputEvent* e = &g.InputEventsQueue[event_n]; + if (e->Type == ImGuiInputEventType_MousePos) + { + // Trickling Rule: Stop processing queued events if we already handled a mouse button change + ImVec2 event_pos(e->MousePos.PosX, e->MousePos.PosY); + if (trickle_fast_inputs && (mouse_button_changed != 0 || mouse_wheeled || key_changed || text_inputted)) + break; + io.MousePos = event_pos; + io.MouseSource = e->MousePos.MouseSource; + mouse_moved = true; + } + else if (e->Type == ImGuiInputEventType_MouseButton) + { + // Trickling Rule: Stop processing queued events if we got multiple action on the same button + const ImGuiMouseButton button = e->MouseButton.Button; + IM_ASSERT(button >= 0 && button < ImGuiMouseButton_COUNT); + if (trickle_fast_inputs && ((mouse_button_changed & (1 << button)) || mouse_wheeled)) + break; + if (trickle_fast_inputs && e->MouseButton.MouseSource == ImGuiMouseSource_TouchScreen && mouse_moved) // #2702: TouchScreen have no initial hover. + break; + io.MouseDown[button] = e->MouseButton.Down; + io.MouseSource = e->MouseButton.MouseSource; + mouse_button_changed |= (1 << button); + } + else if (e->Type == ImGuiInputEventType_MouseWheel) + { + // Trickling Rule: Stop processing queued events if we got multiple action on the event + if (trickle_fast_inputs && (mouse_moved || mouse_button_changed != 0)) + break; + io.MouseWheelH += e->MouseWheel.WheelX; + io.MouseWheel += e->MouseWheel.WheelY; + io.MouseSource = e->MouseWheel.MouseSource; + mouse_wheeled = true; + } + else if (e->Type == ImGuiInputEventType_Key) + { + // Trickling Rule: Stop processing queued events if we got multiple action on the same button + ImGuiKey key = e->Key.Key; + IM_ASSERT(key != ImGuiKey_None); + ImGuiKeyData* key_data = GetKeyData(key); + const int key_data_index = (int)(key_data - g.IO.KeysData); + if (trickle_fast_inputs && key_data->Down != e->Key.Down && (key_changed_mask.TestBit(key_data_index) || text_inputted || mouse_button_changed != 0)) + break; + key_data->Down = e->Key.Down; + key_data->AnalogValue = e->Key.AnalogValue; + key_changed = true; + key_changed_mask.SetBit(key_data_index); + + // Allow legacy code using io.KeysDown[GetKeyIndex()] with new backends +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + io.KeysDown[key_data_index] = key_data->Down; + if (io.KeyMap[key_data_index] != -1) + io.KeysDown[io.KeyMap[key_data_index]] = key_data->Down; +#endif + } + else if (e->Type == ImGuiInputEventType_Text) + { + // Trickling Rule: Stop processing queued events if keys/mouse have been interacted with + if (trickle_fast_inputs && ((key_changed && trickle_interleaved_keys_and_text) || mouse_button_changed != 0 || mouse_moved || mouse_wheeled)) + break; + unsigned int c = e->Text.Char; + io.InputQueueCharacters.push_back(c <= IM_UNICODE_CODEPOINT_MAX ? (ImWchar)c : IM_UNICODE_CODEPOINT_INVALID); + if (trickle_interleaved_keys_and_text) + text_inputted = true; + } + else if (e->Type == ImGuiInputEventType_Focus) + { + // We intentionally overwrite this and process in NewFrame(), in order to give a chance + // to multi-viewports backends to queue AddFocusEvent(false) + AddFocusEvent(true) in same frame. + const bool focus_lost = !e->AppFocused.Focused; + io.AppFocusLost = focus_lost; + } + else + { + IM_ASSERT(0 && "Unknown event!"); + } + } + + // Record trail (for domain-specific applications wanting to access a precise trail) + //if (event_n != 0) IMGUI_DEBUG_LOG_IO("Processed: %d / Remaining: %d\n", event_n, g.InputEventsQueue.Size - event_n); + for (int n = 0; n < event_n; n++) + g.InputEventsTrail.push_back(g.InputEventsQueue[n]); + + // [DEBUG] +#ifndef IMGUI_DISABLE_DEBUG_TOOLS + if (event_n != 0 && (g.DebugLogFlags & ImGuiDebugLogFlags_EventIO)) + for (int n = 0; n < g.InputEventsQueue.Size; n++) + DebugPrintInputEvent(n < event_n ? "Processed" : "Remaining", &g.InputEventsQueue[n]); +#endif + + // Remaining events will be processed on the next frame + if (event_n == g.InputEventsQueue.Size) + g.InputEventsQueue.resize(0); + else + g.InputEventsQueue.erase(g.InputEventsQueue.Data, g.InputEventsQueue.Data + event_n); + + // Clear buttons state when focus is lost + // - this is useful so e.g. releasing Alt after focus loss on Alt-Tab doesn't trigger the Alt menu toggle. + // - we clear in EndFrame() and not now in order allow application/user code polling this flag + // (e.g. custom backend may want to clear additional data, custom widgets may want to react with a "canceling" event). + if (g.IO.AppFocusLost) + g.IO.ClearInputKeys(); +} + +ImGuiID ImGui::GetKeyOwner(ImGuiKey key) { + if (!IsNamedKeyOrModKey(key)) + return ImGuiKeyOwner_None; + ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - ImGuiID id = window->GetIDNoKeepAlive(int_id); - window->IDStack.push_back(id); + ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key); + ImGuiID owner_id = owner_data->OwnerCurr; + + if (g.ActiveIdUsingAllKeyboardKeys && owner_id != g.ActiveId && owner_id != ImGuiKeyOwner_Any) + if (key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END) + return ImGuiKeyOwner_None; + + return owner_id; } -// Push a given id value ignoring the ID stack as a seed. -void ImGui::PushOverrideID(ImGuiID id) +// TestKeyOwner(..., ID) : (owner == None || owner == ID) +// TestKeyOwner(..., None) : (owner == None) +// TestKeyOwner(..., Any) : no owner test +// All paths are also testing for key not being locked, for the rare cases that key have been locked with using ImGuiInputFlags_LockXXX flags. +bool ImGui::TestKeyOwner(ImGuiKey key, ImGuiID owner_id) { + if (!IsNamedKeyOrModKey(key)) + return true; + ImGuiContext& g = *GImGui; - ImGuiWindow* window = g.CurrentWindow; - if (g.DebugHookIdInfo == id) - DebugHookIdInfo(id, ImGuiDataType_ID, NULL, NULL); - window->IDStack.push_back(id); + if (g.ActiveIdUsingAllKeyboardKeys && owner_id != g.ActiveId && owner_id != ImGuiKeyOwner_Any) + if (key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END) + return false; + + ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key); + if (owner_id == ImGuiKeyOwner_Any) + return (owner_data->LockThisFrame == false); + + // Note: SetKeyOwner() sets OwnerCurr. It is not strictly required for most mouse routing overlap (because of ActiveId/HoveredId + // are acting as filter before this has a chance to filter), but sane as soon as user tries to look into things. + // Setting OwnerCurr in SetKeyOwner() is more consistent than testing OwnerNext here: would be inconsistent with getter and other functions. + if (owner_data->OwnerCurr != owner_id) + { + if (owner_data->LockThisFrame) + return false; + if (owner_data->OwnerCurr != ImGuiKeyOwner_None) + return false; + } + + return true; } -// Helper to avoid a common series of PushOverrideID -> GetID() -> PopID() call -// (note that when using this pattern, TestEngine's "Stack Tool" will tend to not display the intermediate stack level. -// for that to work we would need to do PushOverrideID() -> ItemAdd() -> PopID() which would alter widget code a little more) -ImGuiID ImGui::GetIDWithSeed(const char* str, const char* str_end, ImGuiID seed) +// _LockXXX flags are useful to lock keys away from code which is not input-owner aware. +// When using _LockXXX flags, you can use ImGuiKeyOwner_Any to lock keys from everyone. +// - SetKeyOwner(..., None) : clears owner +// - SetKeyOwner(..., Any, !Lock) : illegal (assert) +// - SetKeyOwner(..., Any or None, Lock) : set lock +void ImGui::SetKeyOwner(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags) { - ImGuiID id = ImHashStr(str, str_end ? (str_end - str) : 0, seed); - KeepAliveID(id); + IM_ASSERT(IsNamedKeyOrModKey(key) && (owner_id != ImGuiKeyOwner_Any || (flags & (ImGuiInputFlags_LockThisFrame | ImGuiInputFlags_LockUntilRelease)))); // Can only use _Any with _LockXXX flags (to eat a key away without an ID to retrieve it) + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedBySetKeyOwner) == 0); // Passing flags not supported by this function! + ImGuiContext& g = *GImGui; - if (g.DebugHookIdInfo == id) - DebugHookIdInfo(id, ImGuiDataType_String, str, str_end); - return id; -} + ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key); + owner_data->OwnerCurr = owner_data->OwnerNext = owner_id; -void ImGui::PopID() -{ - ImGuiWindow* window = GImGui->CurrentWindow; - IM_ASSERT(window->IDStack.Size > 1); // Too many PopID(), or could be popping in a wrong/different window? - window->IDStack.pop_back(); + // We cannot lock by default as it would likely break lots of legacy code. + // In the case of using LockUntilRelease while key is not down we still lock during the frame (no key_data->Down test) + owner_data->LockUntilRelease = (flags & ImGuiInputFlags_LockUntilRelease) != 0; + owner_data->LockThisFrame = (flags & ImGuiInputFlags_LockThisFrame) != 0 || (owner_data->LockUntilRelease); } -ImGuiID ImGui::GetID(const char* str_id) +// Rarely used helper +void ImGui::SetKeyOwnersForKeyChord(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags) { - ImGuiWindow* window = GImGui->CurrentWindow; - return window->GetID(str_id); + if (key_chord & ImGuiMod_Ctrl) { SetKeyOwner(ImGuiMod_Ctrl, owner_id, flags); } + if (key_chord & ImGuiMod_Shift) { SetKeyOwner(ImGuiMod_Shift, owner_id, flags); } + if (key_chord & ImGuiMod_Alt) { SetKeyOwner(ImGuiMod_Alt, owner_id, flags); } + if (key_chord & ImGuiMod_Super) { SetKeyOwner(ImGuiMod_Super, owner_id, flags); } + if (key_chord & ImGuiMod_Shortcut) { SetKeyOwner(ImGuiMod_Shortcut, owner_id, flags); } + if (key_chord & ~ImGuiMod_Mask_) { SetKeyOwner((ImGuiKey)(key_chord & ~ImGuiMod_Mask_), owner_id, flags); } } -ImGuiID ImGui::GetID(const char* str_id_begin, const char* str_id_end) +// This is more or less equivalent to: +// if (IsItemHovered() || IsItemActive()) +// SetKeyOwner(key, GetItemID()); +// Extensive uses of that (e.g. many calls for a single item) may want to manually perform the tests once and then call SetKeyOwner() multiple times. +// More advanced usage scenarios may want to call SetKeyOwner() manually based on different condition. +// Worth noting is that only one item can be hovered and only one item can be active, therefore this usage pattern doesn't need to bother with routing and priority. +void ImGui::SetItemKeyOwner(ImGuiKey key, ImGuiInputFlags flags) { - ImGuiWindow* window = GImGui->CurrentWindow; - return window->GetID(str_id_begin, str_id_end); + ImGuiContext& g = *GImGui; + ImGuiID id = g.LastItemData.ID; + if (id == 0 || (g.HoveredId != id && g.ActiveId != id)) + return; + if ((flags & ImGuiInputFlags_CondMask_) == 0) + flags |= ImGuiInputFlags_CondDefault_; + if ((g.HoveredId == id && (flags & ImGuiInputFlags_CondHovered)) || (g.ActiveId == id && (flags & ImGuiInputFlags_CondActive))) + { + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedBySetItemKeyOwner) == 0); // Passing flags not supported by this function! + SetKeyOwner(key, id, flags & ~ImGuiInputFlags_CondMask_); + } } -ImGuiID ImGui::GetID(const void* ptr_id) +bool ImGui::Shortcut(ImGuiKeyChord key_chord, ImGuiID owner_id, ImGuiInputFlags flags) { - ImGuiWindow* window = GImGui->CurrentWindow; - return window->GetID(ptr_id); -} + ImGuiContext& g = *GImGui; -bool ImGui::IsRectVisible(const ImVec2& size) -{ - ImGuiWindow* window = GImGui->CurrentWindow; - return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size)); -} + // When using (owner_id == 0/Any): SetShortcutRouting() will use CurrentFocusScopeId and filter with this, so IsKeyPressed() is fine with he 0/Any. + if ((flags & ImGuiInputFlags_RouteMask_) == 0) + flags |= ImGuiInputFlags_RouteFocused; + if (!SetShortcutRouting(key_chord, owner_id, flags)) + return false; -bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max) -{ - ImGuiWindow* window = GImGui->CurrentWindow; - return window->ClipRect.Overlaps(ImRect(rect_min, rect_max)); + if (key_chord & ImGuiMod_Shortcut) + key_chord = ConvertShortcutMod(key_chord); + ImGuiKey mods = (ImGuiKey)(key_chord & ImGuiMod_Mask_); + if (g.IO.KeyMods != mods) + return false; + + // Special storage location for mods + ImGuiKey key = (ImGuiKey)(key_chord & ~ImGuiMod_Mask_); + if (key == ImGuiKey_None) + key = ConvertSingleModFlagToKey(&g, mods); + + if (!IsKeyPressed(key, owner_id, (flags & (ImGuiInputFlags_Repeat | (ImGuiInputFlags)ImGuiInputFlags_RepeatRateMask_)))) + return false; + IM_ASSERT((flags & ~ImGuiInputFlags_SupportedByShortcut) == 0); // Passing flags not supported by this function! + + return true; } @@ -7460,9 +8963,12 @@ bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max) // Helper function to verify ABI compatibility between caller code and compiled version of Dear ImGui. // Verify that the type sizes are matching between the calling file's compilation unit and imgui.cpp's compilation unit -// If the user has inconsistent compilation settings, imgui configuration #define, packing pragma, etc. your user code -// may see different structures than what imgui.cpp sees, which is problematic. -// We usually require settings to be in imconfig.h to make sure that they are accessible to all compilation units involved with Dear ImGui. +// If this triggers you have an issue: +// - Most commonly: mismatched headers and compiled code version. +// - Or: mismatched configuration #define, compilation settings, packing pragma etc. +// The configuration settings mentioned in imconfig.h must be set for all compilation units involved with Dear ImGui, +// which is way it is required you put them in your imconfig file (and not just before including imgui.h). +// Otherwise it is possible that different compilation units would see different structure layout bool ImGui::DebugCheckVersionAndDataLayout(const char* version, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_vert, size_t sz_idx) { bool error = false; @@ -7476,6 +8982,38 @@ bool ImGui::DebugCheckVersionAndDataLayout(const char* version, size_t sz_io, si return !error; } +// Until 1.89 (IMGUI_VERSION_NUM < 18814) it was legal to use SetCursorPos() to extend the boundary of a parent (e.g. window or table cell) +// This is causing issues and ambiguity and we need to retire that. +// See https://github.com/ocornut/imgui/issues/5548 for more details. +// [Scenario 1] +// Previously this would make the window content size ~200x200: +// Begin(...) + SetCursorScreenPos(GetCursorScreenPos() + ImVec2(200,200)) + End(); // NOT OK +// Instead, please submit an item: +// Begin(...) + SetCursorScreenPos(GetCursorScreenPos() + ImVec2(200,200)) + Dummy(ImVec2(0,0)) + End(); // OK +// Alternative: +// Begin(...) + Dummy(ImVec2(200,200)) + End(); // OK +// [Scenario 2] +// For reference this is one of the issue what we aim to fix with this change: +// BeginGroup() + SomeItem("foobar") + SetCursorScreenPos(GetCursorScreenPos()) + EndGroup() +// The previous logic made SetCursorScreenPos(GetCursorScreenPos()) have a side-effect! It would erroneously incorporate ItemSpacing.y after the item into content size, making the group taller! +// While this code is a little twisted, no-one would expect SetXXX(GetXXX()) to have a side-effect. Using vertical alignment patterns could trigger this issue. +void ImGui::ErrorCheckUsingSetCursorPosToExtendParentBoundaries() +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + IM_ASSERT(window->DC.IsSetPos); + window->DC.IsSetPos = false; +#ifdef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + if (window->DC.CursorPos.x <= window->DC.CursorMaxPos.x && window->DC.CursorPos.y <= window->DC.CursorMaxPos.y) + return; + if (window->SkipItems) + return; + IM_ASSERT(0 && "Code uses SetCursorPos()/SetCursorScreenPos() to extend window/parent boundaries. Please submit an item e.g. Dummy() to validate extent."); +#else + window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos); +#endif +} + static void ImGui::ErrorCheckNewFrameSanityChecks() { ImGuiContext& g = *GImGui; @@ -7488,6 +9026,13 @@ static void ImGui::ErrorCheckNewFrameSanityChecks() // #define IM_ASSERT(EXPR) do { if (SomeCode(EXPR)) SomeMoreCode(); } while (0) // Correct! if (true) IM_ASSERT(1); else IM_ASSERT(0); + // Emscripten backends are often imprecise in their submission of DeltaTime. (#6114, #3644) + // Ideally the Emscripten app/backend should aim to fix or smooth this value and avoid feeding zero, but we tolerate it. +#ifdef __EMSCRIPTEN__ + if (g.IO.DeltaTime <= 0.0f && g.FrameCount > 0) + g.IO.DeltaTime = 0.00001f; +#endif + // Check user data // (We pass an error message in the assert expression to make it visible to programmers who are not using a debugger, as most assert handlers display their argument) IM_ASSERT(g.Initialized); @@ -7496,16 +9041,19 @@ static void ImGui::ErrorCheckNewFrameSanityChecks() IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f && "Invalid DisplaySize value!"); IM_ASSERT(g.IO.Fonts->IsBuilt() && "Font Atlas not built! Make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend, which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()"); IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting!"); - IM_ASSERT(g.Style.CircleTessellationMaxError > 0.0f && "Invalid style setting!"); + IM_ASSERT(g.Style.CircleTessellationMaxError > 0.0f && "Invalid style setting!"); IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting!"); // Allows us to avoid a few clamps in color computations IM_ASSERT(g.Style.WindowMinSize.x >= 1.0f && g.Style.WindowMinSize.y >= 1.0f && "Invalid style setting."); IM_ASSERT(g.Style.WindowMenuButtonPosition == ImGuiDir_None || g.Style.WindowMenuButtonPosition == ImGuiDir_Left || g.Style.WindowMenuButtonPosition == ImGuiDir_Right); - for (int n = 0; n < ImGuiKey_COUNT; n++) - IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && "io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)"); + IM_ASSERT(g.Style.ColorButtonPosition == ImGuiDir_Left || g.Style.ColorButtonPosition == ImGuiDir_Right); +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + for (int n = ImGuiKey_NamedKey_BEGIN; n < ImGuiKey_COUNT; n++) + IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < ImGuiKey_LegacyNativeKey_END && "io.KeyMap[] contains an out of bound value (need to be 0..511, or -1 for unmapped key)"); // Check: required key mapping (we intentionally do NOT check all keys to not pressure user into setting up everything, but Space is required and was only added in 1.60 WIP) - if (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) + if ((g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) && g.IO.BackendUsingLegacyKeyArrays == 1) IM_ASSERT(g.IO.KeyMap[ImGuiKey_Space] != -1 && "ImGuiKey_Space is not mapped, required for keyboard navigation."); +#endif // Check: the io.ConfigWindowsResizeFromEdges option requires backend to honor mouse cursor changes and set the ImGuiBackendFlags_HasMouseCursors flag accordingly. if (g.IO.ConfigWindowsResizeFromEdges && !(g.IO.BackendFlags & ImGuiBackendFlags_HasMouseCursors)) @@ -7520,13 +9068,13 @@ static void ImGui::ErrorCheckEndFrameSanityChecks() // One possible reason leading to this assert is that your backends update inputs _AFTER_ NewFrame(). // It is known that when some modal native windows called mid-frame takes focus away, some backends such as GLFW will // send key release events mid-frame. This would normally trigger this assertion and lead to sheared inputs. - // We silently accommodate for this case by ignoring/ the case where all io.KeyXXX modifiers were released (aka key_mod_flags == 0), + // We silently accommodate for this case by ignoring the case where all io.KeyXXX modifiers were released (aka key_mod_flags == 0), // while still correctly asserting on mid-frame key press events. - const ImGuiKeyModFlags key_mod_flags = GetMergedKeyModFlags(); - IM_ASSERT((key_mod_flags == 0 || g.IO.KeyMods == key_mod_flags) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods"); - IM_UNUSED(key_mod_flags); + const ImGuiKeyChord key_mods = GetMergedModsFromKeys(); + IM_ASSERT((key_mods == 0 || g.IO.KeyMods == key_mods) && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods"); + IM_UNUSED(key_mods); - // Recover from errors + // [EXPERIMENTAL] Recover from errors: You may call this yourself before EndFrame(). //ErrorCheckEndFrameRecover(); // Report when there is a mismatch of Begin/BeginChild vs End/EndChild calls. Important: Remember that the Begin/BeginChild API requires you @@ -7535,7 +9083,9 @@ static void ImGui::ErrorCheckEndFrameSanityChecks() { if (g.CurrentWindowStack.Size > 1) { + ImGuiWindow* window = g.CurrentWindowStack.back().Window; // <-- This window was not Ended! IM_ASSERT_USER_ERROR(g.CurrentWindowStack.Size == 1, "Mismatched Begin/BeginChild vs End/EndChild calls: did you forget to call End/EndChild?"); + IM_UNUSED(window); while (g.CurrentWindowStack.Size > 1) End(); } @@ -7566,7 +9116,6 @@ void ImGui::ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, voi IM_ASSERT(window->IsFallbackWindow); break; } - IM_ASSERT(window == g.CurrentWindow); if (window->Flags & ImGuiWindowFlags_ChildWindow) { if (log_callback) log_callback(user_data, "Recovered from missing EndChild() for '%s'", window->Name); @@ -7633,7 +9182,7 @@ void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, vo if (log_callback) log_callback(user_data, "Recovered from missing PopStyleVar() in '%s'", window->Name); PopStyleVar(); } - while (g.FocusScopeStack.Size > stack_sizes->SizeOfFocusScopeStack) //-V1044 + while (g.FocusScopeStack.Size > stack_sizes->SizeOfFocusScopeStack + 1) //-V1044 { if (log_callback) log_callback(user_data, "Recovered from missing PopFocusScope() in '%s'", window->Name); PopFocusScope(); @@ -7641,9 +9190,9 @@ void ImGui::ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, vo } // Save current stack sizes for later compare -void ImGuiStackSizes::SetToCurrentState() +void ImGuiStackSizes::SetToContextState(ImGuiContext* ctx) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *ctx; ImGuiWindow* window = g.CurrentWindow; SizeOfIDStack = (short)window->IDStack.Size; SizeOfColorStack = (short)g.ColorStack.Size; @@ -7657,9 +9206,9 @@ void ImGuiStackSizes::SetToCurrentState() } // Compare to detect usage errors -void ImGuiStackSizes::CompareWithCurrentState() +void ImGuiStackSizes::CompareWithContextState(ImGuiContext* ctx) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *ctx; ImGuiWindow* window = g.CurrentWindow; IM_UNUSED(window); @@ -7709,7 +9258,7 @@ void ImGuiStackSizes::CompareWithCurrentState() // - GetWindowContentRegionMin(), GetWindowContentRegionMax() // - BeginGroup() // - EndGroup() -// Also see in imgui_widgets: tab bars, columns. +// Also see in imgui_widgets: tab bars, and in imgui_tables: tables, columns. //----------------------------------------------------------------------------- // Advance cursor given item size for layout. @@ -7726,14 +9275,16 @@ void ImGui::ItemSize(const ImVec2& size, float text_baseline_y) // In theory we should be offsetting the starting position (window->DC.CursorPos), that will be the topic of a larger refactor, // but since ItemSize() is not yet an API that moves the cursor (to handle e.g. wrapping) enlarging the height has the same effect. const float offset_to_match_baseline_y = (text_baseline_y >= 0) ? ImMax(0.0f, window->DC.CurrLineTextBaseOffset - text_baseline_y) : 0.0f; - const float line_height = ImMax(window->DC.CurrLineSize.y, size.y + offset_to_match_baseline_y); + + const float line_y1 = window->DC.IsSameLine ? window->DC.CursorPosPrevLine.y : window->DC.CursorPos.y; + const float line_height = ImMax(window->DC.CurrLineSize.y, /*ImMax(*/window->DC.CursorPos.y - line_y1/*, 0.0f)*/ + size.y + offset_to_match_baseline_y); // Always align ourselves on pixel boundaries //if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG] window->DC.CursorPosPrevLine.x = window->DC.CursorPos.x + size.x; - window->DC.CursorPosPrevLine.y = window->DC.CursorPos.y; + window->DC.CursorPosPrevLine.y = line_y1; window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); // Next line - window->DC.CursorPos.y = IM_FLOOR(window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y); // Next line + window->DC.CursorPos.y = IM_FLOOR(line_y1 + line_height + g.Style.ItemSpacing.y); // Next line window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x); window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y - g.Style.ItemSpacing.y); //if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG] @@ -7742,17 +9293,13 @@ void ImGui::ItemSize(const ImVec2& size, float text_baseline_y) window->DC.CurrLineSize.y = 0.0f; window->DC.PrevLineTextBaseOffset = ImMax(window->DC.CurrLineTextBaseOffset, text_baseline_y); window->DC.CurrLineTextBaseOffset = 0.0f; + window->DC.IsSameLine = window->DC.IsSetPos = false; // Horizontal layout mode if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) SameLine(); } -void ImGui::ItemSize(const ImRect& bb, float text_baseline_y) -{ - ItemSize(bb.GetSize(), text_baseline_y); -} - // Declare item bounding box for clipping and interaction. // Note that the size can be different than the one provided to ItemSize(). Typically, widgets that spread over available surface // declare their minimum size requirement to ItemSize() and provide a larger region to ItemAdd() which is used drawing/interaction. @@ -7772,6 +9319,8 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu // Directional navigation processing if (id != 0) { + KeepAliveID(id); + // Runs prior to clipping early-out // (a) So that NavInitRequest can be honored, for newly opened windows to select a default widget // (b) So that we can scroll up/down past clipped items. This adds a small O(N) cost to regular navigation requests @@ -7781,40 +9330,48 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu // to reach unclipped widgets. This would work if user had explicit scrolling control (e.g. mapped on a stick). // We intentionally don't check if g.NavWindow != NULL because g.NavAnyRequest should only be set when it is non null. // If we crash on a NULL g.NavWindow we need to fix the bug elsewhere. - window->DC.NavLayersActiveMaskNext |= (1 << window->DC.NavLayerCurrent); - if (g.NavId == id || g.NavAnyRequest) - if (g.NavWindow->RootWindowForNav == window->RootWindowForNav) - if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened)) - NavProcessItem(); + if (!(g.LastItemData.InFlags & ImGuiItemFlags_NoNav)) + { + window->DC.NavLayersActiveMaskNext |= (1 << window->DC.NavLayerCurrent); + if (g.NavId == id || g.NavAnyRequest) + if (g.NavWindow->RootWindowForNav == window->RootWindowForNav) + if (window == g.NavWindow || ((window->Flags | g.NavWindow->Flags) & ImGuiWindowFlags_NavFlattened)) + NavProcessItem(); + } // [DEBUG] People keep stumbling on this problem and using "" as identifier in the root of a window instead of "##something". // Empty identifier are valid and useful in a small amount of cases, but 99.9% of the time you want to use "##something". - // READ THE FAQ: https://dearimgui.org/faq + // READ THE FAQ: https://dearimgui.com/faq IM_ASSERT(id != window->ID && "Cannot have an empty ID at the root of a window. If you need an empty label, use ## and read the FAQ about how the ID Stack works!"); - - // [DEBUG] Item Picker tool, when enabling the "extended" version we perform the check in ItemAdd() -#ifdef IMGUI_DEBUG_TOOL_ITEM_PICKER_EX - if (id == g.DebugItemPickerBreakId) - { - IM_DEBUG_BREAK(); - g.DebugItemPickerBreakId = 0; - } -#endif } g.NextItemData.Flags = ImGuiNextItemDataFlags_None; #ifdef IMGUI_ENABLE_TEST_ENGINE if (id != 0) - IMGUI_TEST_ENGINE_ITEM_ADD(nav_bb_arg ? *nav_bb_arg : bb, id); + IMGUI_TEST_ENGINE_ITEM_ADD(id, g.LastItemData.NavRect, &g.LastItemData); #endif // Clipping test - const bool is_clipped = IsClippedEx(bb, id); - if (is_clipped) - return false; + // (FIXME: This is a modified copy of IsClippedEx() so we can reuse the is_rect_visible value) + //const bool is_clipped = IsClippedEx(bb, id); + //if (is_clipped) + // return false; + const bool is_rect_visible = bb.Overlaps(window->ClipRect); + if (!is_rect_visible) + if (id == 0 || (id != g.ActiveId && id != g.ActiveIdPreviousFrame && id != g.NavId)) + if (!g.LogEnabled) + return false; + + // [DEBUG] +#ifndef IMGUI_DISABLE_DEBUG_TOOLS + if (id != 0 && id == g.DebugLocateId) + DebugLocateItemResolveWithLastItem(); +#endif //if (g.IO.KeyAlt) window->DrawList->AddRect(bb.Min, bb.Max, IM_COL32(255,255,0,120)); // [DEBUG] // We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them) + if (is_rect_visible) + g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_Visible; if (IsMouseHoveringRect(bb.Min, bb.Max)) g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredRect; return true; @@ -7827,25 +9384,28 @@ bool ImGui::ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg, ImGu // spacing_w >= 0 : enforce spacing amount void ImGui::SameLine(float offset_from_start_x, float spacing_w) { - ImGuiWindow* window = GetCurrentWindow(); + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; if (window->SkipItems) return; - ImGuiContext& g = *GImGui; if (offset_from_start_x != 0.0f) { - if (spacing_w < 0.0f) spacing_w = 0.0f; + if (spacing_w < 0.0f) + spacing_w = 0.0f; window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + offset_from_start_x + spacing_w + window->DC.GroupOffset.x + window->DC.ColumnsOffset.x; window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y; } else { - if (spacing_w < 0.0f) spacing_w = g.Style.ItemSpacing.x; + if (spacing_w < 0.0f) + spacing_w = g.Style.ItemSpacing.x; window->DC.CursorPos.x = window->DC.CursorPosPrevLine.x + spacing_w; window->DC.CursorPos.y = window->DC.CursorPosPrevLine.y; } window->DC.CurrLineSize = window->DC.PrevLineSize; window->DC.CurrLineTextBaseOffset = window->DC.PrevLineTextBaseOffset; + window->DC.IsSameLine = true; } ImVec2 ImGui::GetCursorScreenPos() @@ -7854,11 +9414,15 @@ ImVec2 ImGui::GetCursorScreenPos() return window->DC.CursorPos; } +// 2022/08/05: Setting cursor position also extend boundaries (via modifying CursorMaxPos) used to compute window size, group size etc. +// I believe this was is a judicious choice but it's probably being relied upon (it has been the case since 1.31 and 1.50) +// It would be sane if we requested user to use SetCursorPos() + Dummy(ImVec2(0,0)) to extend CursorMaxPos... void ImGui::SetCursorScreenPos(const ImVec2& pos) { ImGuiWindow* window = GetCurrentWindow(); window->DC.CursorPos = pos; - window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos); + //window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos); + window->DC.IsSetPos = true; } // User generally sees positions in window coordinates. Internally we store CursorPos in absolute screen coordinates because it is more convenient. @@ -7885,21 +9449,24 @@ void ImGui::SetCursorPos(const ImVec2& local_pos) { ImGuiWindow* window = GetCurrentWindow(); window->DC.CursorPos = window->Pos - window->Scroll + local_pos; - window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos); + //window->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos); + window->DC.IsSetPos = true; } void ImGui::SetCursorPosX(float x) { ImGuiWindow* window = GetCurrentWindow(); window->DC.CursorPos.x = window->Pos.x - window->Scroll.x + x; - window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPos.x); + //window->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPos.x); + window->DC.IsSetPos = true; } void ImGui::SetCursorPosY(float y) { ImGuiWindow* window = GetCurrentWindow(); window->DC.CursorPos.y = window->Pos.y - window->Scroll.y + y; - window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y); + //window->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y); + window->DC.IsSetPos = true; } ImVec2 ImGui::GetCursorStartPos() @@ -7990,7 +9557,8 @@ float ImGui::CalcItemWidth() // The 4.0f here may be changed to match CalcItemWidth() and/or BeginChild() (right now we have a mismatch which is harmless but undesirable) ImVec2 ImGui::CalcItemSize(ImVec2 size, float default_w, float default_h) { - ImGuiWindow* window = GImGui->CurrentWindow; + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; ImVec2 region_max; if (size.x < 0.0f || size.y < 0.0f) @@ -8115,6 +9683,9 @@ void ImGui::EndGroup() ImGuiGroupData& group_data = g.GroupStack.back(); IM_ASSERT(group_data.WindowID == window->ID); // EndGroup() in wrong window? + if (window->DC.IsSetPos) + ErrorCheckUsingSetCursorPosToExtendParentBoundaries(); + ImRect group_bb(group_data.BackupCursorPos, ImMax(window->DC.CursorMaxPos, group_data.BackupCursorPos)); window->DC.CursorPos = group_data.BackupCursorPos; @@ -8137,7 +9708,7 @@ void ImGui::EndGroup() ItemAdd(group_bb, 0, NULL, ImGuiItemFlags_NoTabStop); // If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive(), IsItemDeactivated() etc. will be functional on the entire group. - // It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets. + // It would be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but would put a little more burden on individual widgets. // Also if you grep for LastItemId you'll notice it is only used in that context. // (The two tests not the same because ActiveIdIsAlive is an ID itself, in order to be able to handle ActiveId being overwritten during the frame.) const bool group_contains_curr_active_id = (group_data.BackupActiveIdIsAlive != g.ActiveId) && (g.ActiveIdIsAlive == g.ActiveId) && g.ActiveId; @@ -8187,38 +9758,24 @@ static float CalcScrollEdgeSnap(float target, float snap_min, float snap_max, fl static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window) { ImVec2 scroll = window->Scroll; - if (window->ScrollTarget.x < FLT_MAX) - { - float decoration_total_width = window->ScrollbarSizes.x; - float center_x_ratio = window->ScrollTargetCenterRatio.x; - float scroll_target_x = window->ScrollTarget.x; - if (window->ScrollTargetEdgeSnapDist.x > 0.0f) - { - float snap_x_min = 0.0f; - float snap_x_max = window->ScrollMax.x + window->SizeFull.x - decoration_total_width; - scroll_target_x = CalcScrollEdgeSnap(scroll_target_x, snap_x_min, snap_x_max, window->ScrollTargetEdgeSnapDist.x, center_x_ratio); - } - scroll.x = scroll_target_x - center_x_ratio * (window->SizeFull.x - decoration_total_width); - } - if (window->ScrollTarget.y < FLT_MAX) + ImVec2 decoration_size(window->DecoOuterSizeX1 + window->DecoInnerSizeX1 + window->DecoOuterSizeX2, window->DecoOuterSizeY1 + window->DecoInnerSizeY1 + window->DecoOuterSizeY2); + for (int axis = 0; axis < 2; axis++) { - float decoration_total_height = window->TitleBarHeight() + window->MenuBarHeight() + window->ScrollbarSizes.y; - float center_y_ratio = window->ScrollTargetCenterRatio.y; - float scroll_target_y = window->ScrollTarget.y; - if (window->ScrollTargetEdgeSnapDist.y > 0.0f) + if (window->ScrollTarget[axis] < FLT_MAX) { - float snap_y_min = 0.0f; - float snap_y_max = window->ScrollMax.y + window->SizeFull.y - decoration_total_height; - scroll_target_y = CalcScrollEdgeSnap(scroll_target_y, snap_y_min, snap_y_max, window->ScrollTargetEdgeSnapDist.y, center_y_ratio); + float center_ratio = window->ScrollTargetCenterRatio[axis]; + float scroll_target = window->ScrollTarget[axis]; + if (window->ScrollTargetEdgeSnapDist[axis] > 0.0f) + { + float snap_min = 0.0f; + float snap_max = window->ScrollMax[axis] + window->SizeFull[axis] - decoration_size[axis]; + scroll_target = CalcScrollEdgeSnap(scroll_target, snap_min, snap_max, window->ScrollTargetEdgeSnapDist[axis], center_ratio); + } + scroll[axis] = scroll_target - center_ratio * (window->SizeFull[axis] - decoration_size[axis]); } - scroll.y = scroll_target_y - center_y_ratio * (window->SizeFull.y - decoration_total_height); - } - scroll.x = IM_FLOOR(ImMax(scroll.x, 0.0f)); - scroll.y = IM_FLOOR(ImMax(scroll.y, 0.0f)); - if (!window->Collapsed && !window->SkipItems) - { - scroll.x = ImMin(scroll.x, window->ScrollMax.x); - scroll.y = ImMin(scroll.y, window->ScrollMax.y); + scroll[axis] = IM_FLOOR(ImMax(scroll[axis], 0.0f)); + if (!window->Collapsed && !window->SkipItems) + scroll[axis] = ImMin(scroll[axis], window->ScrollMax[axis]); } return scroll; } @@ -8239,8 +9796,11 @@ void ImGui::ScrollToRect(ImGuiWindow* window, const ImRect& item_rect, ImGuiScro ImVec2 ImGui::ScrollToRectEx(ImGuiWindow* window, const ImRect& item_rect, ImGuiScrollFlags flags) { ImGuiContext& g = *GImGui; - ImRect window_rect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1)); - //GetForegroundDrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG] + ImRect scroll_rect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1)); + scroll_rect.Min.x = ImMin(scroll_rect.Min.x + window->DecoInnerSizeX1, scroll_rect.Max.x); + scroll_rect.Min.y = ImMin(scroll_rect.Min.y + window->DecoInnerSizeY1, scroll_rect.Max.y); + //GetForegroundDrawList(window)->AddRect(item_rect.Min, item_rect.Max, IM_COL32(255,0,0,255), 0.0f, 0, 5.0f); // [DEBUG] + //GetForegroundDrawList(window)->AddRect(scroll_rect.Min, scroll_rect.Max, IM_COL32_WHITE); // [DEBUG] // Check that only one behavior is selected per axis IM_ASSERT((flags & ImGuiScrollFlags_MaskX_) == 0 || ImIsPowerOfTwo(flags & ImGuiScrollFlags_MaskX_)); @@ -8253,35 +9813,39 @@ ImVec2 ImGui::ScrollToRectEx(ImGuiWindow* window, const ImRect& item_rect, ImGui if ((flags & ImGuiScrollFlags_MaskY_) == 0) flags |= window->Appearing ? ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeY; - const bool fully_visible_x = item_rect.Min.x >= window_rect.Min.x && item_rect.Max.x <= window_rect.Max.x; - const bool fully_visible_y = item_rect.Min.y >= window_rect.Min.y && item_rect.Max.y <= window_rect.Max.y; - const bool can_be_fully_visible_x = (item_rect.GetWidth() + g.Style.ItemSpacing.x * 2.0f) <= window_rect.GetWidth(); - const bool can_be_fully_visible_y = (item_rect.GetHeight() + g.Style.ItemSpacing.y * 2.0f) <= window_rect.GetHeight(); + const bool fully_visible_x = item_rect.Min.x >= scroll_rect.Min.x && item_rect.Max.x <= scroll_rect.Max.x; + const bool fully_visible_y = item_rect.Min.y >= scroll_rect.Min.y && item_rect.Max.y <= scroll_rect.Max.y; + const bool can_be_fully_visible_x = (item_rect.GetWidth() + g.Style.ItemSpacing.x * 2.0f) <= scroll_rect.GetWidth() || (window->AutoFitFramesX > 0) || (window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0; + const bool can_be_fully_visible_y = (item_rect.GetHeight() + g.Style.ItemSpacing.y * 2.0f) <= scroll_rect.GetHeight() || (window->AutoFitFramesY > 0) || (window->Flags & ImGuiWindowFlags_AlwaysAutoResize) != 0; if ((flags & ImGuiScrollFlags_KeepVisibleEdgeX) && !fully_visible_x) { - if (item_rect.Min.x < window_rect.Min.x || !can_be_fully_visible_x) + if (item_rect.Min.x < scroll_rect.Min.x || !can_be_fully_visible_x) SetScrollFromPosX(window, item_rect.Min.x - g.Style.ItemSpacing.x - window->Pos.x, 0.0f); - else if (item_rect.Max.x >= window_rect.Max.x) + else if (item_rect.Max.x >= scroll_rect.Max.x) SetScrollFromPosX(window, item_rect.Max.x + g.Style.ItemSpacing.x - window->Pos.x, 1.0f); } else if (((flags & ImGuiScrollFlags_KeepVisibleCenterX) && !fully_visible_x) || (flags & ImGuiScrollFlags_AlwaysCenterX)) { - float target_x = can_be_fully_visible_x ? ImFloor((item_rect.Min.x + item_rect.Max.x - window->InnerRect.GetWidth()) * 0.5f) : item_rect.Min.x; - SetScrollFromPosX(window, target_x - window->Pos.x, 0.0f); + if (can_be_fully_visible_x) + SetScrollFromPosX(window, ImFloor((item_rect.Min.x + item_rect.Max.x) * 0.5f) - window->Pos.x, 0.5f); + else + SetScrollFromPosX(window, item_rect.Min.x - window->Pos.x, 0.0f); } if ((flags & ImGuiScrollFlags_KeepVisibleEdgeY) && !fully_visible_y) { - if (item_rect.Min.y < window_rect.Min.y || !can_be_fully_visible_y) + if (item_rect.Min.y < scroll_rect.Min.y || !can_be_fully_visible_y) SetScrollFromPosY(window, item_rect.Min.y - g.Style.ItemSpacing.y - window->Pos.y, 0.0f); - else if (item_rect.Max.y >= window_rect.Max.y) + else if (item_rect.Max.y >= scroll_rect.Max.y) SetScrollFromPosY(window, item_rect.Max.y + g.Style.ItemSpacing.y - window->Pos.y, 1.0f); } else if (((flags & ImGuiScrollFlags_KeepVisibleCenterY) && !fully_visible_y) || (flags & ImGuiScrollFlags_AlwaysCenterY)) { - float target_y = can_be_fully_visible_y ? ImFloor((item_rect.Min.y + item_rect.Max.y - window->InnerRect.GetHeight()) * 0.5f) : item_rect.Min.y; - SetScrollFromPosY(window, target_y - window->Pos.y, 0.0f); + if (can_be_fully_visible_y) + SetScrollFromPosY(window, ImFloor((item_rect.Min.y + item_rect.Max.y) * 0.5f) - window->Pos.y, 0.5f); + else + SetScrollFromPosY(window, item_rect.Min.y - window->Pos.y, 0.0f); } ImVec2 next_scroll = CalcNextScrollFromScrollTargetAndClamp(window); @@ -8356,7 +9920,7 @@ void ImGui::SetScrollY(float scroll_y) // - local_pos = (absolution_pos - window->Pos) // - So local_x/local_y are 0.0f for a position at the upper-left corner of a window, // and generally local_x/local_y are >(padding+decoration) && <(size-padding-decoration) when in the visible area. -// - They mostly exists because of legacy API. +// - They mostly exist because of legacy API. // Following the rules above, when trying to work with scrolling code, consider that: // - SetScrollFromPosY(0.0f) == SetScrollY(0.0f + scroll.y) == has no effect! // - SetScrollFromPosY(-scroll.y) == SetScrollY(-scroll.y + scroll.y) == SetScrollY(0.0f) == reset scroll. Of course writing SetScrollY(0.0f) directly then makes more sense @@ -8364,7 +9928,7 @@ void ImGui::SetScrollY(float scroll_y) void ImGui::SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio) { IM_ASSERT(center_x_ratio >= 0.0f && center_x_ratio <= 1.0f); - window->ScrollTarget.x = IM_FLOOR(local_x + window->Scroll.x); // Convert local position to scroll offset + window->ScrollTarget.x = IM_FLOOR(local_x - window->DecoOuterSizeX1 - window->DecoInnerSizeX1 + window->Scroll.x); // Convert local position to scroll offset window->ScrollTargetCenterRatio.x = center_x_ratio; window->ScrollTargetEdgeSnapDist.x = 0.0f; } @@ -8372,9 +9936,7 @@ void ImGui::SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x void ImGui::SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio) { IM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f); - const float decoration_up_height = window->TitleBarHeight() + window->MenuBarHeight(); // FIXME: Would be nice to have a more standardized access to our scrollable/client rect; - local_y -= decoration_up_height; - window->ScrollTarget.y = IM_FLOOR(local_y + window->Scroll.y); // Convert local position to scroll offset + window->ScrollTarget.y = IM_FLOOR(local_y - window->DecoOuterSizeY1 - window->DecoInnerSizeY1 + window->Scroll.y); // Convert local position to scroll offset window->ScrollTargetCenterRatio.y = center_y_ratio; window->ScrollTargetEdgeSnapDist.y = 0.0f; } @@ -8421,12 +9983,12 @@ void ImGui::SetScrollHereY(float center_y_ratio) // [SECTION] TOOLTIPS //----------------------------------------------------------------------------- -void ImGui::BeginTooltip() +bool ImGui::BeginTooltip() { - BeginTooltipEx(ImGuiTooltipFlags_None, ImGuiWindowFlags_None); + return BeginTooltipEx(ImGuiTooltipFlags_None, ImGuiWindowFlags_None); } -void ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags) +bool ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags) { ImGuiContext& g = *GImGui; @@ -8450,12 +10012,17 @@ void ImGui::BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags ext if (window->Active) { // Hide previous tooltip from being displayed. We can't easily "reset" the content of a window so we create a new one. - window->Hidden = true; - window->HiddenFramesCanSkipItems = 1; // FIXME: This may not be necessary? + SetWindowHiddendAndSkipItemsForCurrentFrame(window); ImFormatString(window_name, IM_ARRAYSIZE(window_name), "##Tooltip_%02d", ++g.TooltipOverrideCount); } ImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize; Begin(window_name, NULL, flags | extra_window_flags); + // 2023-03-09: Added bool return value to the API, but currently always returning true. + // If this ever returns false we need to update BeginDragDropSource() accordingly. + //if (!ret) + // End(); + //return ret; + return true; } void ImGui::EndTooltip() @@ -8466,7 +10033,8 @@ void ImGui::EndTooltip() void ImGui::SetTooltipV(const char* fmt, va_list args) { - BeginTooltipEx(ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_None); + if (!BeginTooltipEx(ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_None)) + return; TextV(fmt, args); EndTooltip(); } @@ -8547,7 +10115,9 @@ ImGuiWindow* ImGui::GetTopMostAndVisiblePopupModal() void ImGui::OpenPopup(const char* str_id, ImGuiPopupFlags popup_flags) { ImGuiContext& g = *GImGui; - OpenPopupEx(g.CurrentWindow->GetID(str_id), popup_flags); + ImGuiID id = g.CurrentWindow->GetID(str_id); + IMGUI_DEBUG_LOG_POPUP("[popup] OpenPopup(\"%s\" -> 0x%08X)\n", str_id, id); + OpenPopupEx(id, popup_flags); } void ImGui::OpenPopup(ImGuiID id, ImGuiPopupFlags popup_flags) @@ -8566,19 +10136,19 @@ void ImGui::OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags) const int current_stack_size = g.BeginPopupStack.Size; if (popup_flags & ImGuiPopupFlags_NoOpenOverExistingPopup) - if (IsPopupOpen(0u, ImGuiPopupFlags_AnyPopupId)) + if (IsPopupOpen((ImGuiID)0, ImGuiPopupFlags_AnyPopupId)) return; ImGuiPopupData popup_ref; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack. popup_ref.PopupId = id; popup_ref.Window = NULL; - popup_ref.SourceWindow = g.NavWindow; + popup_ref.BackupNavWindow = g.NavWindow; // When popup closes focus may be restored to NavWindow (depend on window type). popup_ref.OpenFrameCount = g.FrameCount; popup_ref.OpenParentId = parent_window->IDStack.back(); popup_ref.OpenPopupPos = NavCalcPreferredRefPos(); popup_ref.OpenMousePos = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : popup_ref.OpenPopupPos; - IMGUI_DEBUG_LOG_POPUP("OpenPopupEx(0x%08X)\n", id); + IMGUI_DEBUG_LOG_POPUP("[popup] OpenPopupEx(0x%08X)\n", id); if (g.OpenPopupStack.Size < current_stack_size + 1) { g.OpenPopupStack.push_back(popup_ref); @@ -8647,7 +10217,7 @@ void ImGui::ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to } if (popup_count_to_keep < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the statement below { - IMGUI_DEBUG_LOG_POPUP("ClosePopupsOverWindow(\"%s\") -> ClosePopupToLevel(%d)\n", ref_window->Name, popup_count_to_keep); + IMGUI_DEBUG_LOG_POPUP("[popup] ClosePopupsOverWindow(\"%s\")\n", ref_window ? ref_window->Name : ""); ClosePopupToLevel(popup_count_to_keep, restore_focus_to_window_under_popup); } } @@ -8670,16 +10240,17 @@ void ImGui::ClosePopupsExceptModals() void ImGui::ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup) { ImGuiContext& g = *GImGui; - IMGUI_DEBUG_LOG_POPUP("ClosePopupToLevel(%d), restore_focus_to_window_under_popup=%d\n", remaining, restore_focus_to_window_under_popup); + IMGUI_DEBUG_LOG_POPUP("[popup] ClosePopupToLevel(%d), restore_focus_to_window_under_popup=%d\n", remaining, restore_focus_to_window_under_popup); IM_ASSERT(remaining >= 0 && remaining < g.OpenPopupStack.Size); // Trim open popup stack - ImGuiWindow* focus_window = g.OpenPopupStack[remaining].SourceWindow; ImGuiWindow* popup_window = g.OpenPopupStack[remaining].Window; + ImGuiWindow* popup_backup_nav_window = g.OpenPopupStack[remaining].BackupNavWindow; g.OpenPopupStack.resize(remaining); if (restore_focus_to_window_under_popup) { + ImGuiWindow* focus_window = (popup_window && popup_window->Flags & ImGuiWindowFlags_ChildMenu) ? popup_window->ParentWindow : popup_backup_nav_window; if (focus_window && !focus_window->WasActive && popup_window) { // Fallback @@ -8715,7 +10286,7 @@ void ImGui::CloseCurrentPopup() break; popup_idx--; } - IMGUI_DEBUG_LOG_POPUP("CloseCurrentPopup %d -> %d\n", g.BeginPopupStack.Size - 1, popup_idx); + IMGUI_DEBUG_LOG_POPUP("[popup] CloseCurrentPopup %d -> %d\n", g.BeginPopupStack.Size - 1, popup_idx); ClosePopupToLevel(popup_idx, true); // A common pattern is to close a popup when selecting a menu item/selectable that will open another window. @@ -8758,7 +10329,8 @@ bool ImGui::BeginPopup(const char* str_id, ImGuiWindowFlags flags) return false; } flags |= ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings; - return BeginPopupEx(g.CurrentWindow->GetID(str_id), flags); + ImGuiID id = g.CurrentWindow->GetID(str_id); + return BeginPopupEx(id, flags); } // If 'p_open' is specified for a modal popup window, the popup will have a regular close button which will close the popup. @@ -8837,7 +10409,7 @@ void ImGui::OpenPopupOnItemClick(const char* str_id, ImGuiPopupFlags popup_flags // - You may want to handle the whole on user side if you have specific needs (e.g. tweaking IsItemHovered() parameters). // This is essentially the same as: // id = str_id ? GetID(str_id) : GetItemID(); -// OpenPopupOnItemClick(str_id); +// OpenPopupOnItemClick(str_id, ImGuiPopupFlags_MouseButtonRight); // return BeginPopup(id); // Which is essentially the same as: // id = str_id ? GetID(str_id) : GetItemID(); @@ -8933,7 +10505,7 @@ ImVec2 ImGui::FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& s const float avail_w = (dir == ImGuiDir_Left ? r_avoid.Min.x : r_outer.Max.x) - (dir == ImGuiDir_Right ? r_avoid.Max.x : r_outer.Min.x); const float avail_h = (dir == ImGuiDir_Up ? r_avoid.Min.y : r_outer.Max.y) - (dir == ImGuiDir_Down ? r_avoid.Max.y : r_outer.Min.y); - // If there not enough room on one axis, there's no point in positioning on a side on this axis (e.g. when not enough width, use a top/bottom position to maximize available width) + // If there's not enough room on one axis, there's no point in positioning on a side on this axis (e.g. when not enough width, use a top/bottom position to maximize available width) if (avail_w < size.x && (dir == ImGuiDir_Left || dir == ImGuiDir_Right)) continue; if (avail_h < size.y && (dir == ImGuiDir_Up || dir == ImGuiDir_Down)) @@ -8998,8 +10570,7 @@ ImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window) } if (window->Flags & ImGuiWindowFlags_Popup) { - ImRect r_avoid = ImRect(window->Pos.x - 1, window->Pos.y - 1, window->Pos.x + 1, window->Pos.y + 1); - return FindBestWindowPosForPopupEx(window->Pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid, ImGuiPopupPositionPolicy_Default); + return FindBestWindowPosForPopupEx(window->Pos, window->Size, &window->AutoPosLastDirection, r_outer, ImRect(window->Pos, window->Pos), ImGuiPopupPositionPolicy_Default); // Ideally we'd disable r_avoid here } if (window->Flags & ImGuiWindowFlags_Tooltip) { @@ -9021,8 +10592,22 @@ ImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window) // [SECTION] KEYBOARD/GAMEPAD NAVIGATION //----------------------------------------------------------------------------- -// FIXME-NAV: The existence of SetNavID vs SetFocusID properly needs to be clarified/reworked. -// In our terminology those should be interchangeable. Those two functions are merely a legacy artifact, so at minimum naming should be clarified. +// FIXME-NAV: The existence of SetNavID vs SetFocusID vs FocusWindow() needs to be clarified/reworked. +// In our terminology those should be interchangeable, yet right now this is super confusing. +// Those two functions are merely a legacy artifact, so at minimum naming should be clarified. + +void ImGui::SetNavWindow(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + if (g.NavWindow != window) + { + IMGUI_DEBUG_LOG_FOCUS("[focus] SetNavWindow(\"%s\")\n", window ? window->Name : ""); + g.NavWindow = window; + } + g.NavInitRequest = g.NavMoveSubmitted = g.NavMoveScoringItems = false; + NavUpdateAnyRequestFlag(); +} + void ImGui::SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel) { ImGuiContext& g = *GImGui; @@ -9040,20 +10625,20 @@ void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window) ImGuiContext& g = *GImGui; IM_ASSERT(id != 0); - // Assume that SetFocusID() is called in the context where its window->DC.NavLayerCurrent and window->DC.NavFocusScopeIdCurrent are valid. + if (g.NavWindow != window) + SetNavWindow(window); + + // Assume that SetFocusID() is called in the context where its window->DC.NavLayerCurrent and g.CurrentFocusScopeId are valid. // Note that window may be != g.CurrentWindow (e.g. SetFocusID call in InputTextEx for multi-line text) const ImGuiNavLayer nav_layer = window->DC.NavLayerCurrent; - if (g.NavWindow != window) - g.NavInitRequest = false; - g.NavWindow = window; g.NavId = id; g.NavLayer = nav_layer; - g.NavFocusScopeId = window->DC.NavFocusScopeIdCurrent; + g.NavFocusScopeId = g.CurrentFocusScopeId; window->NavLastIds[nav_layer] = id; if (g.LastItemData.ID == id) window->NavRectRel[nav_layer] = WindowRectAbsToRel(window, g.LastItemData.NavRect); - if (g.ActiveIdSource == ImGuiInputSource_Nav) + if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) g.NavDisableMouseHover = true; else g.NavDisableHighlight = true; @@ -9112,7 +10697,7 @@ static bool ImGui::NavScoreItem(ImGuiNavItemData* result) } // We perform scoring on items bounding box clipped by the current clipping rectangle on the other axis (clipping on our movement axis would give us equal scores for all clipped items) - // For example, this ensure that items in one column are not reached when moving vertically from items in another column. + // For example, this ensures that items in one column are not reached when moving vertically from items in another column. NavClampRectToVisibleAreaForMoveDir(g.NavMoveClipDir, cand, window->ClipRect); // Compute distance between boxes @@ -9176,7 +10761,7 @@ static bool ImGui::NavScoreItem(ImGuiNavItemData* result) } #endif - // Is it in the quadrant we're interesting in moving to? + // Is it in the quadrant we're interested in moving to? bool new_best = false; const ImGuiDir move_dir = g.NavMoveDir; if (quadrant == move_dir) @@ -9229,7 +10814,7 @@ static void ImGui::NavApplyItemToResult(ImGuiNavItemData* result) ImGuiWindow* window = g.CurrentWindow; result->Window = window; result->ID = g.LastItemData.ID; - result->FocusScopeId = window->DC.NavFocusScopeIdCurrent; + result->FocusScopeId = g.CurrentFocusScopeId; result->InFlags = g.LastItemData.InFlags; result->RectRel = WindowRectAbsToRel(window, g.LastItemData.NavRect); } @@ -9245,10 +10830,10 @@ static void ImGui::NavProcessItem() const ImGuiItemFlags item_flags = g.LastItemData.InFlags; // Process Init Request - if (g.NavInitRequest && g.NavLayer == window->DC.NavLayerCurrent) + if (g.NavInitRequest && g.NavLayer == window->DC.NavLayerCurrent && (item_flags & ImGuiItemFlags_Disabled) == 0) { // Even if 'ImGuiItemFlags_NoNavDefaultFocus' is on (typically collapse/close button) we record the first ResultId so they can be used as a fallback - const bool candidate_for_nav_default_focus = (item_flags & (ImGuiItemFlags_NoNavDefaultFocus | ImGuiItemFlags_Disabled)) == 0; + const bool candidate_for_nav_default_focus = (item_flags & ImGuiItemFlags_NoNavDefaultFocus) == 0; if (candidate_for_nav_default_focus || g.NavInitResultId == 0) { g.NavInitResultId = id; @@ -9263,39 +10848,35 @@ static void ImGui::NavProcessItem() // Process Move Request (scoring for navigation) // FIXME-NAV: Consider policy for double scoring (scoring from NavScoringRect + scoring from a rect wrapped according to current wrapping policy) - if (g.NavMoveScoringItems) + if (g.NavMoveScoringItems && (item_flags & ImGuiItemFlags_Disabled) == 0) { - const bool is_tab_stop = (item_flags & ImGuiItemFlags_Inputable) && (item_flags & (ImGuiItemFlags_NoTabStop | ImGuiItemFlags_Disabled)) == 0; const bool is_tabbing = (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) != 0; if (is_tabbing) { - if (is_tab_stop || (g.NavMoveFlags & ImGuiNavMoveFlags_FocusApi)) - NavProcessItemForTabbingRequest(id); + NavProcessItemForTabbingRequest(id, item_flags, g.NavMoveFlags); } - else if ((g.NavId != id || (g.NavMoveFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) && !(item_flags & (ImGuiItemFlags_Disabled | ImGuiItemFlags_NoNav))) + else if (g.NavId != id || (g.NavMoveFlags & ImGuiNavMoveFlags_AllowCurrentNavId)) { ImGuiNavItemData* result = (window == g.NavWindow) ? &g.NavMoveResultLocal : &g.NavMoveResultOther; - if (!is_tabbing) - { - if (NavScoreItem(result)) - NavApplyItemToResult(result); - - // Features like PageUp/PageDown need to maintain a separate score for the visible set of items. - const float VISIBLE_RATIO = 0.70f; - if ((g.NavMoveFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb)) - if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO) - if (NavScoreItem(&g.NavMoveResultLocalVisible)) - NavApplyItemToResult(&g.NavMoveResultLocalVisible); - } + if (NavScoreItem(result)) + NavApplyItemToResult(result); + + // Features like PageUp/PageDown need to maintain a separate score for the visible set of items. + const float VISIBLE_RATIO = 0.70f; + if ((g.NavMoveFlags & ImGuiNavMoveFlags_AlsoScoreVisibleSet) && window->ClipRect.Overlaps(nav_bb)) + if (ImClamp(nav_bb.Max.y, window->ClipRect.Min.y, window->ClipRect.Max.y) - ImClamp(nav_bb.Min.y, window->ClipRect.Min.y, window->ClipRect.Max.y) >= (nav_bb.Max.y - nav_bb.Min.y) * VISIBLE_RATIO) + if (NavScoreItem(&g.NavMoveResultLocalVisible)) + NavApplyItemToResult(&g.NavMoveResultLocalVisible); } } // Update window-relative bounding box of navigated item if (g.NavId == id) { - g.NavWindow = window; // Always refresh g.NavWindow, because some operations such as FocusItem() don't have a window. + if (g.NavWindow != window) + SetNavWindow(window); // Always refresh g.NavWindow, because some operations such as FocusItem() may not have a window. g.NavLayer = window->DC.NavLayerCurrent; - g.NavFocusScopeId = window->DC.NavFocusScopeIdCurrent; + g.NavFocusScopeId = g.CurrentFocusScopeId; g.NavIdIsAlive = true; window->NavRectRel[window->DC.NavLayerCurrent] = WindowRectAbsToRel(window, nav_bb); // Store item bounding box (relative to window position) } @@ -9308,18 +10889,31 @@ static void ImGui::NavProcessItem() // - Case 3: tab forward wrap: set result to first eligible item (preemptively), on ref id set counter, on next frame if counter hasn't elapsed store result. // FIXME-TABBING: Could be done as a next-frame forwarded request // - Case 4: tab backward: store all results, on ref id pick prev, stop storing // - Case 5: tab backward wrap: store all results, on ref id if no result keep storing until last // FIXME-TABBING: Could be done as next-frame forwarded requested -void ImGui::NavProcessItemForTabbingRequest(ImGuiID id) +void ImGui::NavProcessItemForTabbingRequest(ImGuiID id, ImGuiItemFlags item_flags, ImGuiNavMoveFlags move_flags) { ImGuiContext& g = *GImGui; + if ((move_flags & ImGuiNavMoveFlags_FocusApi) == 0) + if (g.NavLayer != g.CurrentWindow->DC.NavLayerCurrent) + return; + + // - Can always land on an item when using API call. + // - Tabbing with _NavEnableKeyboard (space/enter/arrows): goes through every item. + // - Tabbing without _NavEnableKeyboard: goes through inputable items only. + bool can_stop; + if (move_flags & ImGuiNavMoveFlags_FocusApi) + can_stop = true; + else + can_stop = (item_flags & ImGuiItemFlags_NoTabStop) == 0 && ((g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) || (item_flags & ImGuiItemFlags_Inputable)); + // Always store in NavMoveResultLocal (unlike directional request which uses NavMoveResultOther on sibling/flattened windows) ImGuiNavItemData* result = &g.NavMoveResultLocal; if (g.NavTabbingDir == +1) { // Tab Forward or SetKeyboardFocusHere() with >= 0 - if (g.NavTabbingResultFirst.ID == 0) + if (can_stop && g.NavTabbingResultFirst.ID == 0) NavApplyItemToResult(&g.NavTabbingResultFirst); - if (--g.NavTabbingCounter == 0) + if (can_stop && g.NavTabbingCounter > 0 && --g.NavTabbingCounter == 0) NavMoveRequestResolveWithLastItem(result); else if (g.NavId == id) g.NavTabbingCounter = 1; @@ -9335,16 +10929,18 @@ void ImGui::NavProcessItemForTabbingRequest(ImGuiID id) NavUpdateAnyRequestFlag(); } } - else + else if (can_stop) { + // Keep applying until reaching NavId NavApplyItemToResult(result); } } else if (g.NavTabbingDir == 0) { - // Tab Init - if (g.NavTabbingResultFirst.ID == 0) - NavMoveRequestResolveWithLastItem(&g.NavTabbingResultFirst); + if (can_stop && g.NavId == id) + NavMoveRequestResolveWithLastItem(result); + if (can_stop && g.NavTabbingResultFirst.ID == 0) // Tab init + NavApplyItemToResult(&g.NavTabbingResultFirst); } } @@ -9371,10 +10967,11 @@ void ImGui::NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavM g.NavMoveScrollFlags = scroll_flags; g.NavMoveForwardToNextFrame = false; g.NavMoveKeyMods = g.IO.KeyMods; - g.NavTabbingCounter = 0; g.NavMoveResultLocal.Clear(); g.NavMoveResultLocalVisible.Clear(); g.NavMoveResultOther.Clear(); + g.NavTabbingCounter = 0; + g.NavTabbingResultFirst.Clear(); NavUpdateAnyRequestFlag(); } @@ -9441,7 +11038,12 @@ void ImGui::NavRestoreLayer(ImGuiNavLayer layer) { ImGuiContext& g = *GImGui; if (layer == ImGuiNavLayer_Main) - g.NavWindow = NavRestoreLastChildNavWindow(g.NavWindow); + { + ImGuiWindow* prev_nav_window = g.NavWindow; + g.NavWindow = NavRestoreLastChildNavWindow(g.NavWindow); // FIXME-NAV: Should clear ongoing nav requests? + if (prev_nav_window) + IMGUI_DEBUG_LOG_FOCUS("[focus] NavRestoreLayer: from \"%s\" to SetNavWindow(\"%s\")\n", prev_nav_window->Name, g.NavWindow->Name); + } ImGuiWindow* window = g.NavWindow; if (window->NavLastIds[layer] != 0) { @@ -9477,7 +11079,8 @@ void ImGui::NavInitWindow(ImGuiWindow* window, bool force_reinit) if (window->Flags & ImGuiWindowFlags_NoNavInputs) { - g.NavId = g.NavFocusScopeId = 0; + g.NavId = 0; + g.NavFocusScopeId = window->NavRootFocusScopeId; return; } @@ -9487,7 +11090,7 @@ void ImGui::NavInitWindow(ImGuiWindow* window, bool force_reinit) IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from NavInitWindow(), init_for_nav=%d, window=\"%s\", layer=%d\n", init_for_nav, window->Name, g.NavLayer); if (init_for_nav) { - SetNavID(0, g.NavLayer, 0, ImRect()); + SetNavID(0, g.NavLayer, window->NavRootFocusScopeId, ImRect()); g.NavInitRequest = true; g.NavInitRequestFromMove = false; g.NavInitResultId = 0; @@ -9497,7 +11100,7 @@ void ImGui::NavInitWindow(ImGuiWindow* window, bool force_reinit) else { g.NavId = window->NavLastIds[0]; - g.NavFocusScopeId = 0; + g.NavFocusScopeId = window->NavRootFocusScopeId; } } @@ -9508,9 +11111,10 @@ static ImVec2 ImGui::NavCalcPreferredRefPos() if (g.NavDisableHighlight || !g.NavDisableMouseHover || !window) { // Mouse (we need a fallback in case the mouse becomes invalid after being used) - if (IsMousePosValid(&g.IO.MousePos)) - return g.IO.MousePos; - return g.MouseLastValidPos; + // The +1.0f offset when stored by OpenPopupEx() allows reopening this or another popup (same or another mouse button) while not moving the mouse, it is pretty standard. + // In theory we could move that +1.0f offset in OpenPopupEx() + ImVec2 p = IsMousePosValid(&g.IO.MousePos) ? g.IO.MousePos : g.MouseLastValidPos; + return ImVec2(p.x + 1.0f, p.y); } else { @@ -9528,44 +11132,27 @@ static ImVec2 ImGui::NavCalcPreferredRefPos() } } -float ImGui::GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode) +float ImGui::GetNavTweakPressedAmount(ImGuiAxis axis) { ImGuiContext& g = *GImGui; - if (mode == ImGuiInputReadMode_Down) - return g.IO.NavInputs[n]; // Instant, read analog input (0.0f..1.0f, as provided by user) + float repeat_delay, repeat_rate; + GetTypematicRepeatRate(ImGuiInputFlags_RepeatRateNavTweak, &repeat_delay, &repeat_rate); - const float t = g.IO.NavInputsDownDuration[n]; - if (t < 0.0f && mode == ImGuiInputReadMode_Released) // Return 1.0f when just released, no repeat, ignore analog input. - return (g.IO.NavInputsDownDurationPrev[n] >= 0.0f ? 1.0f : 0.0f); - if (t < 0.0f) - return 0.0f; - if (mode == ImGuiInputReadMode_Pressed) // Return 1.0f when just pressed, no repeat, ignore analog input. - return (t == 0.0f) ? 1.0f : 0.0f; - if (mode == ImGuiInputReadMode_Repeat) - return (float)CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay * 0.72f, g.IO.KeyRepeatRate * 0.80f); - if (mode == ImGuiInputReadMode_RepeatSlow) - return (float)CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay * 1.25f, g.IO.KeyRepeatRate * 2.00f); - if (mode == ImGuiInputReadMode_RepeatFast) - return (float)CalcTypematicRepeatAmount(t - g.IO.DeltaTime, t, g.IO.KeyRepeatDelay * 0.72f, g.IO.KeyRepeatRate * 0.30f); - return 0.0f; -} - -ImVec2 ImGui::GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor, float fast_factor) -{ - ImVec2 delta(0.0f, 0.0f); - if (dir_sources & ImGuiNavDirSourceFlags_RawKeyboard) - delta += ImVec2((float)IsKeyDown(GetKeyIndex(ImGuiKey_RightArrow)) - (float)IsKeyDown(GetKeyIndex(ImGuiKey_LeftArrow)), (float)IsKeyDown(GetKeyIndex(ImGuiKey_DownArrow)) - (float)IsKeyDown(GetKeyIndex(ImGuiKey_UpArrow))); - if (dir_sources & ImGuiNavDirSourceFlags_Keyboard) - delta += ImVec2(GetNavInputAmount(ImGuiNavInput_KeyRight_, mode) - GetNavInputAmount(ImGuiNavInput_KeyLeft_, mode), GetNavInputAmount(ImGuiNavInput_KeyDown_, mode) - GetNavInputAmount(ImGuiNavInput_KeyUp_, mode)); - if (dir_sources & ImGuiNavDirSourceFlags_PadDPad) - delta += ImVec2(GetNavInputAmount(ImGuiNavInput_DpadRight, mode) - GetNavInputAmount(ImGuiNavInput_DpadLeft, mode), GetNavInputAmount(ImGuiNavInput_DpadDown, mode) - GetNavInputAmount(ImGuiNavInput_DpadUp, mode)); - if (dir_sources & ImGuiNavDirSourceFlags_PadLStick) - delta += ImVec2(GetNavInputAmount(ImGuiNavInput_LStickRight, mode) - GetNavInputAmount(ImGuiNavInput_LStickLeft, mode), GetNavInputAmount(ImGuiNavInput_LStickDown, mode) - GetNavInputAmount(ImGuiNavInput_LStickUp, mode)); - if (slow_factor != 0.0f && IsNavInputDown(ImGuiNavInput_TweakSlow)) - delta *= slow_factor; - if (fast_factor != 0.0f && IsNavInputDown(ImGuiNavInput_TweakFast)) - delta *= fast_factor; - return delta; + ImGuiKey key_less, key_more; + if (g.NavInputSource == ImGuiInputSource_Gamepad) + { + key_less = (axis == ImGuiAxis_X) ? ImGuiKey_GamepadDpadLeft : ImGuiKey_GamepadDpadUp; + key_more = (axis == ImGuiAxis_X) ? ImGuiKey_GamepadDpadRight : ImGuiKey_GamepadDpadDown; + } + else + { + key_less = (axis == ImGuiAxis_X) ? ImGuiKey_LeftArrow : ImGuiKey_UpArrow; + key_more = (axis == ImGuiAxis_X) ? ImGuiKey_RightArrow : ImGuiKey_DownArrow; + } + float amount = (float)GetKeyPressedAmount(key_more, repeat_delay, repeat_rate) - (float)GetKeyPressedAmount(key_less, repeat_delay, repeat_rate); + if (amount != 0.0f && IsKeyDown(key_less) && IsKeyDown(key_more)) // Cancel when opposite directions are held, regardless of repeat phase + amount = 0.0f; + return amount; } static void ImGui::NavUpdate() @@ -9574,39 +11161,22 @@ static void ImGui::NavUpdate() ImGuiIO& io = g.IO; io.WantSetMousePos = false; - //if (g.NavScoringDebugCount > 0) IMGUI_DEBUG_LOG("NavScoringDebugCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.NavScoringDebugCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest); + //if (g.NavScoringDebugCount > 0) IMGUI_DEBUG_LOG_NAV("[nav] NavScoringDebugCount %d for '%s' layer %d (Init:%d, Move:%d)\n", g.NavScoringDebugCount, g.NavWindow ? g.NavWindow->Name : "NULL", g.NavLayer, g.NavInitRequest || g.NavInitResultId != 0, g.NavMoveRequest); - // Set input source as Gamepad when buttons are pressed (as some features differs when used with Gamepad vs Keyboard) - // (do it before we map Keyboard input!) - const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; + // Set input source based on which keys are last pressed (as some features differs when used with Gamepad vs Keyboard) + // FIXME-NAV: Now that keys are separated maybe we can get rid of NavInputSource? const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; - if (nav_gamepad_active && g.NavInputSource != ImGuiInputSource_Gamepad) - { - if (io.NavInputs[ImGuiNavInput_Activate] > 0.0f || io.NavInputs[ImGuiNavInput_Input] > 0.0f || io.NavInputs[ImGuiNavInput_Cancel] > 0.0f || io.NavInputs[ImGuiNavInput_Menu] > 0.0f - || io.NavInputs[ImGuiNavInput_DpadLeft] > 0.0f || io.NavInputs[ImGuiNavInput_DpadRight] > 0.0f || io.NavInputs[ImGuiNavInput_DpadUp] > 0.0f || io.NavInputs[ImGuiNavInput_DpadDown] > 0.0f) - g.NavInputSource = ImGuiInputSource_Gamepad; - } - - // Update Keyboard->Nav inputs mapping + const ImGuiKey nav_gamepad_keys_to_change_source[] = { ImGuiKey_GamepadFaceRight, ImGuiKey_GamepadFaceLeft, ImGuiKey_GamepadFaceUp, ImGuiKey_GamepadFaceDown, ImGuiKey_GamepadDpadRight, ImGuiKey_GamepadDpadLeft, ImGuiKey_GamepadDpadUp, ImGuiKey_GamepadDpadDown }; + if (nav_gamepad_active) + for (ImGuiKey key : nav_gamepad_keys_to_change_source) + if (IsKeyDown(key)) + g.NavInputSource = ImGuiInputSource_Gamepad; + const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; + const ImGuiKey nav_keyboard_keys_to_change_source[] = { ImGuiKey_Space, ImGuiKey_Enter, ImGuiKey_Escape, ImGuiKey_RightArrow, ImGuiKey_LeftArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow }; if (nav_keyboard_active) - { - #define NAV_MAP_KEY(_KEY, _NAV_INPUT) do { if (IsKeyDown(io.KeyMap[_KEY])) { io.NavInputs[_NAV_INPUT] = 1.0f; g.NavInputSource = ImGuiInputSource_Keyboard; } } while (0) - NAV_MAP_KEY(ImGuiKey_Space, ImGuiNavInput_Activate ); - NAV_MAP_KEY(ImGuiKey_Enter, ImGuiNavInput_Input ); - NAV_MAP_KEY(ImGuiKey_Escape, ImGuiNavInput_Cancel ); - NAV_MAP_KEY(ImGuiKey_LeftArrow, ImGuiNavInput_KeyLeft_ ); - NAV_MAP_KEY(ImGuiKey_RightArrow,ImGuiNavInput_KeyRight_); - NAV_MAP_KEY(ImGuiKey_UpArrow, ImGuiNavInput_KeyUp_ ); - NAV_MAP_KEY(ImGuiKey_DownArrow, ImGuiNavInput_KeyDown_ ); - if (io.KeyCtrl) - io.NavInputs[ImGuiNavInput_TweakSlow] = 1.0f; - if (io.KeyShift) - io.NavInputs[ImGuiNavInput_TweakFast] = 1.0f; - #undef NAV_MAP_KEY - } - memcpy(io.NavInputsDownDurationPrev, io.NavInputsDownDuration, sizeof(io.NavInputsDownDuration)); - for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) - io.NavInputsDownDuration[i] = (io.NavInputs[i] > 0.0f) ? (io.NavInputsDownDuration[i] < 0.0f ? 0.0f : io.NavInputsDownDuration[i] + io.DeltaTime) : -1.0f; + for (ImGuiKey key : nav_keyboard_keys_to_change_source) + if (IsKeyDown(key)) + g.NavInputSource = ImGuiInputSource_Keyboard; // Process navigation init request (select first/default focus) if (g.NavInitResultId != 0) @@ -9647,14 +11217,14 @@ static void ImGui::NavUpdate() NavUpdateCancelRequest(); // Process manual activation request - g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavActivateInputId = 0; + g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = 0; g.NavActivateFlags = ImGuiActivateFlags_None; if (g.NavId != 0 && !g.NavDisableHighlight && !g.NavWindowingTarget && g.NavWindow && !(g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs)) { - bool activate_down = IsNavInputDown(ImGuiNavInput_Activate); - bool input_down = IsNavInputDown(ImGuiNavInput_Input); - bool activate_pressed = activate_down && IsNavInputTest(ImGuiNavInput_Activate, ImGuiInputReadMode_Pressed); - bool input_pressed = input_down && IsNavInputTest(ImGuiNavInput_Input, ImGuiInputReadMode_Pressed); + const bool activate_down = (nav_keyboard_active && IsKeyDown(ImGuiKey_Space)) || (nav_gamepad_active && IsKeyDown(ImGuiKey_NavGamepadActivate)); + const bool activate_pressed = activate_down && ((nav_keyboard_active && IsKeyPressed(ImGuiKey_Space, false)) || (nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadActivate, false))); + const bool input_down = (nav_keyboard_active && IsKeyDown(ImGuiKey_Enter)) || (nav_gamepad_active && IsKeyDown(ImGuiKey_NavGamepadInput)); + const bool input_pressed = input_down && ((nav_keyboard_active && IsKeyPressed(ImGuiKey_Enter, false)) || (nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadInput, false))); if (g.ActiveId == 0 && activate_pressed) { g.NavActivateId = g.NavId; @@ -9662,12 +11232,12 @@ static void ImGui::NavUpdate() } if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && input_pressed) { - g.NavActivateInputId = g.NavId; + g.NavActivateId = g.NavId; g.NavActivateFlags = ImGuiActivateFlags_PreferInput; } - if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_down) + if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && (activate_down || input_down)) g.NavActivateDownId = g.NavId; - if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && activate_pressed) + if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && (activate_pressed || input_pressed)) g.NavActivatePressedId = g.NavId; } if (g.NavWindow && (g.NavWindow->Flags & ImGuiWindowFlags_NoNavInputs)) @@ -9679,10 +11249,7 @@ static void ImGui::NavUpdate() // FIXME-NAV: Those should eventually be queued (unlike focus they don't cancel each others) if (g.NavNextActivateId != 0) { - if (g.NavNextActivateFlags & ImGuiActivateFlags_PreferInput) - g.NavActivateInputId = g.NavNextActivateId; - else - g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavNextActivateId; + g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = g.NavNextActivateId; g.NavActivateFlags = g.NavNextActivateFlags; } g.NavNextActivateId = 0; @@ -9709,13 +11276,17 @@ static void ImGui::NavUpdate() SetScrollY(window, ImFloor(window->Scroll.y + ((move_dir == ImGuiDir_Up) ? -1.0f : +1.0f) * scroll_speed)); } - // *Normal* Manual scroll with NavScrollXXX keys + // *Normal* Manual scroll with LStick // Next movement request will clamp the NavId reference rectangle to the visible area, so navigation will resume within those bounds. - ImVec2 scroll_dir = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadLStick, ImGuiInputReadMode_Down, 1.0f / 10.0f, 10.0f); - if (scroll_dir.x != 0.0f && window->ScrollbarX) - SetScrollX(window, ImFloor(window->Scroll.x + scroll_dir.x * scroll_speed)); - if (scroll_dir.y != 0.0f) - SetScrollY(window, ImFloor(window->Scroll.y + scroll_dir.y * scroll_speed)); + if (nav_gamepad_active) + { + const ImVec2 scroll_dir = GetKeyMagnitude2d(ImGuiKey_GamepadLStickLeft, ImGuiKey_GamepadLStickRight, ImGuiKey_GamepadLStickUp, ImGuiKey_GamepadLStickDown); + const float tweak_factor = IsKeyDown(ImGuiKey_NavGamepadTweakSlow) ? 1.0f / 10.0f : IsKeyDown(ImGuiKey_NavGamepadTweakFast) ? 10.0f : 1.0f; + if (scroll_dir.x != 0.0f && window->ScrollbarX) + SetScrollX(window, ImFloor(window->Scroll.x + scroll_dir.x * scroll_speed * tweak_factor)); + if (scroll_dir.y != 0.0f) + SetScrollY(window, ImFloor(window->Scroll.y + scroll_dir.y * scroll_speed * tweak_factor)); + } } // Always prioritize mouse highlight if navigation is disabled @@ -9731,7 +11302,7 @@ static void ImGui::NavUpdate() { io.MousePos = io.MousePosPrev = NavCalcPreferredRefPos(); io.WantSetMousePos = true; - //IMGUI_DEBUG_LOG("SetMousePos: (%.1f,%.1f)\n", io.MousePos.x, io.MousePos.y); + //IMGUI_DEBUG_LOG_IO("SetMousePos: (%.1f,%.1f)\n", io.MousePos.x, io.MousePos.y); } // [DEBUG] @@ -9755,7 +11326,7 @@ void ImGui::NavInitRequestApplyResult() // Apply result from previous navigation init request (will typically select the first item, unless SetItemDefaultFocus() has been called) // FIXME-NAV: On _NavFlattened windows, g.NavWindow will only be updated during subsequent frame. Not a problem currently. - IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: result NavID 0x%08X in Layer %d Window \"%s\"\n", g.NavInitResultId, g.NavLayer, g.NavWindow->Name); + IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: ApplyResult: NavID 0x%08X in Layer %d Window \"%s\"\n", g.NavInitResultId, g.NavLayer, g.NavWindow->Name); SetNavID(g.NavInitResultId, g.NavLayer, 0, g.NavInitResultRectRel); g.NavIdIsAlive = true; // Mark as alive from previous frame as we got a result if (g.NavInitRequestFromMove) @@ -9767,6 +11338,8 @@ void ImGui::NavUpdateCreateMoveRequest() ImGuiContext& g = *GImGui; ImGuiIO& io = g.IO; ImGuiWindow* window = g.NavWindow; + const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; + const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; if (g.NavMoveForwardToNextFrame && window != NULL) { @@ -9784,11 +11357,11 @@ void ImGui::NavUpdateCreateMoveRequest() g.NavMoveScrollFlags = ImGuiScrollFlags_None; if (window && !g.NavWindowingTarget && !(window->Flags & ImGuiWindowFlags_NoNavInputs)) { - const ImGuiInputReadMode read_mode = ImGuiInputReadMode_Repeat; - if (!IsActiveIdUsingNavDir(ImGuiDir_Left) && (IsNavInputTest(ImGuiNavInput_DpadLeft, read_mode) || IsNavInputTest(ImGuiNavInput_KeyLeft_, read_mode))) { g.NavMoveDir = ImGuiDir_Left; } - if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && (IsNavInputTest(ImGuiNavInput_DpadRight, read_mode) || IsNavInputTest(ImGuiNavInput_KeyRight_, read_mode))) { g.NavMoveDir = ImGuiDir_Right; } - if (!IsActiveIdUsingNavDir(ImGuiDir_Up) && (IsNavInputTest(ImGuiNavInput_DpadUp, read_mode) || IsNavInputTest(ImGuiNavInput_KeyUp_, read_mode))) { g.NavMoveDir = ImGuiDir_Up; } - if (!IsActiveIdUsingNavDir(ImGuiDir_Down) && (IsNavInputTest(ImGuiNavInput_DpadDown, read_mode) || IsNavInputTest(ImGuiNavInput_KeyDown_, read_mode))) { g.NavMoveDir = ImGuiDir_Down; } + const ImGuiInputFlags repeat_mode = ImGuiInputFlags_Repeat | (ImGuiInputFlags)ImGuiInputFlags_RepeatRateNavMove; + if (!IsActiveIdUsingNavDir(ImGuiDir_Left) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadLeft, ImGuiKeyOwner_None, repeat_mode)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_LeftArrow, ImGuiKeyOwner_None, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Left; } + if (!IsActiveIdUsingNavDir(ImGuiDir_Right) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadRight, ImGuiKeyOwner_None, repeat_mode)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_RightArrow, ImGuiKeyOwner_None, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Right; } + if (!IsActiveIdUsingNavDir(ImGuiDir_Up) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadUp, ImGuiKeyOwner_None, repeat_mode)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_UpArrow, ImGuiKeyOwner_None, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Up; } + if (!IsActiveIdUsingNavDir(ImGuiDir_Down) && ((nav_gamepad_active && IsKeyPressed(ImGuiKey_GamepadDpadDown, ImGuiKeyOwner_None, repeat_mode)) || (nav_keyboard_active && IsKeyPressed(ImGuiKey_DownArrow, ImGuiKeyOwner_None, repeat_mode)))) { g.NavMoveDir = ImGuiDir_Down; } } g.NavMoveClipDir = g.NavMoveDir; g.NavScoringNoClipRect = ImRect(+FLT_MAX, +FLT_MAX, -FLT_MAX, -FLT_MAX); @@ -9796,7 +11369,6 @@ void ImGui::NavUpdateCreateMoveRequest() // Update PageUp/PageDown/Home/End scroll // FIXME-NAV: Consider enabling those keys even without the master ImGuiConfigFlags_NavEnableKeyboard flag? - const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; float scoring_rect_offset_y = 0.0f; if (window && g.NavMoveDir == ImGuiDir_None && nav_keyboard_active) scoring_rect_offset_y = NavUpdatePageUpPageDown(); @@ -9808,7 +11380,7 @@ void ImGui::NavUpdateCreateMoveRequest() // [DEBUG] Always send a request #if IMGUI_DEBUG_NAV_SCORING - if (io.KeyCtrl && IsKeyPressedMap(ImGuiKey_C)) + if (io.KeyCtrl && IsKeyPressed(ImGuiKey_C)) g.NavMoveDirForDebug = (ImGuiDir)((g.NavMoveDirForDebug + 1) & 3); if (io.KeyCtrl && g.NavMoveDir == ImGuiDir_None) { @@ -9822,28 +11394,39 @@ void ImGui::NavUpdateCreateMoveRequest() if (g.NavMoveDir != ImGuiDir_None) NavMoveRequestSubmit(g.NavMoveDir, g.NavMoveClipDir, g.NavMoveFlags, g.NavMoveScrollFlags); - // Moving with no reference triggers a init request (will be used as a fallback if the direction fails to find a match) + // Moving with no reference triggers an init request (will be used as a fallback if the direction fails to find a match) if (g.NavMoveSubmitted && g.NavId == 0) { - IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n", g.NavWindow->Name, g.NavLayer); + IMGUI_DEBUG_LOG_NAV("[nav] NavInitRequest: from move, window \"%s\", layer=%d\n", window ? window->Name : "", g.NavLayer); g.NavInitRequest = g.NavInitRequestFromMove = true; g.NavInitResultId = 0; g.NavDisableHighlight = false; } // When using gamepad, we project the reference nav bounding box into window visible area. - // This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, since with gamepad every movements are relative - // (can't focus a visible object like we can with the mouse). - if (g.NavMoveSubmitted && g.NavInputSource == ImGuiInputSource_Gamepad && g.NavLayer == ImGuiNavLayer_Main && window != NULL) + // This is to allow resuming navigation inside the visible area after doing a large amount of scrolling, + // since with gamepad all movements are relative (can't focus a visible object like we can with the mouse). + if (g.NavMoveSubmitted && g.NavInputSource == ImGuiInputSource_Gamepad && g.NavLayer == ImGuiNavLayer_Main && window != NULL)// && (g.NavMoveFlags & ImGuiNavMoveFlags_Forwarded)) { - ImRect window_rect_rel = WindowRectAbsToRel(window, ImRect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1))); - if (!window_rect_rel.Contains(window->NavRectRel[g.NavLayer])) + bool clamp_x = (g.NavMoveFlags & (ImGuiNavMoveFlags_LoopX | ImGuiNavMoveFlags_WrapX)) == 0; + bool clamp_y = (g.NavMoveFlags & (ImGuiNavMoveFlags_LoopY | ImGuiNavMoveFlags_WrapY)) == 0; + ImRect inner_rect_rel = WindowRectAbsToRel(window, ImRect(window->InnerRect.Min - ImVec2(1, 1), window->InnerRect.Max + ImVec2(1, 1))); + + // Take account of changing scroll to handle triggering a new move request on a scrolling frame. (#6171) + // Otherwise 'inner_rect_rel' would be off on the move result frame. + inner_rect_rel.Translate(CalcNextScrollFromScrollTargetAndClamp(window) - window->Scroll); + + if ((clamp_x || clamp_y) && !inner_rect_rel.Contains(window->NavRectRel[g.NavLayer])) { - IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequest: clamp NavRectRel\n"); - float pad = window->CalcFontSize() * 0.5f; - window_rect_rel.Expand(ImVec2(-ImMin(window_rect_rel.GetWidth(), pad), -ImMin(window_rect_rel.GetHeight(), pad))); // Terrible approximation for the intent of starting navigation from first fully visible item - window->NavRectRel[g.NavLayer].ClipWithFull(window_rect_rel); - g.NavId = g.NavFocusScopeId = 0; + IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequest: clamp NavRectRel for gamepad move\n"); + float pad_x = ImMin(inner_rect_rel.GetWidth(), window->CalcFontSize() * 0.5f); + float pad_y = ImMin(inner_rect_rel.GetHeight(), window->CalcFontSize() * 0.5f); // Terrible approximation for the intent of starting navigation from first fully visible item + inner_rect_rel.Min.x = clamp_x ? (inner_rect_rel.Min.x + pad_x) : -FLT_MAX; + inner_rect_rel.Max.x = clamp_x ? (inner_rect_rel.Max.x - pad_x) : +FLT_MAX; + inner_rect_rel.Min.y = clamp_y ? (inner_rect_rel.Min.y + pad_y) : -FLT_MAX; + inner_rect_rel.Max.y = clamp_y ? (inner_rect_rel.Max.y - pad_y) : +FLT_MAX; + window->NavRectRel[g.NavLayer].ClipWithFull(inner_rect_rel); + g.NavId = 0; } } @@ -9856,7 +11439,7 @@ void ImGui::NavUpdateCreateMoveRequest() scoring_rect.TranslateY(scoring_rect_offset_y); scoring_rect.Min.x = ImMin(scoring_rect.Min.x + 1.0f, scoring_rect.Max.x); scoring_rect.Max.x = scoring_rect.Min.x; - IM_ASSERT(!scoring_rect.IsInverted()); // Ensure if we have a finite, non-inverted bounding box here will allows us to remove extraneous ImFabs() calls in NavScoreItem(). + IM_ASSERT(!scoring_rect.IsInverted()); // Ensure if we have a finite, non-inverted bounding box here will allow us to remove extraneous ImFabs() calls in NavScoreItem(). //GetForegroundDrawList()->AddRect(scoring_rect.Min, scoring_rect.Max, IM_COL32(255,200,0,255)); // [DEBUG] //if (!g.NavScoringNoClipRect.IsInverted()) { GetForegroundDrawList()->AddRect(g.NavScoringNoClipRect.Min, g.NavScoringNoClipRect.Max, IM_COL32(255, 200, 0, 255)); } // [DEBUG] } @@ -9872,7 +11455,7 @@ void ImGui::NavUpdateCreateTabbingRequest() if (window == NULL || g.NavWindowingTarget != NULL || (window->Flags & ImGuiWindowFlags_NoNavInputs)) return; - const bool tab_pressed = IsKeyPressedMap(ImGuiKey_Tab, true) && !IsActiveIdUsingKey(ImGuiKey_Tab) && !g.IO.KeyCtrl && !g.IO.KeyAlt; + const bool tab_pressed = IsKeyPressed(ImGuiKey_Tab, ImGuiKeyOwner_None, ImGuiInputFlags_Repeat) && !g.IO.KeyCtrl && !g.IO.KeyAlt; if (!tab_pressed) return; @@ -9880,12 +11463,14 @@ void ImGui::NavUpdateCreateTabbingRequest() // (this is ALWAYS ENABLED, regardless of ImGuiConfigFlags_NavEnableKeyboard flag!) // Initially this was designed to use counters and modulo arithmetic, but that could not work with unsubmitted items (list clipper). Instead we use a strategy close to other move requests. // See NavProcessItemForTabbingRequest() for a description of the various forward/backward tabbing cases with and without wrapping. - //// FIXME: We use (g.ActiveId == 0) but (g.NavDisableHighlight == false) might be righter once we can tab through anything - g.NavTabbingDir = g.IO.KeyShift ? -1 : (g.ActiveId == 0) ? 0 : +1; + const bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; + if (nav_keyboard_active) + g.NavTabbingDir = g.IO.KeyShift ? -1 : (g.NavDisableHighlight == true && g.ActiveId == 0) ? 0 : +1; + else + g.NavTabbingDir = g.IO.KeyShift ? -1 : (g.ActiveId == 0) ? 0 : +1; ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY; ImGuiDir clip_dir = (g.NavTabbingDir < 0) ? ImGuiDir_Up : ImGuiDir_Down; NavMoveRequestSubmit(ImGuiDir_None, clip_dir, ImGuiNavMoveFlags_Tabbing, scroll_flags); // FIXME-NAV: Once we refactor tabbing, add LegacyApi flag to not activate non-inputable. - g.NavTabbingResultFirst.Clear(); g.NavTabbingCounter = -1; } @@ -9902,11 +11487,11 @@ void ImGui::NavMoveRequestApplyResult() ImGuiNavItemData* result = (g.NavMoveResultLocal.ID != 0) ? &g.NavMoveResultLocal : (g.NavMoveResultOther.ID != 0) ? &g.NavMoveResultOther : NULL; // Tabbing forward wrap - if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) + if ((g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) && result == NULL) if ((g.NavTabbingCounter == 1 || g.NavTabbingDir == 0) && g.NavTabbingResultFirst.ID) result = &g.NavTabbingResultFirst; - // In a situation when there is no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result) + // In a situation when there are no results but NavId != 0, re-enable the Navigation highlight (because g.NavId is not considered as a possible result) if (result == NULL) { if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing) @@ -9930,20 +11515,22 @@ void ImGui::NavMoveRequestApplyResult() // Scroll to keep newly navigated item fully into view. if (g.NavLayer == ImGuiNavLayer_Main) { + ImRect rect_abs = WindowRectRelToAbs(result->Window, result->RectRel); + ScrollToRectEx(result->Window, rect_abs, g.NavMoveScrollFlags); + if (g.NavMoveFlags & ImGuiNavMoveFlags_ScrollToEdgeY) { - // FIXME: Should remove this + // FIXME: Should remove this? Or make more precise: use ScrollToRectEx() with edge? float scroll_target = (g.NavMoveDir == ImGuiDir_Up) ? result->Window->ScrollMax.y : 0.0f; SetScrollY(result->Window, scroll_target); } - else - { - ImRect rect_abs = WindowRectRelToAbs(result->Window, result->RectRel); - ScrollToRectEx(result->Window, rect_abs, g.NavMoveScrollFlags); - } } - g.NavWindow = result->Window; + if (g.NavWindow != result->Window) + { + IMGUI_DEBUG_LOG_FOCUS("[focus] NavMoveRequest: SetNavWindow(\"%s\")\n", result->Window->Name); + g.NavWindow = result->Window; + } if (g.ActiveId != result->ID) ClearActiveID(); if (g.NavId != result->ID) @@ -9985,14 +11572,15 @@ void ImGui::NavMoveRequestApplyResult() static void ImGui::NavUpdateCancelRequest() { ImGuiContext& g = *GImGui; - if (!IsNavInputTest(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed)) + const bool nav_gamepad_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (g.IO.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; + const bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; + if (!(nav_keyboard_active && IsKeyPressed(ImGuiKey_Escape, ImGuiKeyOwner_None)) && !(nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadCancel, ImGuiKeyOwner_None))) return; - IMGUI_DEBUG_LOG_NAV("[nav] ImGuiNavInput_Cancel\n"); + IMGUI_DEBUG_LOG_NAV("[nav] NavUpdateCancelRequest()\n"); if (g.ActiveId != 0) { - if (!IsActiveIdUsingNavInput(ImGuiNavInput_Cancel)) - ClearActiveID(); + ClearActiveID(); } else if (g.NavLayer != ImGuiNavLayer_Main) { @@ -10011,18 +11599,17 @@ static void ImGui::NavUpdateCancelRequest() SetNavID(child_window->ChildId, ImGuiNavLayer_Main, 0, WindowRectAbsToRel(parent_window, child_rect)); NavRestoreHighlightAfterMove(); } - else if (g.OpenPopupStack.Size > 0) + else if (g.OpenPopupStack.Size > 0 && g.OpenPopupStack.back().Window != NULL && !(g.OpenPopupStack.back().Window->Flags & ImGuiWindowFlags_Modal)) { // Close open popup/menu - if (!(g.OpenPopupStack.back().Window->Flags & ImGuiWindowFlags_Modal)) - ClosePopupToLevel(g.OpenPopupStack.Size - 1, true); + ClosePopupToLevel(g.OpenPopupStack.Size - 1, true); } else { // Clear NavLastId for popups but keep it for regular child window so we can leave one and come back where we were if (g.NavWindow && ((g.NavWindow->Flags & ImGuiWindowFlags_Popup) || !(g.NavWindow->Flags & ImGuiWindowFlags_ChildWindow))) g.NavWindow->NavLastIds[0] = 0; - g.NavId = g.NavFocusScopeId = 0; + g.NavId = 0; } } @@ -10033,16 +11620,14 @@ static void ImGui::NavUpdateCancelRequest() static float ImGui::NavUpdatePageUpPageDown() { ImGuiContext& g = *GImGui; - ImGuiIO& io = g.IO; - ImGuiWindow* window = g.NavWindow; if ((window->Flags & ImGuiWindowFlags_NoNavInputs) || g.NavWindowingTarget != NULL) return 0.0f; - const bool page_up_held = IsKeyDown(io.KeyMap[ImGuiKey_PageUp]) && !IsActiveIdUsingKey(ImGuiKey_PageUp); - const bool page_down_held = IsKeyDown(io.KeyMap[ImGuiKey_PageDown]) && !IsActiveIdUsingKey(ImGuiKey_PageDown); - const bool home_pressed = IsKeyPressed(io.KeyMap[ImGuiKey_Home]) && !IsActiveIdUsingKey(ImGuiKey_Home); - const bool end_pressed = IsKeyPressed(io.KeyMap[ImGuiKey_End]) && !IsActiveIdUsingKey(ImGuiKey_End); + const bool page_up_held = IsKeyDown(ImGuiKey_PageUp, ImGuiKeyOwner_None); + const bool page_down_held = IsKeyDown(ImGuiKey_PageDown, ImGuiKeyOwner_None); + const bool home_pressed = IsKeyPressed(ImGuiKey_Home, ImGuiKeyOwner_None, ImGuiInputFlags_Repeat); + const bool end_pressed = IsKeyPressed(ImGuiKey_End, ImGuiKeyOwner_None, ImGuiInputFlags_Repeat); if (page_up_held == page_down_held && home_pressed == end_pressed) // Proceed if either (not both) are pressed, otherwise early out return 0.0f; @@ -10052,9 +11637,9 @@ static float ImGui::NavUpdatePageUpPageDown() if (window->DC.NavLayersActiveMask == 0x00 && window->DC.NavHasScroll) { // Fallback manual-scroll when window has no navigable item - if (IsKeyPressed(io.KeyMap[ImGuiKey_PageUp], true)) + if (IsKeyPressed(ImGuiKey_PageUp, ImGuiKeyOwner_None, ImGuiInputFlags_Repeat)) SetScrollY(window, window->Scroll.y - window->InnerRect.GetHeight()); - else if (IsKeyPressed(io.KeyMap[ImGuiKey_PageDown], true)) + else if (IsKeyPressed(ImGuiKey_PageDown, ImGuiKeyOwner_None, ImGuiInputFlags_Repeat)) SetScrollY(window, window->Scroll.y + window->InnerRect.GetHeight()); else if (home_pressed) SetScrollY(window, 0.0f); @@ -10066,14 +11651,14 @@ static float ImGui::NavUpdatePageUpPageDown() ImRect& nav_rect_rel = window->NavRectRel[g.NavLayer]; const float page_offset_y = ImMax(0.0f, window->InnerRect.GetHeight() - window->CalcFontSize() * 1.0f + nav_rect_rel.GetHeight()); float nav_scoring_rect_offset_y = 0.0f; - if (IsKeyPressed(io.KeyMap[ImGuiKey_PageUp], true)) + if (IsKeyPressed(ImGuiKey_PageUp, true)) { nav_scoring_rect_offset_y = -page_offset_y; g.NavMoveDir = ImGuiDir_Down; // Because our scoring rect is offset up, we request the down direction (so we can always land on the last item) g.NavMoveClipDir = ImGuiDir_Up; g.NavMoveFlags = ImGuiNavMoveFlags_AllowCurrentNavId | ImGuiNavMoveFlags_AlsoScoreVisibleSet; } - else if (IsKeyPressed(io.KeyMap[ImGuiKey_PageDown], true)) + else if (IsKeyPressed(ImGuiKey_PageDown, true)) { nav_scoring_rect_offset_y = +page_offset_y; g.NavMoveDir = ImGuiDir_Up; // Because our scoring rect is offset down, we request the up direction (so we can always land on the last item) @@ -10208,7 +11793,10 @@ static void NavUpdateWindowingHighlightWindow(int focus_change_dir) if (!window_target) window_target = FindWindowNavFocusable((focus_change_dir < 0) ? (g.WindowsFocusOrder.Size - 1) : 0, i_current, focus_change_dir); if (window_target) // Don't reset windowing target if there's a single window in the list + { g.NavWindowingTarget = g.NavWindowingTargetAnim = window_target; + g.NavWindowingAccumDeltaPos = g.NavWindowingAccumDeltaSize = ImVec2(0.0f, 0.0f); + } g.NavWindowingToggleLayer = false; } @@ -10237,15 +11825,25 @@ static void ImGui::NavUpdateWindowing() } // Start CTRL+Tab or Square+L/R window selection - const bool start_windowing_with_gamepad = allow_windowing && !g.NavWindowingTarget && IsNavInputTest(ImGuiNavInput_Menu, ImGuiInputReadMode_Pressed); - const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && io.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab); + const ImGuiID owner_id = ImHashStr("###NavUpdateWindowing"); + const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; + const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; + const bool keyboard_next_window = allow_windowing && g.ConfigNavWindowingKeyNext && Shortcut(g.ConfigNavWindowingKeyNext, owner_id, ImGuiInputFlags_Repeat | ImGuiInputFlags_RouteAlways); + const bool keyboard_prev_window = allow_windowing && g.ConfigNavWindowingKeyPrev && Shortcut(g.ConfigNavWindowingKeyPrev, owner_id, ImGuiInputFlags_Repeat | ImGuiInputFlags_RouteAlways); + const bool start_windowing_with_gamepad = allow_windowing && nav_gamepad_active && !g.NavWindowingTarget && IsKeyPressed(ImGuiKey_NavGamepadMenu, 0, ImGuiInputFlags_None); + const bool start_windowing_with_keyboard = allow_windowing && !g.NavWindowingTarget && (keyboard_next_window || keyboard_prev_window); // Note: enabled even without NavEnableKeyboard! if (start_windowing_with_gamepad || start_windowing_with_keyboard) if (ImGuiWindow* window = g.NavWindow ? g.NavWindow : FindWindowNavFocusable(g.WindowsFocusOrder.Size - 1, -INT_MAX, -1)) { g.NavWindowingTarget = g.NavWindowingTargetAnim = window->RootWindow; g.NavWindowingTimer = g.NavWindowingHighlightAlpha = 0.0f; + g.NavWindowingAccumDeltaPos = g.NavWindowingAccumDeltaSize = ImVec2(0.0f, 0.0f); g.NavWindowingToggleLayer = start_windowing_with_gamepad ? true : false; // Gamepad starts toggling layer g.NavInputSource = start_windowing_with_keyboard ? ImGuiInputSource_Keyboard : ImGuiInputSource_Gamepad; + + // Register ownership of our mods. Using ImGuiInputFlags_RouteGlobalHigh in the Shortcut() calls instead would probably be correct but may have more side-effects. + if (keyboard_next_window || keyboard_prev_window) + SetKeyOwnersForKeyChord((g.ConfigNavWindowingKeyNext | g.ConfigNavWindowingKeyPrev) & ImGuiMod_Mask_, owner_id); } // Gamepad update @@ -10256,7 +11854,7 @@ static void ImGui::NavUpdateWindowing() g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f)); // Select window to focus - const int focus_change_dir = (int)IsNavInputTest(ImGuiNavInput_FocusPrev, ImGuiInputReadMode_RepeatSlow) - (int)IsNavInputTest(ImGuiNavInput_FocusNext, ImGuiInputReadMode_RepeatSlow); + const int focus_change_dir = (int)IsKeyPressed(ImGuiKey_GamepadL1) - (int)IsKeyPressed(ImGuiKey_GamepadR1); if (focus_change_dir != 0) { NavUpdateWindowingHighlightWindow(focus_change_dir); @@ -10264,7 +11862,7 @@ static void ImGui::NavUpdateWindowing() } // Single press toggles NavLayer, long press with L/R apply actual focus on release (until then the window was merely rendered top-most) - if (!IsNavInputDown(ImGuiNavInput_Menu)) + if (!IsKeyDown(ImGuiKey_NavGamepadMenu)) { g.NavWindowingToggleLayer &= (g.NavWindowingHighlightAlpha < 1.0f); // Once button was held long enough we don't consider it a tap-to-toggle-layer press anymore. if (g.NavWindowingToggleLayer && g.NavWindow) @@ -10279,18 +11877,19 @@ static void ImGui::NavUpdateWindowing() if (g.NavWindowingTarget && g.NavInputSource == ImGuiInputSource_Keyboard) { // Visuals only appears after a brief time after pressing TAB the first time, so that a fast CTRL+TAB doesn't add visual noise + ImGuiKeyChord shared_mods = ((g.ConfigNavWindowingKeyNext ? g.ConfigNavWindowingKeyNext : ImGuiMod_Mask_) & (g.ConfigNavWindowingKeyPrev ? g.ConfigNavWindowingKeyPrev : ImGuiMod_Mask_)) & ImGuiMod_Mask_; + IM_ASSERT(shared_mods != 0); // Next/Prev shortcut currently needs a shared modifier to "hold", otherwise Prev actions would keep cycling between two windows. g.NavWindowingHighlightAlpha = ImMax(g.NavWindowingHighlightAlpha, ImSaturate((g.NavWindowingTimer - NAV_WINDOWING_HIGHLIGHT_DELAY) / 0.05f)); // 1.0f - if (IsKeyPressedMap(ImGuiKey_Tab, true)) - NavUpdateWindowingHighlightWindow(io.KeyShift ? +1 : -1); - if (!io.KeyCtrl) + if (keyboard_next_window || keyboard_prev_window) + NavUpdateWindowingHighlightWindow(keyboard_next_window ? -1 : +1); + else if ((io.KeyMods & shared_mods) != shared_mods) apply_focus_window = g.NavWindowingTarget; } // Keyboard: Press and Release ALT to toggle menu layer // - Testing that only Alt is tested prevents Alt+Shift or AltGR from toggling menu layer. // - AltGR is normally Alt+Ctrl but we can't reliably detect it (not all backends/systems/layout emit it as Alt+Ctrl). But even on keyboards without AltGR we don't want Alt+Ctrl to open menu anyway. - const bool nav_keyboard_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0; - if (nav_keyboard_active && io.KeyMods == ImGuiKeyModFlags_Alt && (io.KeyModsPrev & ImGuiKeyModFlags_Alt) == 0) + if (nav_keyboard_active && IsKeyPressed(ImGuiMod_Alt, ImGuiKeyOwner_None)) { g.NavWindowingToggleLayer = true; g.NavInputSource = ImGuiInputSource_Keyboard; @@ -10299,36 +11898,41 @@ static void ImGui::NavUpdateWindowing() { // We cancel toggling nav layer when any text has been typed (generally while holding Alt). (See #370) // We cancel toggling nav layer when other modifiers are pressed. (See #4439) - if (io.InputQueueCharacters.Size > 0 || io.KeyCtrl || io.KeyShift || io.KeySuper) + // We cancel toggling nav layer if an owner has claimed the key. + if (io.InputQueueCharacters.Size > 0 || io.KeyCtrl || io.KeyShift || io.KeySuper || TestKeyOwner(ImGuiMod_Alt, ImGuiKeyOwner_None) == false) g.NavWindowingToggleLayer = false; // Apply layer toggle on release - // Important: we don't assume that Alt was previously held in order to handle loss of focus when backend calls io.AddFocusEvent(false) // Important: as before version <18314 we lacked an explicit IO event for focus gain/loss, we also compare mouse validity to detect old backends clearing mouse pos on focus loss. - if (!(io.KeyMods & ImGuiKeyModFlags_Alt) && (io.KeyModsPrev & ImGuiKeyModFlags_Alt) && g.NavWindowingToggleLayer) + if (IsKeyReleased(ImGuiMod_Alt) && g.NavWindowingToggleLayer) if (g.ActiveId == 0 || g.ActiveIdAllowOverlap) if (IsMousePosValid(&io.MousePos) == IsMousePosValid(&io.MousePosPrev)) apply_toggle_layer = true; - if (!io.KeyAlt) + if (!IsKeyDown(ImGuiMod_Alt)) g.NavWindowingToggleLayer = false; } // Move window if (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoMove)) { - ImVec2 move_delta; + ImVec2 nav_move_dir; if (g.NavInputSource == ImGuiInputSource_Keyboard && !io.KeyShift) - move_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_RawKeyboard, ImGuiInputReadMode_Down); + nav_move_dir = GetKeyMagnitude2d(ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_UpArrow, ImGuiKey_DownArrow); if (g.NavInputSource == ImGuiInputSource_Gamepad) - move_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_PadLStick, ImGuiInputReadMode_Down); - if (move_delta.x != 0.0f || move_delta.y != 0.0f) + nav_move_dir = GetKeyMagnitude2d(ImGuiKey_GamepadLStickLeft, ImGuiKey_GamepadLStickRight, ImGuiKey_GamepadLStickUp, ImGuiKey_GamepadLStickDown); + if (nav_move_dir.x != 0.0f || nav_move_dir.y != 0.0f) { const float NAV_MOVE_SPEED = 800.0f; - const float move_speed = ImFloor(NAV_MOVE_SPEED * io.DeltaTime * ImMin(io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y)); // FIXME: Doesn't handle variable framerate very well - ImGuiWindow* moving_window = g.NavWindowingTarget->RootWindow; - SetWindowPos(moving_window, moving_window->Pos + move_delta * move_speed, ImGuiCond_Always); - MarkIniSettingsDirty(moving_window); + const float move_step = NAV_MOVE_SPEED * io.DeltaTime * ImMin(io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y); + g.NavWindowingAccumDeltaPos += nav_move_dir * move_step; g.NavDisableMouseHover = true; + ImVec2 accum_floored = ImFloor(g.NavWindowingAccumDeltaPos); + if (accum_floored.x != 0.0f || accum_floored.y != 0.0f) + { + ImGuiWindow* moving_window = g.NavWindowingTarget->RootWindow; + SetWindowPos(moving_window, moving_window->Pos + accum_floored, ImGuiCond_Always); + g.NavWindowingAccumDeltaPos -= accum_floored; + } } } @@ -10392,10 +11996,10 @@ static void ImGui::NavUpdateWindowing() static const char* GetFallbackWindowNameForWindowingList(ImGuiWindow* window) { if (window->Flags & ImGuiWindowFlags_Popup) - return "(Popup)"; + return ImGui::LocalizeGetMsg(ImGuiLocKey_WindowingPopup); if ((window->Flags & ImGuiWindowFlags_MenuBar) && strcmp(window->Name, "##MainMenuBar") == 0) - return "(Main menu bar)"; - return "(Untitled)"; + return ImGui::LocalizeGetMsg(ImGuiLocKey_WindowingMainMenuBar); + return ImGui::LocalizeGetMsg(ImGuiLocKey_WindowingUntitled); } // Overlay displayed when using CTRL+TAB. Called by EndFrame(). @@ -10434,6 +12038,12 @@ void ImGui::NavUpdateWindowingOverlay() // [SECTION] DRAG AND DROP //----------------------------------------------------------------------------- +bool ImGui::IsDragDropActive() +{ + ImGuiContext& g = *GImGui; + return g.DragDropActive; +} + void ImGui::ClearDragDrop() { ImGuiContext& g = *GImGui; @@ -10503,6 +12113,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags) // We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive. // Rely on keeping other window->LastItemXXX fields intact. source_id = g.LastItemData.ID = window->GetIDFromRectangle(g.LastItemData.Rect); + KeepAliveID(source_id); bool is_hovered = ItemHoverable(g.LastItemData.Rect, source_id); if (is_hovered && g.IO.MouseClicked[mouse_button]) { @@ -10518,7 +12129,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags) source_drag_active = IsMouseDragging(mouse_button); // Disable navigation and key inputs while dragging + cancel existing request if any - SetActiveIdUsingNavAndKeys(); + SetActiveIdUsingAllKeyboardKeys(); } else { @@ -10549,13 +12160,12 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags) { // Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit) // We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents. - BeginTooltip(); + bool ret = BeginTooltip(); + IM_ASSERT(ret); // FIXME-NEWBEGIN: If this ever becomes false, we need to Begin("##Hidden", NULL, ImGuiWindowFlags_NoSavedSettings) + SetWindowHiddendAndSkipItemsForCurrentFrame(). + IM_UNUSED(ret); + if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip)) - { - ImGuiWindow* tooltip_window = g.CurrentWindow; - tooltip_window->Hidden = tooltip_window->SkipItems = true; - tooltip_window->HiddenFramesCanSkipItems = 1; - } + SetWindowHiddendAndSkipItemsForCurrentFrame(g.CurrentWindow); } if (!(flags & ImGuiDragDropFlags_SourceNoDisableHover) && !(flags & ImGuiDragDropFlags_SourceExtern)) @@ -10622,6 +12232,7 @@ bool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_s } payload.DataFrameCount = g.FrameCount; + // Return whether the payload has been accepted return (g.DragDropAcceptFrameCount == g.FrameCount) || (g.DragDropAcceptFrameCount == g.FrameCount - 1); } @@ -10649,7 +12260,7 @@ bool ImGui::BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id) } // We don't use BeginDragDropTargetCustom() and duplicate its code because: -// 1) we use LastItemRectHoveredRect which handles items that pushes a temporarily clip rectangle in their code. Calling BeginDragDropTargetCustom(LastItemRect) would not handle them. +// 1) we use LastItemRectHoveredRect which handles items that push a temporarily clip rectangle in their code. Calling BeginDragDropTargetCustom(LastItemRect) would not handle them. // 2) and it's faster. as this code may be very frequently called, we want to early out as fast as we can. // Also note how the HoveredWindow test is positioned differently in both functions (in both functions we optimize for the cheapest early out case) bool ImGui::BeginDragDropTarget() @@ -10668,7 +12279,10 @@ bool ImGui::BeginDragDropTarget() const ImRect& display_rect = (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasDisplayRect) ? g.LastItemData.DisplayRect : g.LastItemData.Rect; ImGuiID id = g.LastItemData.ID; if (id == 0) + { id = window->GetIDFromRectangle(display_rect); + KeepAliveID(id); + } if (g.DragDropPayload.SourceId == id) return false; @@ -10700,41 +12314,51 @@ const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDrop const bool was_accepted_previously = (g.DragDropAcceptIdPrev == g.DragDropTargetId); ImRect r = g.DragDropTargetRect; float r_surface = r.GetWidth() * r.GetHeight(); - if (r_surface <= g.DragDropAcceptIdCurrRectSurface) - { - g.DragDropAcceptFlags = flags; - g.DragDropAcceptIdCurr = g.DragDropTargetId; - g.DragDropAcceptIdCurrRectSurface = r_surface; - } + if (r_surface > g.DragDropAcceptIdCurrRectSurface) + return NULL; + + g.DragDropAcceptFlags = flags; + g.DragDropAcceptIdCurr = g.DragDropTargetId; + g.DragDropAcceptIdCurrRectSurface = r_surface; + //IMGUI_DEBUG_LOG("AcceptDragDropPayload(): %08X: accept\n", g.DragDropTargetId); // Render default drop visuals - // FIXME-DRAGDROP: Settle on a proper default visuals for drop target. payload.Preview = was_accepted_previously; - flags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that lives for 1 frame) + flags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that live for 1 frame) if (!(flags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect) && payload.Preview) window->DrawList->AddRect(r.Min - ImVec2(3.5f,3.5f), r.Max + ImVec2(3.5f, 3.5f), GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f); g.DragDropAcceptFrameCount = g.FrameCount; - payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting os window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased() + payload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting OS window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased() if (!payload.Delivery && !(flags & ImGuiDragDropFlags_AcceptBeforeDelivery)) return NULL; + //IMGUI_DEBUG_LOG("AcceptDragDropPayload(): %08X: return payload\n", g.DragDropTargetId); return &payload; } +// FIXME-DRAGDROP: Settle on a proper default visuals for drop target. +void ImGui::RenderDragDropTargetRect(const ImRect& bb) +{ + GetWindowDrawList()->AddRect(bb.Min - ImVec2(3.5f, 3.5f), bb.Max + ImVec2(3.5f, 3.5f), GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f); +} + const ImGuiPayload* ImGui::GetDragDropPayload() { ImGuiContext& g = *GImGui; - return g.DragDropActive ? &g.DragDropPayload : NULL; + return (g.DragDropActive && g.DragDropPayload.DataFrameCount != -1) ? &g.DragDropPayload : NULL; } -// We don't really use/need this now, but added it for the sake of consistency and because we might need it later. void ImGui::EndDragDropTarget() { ImGuiContext& g = *GImGui; IM_ASSERT(g.DragDropActive); IM_ASSERT(g.DragDropWithinTarget); g.DragDropWithinTarget = false; + + // Clear drag and drop state payload right after delivery + if (g.DragDropPayload.Delivery) + ClearDragDrop(); } //----------------------------------------------------------------------------- @@ -10968,10 +12592,10 @@ void ImGui::LogButtons() #endif const bool log_to_file = Button("Log To File"); SameLine(); const bool log_to_clipboard = Button("Log To Clipboard"); SameLine(); - PushAllowKeyboardFocus(false); + PushTabStop(false); SetNextItemWidth(80.0f); SliderInt("Default Depth", &g.LogDepthToExpandDefault, 0, 9, NULL); - PopAllowKeyboardFocus(); + PopTabStop(); PopID(); // Start logging at the end of the function so that the buttons don't appear in the log @@ -10989,15 +12613,17 @@ void ImGui::LogButtons() //----------------------------------------------------------------------------- // - UpdateSettings() [Internal] // - MarkIniSettingsDirty() [Internal] -// - CreateNewWindowSettings() [Internal] -// - FindWindowSettings() [Internal] -// - FindOrCreateWindowSettings() [Internal] // - FindSettingsHandler() [Internal] // - ClearIniSettings() [Internal] // - LoadIniSettingsFromDisk() // - LoadIniSettingsFromMemory() // - SaveIniSettingsToDisk() // - SaveIniSettingsToMemory() +//----------------------------------------------------------------------------- +// - CreateNewWindowSettings() [Internal] +// - FindWindowSettingsByID() [Internal] +// - FindWindowSettingsByWindow() [Internal] +// - ClearWindowSettings() [Internal] // - WindowSettingsHandler_***() [Internal] //----------------------------------------------------------------------------- @@ -11044,42 +12670,18 @@ void ImGui::MarkIniSettingsDirty(ImGuiWindow* window) g.SettingsDirtyTimer = g.IO.IniSavingRate; } -ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name) -{ - ImGuiContext& g = *GImGui; - -#if !IMGUI_DEBUG_INI_SETTINGS - // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID() - // Preserve the full string when IMGUI_DEBUG_INI_SETTINGS is set to make .ini inspection easier. - if (const char* p = strstr(name, "###")) - name = p; -#endif - const size_t name_len = strlen(name); - - // Allocate chunk - const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1; - ImGuiWindowSettings* settings = g.SettingsWindows.alloc_chunk(chunk_size); - IM_PLACEMENT_NEW(settings) ImGuiWindowSettings(); - settings->ID = ImHashStr(name, name_len); - memcpy(settings->GetName(), name, name_len + 1); // Store with zero terminator - - return settings; -} - -ImGuiWindowSettings* ImGui::FindWindowSettings(ImGuiID id) -{ - ImGuiContext& g = *GImGui; - for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings)) - if (settings->ID == id) - return settings; - return NULL; +void ImGui::AddSettingsHandler(const ImGuiSettingsHandler* handler) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(FindSettingsHandler(handler->TypeName) == NULL); + g.SettingsHandlers.push_back(*handler); } -ImGuiWindowSettings* ImGui::FindOrCreateWindowSettings(const char* name) +void ImGui::RemoveSettingsHandler(const char* type_name) { - if (ImGuiWindowSettings* settings = FindWindowSettings(ImHashStr(name))) - return settings; - return CreateNewWindowSettings(name); + ImGuiContext& g = *GImGui; + if (ImGuiSettingsHandler* handler = FindSettingsHandler(type_name)) + g.SettingsHandlers.erase(handler); } ImGuiSettingsHandler* ImGui::FindSettingsHandler(const char* type_name) @@ -11092,6 +12694,7 @@ ImGuiSettingsHandler* ImGui::FindSettingsHandler(const char* type_name) return NULL; } +// Clear all settings (windows, tables, docking etc.) void ImGui::ClearIniSettings() { ImGuiContext& g = *GImGui; @@ -11107,7 +12710,8 @@ void ImGui::LoadIniSettingsFromDisk(const char* ini_filename) char* file_data = (char*)ImFileLoadToMemory(ini_filename, "rb", &file_data_size); if (!file_data) return; - LoadIniSettingsFromMemory(file_data, (size_t)file_data_size); + if (file_data_size > 0) + LoadIniSettingsFromMemory(file_data, (size_t)file_data_size); IM_FREE(file_data); } @@ -11215,6 +12819,62 @@ const char* ImGui::SaveIniSettingsToMemory(size_t* out_size) return g.SettingsIniData.c_str(); } +ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name) +{ + ImGuiContext& g = *GImGui; + +#if !IMGUI_DEBUG_INI_SETTINGS + // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID() + // Preserve the full string when IMGUI_DEBUG_INI_SETTINGS is set to make .ini inspection easier. + if (const char* p = strstr(name, "###")) + name = p; +#endif + const size_t name_len = strlen(name); + + // Allocate chunk + const size_t chunk_size = sizeof(ImGuiWindowSettings) + name_len + 1; + ImGuiWindowSettings* settings = g.SettingsWindows.alloc_chunk(chunk_size); + IM_PLACEMENT_NEW(settings) ImGuiWindowSettings(); + settings->ID = ImHashStr(name, name_len); + memcpy(settings->GetName(), name, name_len + 1); // Store with zero terminator + + return settings; +} + +// We don't provide a FindWindowSettingsByName() because Docking system doesn't always hold on names. +// This is called once per window .ini entry + once per newly instantiated window. +ImGuiWindowSettings* ImGui::FindWindowSettingsByID(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings)) + if (settings->ID == id && !settings->WantDelete) + return settings; + return NULL; +} + +// This is faster if you are holding on a Window already as we don't need to perform a search. +ImGuiWindowSettings* ImGui::FindWindowSettingsByWindow(ImGuiWindow* window) +{ + ImGuiContext& g = *GImGui; + if (window->SettingsOffset != -1) + return g.SettingsWindows.ptr_from_offset(window->SettingsOffset); + return FindWindowSettingsByID(window->ID); +} + +// This will revert window to its initial state, including enabling the ImGuiCond_FirstUseEver/ImGuiCond_Once conditions once more. +void ImGui::ClearWindowSettings(const char* name) +{ + //IMGUI_DEBUG_LOG("ClearWindowSettings('%s')\n", name); + ImGuiWindow* window = FindWindowByName(name); + if (window != NULL) + { + window->Flags |= ImGuiWindowFlags_NoSavedSettings; + InitOrLoadWindowSettings(window, NULL); + } + if (ImGuiWindowSettings* settings = window ? FindWindowSettingsByWindow(window) : FindWindowSettingsByID(ImHashStr(name))) + settings->WantDelete = true; +} + static void WindowSettingsHandler_ClearAll(ImGuiContext* ctx, ImGuiSettingsHandler*) { ImGuiContext& g = *ctx; @@ -11225,9 +12885,12 @@ static void WindowSettingsHandler_ClearAll(ImGuiContext* ctx, ImGuiSettingsHandl static void* WindowSettingsHandler_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name) { - ImGuiWindowSettings* settings = ImGui::FindOrCreateWindowSettings(name); - ImGuiID id = settings->ID; - *settings = ImGuiWindowSettings(); // Clear existing if recycling previous entry + ImGuiID id = ImHashStr(name); + ImGuiWindowSettings* settings = ImGui::FindWindowSettingsByID(id); + if (settings) + *settings = ImGuiWindowSettings(); // Clear existing if recycling previous entry + else + settings = ImGui::CreateNewWindowSettings(name); settings->ID = id; settings->WantApply = true; return (void*)settings; @@ -11267,7 +12930,7 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl if (window->Flags & ImGuiWindowFlags_NoSavedSettings) continue; - ImGuiWindowSettings* settings = (window->SettingsOffset != -1) ? g.SettingsWindows.ptr_from_offset(window->SettingsOffset) : ImGui::FindWindowSettings(window->ID); + ImGuiWindowSettings* settings = ImGui::FindWindowSettingsByWindow(window); if (!settings) { settings = ImGui::CreateNewWindowSettings(window->Name); @@ -11278,12 +12941,15 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl settings->Size = ImVec2ih(window->SizeFull); settings->Collapsed = window->Collapsed; + settings->WantDelete = false; } // Write to text buffer buf->reserve(buf->size() + g.SettingsWindows.size() * 6); // ballpark reserve for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings)) { + if (settings->WantDelete) + continue; const char* settings_name = settings->GetName(); buf->appendf("[%s][%s]\n", handler->TypeName, settings_name); buf->appendf("Pos=%d,%d\n", settings->Pos.x, settings->Pos.y); @@ -11294,10 +12960,23 @@ static void WindowSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl } +//----------------------------------------------------------------------------- +// [SECTION] LOCALIZATION +//----------------------------------------------------------------------------- + +void ImGui::LocalizeRegisterEntries(const ImGuiLocEntry* entries, int count) +{ + ImGuiContext& g = *GImGui; + for (int n = 0; n < count; n++) + g.LocalizationTable[entries[n].Key] = entries[n].Text; +} + + //----------------------------------------------------------------------------- // [SECTION] VIEWPORTS, PLATFORM WINDOWS //----------------------------------------------------------------------------- // - GetMainViewport() +// - SetWindowViewport() [Internal] // - UpdateViewportsNewFrame() [Internal] // (this section is more complete in the 'docking' branch) //----------------------------------------------------------------------------- @@ -11308,6 +12987,11 @@ ImGuiViewport* ImGui::GetMainViewport() return g.Viewports[0]; } +void ImGui::SetWindowViewport(ImGuiWindow* window, ImGuiViewportP* viewport) +{ + window->Viewport = viewport; +} + // Update viewports and monitor infos static void ImGui::UpdateViewportsNewFrame() { @@ -11353,9 +13037,9 @@ static void ImGui::UpdateViewportsNewFrame() // Win32 clipboard implementation // We use g.ClipboardHandlerData for temporary storage to ensure it is freed on Shutdown() -static const char* GetClipboardTextFn_DefaultImpl(void*) +static const char* GetClipboardTextFn_DefaultImpl(void* user_data_ctx) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *(ImGuiContext*)user_data_ctx; g.ClipboardHandlerData.clear(); if (!::OpenClipboard(NULL)) return NULL; @@ -11416,8 +13100,9 @@ static void SetClipboardTextFn_DefaultImpl(void*, const char* text) } } -static const char* GetClipboardTextFn_DefaultImpl(void*) +static const char* GetClipboardTextFn_DefaultImpl(void* user_data_ctx) { + ImGuiContext& g = *(ImGuiContext*)user_data_ctx; if (!main_clipboard) PasteboardCreate(kPasteboardClipboard, &main_clipboard); PasteboardSynchronize(main_clipboard); @@ -11435,7 +13120,6 @@ static const char* GetClipboardTextFn_DefaultImpl(void*) CFDataRef cf_data; if (PasteboardCopyItemFlavorData(main_clipboard, item_id, CFSTR("public.utf8-plain-text"), &cf_data) == noErr) { - ImGuiContext& g = *GImGui; g.ClipboardHandlerData.clear(); int length = (int)CFDataGetLength(cf_data); g.ClipboardHandlerData.resize(length + 1); @@ -11452,15 +13136,15 @@ static const char* GetClipboardTextFn_DefaultImpl(void*) #else // Local Dear ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers. -static const char* GetClipboardTextFn_DefaultImpl(void*) +static const char* GetClipboardTextFn_DefaultImpl(void* user_data_ctx) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *(ImGuiContext*)user_data_ctx; return g.ClipboardHandlerData.empty() ? NULL : g.ClipboardHandlerData.begin(); } -static void SetClipboardTextFn_DefaultImpl(void*, const char* text) +static void SetClipboardTextFn_DefaultImpl(void* user_data_ctx, const char* text) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *(ImGuiContext*)user_data_ctx; g.ClipboardHandlerData.clear(); const char* text_end = text + strlen(text); g.ClipboardHandlerData.resize((int)(text_end - text) + 1); @@ -11478,25 +13162,33 @@ static void SetClipboardTextFn_DefaultImpl(void*, const char* text) #pragma comment(lib, "imm32") #endif -static void ImeSetInputScreenPosFn_DefaultImpl(int x, int y) +static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport* viewport, ImGuiPlatformImeData* data) { // Notify OS Input Method Editor of text input position - ImGuiIO& io = ImGui::GetIO(); - if (HWND hwnd = (HWND)io.ImeWindowHandle) - if (HIMC himc = ::ImmGetContext(hwnd)) - { - COMPOSITIONFORM cf; - cf.ptCurrentPos.x = x; - cf.ptCurrentPos.y = y; - cf.dwStyle = CFS_FORCE_POSITION; - ::ImmSetCompositionWindow(himc, &cf); - ::ImmReleaseContext(hwnd, himc); - } + HWND hwnd = (HWND)viewport->PlatformHandleRaw; + if (hwnd == 0) + return; + + //::ImmAssociateContextEx(hwnd, NULL, data->WantVisible ? IACE_DEFAULT : 0); + if (HIMC himc = ::ImmGetContext(hwnd)) + { + COMPOSITIONFORM composition_form = {}; + composition_form.ptCurrentPos.x = (LONG)data->InputPos.x; + composition_form.ptCurrentPos.y = (LONG)data->InputPos.y; + composition_form.dwStyle = CFS_FORCE_POSITION; + ::ImmSetCompositionWindow(himc, &composition_form); + CANDIDATEFORM candidate_form = {}; + candidate_form.dwStyle = CFS_CANDIDATEPOS; + candidate_form.ptCurrentPos.x = (LONG)data->InputPos.x; + candidate_form.ptCurrentPos.y = (LONG)data->InputPos.y; + ::ImmSetCandidateWindow(himc, &candidate_form); + ::ImmReleaseContext(hwnd, himc); + } } #else -static void ImeSetInputScreenPosFn_DefaultImpl(int, int) {} +static void SetPlatformImeDataFn_DefaultImpl(ImGuiViewport*, ImGuiPlatformImeData*) {} #endif @@ -11505,11 +13197,15 @@ static void ImeSetInputScreenPosFn_DefaultImpl(int, int) {} //----------------------------------------------------------------------------- // - RenderViewportThumbnail() [Internal] // - RenderViewportsThumbnails() [Internal] +// - DebugTextEncoding() // - MetricsHelpMarker() [Internal] +// - ShowFontAtlas() [Internal] // - ShowMetricsWindow() // - DebugNodeColumns() [Internal] // - DebugNodeDrawList() [Internal] // - DebugNodeDrawCmdShowMeshAndBoundingBox() [Internal] +// - DebugNodeFont() [Internal] +// - DebugNodeFontGlyph() [Internal] // - DebugNodeStorage() [Internal] // - DebugNodeTabBar() [Internal] // - DebugNodeViewport() [Internal] @@ -11519,7 +13215,7 @@ static void ImeSetInputScreenPosFn_DefaultImpl(int, int) {} // - DebugNodeWindowsListByBeginStackParent() [Internal] //----------------------------------------------------------------------------- -#ifndef IMGUI_DISABLE_METRICS_WINDOW +#ifndef IMGUI_DISABLE_DEBUG_TOOLS void ImGui::DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb) { @@ -11572,13 +13268,97 @@ static void RenderViewportsThumbnails() ImGui::Dummy(bb_full.GetSize() * SCALE); } +// Draw an arbitrary US keyboard layout to visualize translated keys +void ImGui::DebugRenderKeyboardPreview(ImDrawList* draw_list) +{ + const ImVec2 key_size = ImVec2(35.0f, 35.0f); + const float key_rounding = 3.0f; + const ImVec2 key_face_size = ImVec2(25.0f, 25.0f); + const ImVec2 key_face_pos = ImVec2(5.0f, 3.0f); + const float key_face_rounding = 2.0f; + const ImVec2 key_label_pos = ImVec2(7.0f, 4.0f); + const ImVec2 key_step = ImVec2(key_size.x - 1.0f, key_size.y - 1.0f); + const float key_row_offset = 9.0f; + + ImVec2 board_min = GetCursorScreenPos(); + ImVec2 board_max = ImVec2(board_min.x + 3 * key_step.x + 2 * key_row_offset + 10.0f, board_min.y + 3 * key_step.y + 10.0f); + ImVec2 start_pos = ImVec2(board_min.x + 5.0f - key_step.x, board_min.y); + + struct KeyLayoutData { int Row, Col; const char* Label; ImGuiKey Key; }; + const KeyLayoutData keys_to_display[] = + { + { 0, 0, "", ImGuiKey_Tab }, { 0, 1, "Q", ImGuiKey_Q }, { 0, 2, "W", ImGuiKey_W }, { 0, 3, "E", ImGuiKey_E }, { 0, 4, "R", ImGuiKey_R }, + { 1, 0, "", ImGuiKey_CapsLock }, { 1, 1, "A", ImGuiKey_A }, { 1, 2, "S", ImGuiKey_S }, { 1, 3, "D", ImGuiKey_D }, { 1, 4, "F", ImGuiKey_F }, + { 2, 0, "", ImGuiKey_LeftShift },{ 2, 1, "Z", ImGuiKey_Z }, { 2, 2, "X", ImGuiKey_X }, { 2, 3, "C", ImGuiKey_C }, { 2, 4, "V", ImGuiKey_V } + }; + + // Elements rendered manually via ImDrawList API are not clipped automatically. + // While not strictly necessary, here IsItemVisible() is used to avoid rendering these shapes when they are out of view. + Dummy(board_max - board_min); + if (!IsItemVisible()) + return; + draw_list->PushClipRect(board_min, board_max, true); + for (int n = 0; n < IM_ARRAYSIZE(keys_to_display); n++) + { + const KeyLayoutData* key_data = &keys_to_display[n]; + ImVec2 key_min = ImVec2(start_pos.x + key_data->Col * key_step.x + key_data->Row * key_row_offset, start_pos.y + key_data->Row * key_step.y); + ImVec2 key_max = key_min + key_size; + draw_list->AddRectFilled(key_min, key_max, IM_COL32(204, 204, 204, 255), key_rounding); + draw_list->AddRect(key_min, key_max, IM_COL32(24, 24, 24, 255), key_rounding); + ImVec2 face_min = ImVec2(key_min.x + key_face_pos.x, key_min.y + key_face_pos.y); + ImVec2 face_max = ImVec2(face_min.x + key_face_size.x, face_min.y + key_face_size.y); + draw_list->AddRect(face_min, face_max, IM_COL32(193, 193, 193, 255), key_face_rounding, ImDrawFlags_None, 2.0f); + draw_list->AddRectFilled(face_min, face_max, IM_COL32(252, 252, 252, 255), key_face_rounding); + ImVec2 label_min = ImVec2(key_min.x + key_label_pos.x, key_min.y + key_label_pos.y); + draw_list->AddText(label_min, IM_COL32(64, 64, 64, 255), key_data->Label); + if (ImGui::IsKeyDown(key_data->Key)) + draw_list->AddRectFilled(key_min, key_max, IM_COL32(255, 0, 0, 128), key_rounding); + } + draw_list->PopClipRect(); +} + +// Helper tool to diagnose between text encoding issues and font loading issues. Pass your UTF-8 string and verify that there are correct. +void ImGui::DebugTextEncoding(const char* str) +{ + Text("Text: \"%s\"", str); + if (!BeginTable("list", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingFixedFit)) + return; + TableSetupColumn("Offset"); + TableSetupColumn("UTF-8"); + TableSetupColumn("Glyph"); + TableSetupColumn("Codepoint"); + TableHeadersRow(); + for (const char* p = str; *p != 0; ) + { + unsigned int c; + const int c_utf8_len = ImTextCharFromUtf8(&c, p, NULL); + TableNextColumn(); + Text("%d", (int)(p - str)); + TableNextColumn(); + for (int byte_index = 0; byte_index < c_utf8_len; byte_index++) + { + if (byte_index > 0) + SameLine(); + Text("0x%02X", (int)(unsigned char)p[byte_index]); + } + TableNextColumn(); + if (GetFont()->FindGlyphNoFallback((ImWchar)c)) + TextUnformatted(p, p + c_utf8_len); + else + TextUnformatted((c == IM_UNICODE_CODEPOINT_INVALID) ? "[invalid]" : "[missing]"); + TableNextColumn(); + Text("U+%04X", (int)c); + p += c_utf8_len; + } + EndTable(); +} + // Avoid naming collision with imgui_demo.cpp's HelpMarker() for unity builds. static void MetricsHelpMarker(const char* desc) { ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered()) + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort) && ImGui::BeginTooltip()) { - ImGui::BeginTooltip(); ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); ImGui::TextUnformatted(desc); ImGui::PopTextWrapPos(); @@ -11586,15 +13366,35 @@ static void MetricsHelpMarker(const char* desc) } } -#ifndef IMGUI_DISABLE_DEMO_WINDOWS -namespace ImGui { void ShowFontAtlas(ImFontAtlas* atlas); } -#endif +// [DEBUG] List fonts in a font atlas and display its texture +void ImGui::ShowFontAtlas(ImFontAtlas* atlas) +{ + for (int i = 0; i < atlas->Fonts.Size; i++) + { + ImFont* font = atlas->Fonts[i]; + PushID(font); + DebugNodeFont(font); + PopID(); + } + if (TreeNode("Font Atlas", "Font Atlas (%dx%d pixels)", atlas->TexWidth, atlas->TexHeight)) + { + ImGuiContext& g = *GImGui; + ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; + Checkbox("Tint with Text Color", &cfg->ShowAtlasTintedWithTextColor); // Using text color ensure visibility of core atlas data, but will alter custom colored icons + ImVec4 tint_col = cfg->ShowAtlasTintedWithTextColor ? GetStyleColorVec4(ImGuiCol_Text) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f); + ImVec4 border_col = GetStyleColorVec4(ImGuiCol_Border); + Image(atlas->TexID, ImVec2((float)atlas->TexWidth, (float)atlas->TexHeight), ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), tint_col, border_col); + TreePop(); + } +} void ImGui::ShowMetricsWindow(bool* p_open) { ImGuiContext& g = *GImGui; ImGuiIO& io = g.IO; ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; + if (cfg->ShowDebugLog) + ShowDebugLogWindow(&cfg->ShowDebugLog); if (cfg->ShowStackTool) ShowStackToolWindow(&cfg->ShowStackTool); @@ -11627,19 +13427,20 @@ void ImGui::ShowMetricsWindow(bool* p_open) { static ImRect GetTableRect(ImGuiTable* table, int rect_type, int n) { + ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); // Always using last submitted instance if (rect_type == TRT_OuterRect) { return table->OuterRect; } else if (rect_type == TRT_InnerRect) { return table->InnerRect; } else if (rect_type == TRT_WorkRect) { return table->WorkRect; } else if (rect_type == TRT_HostClipRect) { return table->HostClipRect; } else if (rect_type == TRT_InnerClipRect) { return table->InnerClipRect; } else if (rect_type == TRT_BackgroundClipRect) { return table->BgClipRect; } - else if (rect_type == TRT_ColumnsRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->MinX, table->InnerClipRect.Min.y, c->MaxX, table->InnerClipRect.Min.y + table->LastOuterHeight); } + else if (rect_type == TRT_ColumnsRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->MinX, table->InnerClipRect.Min.y, c->MaxX, table->InnerClipRect.Min.y + table_instance->LastOuterHeight); } else if (rect_type == TRT_ColumnsWorkRect) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->WorkRect.Min.y, c->WorkMaxX, table->WorkRect.Max.y); } else if (rect_type == TRT_ColumnsClipRect) { ImGuiTableColumn* c = &table->Columns[n]; return c->ClipRect; } - else if (rect_type == TRT_ColumnsContentHeadersUsed){ ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersUsed, table->InnerClipRect.Min.y + table->LastFirstRowHeight); } // Note: y1/y2 not always accurate - else if (rect_type == TRT_ColumnsContentHeadersIdeal){ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersIdeal, table->InnerClipRect.Min.y + table->LastFirstRowHeight); } - else if (rect_type == TRT_ColumnsContentFrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXFrozen, table->InnerClipRect.Min.y + table->LastFirstRowHeight); } - else if (rect_type == TRT_ColumnsContentUnfrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y + table->LastFirstRowHeight, c->ContentMaxXUnfrozen, table->InnerClipRect.Max.y); } + else if (rect_type == TRT_ColumnsContentHeadersUsed){ ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersUsed, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight); } // Note: y1/y2 not always accurate + else if (rect_type == TRT_ColumnsContentHeadersIdeal){ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXHeadersIdeal, table->InnerClipRect.Min.y + table_instance->LastFirstRowHeight); } + else if (rect_type == TRT_ColumnsContentFrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y, c->ContentMaxXFrozen, table->InnerClipRect.Min.y + table_instance->LastFrozenHeight); } + else if (rect_type == TRT_ColumnsContentUnfrozen) { ImGuiTableColumn* c = &table->Columns[n]; return ImRect(c->WorkMinX, table->InnerClipRect.Min.y + table_instance->LastFrozenHeight, c->ContentMaxXUnfrozen, table->InnerClipRect.Max.y); } IM_ASSERT(0); return ImRect(); } @@ -11662,8 +13463,32 @@ void ImGui::ShowMetricsWindow(bool* p_open) // Tools if (TreeNode("Tools")) { + bool show_encoding_viewer = TreeNode("UTF-8 Encoding viewer"); + SameLine(); + MetricsHelpMarker("You can also call ImGui::DebugTextEncoding() from your code with a given string to test that your UTF-8 encoding settings are correct."); + if (show_encoding_viewer) + { + static char buf[100] = ""; + SetNextItemWidth(-FLT_MIN); + InputText("##Text", buf, IM_ARRAYSIZE(buf)); + if (buf[0] != 0) + DebugTextEncoding(buf); + TreePop(); + } + + // The Item Picker tool is super useful to visually select an item and break into the call-stack of where it was submitted. + if (Checkbox("Show Item Picker", &g.DebugItemPickerActive) && g.DebugItemPickerActive) + DebugStartItemPicker(); + SameLine(); + MetricsHelpMarker("Will call the IM_DEBUG_BREAK() macro to break in debugger.\nWarning: If you don't have a debugger attached, this will probably crash."); + + // Stack Tool is your best friend! + Checkbox("Show Debug Log", &cfg->ShowDebugLog); + SameLine(); + MetricsHelpMarker("You can also call ImGui::ShowDebugLogWindow() from your code."); + // Stack Tool is your best friend! - Checkbox("Show stack tool", &cfg->ShowStackTool); + Checkbox("Show Stack Tool", &cfg->ShowStackTool); SameLine(); MetricsHelpMarker("You can also call ImGui::ShowStackToolWindow() from your code."); @@ -11729,11 +13554,9 @@ void ImGui::ShowMetricsWindow(bool* p_open) } } - // The Item Picker tool is super useful to visually select an item and break into the call-stack of where it was submitted. - if (Button("Item Picker..")) - DebugStartItemPicker(); + Checkbox("Debug Begin/BeginChild return value", &io.ConfigDebugBeginReturnValueLoop); SameLine(); - MetricsHelpMarker("Will call the IM_DEBUG_BREAK() macro to break in debugger.\nWarning: If you don't have a debugger attached, this will probably crash."); + MetricsHelpMarker("Some calls to Begin()/BeginChild() will return false.\n\nWill cycle through window depths then repeat. Windows should be flickering while running."); TreePop(); } @@ -11795,8 +13618,12 @@ void ImGui::ShowMetricsWindow(bool* p_open) { for (int i = 0; i < g.OpenPopupStack.Size; i++) { - ImGuiWindow* window = g.OpenPopupStack[i].Window; - BulletText("PopupID: %08x, Window: '%s'%s%s", g.OpenPopupStack[i].PopupId, window ? window->Name : "NULL", window && (window->Flags & ImGuiWindowFlags_ChildWindow) ? " ChildWindow" : "", window && (window->Flags & ImGuiWindowFlags_ChildMenu) ? " ChildMenu" : ""); + // As it's difficult to interact with tree nodes while popups are open, we display everything inline. + const ImGuiPopupData* popup_data = &g.OpenPopupStack[i]; + ImGuiWindow* window = popup_data->Window; + BulletText("PopupID: %08x, Window: '%s' (%s%s), BackupNavWindow '%s', ParentWindow '%s'", + popup_data->PopupId, window ? window->Name : "NULL", window && (window->Flags & ImGuiWindowFlags_ChildWindow) ? "Child;" : "", window && (window->Flags & ImGuiWindowFlags_ChildMenu) ? "Menu;" : "", + popup_data->BackupNavWindow ? popup_data->BackupNavWindow->Name : "NULL", window && window->ParentWindow ? window->ParentWindow->Name : "NULL"); } TreePop(); } @@ -11824,14 +13651,19 @@ void ImGui::ShowMetricsWindow(bool* p_open) } // Details for Fonts -#ifndef IMGUI_DISABLE_DEMO_WINDOWS ImFontAtlas* atlas = g.IO.Fonts; if (TreeNode("Fonts", "Fonts (%d)", atlas->Fonts.Size)) { ShowFontAtlas(atlas); TreePop(); } -#endif + + // Details for InputText + if (TreeNode("InputText")) + { + DebugNodeInputTextState(&g.InputTextState); + TreePop(); + } // Details for Docking #ifdef IMGUI_HAS_DOCK @@ -11889,11 +13721,101 @@ void ImGui::ShowMetricsWindow(bool* p_open) TreePop(); } - // Misc Details - if (TreeNode("Internal state")) + if (TreeNode("Inputs")) { - const char* input_source_names[] = { "None", "Mouse", "Keyboard", "Gamepad", "Nav", "Clipboard" }; IM_ASSERT(IM_ARRAYSIZE(input_source_names) == ImGuiInputSource_COUNT); + Text("KEYBOARD/GAMEPAD/MOUSE KEYS"); + { + // We iterate both legacy native range and named ImGuiKey ranges, which is a little odd but this allows displaying the data for old/new backends. + // User code should never have to go through such hoops! You can generally iterate between ImGuiKey_NamedKey_BEGIN and ImGuiKey_NamedKey_END. + Indent(); +#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO + struct funcs { static bool IsLegacyNativeDupe(ImGuiKey) { return false; } }; +#else + struct funcs { static bool IsLegacyNativeDupe(ImGuiKey key) { return key < 512 && GetIO().KeyMap[key] != -1; } }; // Hide Native<>ImGuiKey duplicates when both exists in the array + //Text("Legacy raw:"); for (ImGuiKey key = ImGuiKey_KeysData_OFFSET; key < ImGuiKey_COUNT; key++) { if (io.KeysDown[key]) { SameLine(); Text("\"%s\" %d", GetKeyName(key), key); } } +#endif + Text("Keys down:"); for (ImGuiKey key = ImGuiKey_KeysData_OFFSET; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key) || !IsKeyDown(key)) continue; SameLine(); Text(IsNamedKey(key) ? "\"%s\"" : "\"%s\" %d", GetKeyName(key), key); SameLine(); Text("(%.02f)", GetKeyData(key)->DownDuration); } + Text("Keys pressed:"); for (ImGuiKey key = ImGuiKey_KeysData_OFFSET; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key) || !IsKeyPressed(key)) continue; SameLine(); Text(IsNamedKey(key) ? "\"%s\"" : "\"%s\" %d", GetKeyName(key), key); } + Text("Keys released:"); for (ImGuiKey key = ImGuiKey_KeysData_OFFSET; key < ImGuiKey_COUNT; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key) || !IsKeyReleased(key)) continue; SameLine(); Text(IsNamedKey(key) ? "\"%s\"" : "\"%s\" %d", GetKeyName(key), key); } + Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : ""); + Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; SameLine(); Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public. + DebugRenderKeyboardPreview(GetWindowDrawList()); + Unindent(); + } + + Text("MOUSE STATE"); + { + Indent(); + if (IsMousePosValid()) + Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y); + else + Text("Mouse pos: "); + Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y); + int count = IM_ARRAYSIZE(io.MouseDown); + Text("Mouse down:"); for (int i = 0; i < count; i++) if (IsMouseDown(i)) { SameLine(); Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); } + Text("Mouse clicked:"); for (int i = 0; i < count; i++) if (IsMouseClicked(i)) { SameLine(); Text("b%d (%d)", i, io.MouseClickedCount[i]); } + Text("Mouse released:"); for (int i = 0; i < count; i++) if (IsMouseReleased(i)) { SameLine(); Text("b%d", i); } + Text("Mouse wheel: %.1f", io.MouseWheel); + Text("Mouse source: %s", GetMouseSourceName(io.MouseSource)); + Text("Pen Pressure: %.1f", io.PenPressure); // Note: currently unused + Unindent(); + } + + Text("MOUSE WHEELING"); + { + Indent(); + Text("WheelingWindow: '%s'", g.WheelingWindow ? g.WheelingWindow->Name : "NULL"); + Text("WheelingWindowReleaseTimer: %.2f", g.WheelingWindowReleaseTimer); + Text("WheelingAxisAvg[] = { %.3f, %.3f }, Main Axis: %s", g.WheelingAxisAvg.x, g.WheelingAxisAvg.y, (g.WheelingAxisAvg.x > g.WheelingAxisAvg.y) ? "X" : (g.WheelingAxisAvg.x < g.WheelingAxisAvg.y) ? "Y" : ""); + Unindent(); + } + + Text("KEY OWNERS"); + { + Indent(); + if (BeginListBox("##owners", ImVec2(-FLT_MIN, GetTextLineHeightWithSpacing() * 6))) + { + for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) + { + ImGuiKeyOwnerData* owner_data = GetKeyOwnerData(&g, key); + if (owner_data->OwnerCurr == ImGuiKeyOwner_None) + continue; + Text("%s: 0x%08X%s", GetKeyName(key), owner_data->OwnerCurr, + owner_data->LockUntilRelease ? " LockUntilRelease" : owner_data->LockThisFrame ? " LockThisFrame" : ""); + DebugLocateItemOnHover(owner_data->OwnerCurr); + } + EndListBox(); + } + Unindent(); + } + Text("SHORTCUT ROUTING"); + { + Indent(); + if (BeginListBox("##routes", ImVec2(-FLT_MIN, GetTextLineHeightWithSpacing() * 6))) + { + for (ImGuiKey key = ImGuiKey_NamedKey_BEGIN; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) + { + ImGuiKeyRoutingTable* rt = &g.KeysRoutingTable; + for (ImGuiKeyRoutingIndex idx = rt->Index[key - ImGuiKey_NamedKey_BEGIN]; idx != -1; ) + { + char key_chord_name[64]; + ImGuiKeyRoutingData* routing_data = &rt->Entries[idx]; + GetKeyChordName(key | routing_data->Mods, key_chord_name, IM_ARRAYSIZE(key_chord_name)); + Text("%s: 0x%08X", key_chord_name, routing_data->RoutingCurr); + DebugLocateItemOnHover(routing_data->RoutingCurr); + idx = routing_data->NextEntryIndex; + } + } + EndListBox(); + } + Text("(ActiveIdUsing: AllKeyboardKeys: %d, NavDirMask: 0x%X)", g.ActiveIdUsingAllKeyboardKeys, g.ActiveIdUsingNavDirMask); + Unindent(); + } + TreePop(); + } + if (TreeNode("Internal state")) + { Text("WINDOWING"); Indent(); Text("HoveredWindow: '%s'", g.HoveredWindow ? g.HoveredWindow->Name : "NULL"); @@ -11904,20 +13826,24 @@ void ImGui::ShowMetricsWindow(bool* p_open) Text("ITEMS"); Indent(); - Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, input_source_names[g.ActiveIdSource]); + Text("ActiveId: 0x%08X/0x%08X (%.2f sec), AllowOverlap: %d, Source: %s", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer, g.ActiveIdAllowOverlap, GetInputSourceName(g.ActiveIdSource)); + DebugLocateItemOnHover(g.ActiveId); Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL"); - Text("ActiveIdUsing: Wheel: %d, NavDirMask: %X, NavInputMask: %X, KeyInputMask: %llX", g.ActiveIdUsingMouseWheel, g.ActiveIdUsingNavDirMask, g.ActiveIdUsingNavInputMask, g.ActiveIdUsingKeyInputMask); + Text("ActiveIdUsing: AllKeyboardKeys: %d, NavDirMask: %X", g.ActiveIdUsingAllKeyboardKeys, g.ActiveIdUsingNavDirMask); Text("HoveredId: 0x%08X (%.2f sec), AllowOverlap: %d", g.HoveredIdPreviousFrame, g.HoveredIdTimer, g.HoveredIdAllowOverlap); // Not displaying g.HoveredId as it is update mid-frame + Text("HoverDelayId: 0x%08X, Timer: %.2f, ClearTimer: %.2f", g.HoverDelayId, g.HoverDelayTimer, g.HoverDelayClearTimer); Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize); + DebugLocateItemOnHover(g.DragDropPayload.SourceId); Unindent(); Text("NAV,FOCUS"); Indent(); Text("NavWindow: '%s'", g.NavWindow ? g.NavWindow->Name : "NULL"); Text("NavId: 0x%08X, NavLayer: %d", g.NavId, g.NavLayer); - Text("NavInputSource: %s", input_source_names[g.NavInputSource]); + DebugLocateItemOnHover(g.NavId); + Text("NavInputSource: %s", GetInputSourceName(g.NavInputSource)); Text("NavActive: %d, NavVisible: %d", g.IO.NavActive, g.IO.NavVisible); - Text("NavActivateId/DownId/PressedId/InputId: %08X/%08X/%08X/%08X", g.NavActivateId, g.NavActivateDownId, g.NavActivatePressedId, g.NavActivateInputId); + Text("NavActivateId/DownId/PressedId: %08X/%08X/%08X", g.NavActivateId, g.NavActivateDownId, g.NavActivatePressedId); Text("NavActivateFlags: %04X", g.NavActivateFlags); Text("NavDisableHighlight: %d, NavDisableMouseHover: %d", g.NavDisableHighlight, g.NavDisableMouseHover); Text("NavFocusScopeId = 0x%08X", g.NavFocusScopeId); @@ -11989,25 +13915,6 @@ void ImGui::ShowMetricsWindow(bool* p_open) End(); } -// [DEBUG] List fonts in a font atlas and display its texture -void ImGui::ShowFontAtlas(ImFontAtlas* atlas) -{ - for (int i = 0; i < atlas->Fonts.Size; i++) - { - ImFont* font = atlas->Fonts[i]; - PushID(font); - DebugNodeFont(font); - PopID(); - } - if (TreeNode("Atlas texture", "Atlas texture (%dx%d pixels)", atlas->TexWidth, atlas->TexHeight)) - { - ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); - ImVec4 border_col = ImVec4(1.0f, 1.0f, 1.0f, 0.5f); - Image(atlas->TexID, ImVec2((float)atlas->TexWidth, (float)atlas->TexHeight), ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), tint_col, border_col); - TreePop(); - } -} - // [DEBUG] Display contents of Columns void ImGui::DebugNodeColumns(ImGuiOldColumns* columns) { @@ -12217,17 +14124,12 @@ void ImGui::DebugNodeFont(ImFont* font) ImVec2 cell_p2(cell_p1.x + cell_size, cell_p1.y + cell_size); const ImFontGlyph* glyph = font->FindGlyphNoFallback((ImWchar)(base + n)); draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255, 255, 255, 100) : IM_COL32(255, 255, 255, 50)); - if (glyph) - font->RenderChar(draw_list, cell_size, cell_p1, glyph_col, (ImWchar)(base + n)); - if (glyph && IsMouseHoveringRect(cell_p1, cell_p2)) + if (!glyph) + continue; + font->RenderChar(draw_list, cell_size, cell_p1, glyph_col, (ImWchar)(base + n)); + if (IsMouseHoveringRect(cell_p1, cell_p2) && BeginTooltip()) { - BeginTooltip(); - Text("Codepoint: U+%04X", base + n); - Separator(); - Text("Visible: %d", glyph->Visible); - Text("AdvanceX: %.1f", glyph->AdvanceX); - Text("Pos: (%.2f,%.2f)->(%.2f,%.2f)", glyph->X0, glyph->Y0, glyph->X1, glyph->Y1); - Text("UV: (%.3f,%.3f)->(%.3f,%.3f)", glyph->U0, glyph->V0, glyph->U1, glyph->V1); + DebugNodeFontGlyph(font, glyph); EndTooltip(); } } @@ -12239,6 +14141,16 @@ void ImGui::DebugNodeFont(ImFont* font) TreePop(); } +void ImGui::DebugNodeFontGlyph(ImFont*, const ImFontGlyph* glyph) +{ + Text("Codepoint: U+%04X", glyph->Codepoint); + Separator(); + Text("Visible: %d", glyph->Visible); + Text("AdvanceX: %.1f", glyph->AdvanceX); + Text("Pos: (%.2f,%.2f)->(%.2f,%.2f)", glyph->X0, glyph->Y0, glyph->X1, glyph->Y1); + Text("UV: (%.3f,%.3f)->(%.3f,%.3f)", glyph->U0, glyph->V0, glyph->U1, glyph->V1); +} + // [DEBUG] Display contents of ImGuiStorage void ImGui::DebugNodeStorage(ImGuiStorage* storage, const char* label) { @@ -12266,7 +14178,7 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label) { ImGuiTabItem* tab = &tab_bar->Tabs[tab_n]; p += ImFormatString(p, buf_end - p, "%s'%s'", - tab_n > 0 ? ", " : "", (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "???"); + tab_n > 0 ? ", " : "", TabBarGetTabName(tab_bar, tab)); } p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } "); if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); } @@ -12283,12 +14195,12 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label) { for (int tab_n = 0; tab_n < tab_bar->Tabs.Size; tab_n++) { - const ImGuiTabItem* tab = &tab_bar->Tabs[tab_n]; + ImGuiTabItem* tab = &tab_bar->Tabs[tab_n]; PushID(tab); if (SmallButton("<")) { TabBarQueueReorder(tab_bar, tab, -1); } SameLine(0, 2); if (SmallButton(">")) { TabBarQueueReorder(tab_bar, tab, +1); } SameLine(); - Text("%02d%c Tab 0x%08X '%s' Offset: %.1f, Width: %.1f/%.1f", - tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, (tab->NameOffset != -1) ? tab_bar->GetTabName(tab) : "???", tab->Offset, tab->Width, tab->ContentWidth); + Text("%02d%c Tab 0x%08X '%s' Offset: %.2f, Width: %.2f/%.2f", + tab_n, (tab->ID == tab_bar->SelectedTabId) ? '*' : ' ', tab->ID, TabBarGetTabName(tab_bar, tab), tab->Offset, tab->Width, tab->ContentWidth); PopID(); } TreePop(); @@ -12351,13 +14263,10 @@ void ImGui::DebugNodeWindow(ImGuiWindow* window, const char* label) { ImRect r = window->NavRectRel[layer]; if (r.Min.x >= r.Max.y && r.Min.y >= r.Max.y) - { BulletText("NavLastIds[%d]: 0x%08X", layer, window->NavLastIds[layer]); - continue; - } - BulletText("NavLastIds[%d]: 0x%08X at +(%.1f,%.1f)(%.1f,%.1f)", layer, window->NavLastIds[layer], r.Min.x, r.Min.y, r.Max.x, r.Max.y); - if (IsItemHovered()) - GetForegroundDrawList(window)->AddRect(r.Min + window->Pos, r.Max + window->Pos, IM_COL32(255, 255, 0, 255)); + else + BulletText("NavLastIds[%d]: 0x%08X at +(%.1f,%.1f)(%.1f,%.1f)", layer, window->NavLastIds[layer], r.Min.x, r.Min.y, r.Max.x, r.Max.y); + DebugLocateItemOnHover(window->NavLastIds[layer]); } BulletText("NavLayersActiveMask: %X, NavLastChildNavWindow: %s", window->DC.NavLayersActiveMask, window->NavLastChildNavWindow ? window->NavLastChildNavWindow->Name : "NULL"); if (window->RootWindow != window) { DebugNodeWindow(window->RootWindow, "RootWindow"); } @@ -12375,8 +14284,12 @@ void ImGui::DebugNodeWindow(ImGuiWindow* window, const char* label) void ImGui::DebugNodeWindowSettings(ImGuiWindowSettings* settings) { + if (settings->WantDelete) + BeginDisabled(); Text("0x%08X \"%s\" Pos (%d,%d) Size (%d,%d) Collapsed=%d", settings->ID, settings->GetName(), settings->Pos.x, settings->Pos.y, settings->Size.x, settings->Size.y, settings->Collapsed); + if (settings->WantDelete) + EndDisabled(); } void ImGui::DebugNodeWindowsList(ImVector* windows, const char* label) @@ -12410,10 +14323,125 @@ void ImGui::DebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows, int wi } } +//----------------------------------------------------------------------------- +// [SECTION] DEBUG LOG WINDOW +//----------------------------------------------------------------------------- + +void ImGui::DebugLog(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + DebugLogV(fmt, args); + va_end(args); +} + +void ImGui::DebugLogV(const char* fmt, va_list args) +{ + ImGuiContext& g = *GImGui; + const int old_size = g.DebugLogBuf.size(); + g.DebugLogBuf.appendf("[%05d] ", g.FrameCount); + g.DebugLogBuf.appendfv(fmt, args); + if (g.DebugLogFlags & ImGuiDebugLogFlags_OutputToTTY) + IMGUI_DEBUG_PRINTF("%s", g.DebugLogBuf.begin() + old_size); + g.DebugLogIndex.append(g.DebugLogBuf.c_str(), old_size, g.DebugLogBuf.size()); +} + +void ImGui::ShowDebugLogWindow(bool* p_open) +{ + ImGuiContext& g = *GImGui; + if (!(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize)) + SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 12.0f), ImGuiCond_FirstUseEver); + if (!Begin("Dear ImGui Debug Log", p_open) || GetCurrentWindow()->BeginCount > 1) + { + End(); + return; + } + + CheckboxFlags("All", &g.DebugLogFlags, ImGuiDebugLogFlags_EventMask_); + SameLine(); CheckboxFlags("ActiveId", &g.DebugLogFlags, ImGuiDebugLogFlags_EventActiveId); + SameLine(); CheckboxFlags("Focus", &g.DebugLogFlags, ImGuiDebugLogFlags_EventFocus); + SameLine(); CheckboxFlags("Popup", &g.DebugLogFlags, ImGuiDebugLogFlags_EventPopup); + SameLine(); CheckboxFlags("Nav", &g.DebugLogFlags, ImGuiDebugLogFlags_EventNav); + SameLine(); if (CheckboxFlags("Clipper", &g.DebugLogFlags, ImGuiDebugLogFlags_EventClipper)) { g.DebugLogClipperAutoDisableFrames = 2; } if (IsItemHovered()) SetTooltip("Clipper log auto-disabled after 2 frames"); + //SameLine(); CheckboxFlags("Selection", &g.DebugLogFlags, ImGuiDebugLogFlags_EventSelection); + SameLine(); CheckboxFlags("IO", &g.DebugLogFlags, ImGuiDebugLogFlags_EventIO); + + if (SmallButton("Clear")) + { + g.DebugLogBuf.clear(); + g.DebugLogIndex.clear(); + } + SameLine(); + if (SmallButton("Copy")) + SetClipboardText(g.DebugLogBuf.c_str()); + BeginChild("##log", ImVec2(0.0f, 0.0f), true, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar); + + ImGuiListClipper clipper; + clipper.Begin(g.DebugLogIndex.size()); + while (clipper.Step()) + for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++) + { + const char* line_begin = g.DebugLogIndex.get_line_begin(g.DebugLogBuf.c_str(), line_no); + const char* line_end = g.DebugLogIndex.get_line_end(g.DebugLogBuf.c_str(), line_no); + TextUnformatted(line_begin, line_end); + ImRect text_rect = g.LastItemData.Rect; + if (IsItemHovered()) + for (const char* p = line_begin; p < line_end - 10; p++) + { + ImGuiID id = 0; + if (p[0] != '0' || (p[1] != 'x' && p[1] != 'X') || sscanf(p + 2, "%X", &id) != 1) + continue; + ImVec2 p0 = CalcTextSize(line_begin, p); + ImVec2 p1 = CalcTextSize(p, p + 10); + g.LastItemData.Rect = ImRect(text_rect.Min + ImVec2(p0.x, 0.0f), text_rect.Min + ImVec2(p0.x + p1.x, p1.y)); + if (IsMouseHoveringRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, true)) + DebugLocateItemOnHover(id); + p += 10; + } + } + if (GetScrollY() >= GetScrollMaxY()) + SetScrollHereY(1.0f); + EndChild(); + + End(); +} + //----------------------------------------------------------------------------- // [SECTION] OTHER DEBUG TOOLS (ITEM PICKER, STACK TOOL) //----------------------------------------------------------------------------- +static const ImU32 DEBUG_LOCATE_ITEM_COLOR = IM_COL32(0, 255, 0, 255); // Green + +void ImGui::DebugLocateItem(ImGuiID target_id) +{ + ImGuiContext& g = *GImGui; + g.DebugLocateId = target_id; + g.DebugLocateFrames = 2; +} + +void ImGui::DebugLocateItemOnHover(ImGuiID target_id) +{ + if (target_id == 0 || !IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenBlockedByPopup)) + return; + ImGuiContext& g = *GImGui; + DebugLocateItem(target_id); + GetForegroundDrawList(g.CurrentWindow)->AddRect(g.LastItemData.Rect.Min - ImVec2(3.0f, 3.0f), g.LastItemData.Rect.Max + ImVec2(3.0f, 3.0f), DEBUG_LOCATE_ITEM_COLOR); +} + +void ImGui::DebugLocateItemResolveWithLastItem() +{ + ImGuiContext& g = *GImGui; + ImGuiLastItemData item_data = g.LastItemData; + g.DebugLocateId = 0; + ImDrawList* draw_list = GetForegroundDrawList(g.CurrentWindow); + ImRect r = item_data.Rect; + r.Expand(3.0f); + ImVec2 p1 = g.IO.MousePos; + ImVec2 p2 = ImVec2((p1.x < r.Min.x) ? r.Min.x : (p1.x > r.Max.x) ? r.Max.x : p1.x, (p1.y < r.Min.y) ? r.Min.y : (p1.y > r.Max.y) ? r.Max.y : p1.y); + draw_list->AddRect(r.Min, r.Max, DEBUG_LOCATE_ITEM_COLOR); + draw_list->AddLine(p1, p2, DEBUG_LOCATE_ITEM_COLOR); +} + // [DEBUG] Item picker tool - start with DebugStartItemPicker() - useful to visually select an item and break into its call-stack. void ImGui::UpdateDebugToolItemPicker() { @@ -12424,18 +14452,27 @@ void ImGui::UpdateDebugToolItemPicker() const ImGuiID hovered_id = g.HoveredIdPreviousFrame; SetMouseCursor(ImGuiMouseCursor_Hand); - if (IsKeyPressedMap(ImGuiKey_Escape)) + if (IsKeyPressed(ImGuiKey_Escape)) g.DebugItemPickerActive = false; - if (IsMouseClicked(0) && hovered_id) + const bool change_mapping = g.IO.KeyMods == (ImGuiMod_Ctrl | ImGuiMod_Shift); + if (!change_mapping && IsMouseClicked(g.DebugItemPickerMouseButton) && hovered_id) { g.DebugItemPickerBreakId = hovered_id; g.DebugItemPickerActive = false; } - SetNextWindowBgAlpha(0.60f); - BeginTooltip(); + for (int mouse_button = 0; mouse_button < 3; mouse_button++) + if (change_mapping && IsMouseClicked(mouse_button)) + g.DebugItemPickerMouseButton = (ImU8)mouse_button; + SetNextWindowBgAlpha(0.70f); + if (!BeginTooltip()) + return; Text("HoveredId: 0x%08X", hovered_id); Text("Press ESC to abort picking."); - TextColored(GetStyleColorVec4(hovered_id ? ImGuiCol_Text : ImGuiCol_TextDisabled), "Click to break in debugger!"); + const char* mouse_button_names[] = { "Left", "Right", "Middle" }; + if (change_mapping) + Text("Remap w/ Ctrl+Shift: click anywhere to select new mouse button."); + else + TextColored(GetStyleColorVec4(hovered_id ? ImGuiCol_Text : ImGuiCol_TextDisabled), "Click %s Button to break in debugger! (remap w/ Ctrl+Shift)", mouse_button_names[g.DebugItemPickerMouseButton]); EndTooltip(); } @@ -12487,7 +14524,7 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat ImGuiStackTool* tool = &g.DebugStackTool; // Step 0: stack query - // This assume that the ID was computed with the current ID stack, which tends to be the case for our widget. + // This assumes that the ID was computed with the current ID stack, which tends to be the case for our widget. if (tool->StackLevel == -1) { tool->StackLevel++; @@ -12504,27 +14541,44 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat ImGuiStackLevelInfo* info = &tool->Results[tool->StackLevel]; IM_ASSERT(info->ID == id && info->QueryFrameCount > 0); - int data_len; switch (data_type) { case ImGuiDataType_S32: ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%d", (int)(intptr_t)data_id); break; case ImGuiDataType_String: - data_len = data_id_end ? (int)((const char*)data_id_end - (const char*)data_id) : (int)strlen((const char*)data_id); - ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "\"%.*s\"", data_len, (const char*)data_id); + ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "%.*s", data_id_end ? (int)((const char*)data_id_end - (const char*)data_id) : (int)strlen((const char*)data_id), (const char*)data_id); break; case ImGuiDataType_Pointer: ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "(void*)0x%p", data_id); break; case ImGuiDataType_ID: - if (info->Desc[0] == 0) // PushOverrideID() is often used to avoid hashing twice, which would lead to 2 calls to DebugHookIdInfo(). We prioritize the first one. - ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "0x%08X [override]", id); + if (info->Desc[0] != 0) // PushOverrideID() is often used to avoid hashing twice, which would lead to 2 calls to DebugHookIdInfo(). We prioritize the first one. + return; + ImFormatString(info->Desc, IM_ARRAYSIZE(info->Desc), "0x%08X [override]", id); break; default: IM_ASSERT(0); } info->QuerySuccess = true; + info->DataType = data_type; +} + +static int StackToolFormatLevelInfo(ImGuiStackTool* tool, int n, bool format_for_ui, char* buf, size_t buf_size) +{ + ImGuiStackLevelInfo* info = &tool->Results[n]; + ImGuiWindow* window = (info->Desc[0] == 0 && n == 0) ? ImGui::FindWindowByID(info->ID) : NULL; + if (window) // Source: window name (because the root ID don't call GetID() and so doesn't get hooked) + return ImFormatString(buf, buf_size, format_for_ui ? "\"%s\" [window]" : "%s", window->Name); + if (info->QuerySuccess) // Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id) + return ImFormatString(buf, buf_size, (format_for_ui && info->DataType == ImGuiDataType_String) ? "\"%s\"" : "%s", info->Desc); + if (tool->StackLevel < tool->Results.Size) // Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers. + return (*buf = 0); +#ifdef IMGUI_ENABLE_TEST_ENGINE + if (const char* label = ImGuiTestEngine_FindItemDebugLabel(GImGui, info->ID)) // Source: ImGuiTestEngine's ItemInfo() + return ImFormatString(buf, buf_size, format_for_ui ? "??? \"%s\"" : "%s", label); +#endif + return ImFormatString(buf, buf_size, "???"); } // Stack Tool: Display UI @@ -12540,6 +14594,7 @@ void ImGui::ShowStackToolWindow(bool* p_open) } // Display hovered/active status + ImGuiStackTool* tool = &g.DebugStackTool; const ImGuiID hovered_id = g.HoveredIdPreviousFrame; const ImGuiID active_id = g.ActiveId; #ifdef IMGUI_ENABLE_TEST_ENGINE @@ -12550,8 +14605,33 @@ void ImGui::ShowStackToolWindow(bool* p_open) SameLine(); MetricsHelpMarker("Hover an item with the mouse to display elements of the ID Stack leading to the item's final ID.\nEach level of the stack correspond to a PushID() call.\nAll levels of the stack are hashed together to make the final ID of a widget (ID displayed at the bottom level of the stack).\nRead FAQ entry about the ID stack for details."); + // CTRL+C to copy path + const float time_since_copy = (float)g.Time - tool->CopyToClipboardLastTime; + Checkbox("Ctrl+C: copy path to clipboard", &tool->CopyToClipboardOnCtrlC); + SameLine(); + TextColored((time_since_copy >= 0.0f && time_since_copy < 0.75f && ImFmod(time_since_copy, 0.25f) < 0.25f * 0.5f) ? ImVec4(1.f, 1.f, 0.3f, 1.f) : ImVec4(), "*COPIED*"); + if (tool->CopyToClipboardOnCtrlC && IsKeyDown(ImGuiMod_Ctrl) && IsKeyPressed(ImGuiKey_C)) + { + tool->CopyToClipboardLastTime = (float)g.Time; + char* p = g.TempBuffer.Data; + char* p_end = p + g.TempBuffer.Size; + for (int stack_n = 0; stack_n < tool->Results.Size && p + 3 < p_end; stack_n++) + { + *p++ = '/'; + char level_desc[256]; + StackToolFormatLevelInfo(tool, stack_n, false, level_desc, IM_ARRAYSIZE(level_desc)); + for (int n = 0; level_desc[n] && p + 2 < p_end; n++) + { + if (level_desc[n] == '/') + *p++ = '\\'; + *p++ = level_desc[n]; + } + } + *p = '\0'; + SetClipboardText(g.TempBuffer.Data); + } + // Display decorated stack - ImGuiStackTool* tool = &g.DebugStackTool; tool->LastActiveFrame = g.FrameCount; if (tool->Results.Size > 0 && BeginTable("##table", 3, ImGuiTableFlags_Borders)) { @@ -12565,23 +14645,9 @@ void ImGui::ShowStackToolWindow(bool* p_open) ImGuiStackLevelInfo* info = &tool->Results[n]; TableNextColumn(); Text("0x%08X", (n > 0) ? tool->Results[n - 1].ID : 0); - TableNextColumn(); - ImGuiWindow* window = (info->Desc[0] == 0 && n == 0) ? FindWindowByID(info->ID) : NULL; - if (window) // Source: window name (because the root ID don't call GetID() and so doesn't get hooked) - Text("\"%s\" [window]", window->Name); - else if (info->QuerySuccess) // Source: GetID() hooks (prioritize over ItemInfo() because we frequently use patterns like: PushID(str), Button("") where they both have same id) - TextUnformatted(info->Desc); - else if (tool->StackLevel >= tool->Results.Size) // Only start using fallback below when all queries are done, so during queries we don't flickering ??? markers. - { -#ifdef IMGUI_ENABLE_TEST_ENGINE - if (const char* label = ImGuiTestEngine_FindItemDebugLabel(&g, info->ID)) // Source: ImGuiTestEngine's ItemInfo() - Text("??? \"%s\"", label); - else -#endif - TextUnformatted("???"); - } - + StackToolFormatLevelInfo(tool, n, true, g.TempBuffer.Data, g.TempBuffer.Size); + TextUnformatted(g.TempBuffer.Data); TableNextColumn(); Text("0x%08X", info->ID); if (n == tool->Results.Size - 1) @@ -12607,12 +14673,15 @@ void ImGui::DebugNodeWindowSettings(ImGuiWindowSettings*) {} void ImGui::DebugNodeWindowsList(ImVector*, const char*) {} void ImGui::DebugNodeViewport(ImGuiViewportP*) {} +void ImGui::DebugLog(const char*, ...) {} +void ImGui::DebugLogV(const char*, va_list) {} +void ImGui::ShowDebugLogWindow(bool*) {} void ImGui::ShowStackToolWindow(bool*) {} void ImGui::DebugHookIdInfo(ImGuiID, ImGuiDataType, const void*, const void*) {} void ImGui::UpdateDebugToolItemPicker() {} void ImGui::UpdateDebugToolStackQueries() {} -#endif // #ifndef IMGUI_DISABLE_METRICS_WINDOW +#endif // #ifndef IMGUI_DISABLE_DEBUG_TOOLS //----------------------------------------------------------------------------- diff --git a/Sources/CImGui/imgui/imgui.h b/Sources/CImGui/imgui/imgui.h index e986e6c..6946d13 100644 --- a/Sources/CImGui/imgui/imgui.h +++ b/Sources/CImGui/imgui/imgui.h @@ -1,17 +1,17 @@ -// dear imgui, v1.86 +// dear imgui, v1.89.5 // (headers) // Help: -// - Read FAQ at http://dearimgui.org/faq +// - Read FAQ at http://dearimgui.com/faq // - Newcomers, read 'Programmer guide' in imgui.cpp for notes on how to setup Dear ImGui in your codebase. // - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications in examples/ are doing that. // Read imgui.cpp for details, links and comments. // Resources: -// - FAQ http://dearimgui.org/faq +// - FAQ http://dearimgui.com/faq // - Homepage & latest https://github.com/ocornut/imgui // - Releases & changelog https://github.com/ocornut/imgui/releases -// - Gallery https://github.com/ocornut/imgui/issues/4451 (please post your screenshots/video there!) +// - Gallery https://github.com/ocornut/imgui/issues/5886 (please post your screenshots/video there!) // - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there) // - Glossary https://github.com/ocornut/imgui/wiki/Glossary // - Issues & support https://github.com/ocornut/imgui/issues @@ -20,6 +20,12 @@ // - For first-time users having issues compiling/linking/running or issues loading fonts: // please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above. +// Library Version +// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM > 12345') +#define IMGUI_VERSION "1.89.5" +#define IMGUI_VERSION_NUM 18950 +#define IMGUI_HAS_TABLE + /* Index of this file: @@ -31,23 +37,23 @@ Index of this file: // [SECTION] ImGuiStyle // [SECTION] ImGuiIO // [SECTION] Misc data structures (ImGuiInputTextCallbackData, ImGuiSizeCallbackData, ImGuiPayload, ImGuiTableSortSpecs, ImGuiTableColumnSortSpecs) -// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor) +// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, Math Operators, ImColor) // [SECTION] Drawing API (ImDrawCallback, ImDrawCmd, ImDrawIdx, ImDrawVert, ImDrawChannel, ImDrawListSplitter, ImDrawFlags, ImDrawListFlags, ImDrawList, ImDrawData) // [SECTION] Font API (ImFontConfig, ImFontGlyph, ImFontGlyphRangesBuilder, ImFontAtlasFlags, ImFontAtlas, ImFont) // [SECTION] Viewports (ImGuiViewportFlags, ImGuiViewport) +// [SECTION] Platform Dependent Interfaces (ImGuiPlatformImeData) // [SECTION] Obsolete functions and types */ #pragma once -// Configuration file with compile-time options (edit imconfig.h or '#define IMGUI_USER_CONFIG "myfilename.h" from your build system') +// Configuration file with compile-time options +// (edit imconfig.h or '#define IMGUI_USER_CONFIG "myfilename.h" from your build system') #ifdef IMGUI_USER_CONFIG #include IMGUI_USER_CONFIG #endif -#if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H) #include "imconfig.h" -#endif #ifndef IMGUI_DISABLE @@ -61,13 +67,6 @@ Index of this file: #include // ptrdiff_t, NULL #include // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp -// Version -// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens) -#define IMGUI_VERSION "1.86" -#define IMGUI_VERSION_NUM 18600 -#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) -#define IMGUI_HAS_TABLE - // Define attributes of all API symbols declarations (e.g. for DLL under Windows) // IMGUI_API is used for core imgui functions, IMGUI_IMPL_API is used for the default backends files (imgui_impl_xxx.h) // Using dear imgui via a shared library is not recommended, because we don't guarantee backward nor forward ABI compatibility (also function call overhead, as dear imgui is a call-heavy API) @@ -85,11 +84,8 @@ Index of this file: #endif #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR)))) // Size of a static C-style array. Don't use on pointers! #define IM_UNUSED(_VAR) ((void)(_VAR)) // Used to silence "unused variable warnings". Often useful as asserts may be stripped out from final builds. -#if (__cplusplus >= 201100) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201100) #define IM_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in C++11 -#else -#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Old style macro. -#endif +#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx)) // Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions. #if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__) @@ -104,7 +100,7 @@ Index of this file: #endif // Disable some of MSVC most aggressive Debug runtime checks in function header/footer (used in some simple/low-level functions) -#if defined(_MSC_VER) && !defined(__clang__) && !defined(IMGUI_DEBUG_PARANOID) +#if defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(IMGUI_DEBUG_PARANOID) #define IM_MSVC_RUNTIME_CHECKS_OFF __pragma(runtime_checks("",off)) __pragma(check_stack(off)) __pragma(strict_gs_check(push,off)) #define IM_MSVC_RUNTIME_CHECKS_RESTORE __pragma(runtime_checks("",restore)) __pragma(check_stack()) __pragma(strict_gs_check(pop)) #else @@ -151,9 +147,11 @@ struct ImColor; // Helper functions to create a color that c struct ImGuiContext; // Dear ImGui context (opaque structure, unless including imgui_internal.h) struct ImGuiIO; // Main configuration and I/O between your application and ImGui struct ImGuiInputTextCallbackData; // Shared state of InputText() when using custom ImGuiInputTextCallback (rare/advanced use) +struct ImGuiKeyData; // Storage for ImGuiIO and IsKeyDown(), IsKeyPressed() etc functions. struct ImGuiListClipper; // Helper to manually clip large list of items struct ImGuiOnceUponAFrame; // Helper for running a block of code not more than once a frame struct ImGuiPayload; // User data payload for drag and drop operations +struct ImGuiPlatformImeData; // Platform IME data for io.SetPlatformImeDataFn() function. struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use) struct ImGuiStorage; // Helper for key->value storage struct ImGuiStyle; // Runtime data for styling/colors @@ -163,21 +161,27 @@ struct ImGuiTextBuffer; // Helper to hold and append into a text buf struct ImGuiTextFilter; // Helper to parse and apply text filters (e.g. "aaaaa[,bbbbb][,ccccc]") struct ImGuiViewport; // A Platform Window (always only one in 'master' branch), in the future may represent Platform Monitor -// Enums/Flags (declared as int for compatibility with old C++, to allow using as flags without overhead, and to not pollute the top of this file) +// Enumerations +// - We don't use strongly typed enums much because they add constraints (can't extend in private code, can't store typed in bit fields, extra casting on iteration) // - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists! -// In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. +// In Visual Studio IDE: CTRL+comma ("Edit.GoToAll") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments. +enum ImGuiKey : int; // -> enum ImGuiKey // Enum: A key identifier (ImGuiKey_XXX or ImGuiMod_XXX value) +enum ImGuiMouseSource : int; // -> enum ImGuiMouseSource // Enum; A mouse input source identifier (Mouse, TouchScreen, Pen) typedef int ImGuiCol; // -> enum ImGuiCol_ // Enum: A color identifier for styling typedef int ImGuiCond; // -> enum ImGuiCond_ // Enum: A condition for many Set*() functions typedef int ImGuiDataType; // -> enum ImGuiDataType_ // Enum: A primary data type typedef int ImGuiDir; // -> enum ImGuiDir_ // Enum: A cardinal direction -typedef int ImGuiKey; // -> enum ImGuiKey_ // Enum: A key identifier (ImGui-side enum) -typedef int ImGuiNavInput; // -> enum ImGuiNavInput_ // Enum: An input identifier for navigation typedef int ImGuiMouseButton; // -> enum ImGuiMouseButton_ // Enum: A mouse button identifier (0=left, 1=right, 2=middle) -typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor identifier +typedef int ImGuiMouseCursor; // -> enum ImGuiMouseCursor_ // Enum: A mouse cursor shape typedef int ImGuiSortDirection; // -> enum ImGuiSortDirection_ // Enum: A sorting direction (ascending or descending) typedef int ImGuiStyleVar; // -> enum ImGuiStyleVar_ // Enum: A variable identifier for styling typedef int ImGuiTableBgTarget; // -> enum ImGuiTableBgTarget_ // Enum: A color target for TableSetBgColor() + +// Flags (declared as int for compatibility with old C++, to allow using as flags without overhead, and to not pollute the top of this file) +// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists! +// In Visual Studio IDE: CTRL+comma ("Edit.GoToAll") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. +// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments. typedef int ImDrawFlags; // -> enum ImDrawFlags_ // Flags: for ImDrawList functions typedef int ImDrawListFlags; // -> enum ImDrawListFlags_ // Flags: for ImDrawList instance typedef int ImFontAtlasFlags; // -> enum ImFontAtlasFlags_ // Flags: for ImFontAtlas build @@ -190,7 +194,7 @@ typedef int ImGuiDragDropFlags; // -> enum ImGuiDragDropFlags_ // Flags: f typedef int ImGuiFocusedFlags; // -> enum ImGuiFocusedFlags_ // Flags: for IsWindowFocused() typedef int ImGuiHoveredFlags; // -> enum ImGuiHoveredFlags_ // Flags: for IsItemHovered(), IsWindowHovered() etc. typedef int ImGuiInputTextFlags; // -> enum ImGuiInputTextFlags_ // Flags: for InputText(), InputTextMultiline() -typedef int ImGuiKeyModFlags; // -> enum ImGuiKeyModFlags_ // Flags: for io.KeyMods (Ctrl/Shift/Alt/Super) +typedef int ImGuiKeyChord; // -> ImGuiKey | ImGuiMod_XXX // Flags: for storage only for now: an ImGuiKey optionally OR-ed with one or more ImGuiMod_XXX values. typedef int ImGuiPopupFlags; // -> enum ImGuiPopupFlags_ // Flags: for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() typedef int ImGuiSelectableFlags; // -> enum ImGuiSelectableFlags_ // Flags: for Selectable() typedef int ImGuiSliderFlags; // -> enum ImGuiSliderFlags_ // Flags: for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc. @@ -225,17 +229,8 @@ typedef signed short ImS16; // 16-bit signed integer typedef unsigned short ImU16; // 16-bit unsigned integer typedef signed int ImS32; // 32-bit signed integer == int typedef unsigned int ImU32; // 32-bit unsigned integer (often used to store packed colors) -#if defined(_MSC_VER) && !defined(__clang__) -typedef signed __int64 ImS64; // 64-bit signed integer (pre and post C++11 with Visual Studio) -typedef unsigned __int64 ImU64; // 64-bit unsigned integer (pre and post C++11 with Visual Studio) -#elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100) -#include -typedef int64_t ImS64; // 64-bit signed integer (pre C++11) -typedef uint64_t ImU64; // 64-bit unsigned integer (pre C++11) -#else -typedef signed long long ImS64; // 64-bit signed integer (post C++11) -typedef unsigned long long ImU64; // 64-bit unsigned integer (post C++11) -#endif +typedef signed long long ImS64; // 64-bit signed integer +typedef unsigned long long ImU64; // 64-bit unsigned integer // Character types // (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display) @@ -259,10 +254,10 @@ IM_MSVC_RUNTIME_CHECKS_OFF struct ImVec2 { float x, y; - ImVec2() { x = y = 0.0f; } - ImVec2(float _x, float _y) { x = _x; y = _y; } - float operator[] (size_t idx) const { IM_ASSERT(idx <= 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine. - float& operator[] (size_t idx) { IM_ASSERT(idx <= 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine. + constexpr ImVec2() : x(0.0f), y(0.0f) { } + constexpr ImVec2(float _x, float _y) : x(_x), y(_y) { } + float& operator[] (size_t idx) { IM_ASSERT(idx == 0 || idx == 1); return ((float*)(void*)(char*)this)[idx]; } // We very rarely use this [] operator, so the assert overhead is fine. + float operator[] (size_t idx) const { IM_ASSERT(idx == 0 || idx == 1); return ((const float*)(const void*)(const char*)this)[idx]; } #ifdef IM_VEC2_CLASS_EXTRA IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2. #endif @@ -271,9 +266,9 @@ struct ImVec2 // ImVec4: 4D vector used to store clipping rectangles, colors etc. [Compile-time configurable type] struct ImVec4 { - float x, y, z, w; - ImVec4() { x = y = z = w = 0.0f; } - ImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; } + float x, y, z, w; + constexpr ImVec4() : x(0.0f), y(0.0f), z(0.0f), w(0.0f) { } + constexpr ImVec4(float _x, float _y, float _z, float _w) : x(_x), y(_y), z(_z), w(_w) { } #ifdef IM_VEC4_CLASS_EXTRA IM_VEC4_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec4. #endif @@ -307,12 +302,13 @@ namespace ImGui // Demo, Debug, Information IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc. + IMGUI_API void ShowDebugLogWindow(bool* p_open = NULL); // create Debug Log window. display a simplified log of important dear imgui events. IMGUI_API void ShowStackToolWindow(bool* p_open = NULL); // create Stack Tool window. hover items with mouse to query information about the source of their unique ID. IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information. IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style) IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles. IMGUI_API void ShowFontSelector(const char* label); // add font selector block (not a window), essentially a combo listing the loaded fonts. - IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls). + IMGUI_API void ShowUserGuide(); // add basic help/info block (not a window): how to manipulate ImGui as an end-user (mouse/keyboard controls). IMGUI_API const char* GetVersion(); // get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp) // Styles @@ -367,6 +363,7 @@ namespace ImGui IMGUI_API void SetNextWindowContentSize(const ImVec2& size); // set next window content size (~ scrollable client area, which enforce the range of scrollbars). Not including window decorations (title bar, menu bar, etc.) nor WindowPadding. set an axis to 0.0f to leave it automatic. call before Begin() IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0); // set next window collapsed state. call before Begin() IMGUI_API void SetNextWindowFocus(); // set next window to be focused / top-most. call before Begin() + IMGUI_API void SetNextWindowScroll(const ImVec2& scroll); // set next window scrolling value (use < 0.0f to not affect a given axis). IMGUI_API void SetNextWindowBgAlpha(float alpha); // set next window background color alpha. helper to easily override the Alpha component of ImGuiCol_WindowBg/ChildBg/PopupBg. you may also use ImGuiWindowFlags_NoBackground. IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0); // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects. IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiCond cond = 0); // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0, 0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects. @@ -384,9 +381,11 @@ namespace ImGui IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos() IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates - IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates + IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be overridden with SetNextWindowContentSize(), in window coordinates // Windows Scrolling + // - Any change of Scroll will be applied at the beginning of next frame in the first call to Begin(). + // - You may instead use SetNextWindowScroll() prior to calling Begin() to avoid this delay, as an alternative to using SetScrollX()/SetScrollY(). IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()] IMGUI_API float GetScrollY(); // get scrolling amount [0 .. GetScrollMaxY()] IMGUI_API void SetScrollX(float scroll_x); // set scrolling amount [0 .. GetScrollMaxX()] @@ -407,8 +406,8 @@ namespace ImGui IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val); // modify a style float variable. always use this if you modify the style after NewFrame(). IMGUI_API void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val); // modify a style ImVec2 variable. always use this if you modify the style after NewFrame(). IMGUI_API void PopStyleVar(int count = 1); - IMGUI_API void PushAllowKeyboardFocus(bool allow_keyboard_focus); // == tab stop enable. Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets - IMGUI_API void PopAllowKeyboardFocus(); + IMGUI_API void PushTabStop(bool tab_stop); // == tab stop enable. Allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets + IMGUI_API void PopTabStop(); IMGUI_API void PushButtonRepeat(bool repeat); // in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame. IMGUI_API void PopButtonRepeat(); @@ -421,7 +420,7 @@ namespace ImGui IMGUI_API void PopTextWrapPos(); // Style read access - // - Use the style editor (ShowStyleEditor() function) to interactively see what the colors are) + // - Use the ShowStyleEditor() function to interactively see/edit the colors. IMGUI_API ImFont* GetFont(); // get current font IMGUI_API float GetFontSize(); // get current font size (= height in pixels) of current font with current scale applied IMGUI_API ImVec2 GetFontTexUvWhitePixel(); // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API @@ -439,7 +438,7 @@ namespace ImGui // Absolute coordinate: GetCursorScreenPos(), SetCursorScreenPos(), all ImDrawList:: functions. IMGUI_API void Separator(); // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator. IMGUI_API void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f); // call between widgets or groups to layout them horizontally. X position given in window coordinates. - IMGUI_API void NewLine(); // undo a SameLine() or force a new line when in an horizontal-layout context. + IMGUI_API void NewLine(); // undo a SameLine() or force a new line when in a horizontal-layout context. IMGUI_API void Spacing(); // add vertical spacing. IMGUI_API void Dummy(const ImVec2& size); // add a dummy item of given size. unlike InvisibleButton(), Dummy() won't take the mouse click or be navigable into. IMGUI_API void Indent(float indent_w = 0.0f); // move content position toward the right, by indent_w, or style.IndentSpacing if indent_w <= 0 @@ -462,7 +461,7 @@ namespace ImGui IMGUI_API float GetFrameHeightWithSpacing(); // ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets) // ID stack/scopes - // Read the FAQ (docs/FAQ.md or http://dearimgui.org/faq) for more details about how ID are handled in dear imgui. + // Read the FAQ (docs/FAQ.md or http://dearimgui.com/faq) for more details about how ID are handled in dear imgui. // - Those questions are answered and impacted by understanding of the ID stack system: // - "Q: Why is my widget not reacting when I click on it?" // - "Q: How can I have widgets with an empty label?" @@ -495,6 +494,7 @@ namespace ImGui IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args) IM_FMTLIST(2); IMGUI_API void BulletText(const char* fmt, ...) IM_FMTARGS(1); // shortcut for Bullet()+Text() IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1); + IMGUI_API void SeparatorText(const char* label); // currently: formatted text with an horizontal line // Widgets: Main // - Most widgets return true when the value has been changed or when pressed/selected @@ -503,8 +503,6 @@ namespace ImGui IMGUI_API bool SmallButton(const char* label); // button with FramePadding=(0,0) to easily embed within text IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size, ImGuiButtonFlags flags = 0); // flexible button behavior without the visuals, frequently useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.) IMGUI_API bool ArrowButton(const char* str_id, ImGuiDir dir); // square button with an arrow shape - IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0)); - IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,0), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding IMGUI_API bool Checkbox(const char* label, bool* v); IMGUI_API bool CheckboxFlags(const char* label, int* flags, int flags_value); IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value); @@ -513,7 +511,12 @@ namespace ImGui IMGUI_API void ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-FLT_MIN, 0), const char* overlay = NULL); IMGUI_API void Bullet(); // draw a small circle + keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses - // Widgets: Combo Box + // Widgets: Images + // - Read about ImTextureID here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples + IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0)); + IMGUI_API bool ImageButton(const char* str_id, ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1)); + + // Widgets: Combo Box (Dropdown) // - The BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it, by creating e.g. Selectable() items. // - The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose. This is analogous to how ListBox are created. IMGUI_API bool BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags = 0); @@ -524,14 +527,15 @@ namespace ImGui // Widgets: Drag Sliders // - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp. - // - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x + // - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every function, note that a 'float v[X]' function argument is the same as 'float* v', + // the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x // - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc. // - Format string may also be set to NULL or use the default format ("%f" or "%d"). // - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision). // - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not used. // - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum. // - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them. - // - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument. + // - Legacy: Pre-1.78 there are DragXXX() function signatures that take a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument. // If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361 IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // If v_min >= v_max we have no bound IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); @@ -550,7 +554,7 @@ namespace ImGui // - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp. // - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc. // - Format string may also be set to NULL or use the default format ("%f" or "%d"). - // - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument. + // - Legacy: Pre-1.78 there are SliderXXX() function signatures that take a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument. // If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361 IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display. IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); @@ -592,7 +596,7 @@ namespace ImGui IMGUI_API bool ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0); IMGUI_API bool ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0); IMGUI_API bool ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL); - IMGUI_API bool ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0, 0)); // display a color square/button, hover for details, return true when pressed. + IMGUI_API bool ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, const ImVec2& size = ImVec2(0, 0)); // display a color square/button, hover for details, return true when pressed. IMGUI_API void SetColorEditOptions(ImGuiColorEditFlags flags); // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls. // Widgets: Trees @@ -608,7 +612,7 @@ namespace ImGui IMGUI_API bool TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3); IMGUI_API bool TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3); IMGUI_API void TreePush(const char* str_id); // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call TreePush/TreePop yourself if desired. - IMGUI_API void TreePush(const void* ptr_id = NULL); // " + IMGUI_API void TreePush(const void* ptr_id); // " IMGUI_API void TreePop(); // ~ Unindent()+PopId() IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop(). @@ -662,8 +666,8 @@ namespace ImGui // Tooltips // - Tooltip are windows following the mouse. They do not take focus away. - IMGUI_API void BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of items). - IMGUI_API void EndTooltip(); + IMGUI_API bool BeginTooltip(); // begin/append a tooltip window. to create full-featured tooltip (with any kind of items). + IMGUI_API void EndTooltip(); // only call EndTooltip() if BeginTooltip() returns true! IMGUI_API void SetTooltip(const char* fmt, ...) IM_FMTARGS(1); // set a text-only tooltip, typically use with ImGui::IsItemHovered(). override any previous call to SetTooltip(). IMGUI_API void SetTooltipV(const char* fmt, va_list args) IM_FMTLIST(1); @@ -678,7 +682,7 @@ namespace ImGui // Popups: begin/end functions // - BeginPopup(): query popup state, if open start appending into the window. Call EndPopup() afterwards. ImGuiWindowFlags are forwarded to the window. - // - BeginPopupModal(): block every interactions behind the window, cannot be closed by user, add a dimming background, has a title bar. + // - BeginPopupModal(): block every interaction behind the window, cannot be closed by user, add a dimming background, has a title bar. IMGUI_API bool BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0); // return true if the popup is open, and you can start outputting to it. IMGUI_API bool BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0); // return true if the modal is open, and you can start outputting to it. IMGUI_API void EndPopup(); // only call EndPopup() if BeginPopupXXX() returns true! @@ -690,6 +694,7 @@ namespace ImGui // - CloseCurrentPopup() is called by default by Selectable()/MenuItem() when activated (FIXME: need some options). // - Use ImGuiPopupFlags_NoOpenOverExistingPopup to avoid opening a popup if there's already one at the same level. This is equivalent to e.g. testing for !IsAnyPopupOpen() prior to OpenPopup(). // - Use IsWindowAppearing() after BeginPopup() to tell if a window just opened. + // - IMPORTANT: Notice that for OpenPopupOnItemClick() we exceptionally default flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter IMGUI_API void OpenPopup(const char* str_id, ImGuiPopupFlags popup_flags = 0); // call to mark popup as open (don't call every frame!). IMGUI_API void OpenPopup(ImGuiID id, ImGuiPopupFlags popup_flags = 0); // id overload to facilitate calling from nested stacks IMGUI_API void OpenPopupOnItemClick(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // helper to open popup when clicked on last item. Default to ImGuiPopupFlags_MouseButtonRight == 1. (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors) @@ -699,7 +704,7 @@ namespace ImGui // - Helpers to do OpenPopup+BeginPopup where the Open action is triggered by e.g. hovering an item and right-clicking. // - They are convenient to easily create context menus, hence the name. // - IMPORTANT: Notice that BeginPopupContextXXX takes ImGuiPopupFlags just like OpenPopup() and unlike BeginPopup(). For full consistency, we may add ImGuiWindowFlags to the BeginPopupContextXXX functions in the future. - // - IMPORTANT: we exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter, so if you add other flags remember to re-add the ImGuiPopupFlags_MouseButtonRight. + // - IMPORTANT: Notice that we exceptionally default their flags to 1 (== ImGuiPopupFlags_MouseButtonRight) for backward compatibility with older API taking 'int mouse_button = 1' parameter, so if you add other flags remember to re-add the ImGuiPopupFlags_MouseButtonRight. IMGUI_API bool BeginPopupContextItem(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // open+begin popup when clicked on last item. Use str_id==NULL to associate the popup to previous item. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp! IMGUI_API bool BeginPopupContextWindow(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1);// open+begin popup when clicked on current window. IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, ImGuiPopupFlags popup_flags = 1); // open+begin popup when clicked in void (where there are no windows). @@ -711,19 +716,17 @@ namespace ImGui IMGUI_API bool IsPopupOpen(const char* str_id, ImGuiPopupFlags flags = 0); // return true if the popup is open. // Tables - // [BETA API] API may evolve slightly! If you use this, please update to the next version when it comes out! // - Full-featured replacement for old Columns API. - // - See Demo->Tables for demo code. - // - See top of imgui_tables.cpp for general commentary. + // - See Demo->Tables for demo code. See top of imgui_tables.cpp for general commentary. // - See ImGuiTableFlags_ and ImGuiTableColumnFlags_ enums for a description of available flags. // The typical call flow is: - // - 1. Call BeginTable(). + // - 1. Call BeginTable(), early out if returning false. // - 2. Optionally call TableSetupColumn() to submit column name/flags/defaults. // - 3. Optionally call TableSetupScrollFreeze() to request scroll freezing of columns/rows. // - 4. Optionally call TableHeadersRow() to submit a header row. Names are pulled from TableSetupColumn() data. // - 5. Populate contents: // - In most situations you can use TableNextRow() + TableSetColumnIndex(N) to start appending into a column. - // - If you are using tables as a sort of grid, where every columns is holding the same type of contents, + // - If you are using tables as a sort of grid, where every column is holding the same type of contents, // you may prefer using TableNextColumn() instead of TableNextRow() + TableSetColumnIndex(). // TableNextColumn() will automatically wrap-around into the next row if needed. // - IMPORTANT: Comparatively to the old Columns() API, we need to call TableNextColumn() for the first column! @@ -736,10 +739,10 @@ namespace ImGui // -------------------------------------------------------------------------------------------------------- // - 5. Call EndTable() IMGUI_API bool BeginTable(const char* str_id, int column, ImGuiTableFlags flags = 0, const ImVec2& outer_size = ImVec2(0.0f, 0.0f), float inner_width = 0.0f); - IMGUI_API void EndTable(); // only call EndTable() if BeginTable() returns true! + IMGUI_API void EndTable(); // only call EndTable() if BeginTable() returns true! IMGUI_API void TableNextRow(ImGuiTableRowFlags row_flags = 0, float min_row_height = 0.0f); // append into the first cell of a new row. - IMGUI_API bool TableNextColumn(); // append into the next column (or first column of next row if currently in last column). Return true when column is visible. - IMGUI_API bool TableSetColumnIndex(int column_n); // append into the specified column. Return true when column is visible. + IMGUI_API bool TableNextColumn(); // append into the next column (or first column of next row if currently in last column). Return true when column is visible. + IMGUI_API bool TableSetColumnIndex(int column_n); // append into the specified column. Return true when column is visible. // Tables: Headers & Columns declaration // - Use TableSetupColumn() to specify label, resizing policy, default width/weight, id, various other flags etc. @@ -750,20 +753,17 @@ namespace ImGui // some advanced use cases (e.g. adding custom widgets in header row). // - Use TableSetupScrollFreeze() to lock columns/rows so they stay visible when scrolled. IMGUI_API void TableSetupColumn(const char* label, ImGuiTableColumnFlags flags = 0, float init_width_or_weight = 0.0f, ImGuiID user_id = 0); - IMGUI_API void TableSetupScrollFreeze(int cols, int rows); // lock columns/rows so they stay visible when scrolled. - IMGUI_API void TableHeadersRow(); // submit all headers cells based on data provided to TableSetupColumn() + submit context menu - IMGUI_API void TableHeader(const char* label); // submit one header cell manually (rarely used) - - // Tables: Sorting - // - Call TableGetSortSpecs() to retrieve latest sort specs for the table. NULL when not sorting. - // - When 'SpecsDirty == true' you should sort your data. It will be true when sorting specs have changed - // since last call, or the first time. Make sure to set 'SpecsDirty = false' after sorting, else you may - // wastefully sort your data every frame! - // - Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable(). - IMGUI_API ImGuiTableSortSpecs* TableGetSortSpecs(); // get latest sort specs for the table (NULL if not sorting). - - // Tables: Miscellaneous functions + IMGUI_API void TableSetupScrollFreeze(int cols, int rows); // lock columns/rows so they stay visible when scrolled. + IMGUI_API void TableHeadersRow(); // submit all headers cells based on data provided to TableSetupColumn() + submit context menu + IMGUI_API void TableHeader(const char* label); // submit one header cell manually (rarely used) + + // Tables: Sorting & Miscellaneous functions + // - Sorting: call TableGetSortSpecs() to retrieve latest sort specs for the table. NULL when not sorting. + // When 'sort_specs->SpecsDirty == true' you should sort your data. It will be true when sorting specs have + // changed since last call, or the first time. Make sure to set 'SpecsDirty = false' after sorting, + // else you may wastefully sort your data every frame! // - Functions args 'int column_n' treat the default value of -1 as the same as passing the current column index. + IMGUI_API ImGuiTableSortSpecs* TableGetSortSpecs(); // get latest sort specs for the table (NULL if not sorting). Lifetime: don't hold on this pointer over multiple frames or past any subsequent call to BeginTable(). IMGUI_API int TableGetColumnCount(); // return number of columns (value passed to BeginTable) IMGUI_API int TableGetColumnIndex(); // return current column index. IMGUI_API int TableGetRowIndex(); // return current row index. @@ -784,6 +784,7 @@ namespace ImGui IMGUI_API int GetColumnsCount(); // Tab Bars, Tabs + // - Note: Tabs are automatically created by the docking system (when in 'docking' branch). Use this to create tab bars/tabs yourself. IMGUI_API bool BeginTabBar(const char* str_id, ImGuiTabBarFlags flags = 0); // create and append into a TabBar IMGUI_API void EndTabBar(); // only call EndTabBar() if BeginTabBar() returns true! IMGUI_API bool BeginTabItem(const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0); // create a Tab. Returns true if the Tab is selected. @@ -807,7 +808,7 @@ namespace ImGui // - If you stop calling BeginDragDropSource() the payload is preserved however it won't have a preview tooltip (we currently display a fallback "..." tooltip, see #1725) // - An item can be both drag source and drop target. IMGUI_API bool BeginDragDropSource(ImGuiDragDropFlags flags = 0); // call after submitting an item which may be dragged. when this return true, you can call SetDragDropPayload() + EndDragDropSource() - IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t sz, ImGuiCond cond = 0); // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui. + IMGUI_API bool SetDragDropPayload(const char* type, const void* data, size_t sz, ImGuiCond cond = 0); // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui. Return true when payload has been accepted. IMGUI_API void EndDragDropSource(); // only call EndDragDropSource() if BeginDragDropSource() returns true! IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive a payload. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget() IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released. @@ -837,16 +838,17 @@ namespace ImGui IMGUI_API bool IsItemHovered(ImGuiHoveredFlags flags = 0); // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options. IMGUI_API bool IsItemActive(); // is the last item active? (e.g. button being held, text field being edited. This will continuously return true while holding mouse button on an item. Items that don't interact will always return false) IMGUI_API bool IsItemFocused(); // is the last item focused for keyboard/gamepad navigation? - IMGUI_API bool IsItemClicked(ImGuiMouseButton mouse_button = 0); // is the last item hovered and mouse clicked on? (**) == IsMouseClicked(mouse_button) && IsItemHovered()Important. (**) this it NOT equivalent to the behavior of e.g. Button(). Read comments in function definition. + IMGUI_API bool IsItemClicked(ImGuiMouseButton mouse_button = 0); // is the last item hovered and mouse clicked on? (**) == IsMouseClicked(mouse_button) && IsItemHovered()Important. (**) this is NOT equivalent to the behavior of e.g. Button(). Read comments in function definition. IMGUI_API bool IsItemVisible(); // is the last item visible? (items may be out of sight because of clipping/scrolling) IMGUI_API bool IsItemEdited(); // did the last item modify its underlying value this frame? or was pressed? This is generally the same as the "bool" return value of many widgets. IMGUI_API bool IsItemActivated(); // was the last item just made active (item was previously inactive). - IMGUI_API bool IsItemDeactivated(); // was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that requires continuous editing. - IMGUI_API bool IsItemDeactivatedAfterEdit(); // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that requires continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item). + IMGUI_API bool IsItemDeactivated(); // was the last item just made inactive (item was previously active). Useful for Undo/Redo patterns with widgets that require continuous editing. + IMGUI_API bool IsItemDeactivatedAfterEdit(); // was the last item just made inactive and made a value change when it was active? (e.g. Slider/Drag moved). Useful for Undo/Redo patterns with widgets that require continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item). IMGUI_API bool IsItemToggledOpen(); // was the last item open state toggled? set by TreeNode(). IMGUI_API bool IsAnyItemHovered(); // is any item hovered? IMGUI_API bool IsAnyItemActive(); // is any item active? IMGUI_API bool IsAnyItemFocused(); // is any item focused? + IMGUI_API ImGuiID GetItemID(); // get ID of last item (~~ often same ImGui::GetID(label) beforehand) IMGUI_API ImVec2 GetItemRectMin(); // get upper-left bounding rectangle of the last item (screen space) IMGUI_API ImVec2 GetItemRectMax(); // get lower-right bounding rectangle of the last item (screen space) IMGUI_API ImVec2 GetItemRectSize(); // get size of last item @@ -858,13 +860,15 @@ namespace ImGui // - In the future we will extend this concept further to also represent Platform Monitor and support a "no main platform window" operation mode. IMGUI_API ImGuiViewport* GetMainViewport(); // return primary/default viewport. This can never be NULL. + // Background/Foreground Draw Lists + IMGUI_API ImDrawList* GetBackgroundDrawList(); // this draw list will be the first rendered one. Useful to quickly draw shapes/text behind dear imgui contents. + IMGUI_API ImDrawList* GetForegroundDrawList(); // this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents. + // Miscellaneous Utilities IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle (of given size, starting from cursor position) is visible / not clipped. IMGUI_API bool IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max); // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side. IMGUI_API double GetTime(); // get global imgui time. incremented by io.DeltaTime every frame. IMGUI_API int GetFrameCount(); // get global imgui frame count. incremented by 1 every frame. - IMGUI_API ImDrawList* GetBackgroundDrawList(); // this draw list will be the first rendering one. Useful to quickly draw shapes/text behind dear imgui contents. - IMGUI_API ImDrawList* GetForegroundDrawList(); // this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents. IMGUI_API ImDrawListSharedData* GetDrawListSharedData(); // you may use this when creating your own ImDrawList instances. IMGUI_API const char* GetStyleColorName(ImGuiCol idx); // get a string corresponding to the enum value (for display, saving, etc.). IMGUI_API void SetStateStorage(ImGuiStorage* storage); // replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it) @@ -881,17 +885,19 @@ namespace ImGui IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v); IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b); - // Inputs Utilities: Keyboard - // - For 'int user_key_index' you can use your own indices/enums according to how your backend/engine stored them in io.KeysDown[]. - // - We don't know the meaning of those value. You can use GetKeyIndex() to map a ImGuiKey_ value into the user index. - IMGUI_API int GetKeyIndex(ImGuiKey imgui_key); // map ImGuiKey_* values into user's key index. == io.KeyMap[key] - IMGUI_API bool IsKeyDown(int user_key_index); // is key being held. == io.KeysDown[user_key_index]. - IMGUI_API bool IsKeyPressed(int user_key_index, bool repeat = true); // was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate - IMGUI_API bool IsKeyReleased(int user_key_index); // was key released (went from Down to !Down)? - IMGUI_API int GetKeyPressedAmount(int key_index, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate - IMGUI_API void CaptureKeyboardFromApp(bool want_capture_keyboard_value = true); // attention: misleading name! manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application to handle). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard_value"; after the next NewFrame() call. - - // Inputs Utilities: Mouse + // Inputs Utilities: Keyboard/Mouse/Gamepad + // - the ImGuiKey enum contains all possible keyboard, mouse and gamepad inputs (e.g. ImGuiKey_A, ImGuiKey_MouseLeft, ImGuiKey_GamepadDpadUp...). + // - before v1.87, we used ImGuiKey to carry native/user indices as defined by each backends. About use of those legacy ImGuiKey values: + // - without IMGUI_DISABLE_OBSOLETE_KEYIO (legacy support): you can still use your legacy native/user indices (< 512) according to how your backend/engine stored them in io.KeysDown[], but need to cast them to ImGuiKey. + // - with IMGUI_DISABLE_OBSOLETE_KEYIO (this is the way forward): any use of ImGuiKey will assert with key < 512. GetKeyIndex() is pass-through and therefore deprecated (gone if IMGUI_DISABLE_OBSOLETE_KEYIO is defined). + IMGUI_API bool IsKeyDown(ImGuiKey key); // is key being held. + IMGUI_API bool IsKeyPressed(ImGuiKey key, bool repeat = true); // was key pressed (went from !Down to Down)? if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate + IMGUI_API bool IsKeyReleased(ImGuiKey key); // was key released (went from Down to !Down)? + IMGUI_API int GetKeyPressedAmount(ImGuiKey key, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate + IMGUI_API const char* GetKeyName(ImGuiKey key); // [DEBUG] returns English name of the key. Those names a provided for debugging purpose and are not meant to be saved persistently not compared. + IMGUI_API void SetNextFrameWantCaptureKeyboard(bool want_capture_keyboard); // Override io.WantCaptureKeyboard flag next frame (said flag is left for your application to handle, typically when true it instructs your app to ignore inputs). e.g. force capture keyboard when your widget is being hovered. This is equivalent to setting "io.WantCaptureKeyboard = want_capture_keyboard"; after the next NewFrame() call. + + // Inputs Utilities: Mouse specific // - To refer to a mouse button, you may use named enums in your code e.g. ImGuiMouseButton_Left, ImGuiMouseButton_Right. // - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle. // - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold') @@ -902,15 +908,15 @@ namespace ImGui IMGUI_API int GetMouseClickedCount(ImGuiMouseButton button); // return the number of successive mouse-clicks at the time where a click happen (otherwise 0). IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block. IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available - IMGUI_API bool IsAnyMouseDown(); // is any mouse button held? + IMGUI_API bool IsAnyMouseDown(); // [WILL OBSOLETE] is any mouse button held? This was designed for backends, but prefer having backend maintain a mask of held mouse buttons, because upcoming input queue system will make this invalid. IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve mouse position at the time of opening popup we have BeginPopup() into (helper to avoid user backing that value themselves) IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_threshold = -1.0f); // is mouse dragging? (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold) IMGUI_API ImVec2 GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (if lock_threshold < -1.0f, uses io.MouseDraggingThreshold) IMGUI_API void ResetMouseDragDelta(ImGuiMouseButton button = 0); // - IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you - IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired cursor type - IMGUI_API void CaptureMouseFromApp(bool want_capture_mouse_value = true); // attention: misleading name! manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application to handle). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse_value;" after the next NewFrame() call. + IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired mouse cursor shape. Important: reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you + IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired mouse cursor shape + IMGUI_API void SetNextFrameWantCaptureMouse(bool want_capture_mouse); // Override io.WantCaptureMouse flag next frame (said flag is left for your application to handle, typical when true it instucts your app to ignore inputs). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse;" after the next NewFrame() call. // Clipboard Utilities // - Also see the LogToClipboard() function to capture GUI into clipboard, or easily output text data to the clipboard. @@ -927,7 +933,7 @@ namespace ImGui IMGUI_API const char* SaveIniSettingsToMemory(size_t* out_ini_size = NULL); // return a zero-terminated string with the .ini data which you can save by your own mean. call when io.WantSaveIniSettings is set, then save data by your own mean and clear io.WantSaveIniSettings. // Debug Utilities - // - This is used by the IMGUI_CHECKVERSION() macro. + IMGUI_API void DebugTextEncoding(const char* text); IMGUI_API bool DebugCheckVersionAndDataLayout(const char* version_str, size_t sz_io, size_t sz_style, size_t sz_vec2, size_t sz_vec4, size_t sz_drawvert, size_t sz_drawidx); // This is called by IMGUI_CHECKVERSION() macro. // Memory Allocators @@ -946,6 +952,7 @@ namespace ImGui //----------------------------------------------------------------------------- // Flags for ImGui::Begin() +// (Those are per-window flags. There are shared flags in ImGuiIO: io.ConfigWindowsResizeFromEdges and io.ConfigWindowsMoveFromTitleBarOnly) enum ImGuiWindowFlags_ { ImGuiWindowFlags_None = 0, @@ -979,13 +986,11 @@ enum ImGuiWindowFlags_ ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip() ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup() ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For internal use by BeginPopupModal() - ImGuiWindowFlags_ChildMenu = 1 << 28 // Don't use! For internal use by BeginMenu() - - // [Obsolete] - //ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // --> Set io.ConfigWindowsResizeFromEdges=true and make sure mouse cursors are supported by backend (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) + ImGuiWindowFlags_ChildMenu = 1 << 28, // Don't use! For internal use by BeginMenu() }; // Flags for ImGui::InputText() +// (Those are per-item flags. There are shared flags in ImGuiIO: io.ConfigInputTextCursorBlink and io.ConfigInputTextEnterKeepActive) enum ImGuiInputTextFlags_ { ImGuiInputTextFlags_None = 0, @@ -1008,12 +1013,11 @@ enum ImGuiInputTextFlags_ ImGuiInputTextFlags_NoUndoRedo = 1 << 16, // 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(). ImGuiInputTextFlags_CharsScientific = 1 << 17, // Allow 0123456789.+-*/eE (Scientific notation input) ImGuiInputTextFlags_CallbackResize = 1 << 18, // Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. Notify when the string wants to be resized (for string types which hold a cache of their Size). You will be provided a new BufSize in the callback and NEED to honor it. (see misc/cpp/imgui_stdlib.h for an example of using this) - ImGuiInputTextFlags_CallbackEdit = 1 << 19 // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active) + ImGuiInputTextFlags_CallbackEdit = 1 << 19, // Callback on any edit (note that InputText() already returns true on edit, the callback is useful mainly to manipulate the underlying buffer while focus is active) + ImGuiInputTextFlags_EscapeClearsAll = 1 << 20, // Escape key clears content if not empty, and deactivate otherwise (contrast to default behavior of Escape to revert) - // Obsolete names (will be removed soon) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - , ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior -#endif + // Obsolete names + //ImGuiInputTextFlags_AlwaysInsertMode = ImGuiInputTextFlags_AlwaysOverwrite // [renamed in 1.82] name was not matching behavior }; // Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*() @@ -1035,7 +1039,7 @@ enum ImGuiTreeNodeFlags_ ImGuiTreeNodeFlags_SpanFullWidth = 1 << 12, // Extend hit box to the left-most and right-most edges (bypass the indented area). ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13, // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop) //ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 14, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible - ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog + ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog, }; // Flags for OpenPopup*(), BeginPopupContext*(), IsPopupOpen() functions. @@ -1044,7 +1048,7 @@ enum ImGuiTreeNodeFlags_ // It is therefore guaranteed to be legal to pass a mouse button index in ImGuiPopupFlags. // - For the same reason, we exceptionally default the ImGuiPopupFlags argument of BeginPopupContextXXX functions to 1 instead of 0. // IMPORTANT: because the default parameter is 1 (==ImGuiPopupFlags_MouseButtonRight), if you rely on the default parameter -// and want to another another flag, you need to pass in the ImGuiPopupFlags_MouseButtonRight flag. +// and want to use another flag, you need to pass in the ImGuiPopupFlags_MouseButtonRight flag explicitly. // - Multiple buttons currently cannot be combined/or-ed in those functions (we could allow it later). enum ImGuiPopupFlags_ { @@ -1058,18 +1062,18 @@ enum ImGuiPopupFlags_ ImGuiPopupFlags_NoOpenOverItems = 1 << 6, // For BeginPopupContextWindow(): don't return true when hovering items, only when hovering empty space ImGuiPopupFlags_AnyPopupId = 1 << 7, // For IsPopupOpen(): ignore the ImGuiID parameter and test for any popup. ImGuiPopupFlags_AnyPopupLevel = 1 << 8, // For IsPopupOpen(): search/test at any level of the popup stack (default test in the current level) - ImGuiPopupFlags_AnyPopup = ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel + ImGuiPopupFlags_AnyPopup = ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel, }; // Flags for ImGui::Selectable() enum ImGuiSelectableFlags_ { ImGuiSelectableFlags_None = 0, - ImGuiSelectableFlags_DontClosePopups = 1 << 0, // Clicking this don't close parent popup window + ImGuiSelectableFlags_DontClosePopups = 1 << 0, // Clicking this doesn't close parent popup window ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Selectable frame can span all columns (text will still fit in current column) ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, // Generate press events on double clicks too ImGuiSelectableFlags_Disabled = 1 << 3, // Cannot be selected, display grayed out text - ImGuiSelectableFlags_AllowItemOverlap = 1 << 4 // (WIP) Hit testing to allow subsequent widgets to overlap this one + ImGuiSelectableFlags_AllowItemOverlap = 1 << 4, // (WIP) Hit testing to allow subsequent widgets to overlap this one }; // Flags for ImGui::BeginCombo() @@ -1083,7 +1087,7 @@ enum ImGuiComboFlags_ ImGuiComboFlags_HeightLargest = 1 << 4, // As many fitting items as possible ImGuiComboFlags_NoArrowButton = 1 << 5, // Display on the preview box without the square arrow button ImGuiComboFlags_NoPreview = 1 << 6, // Display only a square arrow button - ImGuiComboFlags_HeightMask_ = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest + ImGuiComboFlags_HeightMask_ = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest, }; // Flags for ImGui::BeginTabBar() @@ -1099,7 +1103,7 @@ enum ImGuiTabBarFlags_ ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6, // Resize tabs when they don't fit ImGuiTabBarFlags_FittingPolicyScroll = 1 << 7, // Add scroll buttons when tabs don't fit ImGuiTabBarFlags_FittingPolicyMask_ = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll, - ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyResizeDown + ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyResizeDown, }; // Flags for ImGui::BeginTabItem() @@ -1113,12 +1117,11 @@ enum ImGuiTabItemFlags_ ImGuiTabItemFlags_NoTooltip = 1 << 4, // Disable tooltip for the given tab ImGuiTabItemFlags_NoReorder = 1 << 5, // Disable reordering this tab or having another tab cross over this tab ImGuiTabItemFlags_Leading = 1 << 6, // Enforce the tab position to the left of the tab bar (after the tab list popup button) - ImGuiTabItemFlags_Trailing = 1 << 7 // Enforce the tab position to the right of the tab bar (before the scrolling buttons) + ImGuiTabItemFlags_Trailing = 1 << 7, // Enforce the tab position to the right of the tab bar (before the scrolling buttons) }; // Flags for ImGui::BeginTable() -// [BETA API] API may evolve slightly! If you use this, please update to the next version when it comes out! -// - Important! Sizing policies have complex and subtle side effects, more so than you would expect. +// - Important! Sizing policies have complex and subtle side effects, much more so than you would expect. // Read comments/demos carefully + experiment with live demos to get acquainted with them. // - The DEFAULT sizing policies are: // - Default to ImGuiTableFlags_SizingFixedFit if ScrollX is on, or if host window has ImGuiWindowFlags_AlwaysAutoResize. @@ -1126,15 +1129,15 @@ enum ImGuiTabItemFlags_ // - When ScrollX is off: // - Table defaults to ImGuiTableFlags_SizingStretchSame -> all Columns defaults to ImGuiTableColumnFlags_WidthStretch with same weight. // - Columns sizing policy allowed: Stretch (default), Fixed/Auto. -// - Fixed Columns will generally obtain their requested width (unless the table cannot fit them all). -// - Stretch Columns will share the remaining width. +// - Fixed Columns (if any) will generally obtain their requested width (unless the table cannot fit them all). +// - Stretch Columns will share the remaining width according to their respective weight. // - Mixed Fixed/Stretch columns is possible but has various side-effects on resizing behaviors. // The typical use of mixing sizing policies is: any number of LEADING Fixed columns, followed by one or two TRAILING Stretch columns. // (this is because the visible order of columns have subtle but necessary effects on how they react to manual resizing). // - When ScrollX is on: // - Table defaults to ImGuiTableFlags_SizingFixedFit -> all Columns defaults to ImGuiTableColumnFlags_WidthFixed // - Columns sizing policy allowed: Fixed/Auto mostly. -// - Fixed Columns can be enlarged as needed. Table will show an horizontal scrollbar if needed. +// - Fixed Columns can be enlarged as needed. Table will show a horizontal scrollbar if needed. // - When using auto-resizing (non-resizable) fixed columns, querying the content width to use item right-alignment e.g. SetNextItemWidth(-FLT_MIN) doesn't make sense, would create a feedback loop. // - Using Stretch columns OFTEN DOES NOT MAKE SENSE if ScrollX is on, UNLESS you have specified a value for 'inner_width' in BeginTable(). // If you specify a value for 'inner_width' then effectively the scrolling space is known and Stretch or mixed Fixed/Stretch columns become meaningful again. @@ -1160,8 +1163,8 @@ enum ImGuiTableFlags_ ImGuiTableFlags_BordersInner = ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_BordersInnerH, // Draw inner borders. ImGuiTableFlags_BordersOuter = ImGuiTableFlags_BordersOuterV | ImGuiTableFlags_BordersOuterH, // Draw outer borders. ImGuiTableFlags_Borders = ImGuiTableFlags_BordersInner | ImGuiTableFlags_BordersOuter, // Draw all borders. - ImGuiTableFlags_NoBordersInBody = 1 << 11, // [ALPHA] Disable vertical borders in columns Body (borders will always appears in Headers). -> May move to style - ImGuiTableFlags_NoBordersInBodyUntilResize = 1 << 12, // [ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers). -> May move to style + ImGuiTableFlags_NoBordersInBody = 1 << 11, // [ALPHA] Disable vertical borders in columns Body (borders will always appear in Headers). -> May move to style + ImGuiTableFlags_NoBordersInBodyUntilResize = 1 << 12, // [ALPHA] Disable vertical borders in columns Body until hovered for resize (borders will always appear in Headers). -> May move to style // Sizing Policy (read above for defaults) ImGuiTableFlags_SizingFixedFit = 1 << 13, // Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching contents width. ImGuiTableFlags_SizingFixedSame = 2 << 13, // Columns default to _WidthFixed or _WidthAuto (if resizable or not resizable), matching the maximum contents width of all columns. Implicitly enable ImGuiTableFlags_NoKeepColumnsVisible. @@ -1175,24 +1178,18 @@ enum ImGuiTableFlags_ // Clipping ImGuiTableFlags_NoClip = 1 << 20, // Disable clipping rectangle for every individual columns (reduce draw command count, items will be able to overflow into other columns). Generally incompatible with TableSetupScrollFreeze(). // Padding - ImGuiTableFlags_PadOuterX = 1 << 21, // Default if BordersOuterV is on. Enable outer-most padding. Generally desirable if you have headers. - ImGuiTableFlags_NoPadOuterX = 1 << 22, // Default if BordersOuterV is off. Disable outer-most padding. + ImGuiTableFlags_PadOuterX = 1 << 21, // Default if BordersOuterV is on. Enable outermost padding. Generally desirable if you have headers. + ImGuiTableFlags_NoPadOuterX = 1 << 22, // Default if BordersOuterV is off. Disable outermost padding. ImGuiTableFlags_NoPadInnerX = 1 << 23, // Disable inner padding between columns (double inner padding if BordersOuterV is on, single inner padding if BordersOuterV is off). // Scrolling - ImGuiTableFlags_ScrollX = 1 << 24, // Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Changes default sizing policy. Because this create a child window, ScrollY is currently generally recommended when using ScrollX. + ImGuiTableFlags_ScrollX = 1 << 24, // Enable horizontal scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. Changes default sizing policy. Because this creates a child window, ScrollY is currently generally recommended when using ScrollX. ImGuiTableFlags_ScrollY = 1 << 25, // Enable vertical scrolling. Require 'outer_size' parameter of BeginTable() to specify the container size. // Sorting ImGuiTableFlags_SortMulti = 1 << 26, // Hold shift when clicking headers to sort on multiple column. TableGetSortSpecs() may return specs where (SpecsCount > 1). ImGuiTableFlags_SortTristate = 1 << 27, // Allow no sorting, disable default sorting. TableGetSortSpecs() may return specs where (SpecsCount == 0). // [Internal] Combinations and masks - ImGuiTableFlags_SizingMask_ = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_SizingStretchSame - - // Obsolete names (will be removed soon) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - //, ImGuiTableFlags_ColumnsWidthFixed = ImGuiTableFlags_SizingFixedFit, ImGuiTableFlags_ColumnsWidthStretch = ImGuiTableFlags_SizingStretchSame // WIP Tables 2020/12 - //, ImGuiTableFlags_SizingPolicyFixed = ImGuiTableFlags_SizingFixedFit, ImGuiTableFlags_SizingPolicyStretch = ImGuiTableFlags_SizingStretchSame // WIP Tables 2021/01 -#endif + ImGuiTableFlags_SizingMask_ = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_SizingStretchSame, }; // Flags for ImGui::TableSetupColumn() @@ -1229,19 +1226,14 @@ enum ImGuiTableColumnFlags_ ImGuiTableColumnFlags_WidthMask_ = ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_WidthFixed, ImGuiTableColumnFlags_IndentMask_ = ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_IndentDisable, ImGuiTableColumnFlags_StatusMask_ = ImGuiTableColumnFlags_IsEnabled | ImGuiTableColumnFlags_IsVisible | ImGuiTableColumnFlags_IsSorted | ImGuiTableColumnFlags_IsHovered, - ImGuiTableColumnFlags_NoDirectResize_ = 1 << 30 // [Internal] Disable user resizing this column directly (it may however we resized indirectly from its left edge) - - // Obsolete names (will be removed soon) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - //ImGuiTableColumnFlags_WidthAuto = ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_NoResize, // Column will not stretch and keep resizing based on submitted contents. -#endif + ImGuiTableColumnFlags_NoDirectResize_ = 1 << 30, // [Internal] Disable user resizing this column directly (it may however we resized indirectly from its left edge) }; // Flags for ImGui::TableNextRow() enum ImGuiTableRowFlags_ { - ImGuiTableRowFlags_None = 0, - ImGuiTableRowFlags_Headers = 1 << 0 // Identify header row (set default background color + width of its contents accounted different for auto column width) + ImGuiTableRowFlags_None = 0, + ImGuiTableRowFlags_Headers = 1 << 0, // Identify header row (set default background color + width of its contents accounted differently for auto column width) }; // Enum for ImGui::TableSetBgColor() @@ -1249,16 +1241,16 @@ enum ImGuiTableRowFlags_ // - Layer 0: draw with RowBg0 color if set, otherwise draw with ColumnBg0 if set. // - Layer 1: draw with RowBg1 color if set, otherwise draw with ColumnBg1 if set. // - Layer 2: draw with CellBg color if set. -// The purpose of the two row/columns layers is to let you decide if a background color changes should override or blend with the existing color. +// The purpose of the two row/columns layers is to let you decide if a background color change should override or blend with the existing color. // When using ImGuiTableFlags_RowBg on the table, each row has the RowBg0 color automatically set for odd/even rows. // If you set the color of RowBg0 target, your color will override the existing RowBg0 color. // If you set the color of RowBg1 or ColumnBg1 target, your color will blend over the RowBg0 color. enum ImGuiTableBgTarget_ { - ImGuiTableBgTarget_None = 0, - ImGuiTableBgTarget_RowBg0 = 1, // Set row background color 0 (generally used for background, automatically set when ImGuiTableFlags_RowBg is used) - ImGuiTableBgTarget_RowBg1 = 2, // Set row background color 1 (generally used for selection marking) - ImGuiTableBgTarget_CellBg = 3 // Set cell background color (top-most color) + ImGuiTableBgTarget_None = 0, + ImGuiTableBgTarget_RowBg0 = 1, // Set row background color 0 (generally used for background, automatically set when ImGuiTableFlags_RowBg is used) + ImGuiTableBgTarget_RowBg1 = 2, // Set row background color 1 (generally used for selection marking) + ImGuiTableBgTarget_CellBg = 3, // Set cell background color (top-most color) }; // Flags for ImGui::IsWindowFocused() @@ -1270,7 +1262,7 @@ enum ImGuiFocusedFlags_ ImGuiFocusedFlags_AnyWindow = 1 << 2, // Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ! ImGuiFocusedFlags_NoPopupHierarchy = 1 << 3, // Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow) //ImGuiFocusedFlags_DockHierarchy = 1 << 4, // Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow) - ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows + ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows, }; // Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered() @@ -1289,8 +1281,14 @@ enum ImGuiHoveredFlags_ ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 7, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns. ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 8, // IsItemHovered() only: Return true even if the position is obstructed or overlapped by another window ImGuiHoveredFlags_AllowWhenDisabled = 1 << 9, // IsItemHovered() only: Return true even if the item is disabled + ImGuiHoveredFlags_NoNavOverride = 1 << 10, // Disable using gamepad/keyboard navigation state when active, always query mouse. ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped, - ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows + ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows, + + // Hovering delays (for tooltips) + ImGuiHoveredFlags_DelayNormal = 1 << 11, // Return true after io.HoverDelayNormal elapsed (~0.30 sec) + ImGuiHoveredFlags_DelayShort = 1 << 12, // Return true after io.HoverDelayShort elapsed (~0.10 sec) + ImGuiHoveredFlags_NoSharedDelay = 1 << 13, // Disable shared delay system where moving from one item to the next keeps the previous timer for a short time (standard for tooltips with long delays) }; // Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload() @@ -1298,8 +1296,8 @@ enum ImGuiDragDropFlags_ { ImGuiDragDropFlags_None = 0, // BeginDragDropSource() flags - ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // 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. - ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item. + ImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0, // Disable preview tooltip. By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disables this behavior. + ImGuiDragDropFlags_SourceNoDisableHover = 1 << 1, // By default, when dragging we clear data so that IsItemHovered() will return false, to avoid subsequent user code submitting tooltips. This flag disables this behavior so you can still call IsItemHovered() on the source item. ImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2, // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item. ImGuiDragDropFlags_SourceAllowNullID = 1 << 3, // 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. ImGuiDragDropFlags_SourceExtern = 1 << 4, // External source (from outside of dear imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously. @@ -1308,7 +1306,7 @@ enum ImGuiDragDropFlags_ ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10, // 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. ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11, // Do not draw the default highlight rectangle when hovering over target. ImGuiDragDropFlags_AcceptNoPreviewTooltip = 1 << 12, // Request hiding the BeginDragDropSource tooltip from the BeginDragDropTarget site. - ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect // For peeking ahead and inspecting the payload before delivery. + ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect, // For peeking ahead and inspecting the payload before delivery. }; // Standard Drag and Drop payload types. You can define you own payload types using short strings. Types starting with '_' are defined by Dear ImGui. @@ -1350,10 +1348,16 @@ enum ImGuiSortDirection_ ImGuiSortDirection_Descending = 2 // Descending = 9->0, Z->A etc. }; -// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array -enum ImGuiKey_ +// A key identifier (ImGuiKey_XXX or ImGuiMod_XXX value): can represent Keyboard, Mouse and Gamepad values. +// All our named keys are >= 512. Keys value 0 to 511 are left unused as legacy native/opaque key values (< 1.87). +// Since >= 1.89 we increased typing (went from int to enum), some legacy code may need a cast to ImGuiKey. +// Read details about the 1.87 and 1.89 transition : https://github.com/ocornut/imgui/issues/4921 +// Note that "Keys" related to physical keys and are not the same concept as input "Characters", the later are submitted via io.AddInputCharacter(). +enum ImGuiKey : int { - ImGuiKey_Tab, + // Keyboard + ImGuiKey_None = 0, + ImGuiKey_Tab = 512, // == ImGuiKey_NamedKey_BEGIN ImGuiKey_LeftArrow, ImGuiKey_RightArrow, ImGuiKey_UpArrow, @@ -1368,74 +1372,138 @@ enum ImGuiKey_ ImGuiKey_Space, ImGuiKey_Enter, ImGuiKey_Escape, - ImGuiKey_KeyPadEnter, - ImGuiKey_A, // for text edit CTRL+A: select all - ImGuiKey_C, // for text edit CTRL+C: copy - ImGuiKey_V, // for text edit CTRL+V: paste - ImGuiKey_X, // for text edit CTRL+X: cut - ImGuiKey_Y, // for text edit CTRL+Y: redo - ImGuiKey_Z, // for text edit CTRL+Z: undo - ImGuiKey_COUNT -}; - -// To test io.KeyMods (which is a combination of individual fields io.KeyCtrl, io.KeyShift, io.KeyAlt set by user/backend) -enum ImGuiKeyModFlags_ -{ - ImGuiKeyModFlags_None = 0, - ImGuiKeyModFlags_Ctrl = 1 << 0, - ImGuiKeyModFlags_Shift = 1 << 1, - ImGuiKeyModFlags_Alt = 1 << 2, - ImGuiKeyModFlags_Super = 1 << 3 -}; - -// Gamepad/Keyboard navigation -// Keyboard: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays. -// Gamepad: Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable. Backend: set ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). Note that io.NavInputs[] is cleared by EndFrame(). -// Read instructions in imgui.cpp for more details. Download PNG/PSD at http://dearimgui.org/controls_sheets. -enum ImGuiNavInput_ -{ - // Gamepad Mapping - ImGuiNavInput_Activate, // activate / open / toggle / tweak value // e.g. Cross (PS4), A (Xbox), A (Switch), Space (Keyboard) - ImGuiNavInput_Cancel, // cancel / close / exit // e.g. Circle (PS4), B (Xbox), B (Switch), Escape (Keyboard) - ImGuiNavInput_Input, // text input / on-screen keyboard // e.g. Triang.(PS4), Y (Xbox), X (Switch), Return (Keyboard) - ImGuiNavInput_Menu, // tap: toggle menu / hold: focus, move, resize // e.g. Square (PS4), X (Xbox), Y (Switch), Alt (Keyboard) - ImGuiNavInput_DpadLeft, // move / tweak / resize window (w/ PadMenu) // e.g. D-pad Left/Right/Up/Down (Gamepads), Arrow keys (Keyboard) - ImGuiNavInput_DpadRight, // - ImGuiNavInput_DpadUp, // - ImGuiNavInput_DpadDown, // - ImGuiNavInput_LStickLeft, // scroll / move window (w/ PadMenu) // e.g. Left Analog Stick Left/Right/Up/Down - ImGuiNavInput_LStickRight, // - ImGuiNavInput_LStickUp, // - ImGuiNavInput_LStickDown, // - ImGuiNavInput_FocusPrev, // next window (w/ PadMenu) // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) - ImGuiNavInput_FocusNext, // prev window (w/ PadMenu) // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) - ImGuiNavInput_TweakSlow, // slower tweaks // e.g. L1 or L2 (PS4), LB or LT (Xbox), L or ZL (Switch) - ImGuiNavInput_TweakFast, // faster tweaks // e.g. R1 or R2 (PS4), RB or RT (Xbox), R or ZL (Switch) - - // [Internal] Don't use directly! This is used internally to differentiate keyboard from gamepad inputs for behaviors that require to differentiate them. - // Keyboard behavior that have no corresponding gamepad mapping (e.g. CTRL+TAB) will be directly reading from io.KeysDown[] instead of io.NavInputs[]. - ImGuiNavInput_KeyLeft_, // move left // = Arrow keys - ImGuiNavInput_KeyRight_, // move right - ImGuiNavInput_KeyUp_, // move up - ImGuiNavInput_KeyDown_, // move down + ImGuiKey_LeftCtrl, ImGuiKey_LeftShift, ImGuiKey_LeftAlt, ImGuiKey_LeftSuper, + ImGuiKey_RightCtrl, ImGuiKey_RightShift, ImGuiKey_RightAlt, ImGuiKey_RightSuper, + ImGuiKey_Menu, + ImGuiKey_0, ImGuiKey_1, ImGuiKey_2, ImGuiKey_3, ImGuiKey_4, ImGuiKey_5, ImGuiKey_6, ImGuiKey_7, ImGuiKey_8, ImGuiKey_9, + ImGuiKey_A, ImGuiKey_B, ImGuiKey_C, ImGuiKey_D, ImGuiKey_E, ImGuiKey_F, ImGuiKey_G, ImGuiKey_H, ImGuiKey_I, ImGuiKey_J, + ImGuiKey_K, ImGuiKey_L, ImGuiKey_M, ImGuiKey_N, ImGuiKey_O, ImGuiKey_P, ImGuiKey_Q, ImGuiKey_R, ImGuiKey_S, ImGuiKey_T, + ImGuiKey_U, ImGuiKey_V, ImGuiKey_W, ImGuiKey_X, ImGuiKey_Y, ImGuiKey_Z, + ImGuiKey_F1, ImGuiKey_F2, ImGuiKey_F3, ImGuiKey_F4, ImGuiKey_F5, ImGuiKey_F6, + ImGuiKey_F7, ImGuiKey_F8, ImGuiKey_F9, ImGuiKey_F10, ImGuiKey_F11, ImGuiKey_F12, + ImGuiKey_Apostrophe, // ' + ImGuiKey_Comma, // , + ImGuiKey_Minus, // - + ImGuiKey_Period, // . + ImGuiKey_Slash, // / + ImGuiKey_Semicolon, // ; + ImGuiKey_Equal, // = + ImGuiKey_LeftBracket, // [ + ImGuiKey_Backslash, // \ (this text inhibit multiline comment caused by backslash) + ImGuiKey_RightBracket, // ] + ImGuiKey_GraveAccent, // ` + ImGuiKey_CapsLock, + ImGuiKey_ScrollLock, + ImGuiKey_NumLock, + ImGuiKey_PrintScreen, + ImGuiKey_Pause, + ImGuiKey_Keypad0, ImGuiKey_Keypad1, ImGuiKey_Keypad2, ImGuiKey_Keypad3, ImGuiKey_Keypad4, + ImGuiKey_Keypad5, ImGuiKey_Keypad6, ImGuiKey_Keypad7, ImGuiKey_Keypad8, ImGuiKey_Keypad9, + ImGuiKey_KeypadDecimal, + ImGuiKey_KeypadDivide, + ImGuiKey_KeypadMultiply, + ImGuiKey_KeypadSubtract, + ImGuiKey_KeypadAdd, + ImGuiKey_KeypadEnter, + ImGuiKey_KeypadEqual, + + // Gamepad (some of those are analog values, 0.0f to 1.0f) // NAVIGATION ACTION + // (download controller mapping PNG/PSD at http://dearimgui.com/controls_sheets) + ImGuiKey_GamepadStart, // Menu (Xbox) + (Switch) Start/Options (PS) + ImGuiKey_GamepadBack, // View (Xbox) - (Switch) Share (PS) + ImGuiKey_GamepadFaceLeft, // X (Xbox) Y (Switch) Square (PS) // Tap: Toggle Menu. Hold: Windowing mode (Focus/Move/Resize windows) + ImGuiKey_GamepadFaceRight, // B (Xbox) A (Switch) Circle (PS) // Cancel / Close / Exit + ImGuiKey_GamepadFaceUp, // Y (Xbox) X (Switch) Triangle (PS) // Text Input / On-screen Keyboard + ImGuiKey_GamepadFaceDown, // A (Xbox) B (Switch) Cross (PS) // Activate / Open / Toggle / Tweak + ImGuiKey_GamepadDpadLeft, // D-pad Left // Move / Tweak / Resize Window (in Windowing mode) + ImGuiKey_GamepadDpadRight, // D-pad Right // Move / Tweak / Resize Window (in Windowing mode) + ImGuiKey_GamepadDpadUp, // D-pad Up // Move / Tweak / Resize Window (in Windowing mode) + ImGuiKey_GamepadDpadDown, // D-pad Down // Move / Tweak / Resize Window (in Windowing mode) + ImGuiKey_GamepadL1, // L Bumper (Xbox) L (Switch) L1 (PS) // Tweak Slower / Focus Previous (in Windowing mode) + ImGuiKey_GamepadR1, // R Bumper (Xbox) R (Switch) R1 (PS) // Tweak Faster / Focus Next (in Windowing mode) + ImGuiKey_GamepadL2, // L Trig. (Xbox) ZL (Switch) L2 (PS) [Analog] + ImGuiKey_GamepadR2, // R Trig. (Xbox) ZR (Switch) R2 (PS) [Analog] + ImGuiKey_GamepadL3, // L Stick (Xbox) L3 (Switch) L3 (PS) + ImGuiKey_GamepadR3, // R Stick (Xbox) R3 (Switch) R3 (PS) + ImGuiKey_GamepadLStickLeft, // [Analog] // Move Window (in Windowing mode) + ImGuiKey_GamepadLStickRight, // [Analog] // Move Window (in Windowing mode) + ImGuiKey_GamepadLStickUp, // [Analog] // Move Window (in Windowing mode) + ImGuiKey_GamepadLStickDown, // [Analog] // Move Window (in Windowing mode) + ImGuiKey_GamepadRStickLeft, // [Analog] + ImGuiKey_GamepadRStickRight, // [Analog] + ImGuiKey_GamepadRStickUp, // [Analog] + ImGuiKey_GamepadRStickDown, // [Analog] + + // Aliases: Mouse Buttons (auto-submitted from AddMouseButtonEvent() calls) + // - This is mirroring the data also written to io.MouseDown[], io.MouseWheel, in a format allowing them to be accessed via standard key API. + ImGuiKey_MouseLeft, ImGuiKey_MouseRight, ImGuiKey_MouseMiddle, ImGuiKey_MouseX1, ImGuiKey_MouseX2, ImGuiKey_MouseWheelX, ImGuiKey_MouseWheelY, + + // [Internal] Reserved for mod storage + ImGuiKey_ReservedForModCtrl, ImGuiKey_ReservedForModShift, ImGuiKey_ReservedForModAlt, ImGuiKey_ReservedForModSuper, + ImGuiKey_COUNT, + + // Keyboard Modifiers (explicitly submitted by backend via AddKeyEvent() calls) + // - This is mirroring the data also written to io.KeyCtrl, io.KeyShift, io.KeyAlt, io.KeySuper, in a format allowing + // them to be accessed via standard key API, allowing calls such as IsKeyPressed(), IsKeyReleased(), querying duration etc. + // - Code polling every key (e.g. an interface to detect a key press for input mapping) might want to ignore those + // and prefer using the real keys (e.g. ImGuiKey_LeftCtrl, ImGuiKey_RightCtrl instead of ImGuiMod_Ctrl). + // - In theory the value of keyboard modifiers should be roughly equivalent to a logical or of the equivalent left/right keys. + // In practice: it's complicated; mods are often provided from different sources. Keyboard layout, IME, sticky keys and + // backends tend to interfere and break that equivalence. The safer decision is to relay that ambiguity down to the end-user... + ImGuiMod_None = 0, + ImGuiMod_Ctrl = 1 << 12, // Ctrl + ImGuiMod_Shift = 1 << 13, // Shift + ImGuiMod_Alt = 1 << 14, // Option/Menu + ImGuiMod_Super = 1 << 15, // Cmd/Super/Windows + ImGuiMod_Shortcut = 1 << 11, // Alias for Ctrl (non-macOS) _or_ Super (macOS). + ImGuiMod_Mask_ = 0xF800, // 5-bits + + // [Internal] Prior to 1.87 we required user to fill io.KeysDown[512] using their own native index + the io.KeyMap[] array. + // We are ditching this method but keeping a legacy path for user code doing e.g. IsKeyPressed(MY_NATIVE_KEY_CODE) + // If you need to iterate all keys (for e.g. an input mapper) you may use ImGuiKey_NamedKey_BEGIN..ImGuiKey_NamedKey_END. + ImGuiKey_NamedKey_BEGIN = 512, + ImGuiKey_NamedKey_END = ImGuiKey_COUNT, + ImGuiKey_NamedKey_COUNT = ImGuiKey_NamedKey_END - ImGuiKey_NamedKey_BEGIN, +#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO + ImGuiKey_KeysData_SIZE = ImGuiKey_NamedKey_COUNT, // Size of KeysData[]: only hold named keys + ImGuiKey_KeysData_OFFSET = ImGuiKey_NamedKey_BEGIN, // Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET) index. +#else + ImGuiKey_KeysData_SIZE = ImGuiKey_COUNT, // Size of KeysData[]: hold legacy 0..512 keycodes + named keys + ImGuiKey_KeysData_OFFSET = 0, // Accesses to io.KeysData[] must use (key - ImGuiKey_KeysData_OFFSET) index. +#endif + +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + ImGuiKey_ModCtrl = ImGuiMod_Ctrl, ImGuiKey_ModShift = ImGuiMod_Shift, ImGuiKey_ModAlt = ImGuiMod_Alt, ImGuiKey_ModSuper = ImGuiMod_Super, // Renamed in 1.89 + ImGuiKey_KeyPadEnter = ImGuiKey_KeypadEnter, // Renamed in 1.87 +#endif +}; + +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO +// OBSOLETED in 1.88 (from July 2022): ImGuiNavInput and io.NavInputs[]. +// Official backends between 1.60 and 1.86: will keep working and feed gamepad inputs as long as IMGUI_DISABLE_OBSOLETE_KEYIO is not set. +// Custom backends: feed gamepad inputs via io.AddKeyEvent() and ImGuiKey_GamepadXXX enums. +enum ImGuiNavInput +{ + ImGuiNavInput_Activate, ImGuiNavInput_Cancel, ImGuiNavInput_Input, ImGuiNavInput_Menu, ImGuiNavInput_DpadLeft, ImGuiNavInput_DpadRight, ImGuiNavInput_DpadUp, ImGuiNavInput_DpadDown, + ImGuiNavInput_LStickLeft, ImGuiNavInput_LStickRight, ImGuiNavInput_LStickUp, ImGuiNavInput_LStickDown, ImGuiNavInput_FocusPrev, ImGuiNavInput_FocusNext, ImGuiNavInput_TweakSlow, ImGuiNavInput_TweakFast, ImGuiNavInput_COUNT, - ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyLeft_ }; +#endif // Configuration flags stored in io.ConfigFlags. Set by user/application. enum ImGuiConfigFlags_ { ImGuiConfigFlags_None = 0, - ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. NewFrame() will automatically fill io.NavInputs[] based on io.KeysDown[]. - ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. This is mostly to instruct your imgui backend to fill io.NavInputs[]. Backend also needs to set ImGuiBackendFlags_HasGamepad. + ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, // Master keyboard navigation enable flag. Enable full Tabbing + directional arrows + space/enter to activate. + ImGuiConfigFlags_NavEnableGamepad = 1 << 1, // Master gamepad navigation enable flag. Backend also needs to set ImGuiBackendFlags_HasGamepad. ImGuiConfigFlags_NavEnableSetMousePos = 1 << 2, // Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward. Will update io.MousePos and set io.WantSetMousePos=true. If enabled you MUST honor io.WantSetMousePos requests in your backend, otherwise ImGui will react as if the mouse is jumping around back and forth. ImGuiConfigFlags_NavNoCaptureKeyboard = 1 << 3, // Instruct navigation to not set the io.WantCaptureKeyboard flag when io.NavActive is set. ImGuiConfigFlags_NoMouse = 1 << 4, // Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information set by the backend. ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, // Instruct backend to not alter mouse cursor shape and visibility. Use if the backend cursor changes are interfering with yours and you don't want to use SetMouseCursor() to change mouse cursor. You may want to honor requests from imgui by reading GetMouseCursor() yourself instead. - // User storage (to allow your backend/engine to communicate to code that may be shared between multiple projects. Those flags are not used by core Dear ImGui) + // User storage (to allow your backend/engine to communicate to code that may be shared between multiple projects. Those flags are NOT used by core Dear ImGui) ImGuiConfigFlags_IsSRGB = 1 << 20, // Application is SRGB-aware. - ImGuiConfigFlags_IsTouchScreen = 1 << 21 // Application is using a touch screen instead of a mouse. + ImGuiConfigFlags_IsTouchScreen = 1 << 21, // Application is using a touch screen instead of a mouse. }; // Backend capabilities flags stored in io.BackendFlags. Set by imgui_impl_xxx or custom backend. @@ -1445,7 +1513,7 @@ enum ImGuiBackendFlags_ ImGuiBackendFlags_HasGamepad = 1 << 0, // Backend Platform supports gamepad and currently has one connected. ImGuiBackendFlags_HasMouseCursors = 1 << 1, // Backend Platform supports honoring GetMouseCursor() value to change the OS cursor shape. ImGuiBackendFlags_HasSetMousePos = 1 << 2, // Backend Platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set). - ImGuiBackendFlags_RendererHasVtxOffset = 1 << 3 // Backend Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices. + ImGuiBackendFlags_RendererHasVtxOffset = 1 << 3, // Backend Renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices. }; // Enumeration for PushStyleColor() / PopStyleColor() @@ -1481,10 +1549,10 @@ enum ImGuiCol_ ImGuiCol_Separator, ImGuiCol_SeparatorHovered, ImGuiCol_SeparatorActive, - ImGuiCol_ResizeGrip, + ImGuiCol_ResizeGrip, // Resize grip in lower-right and lower-left corners of windows. ImGuiCol_ResizeGripHovered, ImGuiCol_ResizeGripActive, - ImGuiCol_Tab, + ImGuiCol_Tab, // TabItem in a TabBar ImGuiCol_TabHovered, ImGuiCol_TabActive, ImGuiCol_TabUnfocused, @@ -1499,7 +1567,7 @@ enum ImGuiCol_ ImGuiCol_TableRowBg, // Table row background (even rows) ImGuiCol_TableRowBgAlt, // Table row background (odd rows) ImGuiCol_TextSelectedBg, - ImGuiCol_DragDropTarget, + ImGuiCol_DragDropTarget, // Rectangle highlighting a drop target ImGuiCol_NavHighlight, // Gamepad/keyboard: current highlighted item ImGuiCol_NavWindowingHighlight, // Highlight window when using CTRL+TAB ImGuiCol_NavWindowingDimBg, // Darken/colorize entire screen behind the CTRL+TAB window list, when active @@ -1511,7 +1579,7 @@ enum ImGuiCol_ // - The enum only refers to fields of ImGuiStyle which makes sense to be pushed/popped inside UI code. // During initialization or between frames, feel free to just poke into ImGuiStyle directly. // - Tip: Use your programming IDE navigation facilities on the names in the _second column_ below to find the actual members and their description. -// In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. +// In Visual Studio IDE: CTRL+comma ("Edit.GoToAll") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments. // - When changing this enum, you need to update the associated internal table GStyleVarInfo[] accordingly. This is where we link enum values to members offset/type. enum ImGuiStyleVar_ @@ -1542,6 +1610,9 @@ enum ImGuiStyleVar_ ImGuiStyleVar_TabRounding, // float TabRounding ImGuiStyleVar_ButtonTextAlign, // ImVec2 ButtonTextAlign ImGuiStyleVar_SelectableTextAlign, // ImVec2 SelectableTextAlign + ImGuiStyleVar_SeparatorTextBorderSize,// float SeparatorTextBorderSize + ImGuiStyleVar_SeparatorTextAlign, // ImVec2 SeparatorTextAlign + ImGuiStyleVar_SeparatorTextPadding,// ImVec2 SeparatorTextPadding ImGuiStyleVar_COUNT }; @@ -1555,7 +1626,7 @@ enum ImGuiButtonFlags_ // [Internal] ImGuiButtonFlags_MouseButtonMask_ = ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight | ImGuiButtonFlags_MouseButtonMiddle, - ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft + ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft, }; // Flags for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton() @@ -1596,16 +1667,15 @@ enum ImGuiColorEditFlags_ ImGuiColorEditFlags_DisplayMask_ = ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_DisplayHex, ImGuiColorEditFlags_DataTypeMask_ = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_Float, ImGuiColorEditFlags_PickerMask_ = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar, - ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV + ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV, - // Obsolete names (will be removed) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - , ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex // [renamed in 1.69] -#endif + // Obsolete names + //ImGuiColorEditFlags_RGB = ImGuiColorEditFlags_DisplayRGB, ImGuiColorEditFlags_HSV = ImGuiColorEditFlags_DisplayHSV, ImGuiColorEditFlags_HEX = ImGuiColorEditFlags_DisplayHex // [renamed in 1.69] }; // Flags for DragFloat(), DragInt(), SliderFloat(), SliderInt() etc. // We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them. +// (Those are per-item flags. There are shared flags in ImGuiIO: io.ConfigDragClickToInputText) enum ImGuiSliderFlags_ { ImGuiSliderFlags_None = 0, @@ -1613,12 +1683,10 @@ enum ImGuiSliderFlags_ ImGuiSliderFlags_Logarithmic = 1 << 5, // Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits. ImGuiSliderFlags_NoRoundToFormat = 1 << 6, // Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits) ImGuiSliderFlags_NoInput = 1 << 7, // Disable CTRL+Click or Enter key allowing to input text directly into the widget - ImGuiSliderFlags_InvalidMask_ = 0x7000000F // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed. + ImGuiSliderFlags_InvalidMask_ = 0x7000000F, // [Internal] We treat using those bits as being potentially a 'float power' argument from the previous API that has got miscast to this enum, and will trigger an assert if needed. - // Obsolete names (will be removed) -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - , ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp // [renamed in 1.79] -#endif + // Obsolete names + //ImGuiSliderFlags_ClampOnInput = ImGuiSliderFlags_AlwaysClamp, // [renamed in 1.79] }; // Identify a mouse button. @@ -1639,7 +1707,7 @@ enum ImGuiMouseCursor_ ImGuiMouseCursor_Arrow = 0, ImGuiMouseCursor_TextInput, // When hovering over InputText, etc. ImGuiMouseCursor_ResizeAll, // (Unused by Dear ImGui functions) - ImGuiMouseCursor_ResizeNS, // When hovering over an horizontal border + ImGuiMouseCursor_ResizeNS, // When hovering over a horizontal border ImGuiMouseCursor_ResizeEW, // When hovering over a vertical border or a column ImGuiMouseCursor_ResizeNESW, // When hovering over the bottom-left corner of a window ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window @@ -1648,16 +1716,28 @@ enum ImGuiMouseCursor_ ImGuiMouseCursor_COUNT }; +// Enumeration for AddMouseSourceEvent() actual source of Mouse Input data. +// Historically we use "Mouse" terminology everywhere to indicate pointer data, e.g. MousePos, IsMousePressed(), io.AddMousePosEvent() +// But that "Mouse" data can come from different source which occasionally may be useful for application to know about. +// You can submit a change of pointer type using io.AddMouseSourceEvent(). +enum ImGuiMouseSource : int +{ + ImGuiMouseSource_Mouse = 0, // Input is coming from an actual mouse. + ImGuiMouseSource_TouchScreen, // Input is coming from a touch screen (no hovering prior to initial press, less precise initial press aiming, dual-axis wheeling possible). + ImGuiMouseSource_Pen, // Input is coming from a pressure/magnetic pen (often used in conjunction with high-sampling rates). + ImGuiMouseSource_COUNT +}; + // Enumeration for ImGui::SetWindow***(), SetNextWindow***(), SetNextItem***() functions // Represent a condition. // Important: Treat as a regular enum! Do NOT combine multiple values using binary operators! All the functions above treat 0 as a shortcut to ImGuiCond_Always. enum ImGuiCond_ { ImGuiCond_None = 0, // No condition (always set the variable), same as _Always - ImGuiCond_Always = 1 << 0, // No condition (always set the variable) + ImGuiCond_Always = 1 << 0, // No condition (always set the variable), same as _None ImGuiCond_Once = 1 << 1, // Set the variable once per runtime session (only the first call will succeed) ImGuiCond_FirstUseEver = 1 << 2, // Set the variable if the object/window has no persistently saved data (no entry in .ini file) - ImGuiCond_Appearing = 1 << 3 // Set the variable if the object/window is appearing after being hidden/inactive (or the first time) + ImGuiCond_Appearing = 1 << 3, // Set the variable if the object/window is appearing after being hidden/inactive (or the first time) }; //----------------------------------------------------------------------------- @@ -1706,7 +1786,7 @@ struct ImVector // Constructors, destructor inline ImVector() { Size = Capacity = 0; Data = NULL; } inline ImVector(const ImVector& src) { Size = Capacity = 0; Data = NULL; operator=(src); } - inline ImVector& operator=(const ImVector& src) { clear(); resize(src.Size); memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; } + inline ImVector& operator=(const ImVector& src) { clear(); resize(src.Size); if (src.Data) memcpy(Data, src.Data, (size_t)Size * sizeof(T)); return *this; } inline ~ImVector() { if (Data) IM_FREE(Data); } // Important: does not destruct anything inline void clear() { if (Data) { Size = Capacity = 0; IM_FREE(Data); Data = NULL; } } // Important: does not destruct anything @@ -1736,13 +1816,14 @@ struct ImVector inline void resize(int new_size, const T& v) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) memcpy(&Data[n], &v, sizeof(v)); Size = new_size; } inline void shrink(int new_size) { IM_ASSERT(new_size <= Size); Size = new_size; } // Resize a vector to a smaller size, guaranteed not to cause a reallocation inline void reserve(int new_capacity) { if (new_capacity <= Capacity) return; T* new_data = (T*)IM_ALLOC((size_t)new_capacity * sizeof(T)); if (Data) { memcpy(new_data, Data, (size_t)Size * sizeof(T)); IM_FREE(Data); } Data = new_data; Capacity = new_capacity; } + inline void reserve_discard(int new_capacity) { if (new_capacity <= Capacity) return; if (Data) IM_FREE(Data); Data = (T*)IM_ALLOC((size_t)new_capacity * sizeof(T)); Capacity = new_capacity; } // NB: It is illegal to call push_back/push_front/insert with a reference pointing inside the ImVector data itself! e.g. v.push_back(v[10]) is forbidden. inline void push_back(const T& v) { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); memcpy(&Data[Size], &v, sizeof(v)); Size++; } inline void pop_back() { IM_ASSERT(Size > 0); Size--; } inline void push_front(const T& v) { if (Size == 0) push_back(v); else insert(Data, v); } inline T* erase(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(T)); Size--; return Data + off; } - inline T* erase(const T* it, const T* it_last){ IM_ASSERT(it >= Data && it < Data + Size && it_last > it && it_last <= Data + Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - (size_t)count) * sizeof(T)); Size -= (int)count; return Data + off; } + inline T* erase(const T* it, const T* it_last){ IM_ASSERT(it >= Data && it < Data + Size && it_last >= it && it_last <= Data + Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - (size_t)count) * sizeof(T)); Size -= (int)count; return Data + off; } inline T* erase_unsorted(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; if (it < Data + Size - 1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; } inline T* insert(const T* it, const T& v) { IM_ASSERT(it >= Data && it <= Data + Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; } inline bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; } @@ -1769,7 +1850,7 @@ struct ImGuiStyle ImVec2 WindowPadding; // Padding within a window. float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows. Large values tend to lead to variety of artifacts and are not recommended. float WindowBorderSize; // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly). - ImVec2 WindowMinSize; // Minimum window size. This is a global setting. If you want to constraint individual windows, use SetNextWindowSizeConstraints(). + ImVec2 WindowMinSize; // Minimum window size. This is a global setting. If you want to constrain individual windows, use SetNextWindowSizeConstraints(). ImVec2 WindowTitleAlign; // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered. ImGuiDir WindowMenuButtonPosition; // Side of the collapsing/docking button in the title bar (None/Left/Right). Defaults to ImGuiDir_Left. float ChildRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows. @@ -1792,15 +1873,18 @@ struct ImGuiStyle float LogSliderDeadzone; // The size in pixels of the dead-zone around zero on logarithmic sliders that cross zero. float TabRounding; // Radius of upper corners of a tab. Set to 0.0f to have rectangular tabs. float TabBorderSize; // Thickness of border around tabs. - float TabMinWidthForCloseButton; // Minimum width for close button to appears on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected. + float TabMinWidthForCloseButton; // Minimum width for close button to appear on an unselected tab when hovered. Set to 0.0f to always show when hovering, set to FLT_MAX to never show close button unless selected. ImGuiDir ColorButtonPosition; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right. ImVec2 ButtonTextAlign; // Alignment of button text when button is larger than text. Defaults to (0.5f, 0.5f) (centered). ImVec2 SelectableTextAlign; // Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line. + float SeparatorTextBorderSize; // Thickkness of border in SeparatorText() + ImVec2 SeparatorTextAlign; // Alignment of text within the separator. Defaults to (0.0f, 0.5f) (left aligned, center). + ImVec2 SeparatorTextPadding; // Horizontal offset of text from each edge of the separator + spacing on other axis. Generally small values. .y is recommended to be == FramePadding.y. ImVec2 DisplayWindowPadding; // Window position are clamped to be visible within the display area or monitors by at least this amount. Only applies to regular windows. ImVec2 DisplaySafeAreaPadding; // If you cannot see the edges of your screen (e.g. on a TV) increase the safe area padding. Apply to popups/tooltips as well regular windows. NB: Prefer configuring your TV sets correctly! float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). May be removed later. bool AntiAliasedLines; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList). - bool AntiAliasedLinesUseTex; // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering. Latched at the beginning of the frame (copied to ImDrawList). + bool AntiAliasedLinesUseTex; // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). Latched at the beginning of the frame (copied to ImDrawList). bool AntiAliasedFill; // Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList). float CurveTessellationTol; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. float CircleTessellationMaxError; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. @@ -1817,26 +1901,37 @@ struct ImGuiStyle // Access via ImGui::GetIO(). Read 'Programmer guide' section in .cpp file for general usage. //----------------------------------------------------------------------------- +// [Internal] Storage used by IsKeyDown(), IsKeyPressed() etc functions. +// If prior to 1.87 you used io.KeysDownDuration[] (which was marked as internal), you should use GetKeyData(key)->DownDuration and *NOT* io.KeysData[key]->DownDuration. +struct ImGuiKeyData +{ + bool Down; // True for if key is down + float DownDuration; // Duration the key has been down (<0.0f: not pressed, 0.0f: just pressed, >0.0f: time held) + float DownDurationPrev; // Last frame duration the key has been down + float AnalogValue; // 0.0f..1.0f for gamepad values +}; + struct ImGuiIO { //------------------------------------------------------------------ - // Configuration (fill once) // Default value + // Configuration // Default value //------------------------------------------------------------------ ImGuiConfigFlags ConfigFlags; // = 0 // See ImGuiConfigFlags_ enum. Set by user/application. Gamepad/keyboard navigation options, etc. ImGuiBackendFlags BackendFlags; // = 0 // See ImGuiBackendFlags_ enum. Set by backend (imgui_impl_xxx files or custom backend) to communicate features supported by the backend. - ImVec2 DisplaySize; // // Main display size, in pixels (generally == GetMainViewport()->Size) - float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds. + ImVec2 DisplaySize; // // Main display size, in pixels (generally == GetMainViewport()->Size). May change every frame. + float DeltaTime; // = 1.0f/60.0f // Time elapsed since last frame, in seconds. May change every frame. float IniSavingRate; // = 5.0f // Minimum time between saving positions/sizes to .ini file, in seconds. const char* IniFilename; // = "imgui.ini" // Path to .ini file (important: default "imgui.ini" is relative to current working dir!). Set NULL to disable automatic .ini loading/saving or if you want to manually call LoadIniSettingsXXX() / SaveIniSettingsXXX() functions. const char* LogFilename; // = "imgui_log.txt"// Path to .log file (default parameter to ImGui::LogToFile when no file is specified). float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds. float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels. float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging. - int KeyMap[ImGuiKey_COUNT]; // // Map of indices into the KeysDown[512] entries array which represent your "native" keyboard state. - float KeyRepeatDelay; // = 0.250f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). + float KeyRepeatDelay; // = 0.275f // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.). float KeyRepeatRate; // = 0.050f // When holding a key/button, rate at which it repeats, in seconds. - void* UserData; // = NULL // Store your own data for retrieval by callbacks. + float HoverDelayNormal; // = 0.30 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayNormal) returns true. + float HoverDelayShort; // = 0.10 sec // Delay on hovering before IsItemHovered(ImGuiHoveredFlags_DelayShort) returns true. + void* UserData; // = NULL // Store your own data. ImFontAtlas*Fonts; // // Font atlas: load, rasterize and pack one or more fonts into a single texture. float FontGlobalScale; // = 1.0f // Global scale all fonts @@ -1847,12 +1942,22 @@ struct ImGuiIO // Miscellaneous options bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations. bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl. + bool ConfigInputTrickleEventQueue; // = true // Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates. bool ConfigInputTextCursorBlink; // = true // Enable blinking cursor (optional as some users consider it to be distracting). + bool ConfigInputTextEnterKeepActive; // = false // [BETA] Pressing Enter will keep item active and select contents (single-line only). bool ConfigDragClickToInputText; // = false // [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard. bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag) bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar. float ConfigMemoryCompactTimer; // = 60.0f // Timer (in seconds) to free transient windows/tables memory buffers when unused. Set to -1.0f to disable. + // Debug options + // - tools to test correct Begin/End and BeginChild/EndChild behaviors. + // - presently Begn()/End() and BeginChild()EndChild() needs to ALWAYS be called in tandem, regardless of return value of BeginXXX() + // this is inconsistent with other BeginXXX functions and create confusion for many users. + // - we expect to update the API eventually. In the meanwhile we provided tools to facilitate checking user-code behavior. + bool ConfigDebugBeginReturnValueOnce; // = false // First-time calls to Begin()/BeginChild() will return false. NEEDS TO BE SET AT APPLICATION BOOT TIME if you don't want to miss windows. + bool ConfigDebugBeginReturnValueLoop; // = false // Some calls to Begin()/BeginChild() will return false. Will cycle through window depths then repeat. Suggested use: add "io.ConfigDebugBeginReturnValue = io.KeyShift" in your main loop then occasionally press SHIFT. Windows should be flickering while running. + //------------------------------------------------------------------ // Platform Functions // (the imgui_impl_xxxx backend files are setting those up for you) @@ -1873,31 +1978,33 @@ struct ImGuiIO // Optional: Notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME on Windows) // (default to use native imm32 api on Windows) - void (*ImeSetInputScreenPosFn)(int x, int y); - void* ImeWindowHandle; // = NULL // (Windows) Set this to your HWND to get automatic IME cursor positioning. + void (*SetPlatformImeDataFn)(ImGuiViewport* viewport, ImGuiPlatformImeData* data); +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + void* ImeWindowHandle; // = NULL // [Obsolete] Set ImGuiViewport::PlatformHandleRaw instead. Set this to your HWND to get automatic IME cursor positioning. +#else + void* _UnusedPadding; // Unused field to keep data structure the same size. +#endif //------------------------------------------------------------------ - // Input - Fill before calling NewFrame() + // Input - Call before calling NewFrame() //------------------------------------------------------------------ - ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) - bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. - float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text. - float MouseWheelH; // Mouse wheel Horizontal. Most users don't have a mouse with an horizontal wheel, may not be filled by all backends. - bool KeyCtrl; // Keyboard modifier pressed: Control - bool KeyShift; // Keyboard modifier pressed: Shift - bool KeyAlt; // Keyboard modifier pressed: Alt - bool KeySuper; // Keyboard modifier pressed: Cmd/Super/Windows - bool KeysDown[512]; // Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys). - float NavInputs[ImGuiNavInput_COUNT]; // Gamepad inputs. Cleared back to zero by EndFrame(). Keyboard keys will be auto-mapped and be written here by NewFrame(). - - // Functions - IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input - IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate - IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string - IMGUI_API void AddFocusEvent(bool focused); // Notifies Dear ImGui when hosting platform windows lose or gain input focus - IMGUI_API void ClearInputCharacters(); // [Internal] Clear the text input buffer manually - IMGUI_API void ClearInputKeys(); // [Internal] Release all keys + // Input Functions + IMGUI_API void AddKeyEvent(ImGuiKey key, bool down); // Queue a new key down/up event. Key should be "translated" (as in, generally ImGuiKey_A matches the key end-user would use to emit an 'A' character) + IMGUI_API void AddKeyAnalogEvent(ImGuiKey key, bool down, float v); // Queue a new key down/up event for analog values (e.g. ImGuiKey_Gamepad_ values). Dead-zones should be handled by the backend. + IMGUI_API void AddMousePosEvent(float x, float y); // Queue a mouse position update. Use -FLT_MAX,-FLT_MAX to signify no mouse (e.g. app not focused and not hovered) + IMGUI_API void AddMouseButtonEvent(int button, bool down); // Queue a mouse button change + IMGUI_API void AddMouseWheelEvent(float wheel_x, float wheel_y); // Queue a mouse wheel update. wheel_y<0: scroll down, wheel_y>0: scroll up, wheel_x<0: scroll right, wheel_x>0: scroll left. + IMGUI_API void AddMouseSourceEvent(ImGuiMouseSource source); // Queue a mouse source change (Mouse/TouchScreen/Pen) + IMGUI_API void AddFocusEvent(bool focused); // Queue a gain/loss of focus for the application (generally based on OS/platform focus of your window) + IMGUI_API void AddInputCharacter(unsigned int c); // Queue a new character input + IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue a new character input from a UTF-16 character, it can be a surrogate + IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue a new characters input from a UTF-8 string + + IMGUI_API void SetKeyEventNativeData(ImGuiKey key, int native_keycode, int native_scancode, int native_legacy_index = -1); // [Optional] Specify index for legacy <1.87 IsKeyXXX() functions with native indices + specify native keycode, scancode. + IMGUI_API void SetAppAcceptingEvents(bool accepting_events); // Set master flag for accepting key/mouse/text events (default to true). Useful if you have native dialog boxes that are interrupting your application loop/refresh, and you want to disable events being queued while your app is frozen. + IMGUI_API void ClearInputCharacters(); // [Internal] Clear the text input buffer manually + IMGUI_API void ClearInputKeys(); // [Internal] Release all keys //------------------------------------------------------------------ // Output - Updated by NewFrame() or EndFrame()/Render() @@ -1905,50 +2012,74 @@ struct ImGuiIO // generally easier and more correct to use their state BEFORE calling NewFrame(). See FAQ for details!) //------------------------------------------------------------------ - bool WantCaptureMouse; // Set when Dear ImGui will use mouse inputs, in this case do not dispatch them to your main game/application (either way, always pass on mouse inputs to imgui). (e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.). - bool WantCaptureKeyboard; // Set when Dear ImGui will use keyboard inputs, in this case do not dispatch them to your main game/application (either way, always pass keyboard inputs to imgui). (e.g. InputText active, or an imgui window is focused and navigation is enabled, etc.). - bool WantTextInput; // Mobile/console: when set, you may display an on-screen keyboard. This is set by Dear ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active). - bool WantSetMousePos; // MousePos has been altered, backend should reposition mouse on next frame. Rarely used! Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled. - bool WantSaveIniSettings; // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving! - bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag. - bool NavVisible; // Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events). - float Framerate; // Rough estimate of application framerate, in frame per second. Solely for convenience. Rolling average estimation based on io.DeltaTime over 120 frames. - int MetricsRenderVertices; // Vertices output during last call to Render() - int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3 - int MetricsRenderWindows; // Number of visible windows - int MetricsActiveWindows; // Number of active windows - int MetricsActiveAllocations; // Number of active allocations, updated by MemAlloc/MemFree based on current context. May be off if you have multiple imgui contexts. - ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. + bool WantCaptureMouse; // Set when Dear ImGui will use mouse inputs, in this case do not dispatch them to your main game/application (either way, always pass on mouse inputs to imgui). (e.g. unclicked mouse is hovering over an imgui window, widget is active, mouse was clicked over an imgui window, etc.). + bool WantCaptureKeyboard; // Set when Dear ImGui will use keyboard inputs, in this case do not dispatch them to your main game/application (either way, always pass keyboard inputs to imgui). (e.g. InputText active, or an imgui window is focused and navigation is enabled, etc.). + bool WantTextInput; // Mobile/console: when set, you may display an on-screen keyboard. This is set by Dear ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active). + bool WantSetMousePos; // MousePos has been altered, backend should reposition mouse on next frame. Rarely used! Set only when ImGuiConfigFlags_NavEnableSetMousePos flag is enabled. + bool WantSaveIniSettings; // When manual .ini load/save is active (io.IniFilename == NULL), this will be set to notify your application that you can call SaveIniSettingsToMemory() and save yourself. Important: clear io.WantSaveIniSettings yourself after saving! + bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag. + bool NavVisible; // Keyboard/Gamepad navigation is visible and allowed (will handle ImGuiKey_NavXXX events). + float Framerate; // Estimate of application framerate (rolling average over 60 frames, based on io.DeltaTime), in frame per second. Solely for convenience. Slow applications may not want to use a moving average or may want to reset underlying buffers occasionally. + int MetricsRenderVertices; // Vertices output during last call to Render() + int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3 + int MetricsRenderWindows; // Number of visible windows + int MetricsActiveWindows; // Number of active windows + int MetricsActiveAllocations; // Number of active allocations, updated by MemAlloc/MemFree based on current context. May be off if you have multiple imgui contexts. + ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. + + // Legacy: before 1.87, we required backend to fill io.KeyMap[] (imgui->native map) during initialization and io.KeysDown[] (native indices) every frame. + // This is still temporarily supported as a legacy feature. However the new preferred scheme is for backend to call io.AddKeyEvent(). + // Old (<1.87): ImGui::IsKeyPressed(ImGui::GetIO().KeyMap[ImGuiKey_Space]) --> New (1.87+) ImGui::IsKeyPressed(ImGuiKey_Space) +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + int KeyMap[ImGuiKey_COUNT]; // [LEGACY] Input: map of indices into the KeysDown[512] entries array which represent your "native" keyboard state. The first 512 are now unused and should be kept zero. Legacy backend will write into KeyMap[] using ImGuiKey_ indices which are always >512. + bool KeysDown[ImGuiKey_COUNT]; // [LEGACY] Input: Keyboard keys that are pressed (ideally left in the "native" order your engine has access to keyboard keys, so you can use your own defines/enums for keys). This used to be [512] sized. It is now ImGuiKey_COUNT to allow legacy io.KeysDown[GetKeyIndex(...)] to work without an overflow. + float NavInputs[ImGuiNavInput_COUNT]; // [LEGACY] Since 1.88, NavInputs[] was removed. Backends from 1.60 to 1.86 won't build. Feed gamepad inputs via io.AddKeyEvent() and ImGuiKey_GamepadXXX enums. +#endif //------------------------------------------------------------------ // [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed! //------------------------------------------------------------------ - bool WantCaptureMouseUnlessPopupClose;// Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup. - ImGuiKeyModFlags KeyMods; // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame() - ImGuiKeyModFlags KeyModsPrev; // Previous key mods - ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid) - ImVec2 MouseClickedPos[5]; // Position at time of clicking - double MouseClickedTime[5]; // Time of last click (used to figure out double-click) - bool MouseClicked[5]; // Mouse button went from !Down to Down (same as MouseClickedCount[x] != 0) - bool MouseDoubleClicked[5]; // Has mouse button been double-clicked? (same as MouseClickedCount[x] == 2) - ImU16 MouseClickedCount[5]; // == 0 (not clicked), == 1 (same as MouseClicked[]), == 2 (double-clicked), == 3 (triple-clicked) etc. when going from !Down to Down - ImU16 MouseClickedLastCount[5]; // Count successive number of clicks. Stays valid after mouse release. Reset after another click is done. - bool MouseReleased[5]; // Mouse button went from Down to !Down - bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds. - bool MouseDownOwnedUnlessPopupClose[5];//Track if button was clicked inside a dear imgui window. - float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked) - float MouseDownDurationPrev[5]; // Previous time the mouse button has been down - ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point - float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point - float KeysDownDuration[512]; // Duration the keyboard key has been down (0.0f == just pressed) - float KeysDownDurationPrev[512]; // Previous duration the key has been down - float NavInputsDownDuration[ImGuiNavInput_COUNT]; - float NavInputsDownDurationPrev[ImGuiNavInput_COUNT]; - float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui. - bool AppFocusLost; - ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16 - ImVector InputQueueCharacters; // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper. + ImGuiContext* Ctx; // Parent UI context (needs to be set explicitly by parent). + + // Main Input State + // (this block used to be written by backend, since 1.87 it is best to NOT write to those directly, call the AddXXX functions above instead) + // (reading from those variables is fair game, as they are extremely unlikely to be moving anywhere) + ImVec2 MousePos; // Mouse position, in pixels. Set to ImVec2(-FLT_MAX, -FLT_MAX) if mouse is unavailable (on another screen, etc.) + bool MouseDown[5]; // Mouse buttons: 0=left, 1=right, 2=middle + extras (ImGuiMouseButton_COUNT == 5). Dear ImGui mostly uses left and right buttons. Other buttons allow us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. + float MouseWheel; // Mouse wheel Vertical: 1 unit scrolls about 5 lines text. >0 scrolls Up, <0 scrolls Down. Hold SHIFT to turn vertical scroll into horizontal scroll. + float MouseWheelH; // Mouse wheel Horizontal. >0 scrolls Left, <0 scrolls Right. Most users don't have a mouse with a horizontal wheel, may not be filled by all backends. + ImGuiMouseSource MouseSource; // Mouse actual input peripheral (Mouse/TouchScreen/Pen). + bool KeyCtrl; // Keyboard modifier down: Control + bool KeyShift; // Keyboard modifier down: Shift + bool KeyAlt; // Keyboard modifier down: Alt + bool KeySuper; // Keyboard modifier down: Cmd/Super/Windows + + // Other state maintained from data above + IO function calls + ImGuiKeyChord KeyMods; // Key mods flags (any of ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Alt/ImGuiMod_Super flags, same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags. DOES NOT CONTAINS ImGuiMod_Shortcut which is pretranslated). Read-only, updated by NewFrame() + ImGuiKeyData KeysData[ImGuiKey_KeysData_SIZE]; // Key state for all known keys. Use IsKeyXXX() functions to access this. + bool WantCaptureMouseUnlessPopupClose; // Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup. + ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid) + ImVec2 MouseClickedPos[5]; // Position at time of clicking + double MouseClickedTime[5]; // Time of last click (used to figure out double-click) + bool MouseClicked[5]; // Mouse button went from !Down to Down (same as MouseClickedCount[x] != 0) + bool MouseDoubleClicked[5]; // Has mouse button been double-clicked? (same as MouseClickedCount[x] == 2) + ImU16 MouseClickedCount[5]; // == 0 (not clicked), == 1 (same as MouseClicked[]), == 2 (double-clicked), == 3 (triple-clicked) etc. when going from !Down to Down + ImU16 MouseClickedLastCount[5]; // Count successive number of clicks. Stays valid after mouse release. Reset after another click is done. + bool MouseReleased[5]; // Mouse button went from Down to !Down + bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds. + bool MouseDownOwnedUnlessPopupClose[5]; // Track if button was clicked inside a dear imgui window. + bool MouseWheelRequestAxisSwap; // On a non-Mac system, holding SHIFT requests WheelY to perform the equivalent of a WheelX event. On a Mac system this is already enforced by the system. + float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked) + float MouseDownDurationPrev[5]; // Previous time the mouse button has been down + float MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point (used for moving thresholds) + float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui. + bool AppFocusLost; // Only modify via AddFocusEvent() + bool AppAcceptingEvents; // Only modify via SetAppAcceptingEvents() + ImS8 BackendUsingLegacyKeyArrays; // -1: unknown, 0: using AddKeyEvent(), 1: using legacy io.KeysDown[] + bool BackendUsingLegacyNavInputArray; // 0: using AddKeyAnalogEvent(), 1: writing to legacy io.NavInputs[] directly + ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16() + ImVector InputQueueCharacters; // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper. IMGUI_API ImGuiIO(); }; @@ -1968,6 +2099,7 @@ struct ImGuiIO // - ImGuiInputTextFlags_CallbackResize: Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow. struct ImGuiInputTextCallbackData { + ImGuiContext* Ctx; // Parent UI context ImGuiInputTextFlags EventFlag; // One ImGuiInputTextFlags_Callback* // Read-only ImGuiInputTextFlags Flags; // What user passed to InputText() // Read-only void* UserData; // What user passed to InputText() // Read-only @@ -1999,7 +2131,7 @@ struct ImGuiInputTextCallbackData // NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough. struct ImGuiSizeCallbackData { - void* UserData; // Read-only. What user passed to SetNextWindowSizeConstraints() + void* UserData; // Read-only. What user passed to SetNextWindowSizeConstraints(). Generally store an integer or float in here (need reinterpret_cast<>). ImVec2 Pos; // Read-only. Window position, for reference. ImVec2 CurrentSize; // Read-only. Current window size. ImVec2 DesiredSize; // Read-write. Desired size, based on user's mouse position. Write to this field to restrain resizing. @@ -2052,7 +2184,7 @@ struct ImGuiTableSortSpecs }; //----------------------------------------------------------------------------- -// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, ImColor) +// [SECTION] Helpers (ImGuiOnceUponAFrame, ImGuiTextFilter, ImGuiTextBuffer, ImGuiStorage, ImGuiListClipper, Math Operators, ImColor) //----------------------------------------------------------------------------- // Helper: Unicode defines @@ -2063,7 +2195,7 @@ struct ImGuiTableSortSpecs #define IM_UNICODE_CODEPOINT_MAX 0xFFFF // Maximum Unicode code point supported by this build. #endif -// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame. +// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create a UI within deep-nested code that runs multiple times every frame. // Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame"); struct ImGuiOnceUponAFrame { @@ -2171,7 +2303,7 @@ struct ImGuiStorage }; // Helper: Manually clip large list of items. -// If you have lots evenly spaced items and you have a random access to the list, you can perform coarse +// 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 @@ -2192,6 +2324,7 @@ struct ImGuiStorage // - The clipper also handles various subtleties related to keyboard/gamepad navigation, wrapping etc. struct ImGuiListClipper { + ImGuiContext* Ctx; // Parent UI context int DisplayStart; // First item to display, updated by each call to Step() int DisplayEnd; // End of items to display (exclusive) int ItemsCount; // [Internal] Number of items @@ -2215,7 +2348,35 @@ struct ImGuiListClipper #endif }; +// Helpers: ImVec2/ImVec4 operators +// - It is important that we are keeping those disabled by default so they don't leak in user space. +// - This is in order to allow user enabling implicit cast operators between ImVec2/ImVec4 and their own types (using IM_VEC2_CLASS_EXTRA in imconfig.h) +// - You can use '#define IMGUI_DEFINE_MATH_OPERATORS' to import our operators, provided as a courtesy. +// - We unfortunately don't have a unary- operator for ImVec2 because this would needs to be defined inside the class itself. +#ifdef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS_IMPLEMENTED +IM_MSVC_RUNTIME_CHECKS_OFF +static inline ImVec2 operator*(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x * rhs, lhs.y * rhs); } +static inline ImVec2 operator/(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x / rhs, lhs.y / rhs); } +static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x + rhs.x, lhs.y + rhs.y); } +static inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x - rhs.x, lhs.y - rhs.y); } +static inline ImVec2 operator*(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); } +static inline ImVec2 operator/(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x / rhs.x, lhs.y / rhs.y); } +static inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; } +static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; } +static inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; } +static inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; } +static inline ImVec2& operator*=(ImVec2& lhs, const ImVec2& rhs) { lhs.x *= rhs.x; lhs.y *= rhs.y; return lhs; } +static inline ImVec2& operator/=(ImVec2& lhs, const ImVec2& rhs) { lhs.x /= rhs.x; lhs.y /= rhs.y; return lhs; } +static inline ImVec4 operator+(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z, lhs.w + rhs.w); } +static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z, lhs.w - rhs.w); } +static inline ImVec4 operator*(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z, lhs.w * rhs.w); } +IM_MSVC_RUNTIME_CHECKS_RESTORE +#endif + // Helpers macros to generate 32-bit encoded colors +// User can declare their own format by #defining the 5 _SHIFT/_MASK macros in their imconfig file. +#ifndef IM_COL32_R_SHIFT #ifdef IMGUI_USE_BGRA_PACKED_COLOR #define IM_COL32_R_SHIFT 16 #define IM_COL32_G_SHIFT 8 @@ -2229,6 +2390,7 @@ struct ImGuiListClipper #define IM_COL32_A_SHIFT 24 #define IM_COL32_A_MASK 0xFF000000 #endif +#endif #define IM_COL32(R,G,B,A) (((ImU32)(A)<> IM_COL32_R_SHIFT) & 0xFF) * sc; Value.y = (float)((rgba >> IM_COL32_G_SHIFT) & 0xFF) * sc; Value.z = (float)((rgba >> IM_COL32_B_SHIFT) & 0xFF) * sc; Value.w = (float)((rgba >> IM_COL32_A_SHIFT) & 0xFF) * sc; } - ImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; } - ImColor(const ImVec4& col) { Value = col; } inline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); } inline operator ImVec4() const { return Value; } @@ -2283,16 +2445,16 @@ typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* c #define ImDrawCallback_ResetRenderState (ImDrawCallback)(-1) // Typically, 1 command = 1 GPU draw call (unless command is a callback) -// - VtxOffset/IdxOffset: When 'io.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset' is enabled, -// those fields allow us to render meshes larger than 64K vertices while keeping 16-bit indices. -// Pre-1.71 backends will typically ignore the VtxOffset/IdxOffset fields. +// - VtxOffset: When 'io.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset' is enabled, +// this fields allow us to render meshes larger than 64K vertices while keeping 16-bit indices. +// Backends made for <1.71. will typically ignore the VtxOffset fields. // - The ClipRect/TextureId/VtxOffset fields must be contiguous as we memcmp() them together (this is asserted for). struct ImDrawCmd { ImVec4 ClipRect; // 4*4 // Clipping rectangle (x1, y1, x2, y2). Subtract ImDrawData->DisplayPos to get clipping rectangle in "viewport" coordinates ImTextureID TextureId; // 4-8 // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas. unsigned int VtxOffset; // 4 // Start offset in vertex buffer. ImGuiBackendFlags_RendererHasVtxOffset: always 0, otherwise may be >0 to support meshes larger than 64K vertices with 16-bit indices. - unsigned int IdxOffset; // 4 // Start offset in index buffer. Always equal to sum of ElemCount drawn so far. + unsigned int IdxOffset; // 4 // Start offset in index buffer. unsigned int ElemCount; // 4 // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[]. ImDrawCallback UserCallback; // 4-8 // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally. void* UserCallbackData; // 4-8 // The draw callback code can access this. @@ -2314,7 +2476,7 @@ struct ImDrawVert #else // You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h // The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine. -// The type has to be described within the macro (you can either declare the struct or use a typedef). This is because ImVec2/ImU32 are likely not declared a the time you'd want to set your type up. +// The type has to be described within the macro (you can either declare the struct or use a typedef). This is because ImVec2/ImU32 are likely not declared at the time you'd want to set your type up. // NOTE: IMGUI DOESN'T CLEAR THE STRUCTURE AND DOESN'T CALL A CONSTRUCTOR SO ANY CUSTOM FIELD WILL BE UNINITIALIZED. IF YOU ADD EXTRA FIELDS (SUCH AS A 'Z' COORDINATES) YOU WILL NEED TO CLEAR THEM DURING RENDER OR TO IGNORE THEM. IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT; #endif @@ -2369,7 +2531,7 @@ enum ImDrawFlags_ ImDrawFlags_RoundCornersRight = ImDrawFlags_RoundCornersBottomRight | ImDrawFlags_RoundCornersTopRight, ImDrawFlags_RoundCornersAll = ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight, ImDrawFlags_RoundCornersDefault_ = ImDrawFlags_RoundCornersAll, // Default to ALL corners if none of the _RoundCornersXX flags are specified. - ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundCornersAll | ImDrawFlags_RoundCornersNone + ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundCornersAll | ImDrawFlags_RoundCornersNone, }; // Flags for ImDrawList instance. Those are set automatically by ImGui:: functions from ImGuiIO settings, and generally not manipulated directly. @@ -2378,9 +2540,9 @@ enum ImDrawListFlags_ { ImDrawListFlags_None = 0, ImDrawListFlags_AntiAliasedLines = 1 << 0, // Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles) - ImDrawListFlags_AntiAliasedLinesUseTex = 1 << 1, // Enable anti-aliased lines/borders using textures when possible. Require backend to render with bilinear filtering. + ImDrawListFlags_AntiAliasedLinesUseTex = 1 << 1, // Enable anti-aliased lines/borders using textures when possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). ImDrawListFlags_AntiAliasedFill = 1 << 2, // Enable anti-aliased edge around filled shapes (rounded rectangles, circles). - ImDrawListFlags_AllowVtxOffset = 1 << 3 // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled. + ImDrawListFlags_AllowVtxOffset = 1 << 3, // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled. }; // Draw command list @@ -2402,7 +2564,7 @@ struct ImDrawList // [Internal, used while building lists] unsigned int _VtxCurrentIdx; // [Internal] generally == VtxBuffer.Size unless we are past 64K vertices, in which case this gets reset to 0. - const ImDrawListSharedData* _Data; // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context) + ImDrawListSharedData* _Data; // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context) const char* _OwnerName; // Pointer to owner window's name for debugging ImDrawVert* _VtxWritePtr; // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) ImDrawIdx* _IdxWritePtr; // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much) @@ -2414,10 +2576,10 @@ struct ImDrawList float _FringeScale; // [Internal] anti-alias fringe is scaled by this value, this helps to keep things sharp while zooming at vertex buffer content // If you want to create ImDrawList instances, pass them ImGui::GetDrawListSharedData() or create and use your own ImDrawListSharedData (so you can use ImDrawList without ImGui) - ImDrawList(const ImDrawListSharedData* shared_data) { memset(this, 0, sizeof(*this)); _Data = shared_data; } + ImDrawList(ImDrawListSharedData* shared_data) { memset(this, 0, sizeof(*this)); _Data = shared_data; } ~ImDrawList() { _ClearFreeMemory(); } - IMGUI_API void PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) + IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) IMGUI_API void PushClipRectFullScreen(); IMGUI_API void PopClipRect(); IMGUI_API void PushTextureID(ImTextureID texture_id); @@ -2426,11 +2588,12 @@ struct ImDrawList inline ImVec2 GetClipRectMax() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.z, cr.w); } // Primitives + // - Filled shapes must always use clockwise winding order. The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing. // - For rectangular primitives, "p_min" and "p_max" represent the upper-left and lower-right corners. // - For circle primitives, use "num_segments == 0" to automatically calculate tessellation (preferred). // In older versions (until Dear ImGui 1.77) the AddCircle functions defaulted to num_segments == 12. // In future versions we will use textures to provide cheaper and higher-quality circles. - // Use AddNgon() and AddNgonFilled() functions if you need to guaranteed a specific number of sides. + // Use AddNgon() and AddNgonFilled() functions if you need to guarantee a specific number of sides. IMGUI_API void AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness = 1.0f); IMGUI_API void AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0, float thickness = 1.0f); // a: upper-left, b: lower-right (== upper-left + size) IMGUI_API void AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0); // a: upper-left, b: lower-right (== upper-left + size) @@ -2446,7 +2609,7 @@ struct ImDrawList IMGUI_API void AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL); IMGUI_API void AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL); IMGUI_API void AddPolyline(const ImVec2* points, int num_points, ImU32 col, ImDrawFlags flags, float thickness); - IMGUI_API void AddConvexPolyFilled(const ImVec2* points, int num_points, ImU32 col); // Note: Anti-aliased filling requires points to be in clockwise order. + IMGUI_API void AddConvexPolyFilled(const ImVec2* points, int num_points, ImU32 col); IMGUI_API void AddBezierCubic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0); // Cubic Bezier (4 control points) IMGUI_API void AddBezierQuadratic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness, int num_segments = 0); // Quadratic Bezier (3 control points) @@ -2459,10 +2622,11 @@ struct ImDrawList IMGUI_API void AddImageRounded(ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min, const ImVec2& uv_max, ImU32 col, float rounding, ImDrawFlags flags = 0); // Stateful path API, add points then finish with PathFillConvex() or PathStroke() + // - Filled shapes must always use clockwise winding order. The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing. inline void PathClear() { _Path.Size = 0; } inline void PathLineTo(const ImVec2& pos) { _Path.push_back(pos); } inline void PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path.Data[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); } - inline void PathFillConvex(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); _Path.Size = 0; } // Note: Anti-aliased filling requires points to be in clockwise order. + inline void PathFillConvex(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); _Path.Size = 0; } inline void PathStroke(ImU32 col, ImDrawFlags flags = 0, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, flags, thickness); _Path.Size = 0; } IMGUI_API void PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments = 0); IMGUI_API void PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12); // Use precomputed angles for a 12 steps circle @@ -2497,10 +2661,9 @@ struct ImDrawList inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - inline void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0) { AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); } - inline void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0) { PathBezierCubicCurveTo(p2, p3, p4, num_segments); } -#endif + // Obsolete names + //inline void AddBezierCurve(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0) { AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); } // OBSOLETED in 1.80 (Jan 2021) + //inline void PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments = 0) { PathBezierCubicCurveTo(p2, p3, p4, num_segments); } // OBSOLETED in 1.80 (Jan 2021) // [Internal helpers] IMGUI_API void _ResetForNewFrame(); @@ -2552,7 +2715,7 @@ struct ImFontConfig bool PixelSnapH; // false // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1. ImVec2 GlyphExtraSpacing; // 0, 0 // Extra spacing (in pixels) between glyphs. Only X axis is supported for now. ImVec2 GlyphOffset; // 0, 0 // Offset all glyphs from this font input. - const ImWchar* GlyphRanges; // NULL // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. + const ImWchar* GlyphRanges; // NULL // THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE. Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). float GlyphMinAdvanceX; // 0 // Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font float GlyphMaxAdvanceX; // FLT_MAX // Maximum AdvanceX for glyphs bool MergeMode; // false // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights. @@ -2614,7 +2777,7 @@ enum ImFontAtlasFlags_ ImFontAtlasFlags_None = 0, ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, // Don't round the height to next power of two ImFontAtlasFlags_NoMouseCursors = 1 << 1, // Don't build software mouse cursors into the atlas (save a little texture memory) - ImFontAtlasFlags_NoBakedLines = 1 << 2 // Don't build thick line textures into the atlas (save a little texture memory). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU). + ImFontAtlasFlags_NoBakedLines = 1 << 2, // Don't build thick line textures into the atlas (save a little texture memory, allow support for point/nearest filtering). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU). }; // Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding: @@ -2633,7 +2796,7 @@ enum ImFontAtlasFlags_ // - Important: By default, AddFontFromMemoryTTF() takes ownership of the data. Even though we are not writing to it, we will free the pointer on destruction. // You can set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed, // - Even though many functions are suffixed with "TTF", OTF data is supported just as well. -// - This is an old API and it is currently awkward for those and and various other reasons! We will address them in the future! +// - This is an old API and it is currently awkward for those and various other reasons! We will address them in the future! struct ImFontAtlas { IMGUI_API ImFontAtlas(); @@ -2657,7 +2820,7 @@ struct ImFontAtlas IMGUI_API bool Build(); // Build pixels data. This is called automatically for you by the GetTexData*** functions. IMGUI_API void GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 1 byte per-pixel IMGUI_API void GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL); // 4 bytes-per-pixel - bool IsBuilt() const { return Fonts.Size > 0 && TexReady; } // Bit ambiguous: used to detect when user didn't built texture but effectively we should check TexID != 0 except that would be backend dependent... + bool IsBuilt() const { return Fonts.Size > 0 && TexReady; } // Bit ambiguous: used to detect when user didn't build texture but effectively we should check TexID != 0 except that would be backend dependent... void SetTexID(ImTextureID id) { TexID = id; } //------------------------------------------- @@ -2668,6 +2831,7 @@ struct ImFontAtlas // NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8"Hello world" syntax. See FAQ for details. // NB: Consider using ImFontGlyphRangesBuilder to build glyph ranges from textual data. IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin + IMGUI_API const ImWchar* GetGlyphRangesGreek(); // Default + Greek and Coptic IMGUI_API const ImWchar* GetGlyphRangesKorean(); // Default + Korean characters IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 2999 Ideographs IMGUI_API const ImWchar* GetGlyphRangesChineseFull(); // Default + Half-Width + Japanese Hiragana/Katakana + full set of about 21000 CJK Unified Ideographs @@ -2702,8 +2866,9 @@ struct ImFontAtlas ImFontAtlasFlags Flags; // Build flags (see ImFontAtlasFlags_) ImTextureID TexID; // User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure. int TexDesiredWidth; // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height. - int TexGlyphPadding; // Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0. + int TexGlyphPadding; // Padding between glyphs within texture in pixels. Defaults to 1. If your rendering method doesn't rely on bilinear filtering you may set this to 0 (will also need to set AntiAliasedLinesUseTex = false). bool Locked; // Marked as Locked by ImGui::NewFrame() so attempt to modify the atlas will assert. + void* UserData; // Store your own atlas related user-data (if e.g. you have multiple font atlas). // [Internal] // NB: Access texture data via GetTexData*() calls! Which will setup a default font for you. @@ -2728,10 +2893,9 @@ struct ImFontAtlas int PackIdMouseCursors; // Custom texture rectangle ID for white pixel and mouse cursors int PackIdLines; // Custom texture rectangle ID for baked anti-aliased lines -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - typedef ImFontAtlasCustomRect CustomRect; // OBSOLETED in 1.72+ + // [Obsolete] + //typedef ImFontAtlasCustomRect CustomRect; // OBSOLETED in 1.72+ //typedef ImFontGlyphRangesBuilder GlyphRangesBuilder; // OBSOLETED in 1.67+ -#endif }; // Font runtime data and rendering @@ -2753,8 +2917,10 @@ struct ImFont const ImFontConfig* ConfigData; // 4-8 // in // // Pointer within ContainerAtlas->ConfigData short ConfigDataCount; // 2 // in // ~ 1 // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont. ImWchar FallbackChar; // 2 // out // = FFFD/'?' // Character used if a glyph isn't found. - ImWchar EllipsisChar; // 2 // out // = '...' // Character used for ellipsis rendering. - ImWchar DotChar; // 2 // out // = '.' // Character used for ellipsis rendering (if a single '...' character isn't found) + ImWchar EllipsisChar; // 2 // out // = '...'/'.'// Character used for ellipsis rendering. + short EllipsisCharCount; // 1 // out // 1 or 3 + float EllipsisWidth; // 4 // out // Width + float EllipsisCharStep; // 4 // out // Step between characters when EllipsisCount > 0 bool DirtyLookupTables; // 1 // out // float Scale; // 4 // in // = 1.f // Base font scale, multiplied by the per-window font scale which you can adjust with SetWindowFontScale() float Ascent, Descent; // 4+4 // out // // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] @@ -2774,8 +2940,8 @@ struct ImFont // 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable. IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8 IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const; - IMGUI_API void RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const; - IMGUI_API void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const; + IMGUI_API void RenderChar(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, ImWchar c) const; + IMGUI_API void RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const; // [Internal] Don't use! IMGUI_API void BuildLookupTable(); @@ -2797,7 +2963,7 @@ enum ImGuiViewportFlags_ ImGuiViewportFlags_None = 0, ImGuiViewportFlags_IsPlatformWindow = 1 << 0, // Represent a Platform Window ImGuiViewportFlags_IsPlatformMonitor = 1 << 1, // Represent a Platform Monitor (unused yet) - ImGuiViewportFlags_OwnedByApp = 1 << 2 // Platform Window: is created/managed by the application (rather than a dear imgui backend) + ImGuiViewportFlags_OwnedByApp = 1 << 2, // Platform Window: is created/managed by the application (rather than a dear imgui backend) }; // - Currently represents the Platform Window created by the application which is hosting our Dear ImGui windows. @@ -2815,6 +2981,9 @@ struct ImGuiViewport ImVec2 WorkPos; // Work Area: Position of the viewport minus task bars, menus bars, status bars (>= Pos) ImVec2 WorkSize; // Work Area: Size of the viewport minus task bars, menu bars, status bars (<= Size) + // Platform/Backend Dependent Data + void* PlatformHandleRaw; // void* to hold lower-level, platform-native window handle (under Win32 this is expected to be a HWND, unused for other platforms) + ImGuiViewport() { memset(this, 0, sizeof(*this)); } // Helpers @@ -2822,60 +2991,100 @@ struct ImGuiViewport ImVec2 GetWorkCenter() const { return ImVec2(WorkPos.x + WorkSize.x * 0.5f, WorkPos.y + WorkSize.y * 0.5f); } }; +//----------------------------------------------------------------------------- +// [SECTION] Platform Dependent Interfaces +//----------------------------------------------------------------------------- + +// (Optional) Support for IME (Input Method Editor) via the io.SetPlatformImeDataFn() function. +struct ImGuiPlatformImeData +{ + bool WantVisible; // A widget wants the IME to be visible + ImVec2 InputPos; // Position of the input cursor + float InputLineHeight; // Line height + + ImGuiPlatformImeData() { memset(this, 0, sizeof(*this)); } +}; + //----------------------------------------------------------------------------- // [SECTION] Obsolete functions and types // (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for details) // Please keep your copy of dear imgui up to date! Occasionally set '#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS' in imconfig.h to stay ahead. //----------------------------------------------------------------------------- +namespace ImGui +{ +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + IMGUI_API ImGuiKey GetKeyIndex(ImGuiKey key); // map ImGuiKey_* values into legacy native key index. == io.KeyMap[key] +#else + static inline ImGuiKey GetKeyIndex(ImGuiKey key) { IM_ASSERT(key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END && "ImGuiKey and native_index was merged together and native_index is disabled by IMGUI_DISABLE_OBSOLETE_KEYIO. Please switch to ImGuiKey."); return key; } +#endif +} + #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS namespace ImGui { + // OBSOLETED in 1.89.4 (from March 2023) + static inline void PushAllowKeyboardFocus(bool tab_stop) { PushTabStop(tab_stop); } + static inline void PopAllowKeyboardFocus() { PopTabStop(); } + // OBSOLETED in 1.89 (from August 2022) + IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1)); // Use new ImageButton() signature (explicit item id, regular FramePadding) + // OBSOLETED in 1.88 (from May 2022) + static inline void CaptureKeyboardFromApp(bool want_capture_keyboard = true) { SetNextFrameWantCaptureKeyboard(want_capture_keyboard); } // Renamed as name was misleading + removed default value. + static inline void CaptureMouseFromApp(bool want_capture_mouse = true) { SetNextFrameWantCaptureMouse(want_capture_mouse); } // Renamed as name was misleading + removed default value. // OBSOLETED in 1.86 (from November 2021) IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // Calculate coarse clipping for large list of evenly sized items. Prefer using ImGuiListClipper. // OBSOLETED in 1.85 (from August 2021) - static inline float GetWindowContentRegionWidth() { return GetWindowContentRegionMax().x - GetWindowContentRegionMin().x; } + static inline float GetWindowContentRegionWidth() { return GetWindowContentRegionMax().x - GetWindowContentRegionMin().x; } // OBSOLETED in 1.81 (from February 2021) IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // Helper to calculate size from items_count and height_in_items static inline bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) { return BeginListBox(label, size); } - static inline void ListBoxFooter() { EndListBox(); } - // OBSOLETED in 1.79 (from August 2020) - static inline void OpenPopupContextItem(const char* str_id = NULL, ImGuiMouseButton mb = 1) { OpenPopupOnItemClick(str_id, mb); } // Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry! - // OBSOLETED in 1.78 (from June 2020) - // Old drag/sliders functions that took a 'float power = 1.0' argument instead of flags. - // For shared code, you can version check at compile-time with `#if IMGUI_VERSION_NUM >= 17704`. - IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power); - IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power); - static inline bool DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, power); } - static inline bool DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, power); } - static inline bool DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); } - static inline bool DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power) { return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); } - IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power); - IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format, float power); - static inline bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format, float power) { return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); } - static inline bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); } - static inline bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); } - static inline bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power) { return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); } - // OBSOLETED in 1.77 (from June 2020) - static inline bool BeginPopupContextWindow(const char* str_id, ImGuiMouseButton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_items ? 0 : ImGuiPopupFlags_NoOpenOverItems)); } - // OBSOLETED in 1.72 (from April 2019) - static inline void TreeAdvanceToLabelPos() { SetCursorPosX(GetCursorPosX() + GetTreeNodeToLabelSpacing()); } - // OBSOLETED in 1.71 (from June 2019) - static inline void SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { SetNextItemOpen(open, cond); } - // OBSOLETED in 1.70 (from May 2019) - static inline float GetContentRegionAvailWidth() { return GetContentRegionAvail().x; } + static inline void ListBoxFooter() { EndListBox(); } // Some of the older obsolete names along with their replacement (commented out so they are not reported in IDE) - //static inline ImDrawList* GetOverlayDrawList() { return GetForegroundDrawList(); } // OBSOLETED in 1.69 (from Mar 2019) - //static inline void SetScrollHere(float ratio = 0.5f) { SetScrollHereY(ratio); } // OBSOLETED in 1.66 (from Nov 2018) - //static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); } // OBSOLETED in 1.63 (from Aug 2018) - //static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); } // OBSOLETED in 1.60 (from Apr 2018) - //static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } // OBSOLETED in 1.60 (between Dec 2017 and Apr 2018) - //static inline void ShowTestWindow() { return ShowDemoWindow(); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) - //static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) - //static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) - //static inline void SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) - //static inline float GetItemsLineHeightWithSpacing() { return GetFrameHeightWithSpacing(); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) + //-- OBSOLETED in 1.79 (from August 2020) + //static inline void OpenPopupContextItem(const char* str_id = NULL, ImGuiMouseButton mb = 1) { OpenPopupOnItemClick(str_id, mb); } // Bool return value removed. Use IsWindowAppearing() in BeginPopup() instead. Renamed in 1.77, renamed back in 1.79. Sorry! + //-- OBSOLETED in 1.78 (from June 2020): Old drag/sliders functions that took a 'float power > 1.0f' argument instead of ImGuiSliderFlags_Logarithmic. See github.com/ocornut/imgui/issues/3361 for details. + //IMGUI_API bool DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power = 1.0f) // OBSOLETED in 1.78 (from June 2020) + //IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power = 1.0f); // OBSOLETED in 1.78 (from June 2020) + //IMGUI_API bool SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power = 1.0f); // OBSOLETED in 1.78 (from June 2020) + //IMGUI_API bool SliderScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format, float power = 1.0f); // OBSOLETED in 1.78 (from June 2020) + //static inline bool DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* format, float power = 1.0f) { return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) + //static inline bool DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* format, float power = 1.0f) { return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) + //static inline bool DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power = 1.0f) { return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) + //static inline bool DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power = 1.0f) { return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) + //static inline bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) + //static inline bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) + //static inline bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) + //static inline bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power = 1.0f) { return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); } // OBSOLETED in 1.78 (from June 2020) + //-- OBSOLETED in 1.77 and before + //static inline bool BeginPopupContextWindow(const char* str_id, ImGuiMouseButton mb, bool over_items) { return BeginPopupContextWindow(str_id, mb | (over_items ? 0 : ImGuiPopupFlags_NoOpenOverItems)); } // OBSOLETED in 1.77 (from June 2020) + //static inline void TreeAdvanceToLabelPos() { SetCursorPosX(GetCursorPosX() + GetTreeNodeToLabelSpacing()); } // OBSOLETED in 1.72 (from July 2019) + //static inline void SetNextTreeNodeOpen(bool open, ImGuiCond cond = 0) { SetNextItemOpen(open, cond); } // OBSOLETED in 1.71 (from June 2019) + //static inline float GetContentRegionAvailWidth() { return GetContentRegionAvail().x; } // OBSOLETED in 1.70 (from May 2019) + //static inline ImDrawList* GetOverlayDrawList() { return GetForegroundDrawList(); } // OBSOLETED in 1.69 (from Mar 2019) + //static inline void SetScrollHere(float ratio = 0.5f) { SetScrollHereY(ratio); } // OBSOLETED in 1.66 (from Nov 2018) + //static inline bool IsItemDeactivatedAfterChange() { return IsItemDeactivatedAfterEdit(); } // OBSOLETED in 1.63 (from Aug 2018) + //-- OBSOLETED in 1.60 and before + //static inline bool IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); } // OBSOLETED in 1.60 (from Apr 2018) + //static inline bool IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } // OBSOLETED in 1.60 (between Dec 2017 and Apr 2018) + //static inline void ShowTestWindow() { return ShowDemoWindow(); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) + //static inline bool IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) + //static inline bool IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) + //static inline void SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) + //static inline float GetItemsLineHeightWithSpacing() { return GetFrameHeightWithSpacing(); } // OBSOLETED in 1.53 (between Oct 2017 and Dec 2017) + //IMGUI_API bool Begin(char* name, bool* p_open, ImVec2 size_first_use, float bg_alpha = -1.0f, ImGuiWindowFlags flags=0); // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017): Equivalent of using SetNextWindowSize(size, ImGuiCond_FirstUseEver) and SetNextWindowBgAlpha(). + //static inline bool IsRootWindowOrAnyChildHovered() { return IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows); } // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017) + //static inline void AlignFirstTextHeightToWidgets() { AlignTextToFramePadding(); } // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017) + //static inline void SetNextWindowPosCenter(ImGuiCond c=0) { SetNextWindowPos(GetMainViewport()->GetCenter(), c, ImVec2(0.5f,0.5f)); } // OBSOLETED in 1.52 (between Aug 2017 and Oct 2017) + //static inline bool IsItemHoveredRect() { return IsItemHovered(ImGuiHoveredFlags_RectOnly); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017) + //static inline bool IsPosHoveringAnyWindow(const ImVec2&) { IM_ASSERT(0); return false; } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017): This was misleading and partly broken. You probably want to use the io.WantCaptureMouse flag instead. + //static inline bool IsMouseHoveringAnyWindow() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017) + //static inline bool IsMouseHoveringWindow() { return IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); } // OBSOLETED in 1.51 (between Jun 2017 and Aug 2017) + //-- OBSOLETED in 1.50 and before + //static inline bool CollapsingHeader(char* label, const char* str_id, bool framed = true, bool default_open = false) { return CollapsingHeader(label, (default_open ? (1 << 5) : 0)); } // OBSOLETED in 1.49 + //static inline ImFont*GetWindowFont() { return GetFont(); } // OBSOLETED in 1.48 + //static inline float GetWindowFontSize() { return GetFontSize(); } // OBSOLETED in 1.48 + //static inline void SetScrollPosHere() { SetScrollHere(); } // OBSOLETED in 1.42 } // OBSOLETED in 1.82 (from Mars 2021): flags for AddRect(), AddRectFilled(), AddImageRounded(), PathRect() @@ -2891,11 +3100,26 @@ enum ImDrawCornerFlags_ ImDrawCornerFlags_Top = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_TopRight, ImDrawCornerFlags_Bot = ImDrawCornerFlags_BotLeft | ImDrawCornerFlags_BotRight, ImDrawCornerFlags_Left = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotLeft, - ImDrawCornerFlags_Right = ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight + ImDrawCornerFlags_Right = ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight, }; +// RENAMED and MERGED both ImGuiKey_ModXXX and ImGuiModFlags_XXX into ImGuiMod_XXX (from September 2022) +// RENAMED ImGuiKeyModFlags -> ImGuiModFlags in 1.88 (from April 2022). Exceptionally commented out ahead of obscolescence schedule to reduce confusion and because they were not meant to be used in the first place. +typedef ImGuiKeyChord ImGuiModFlags; // == int. We generally use ImGuiKeyChord to mean "a ImGuiKey or-ed with any number of ImGuiMod_XXX value", but you may store only mods in there. +enum ImGuiModFlags_ { ImGuiModFlags_None = 0, ImGuiModFlags_Ctrl = ImGuiMod_Ctrl, ImGuiModFlags_Shift = ImGuiMod_Shift, ImGuiModFlags_Alt = ImGuiMod_Alt, ImGuiModFlags_Super = ImGuiMod_Super }; +//typedef ImGuiKeyChord ImGuiKeyModFlags; // == int +//enum ImGuiKeyModFlags_ { ImGuiKeyModFlags_None = 0, ImGuiKeyModFlags_Ctrl = ImGuiMod_Ctrl, ImGuiKeyModFlags_Shift = ImGuiMod_Shift, ImGuiKeyModFlags_Alt = ImGuiMod_Alt, ImGuiKeyModFlags_Super = ImGuiMod_Super }; + #endif // #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS +// RENAMED IMGUI_DISABLE_METRICS_WINDOW > IMGUI_DISABLE_DEBUG_TOOLS in 1.88 (from June 2022) +#if defined(IMGUI_DISABLE_METRICS_WINDOW) && !defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) && !defined(IMGUI_DISABLE_DEBUG_TOOLS) +#define IMGUI_DISABLE_DEBUG_TOOLS +#endif +#if defined(IMGUI_DISABLE_METRICS_WINDOW) && defined(IMGUI_DISABLE_OBSOLETE_FUNCTIONS) +#error IMGUI_DISABLE_METRICS_WINDOW was renamed to IMGUI_DISABLE_DEBUG_TOOLS, please use new name. +#endif + //----------------------------------------------------------------------------- #if defined(__clang__) diff --git a/Sources/CImGui/imgui/imgui_demo.cpp b/Sources/CImGui/imgui/imgui_demo.cpp index 9cbc503..fc8097c 100644 --- a/Sources/CImGui/imgui/imgui_demo.cpp +++ b/Sources/CImGui/imgui/imgui_demo.cpp @@ -1,18 +1,22 @@ -// dear imgui, v1.86 +// dear imgui, v1.89.5 // (demo code) // Help: -// - Read FAQ at http://dearimgui.org/faq +// - Read FAQ at http://dearimgui.com/faq // - Newcomers, read 'Programmer guide' in imgui.cpp for notes on how to setup Dear ImGui in your codebase. // - Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp. All applications in examples/ are doing that. // Read imgui.cpp for more details, documentation and comments. // Get the latest version at https://github.com/ocornut/imgui +// ------------------------------------------------- +// PLEASE DO NOT REMOVE THIS FILE FROM YOUR PROJECT! +// ------------------------------------------------- // Message to the person tempted to delete this file when integrating Dear ImGui into their codebase: -// Do NOT remove this file from your project! Think again! It is the most useful reference code that you and other -// coders will want to refer to and call. Have the ImGui::ShowDemoWindow() function wired in an always-available -// debug menu of your game/app! Removing this file from your project is hindering access to documentation for everyone -// in your team, likely leading you to poorer usage of the library. +// Think again! It is the most useful reference code that you and other coders will want to refer to and call. +// Have the ImGui::ShowDemoWindow() function wired in an always-available debug menu of your game/app! +// Also include Metrics! ItemPicker! DebugLog! and other debug features. +// Removing this file from your project is hindering access to documentation for everyone in your team, +// likely leading you to poorer usage of the library. // Everything in this file will be stripped out by the linker if you don't call ImGui::ShowDemoWindow(). // If you want to link core Dear ImGui in your shipped builds but want a thorough guarantee that the demo will not be // linked, you can setup your imconfig.h with #define IMGUI_DISABLE_DEMO_WINDOWS and those functions will be empty. @@ -34,27 +38,30 @@ // - We try to declare static variables in the local scope, as close as possible to the code using them. // - We never use any of the helpers/facilities used internally by Dear ImGui, unless available in the public API. // - We never use maths operators on ImVec2/ImVec4. For our other sources files we use them, and they are provided -// by imgui_internal.h using the IMGUI_DEFINE_MATH_OPERATORS define. For your own sources file they are optional +// by imgui.h using the IMGUI_DEFINE_MATH_OPERATORS define. For your own sources file they are optional // and require you either enable those, either provide your own via IM_VEC2_CLASS_EXTRA in imconfig.h. // Because we can't assume anything about your support of maths operators, we cannot use them in imgui_demo.cpp. // Navigating this file: -// - In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. +// - In Visual Studio IDE: CTRL+comma ("Edit.GoToAll") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // - With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments. /* Index of this file: -// [SECTION] Forward Declarations, Helpers +// [SECTION] Forward Declarations +// [SECTION] Helpers // [SECTION] Demo Window / ShowDemoWindow() +// - ShowDemoWindow() // - sub section: ShowDemoWindowWidgets() // - sub section: ShowDemoWindowLayout() // - sub section: ShowDemoWindowPopups() // - sub section: ShowDemoWindowTables() -// - sub section: ShowDemoWindowMisc() +// - sub section: ShowDemoWindowInputs() // [SECTION] About Window / ShowAboutWindow() // [SECTION] Style Editor / ShowStyleEditor() +// [SECTION] User Guide / ShowUserGuide() // [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar() // [SECTION] Example App: Debug Console / ShowExampleAppConsole() // [SECTION] Example App: Debug Log / ShowExampleAppLog() @@ -92,8 +99,9 @@ Index of this file: // Visual Studio warnings #ifdef _MSC_VER +#pragma warning (disable: 4127) // condition expression is constant #pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen -#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2). +#pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to an 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2). #endif // Clang/GCC warnings with -Weverything @@ -185,14 +193,26 @@ static void ShowExampleAppWindowTitles(bool* p_open); static void ShowExampleAppCustomRendering(bool* p_open); static void ShowExampleMenuFile(); +// We split the contents of the big ShowDemoWindow() function into smaller functions +// (because the link time of very large functions grow non-linearly) +static void ShowDemoWindowWidgets(); +static void ShowDemoWindowLayout(); +static void ShowDemoWindowPopups(); +static void ShowDemoWindowTables(); +static void ShowDemoWindowColumns(); +static void ShowDemoWindowInputs(); + +//----------------------------------------------------------------------------- +// [SECTION] Helpers +//----------------------------------------------------------------------------- + // Helper to display a little (?) mark which shows a tooltip when hovered. // In your own code you may want to display an actual icon if you are using a merged icon fonts (see docs/FONTS.md) static void HelpMarker(const char* desc) { ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered()) + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort) && ImGui::BeginTooltip()) { - ImGui::BeginTooltip(); ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f); ImGui::TextUnformatted(desc); ImGui::PopTextWrapPos(); @@ -200,79 +220,38 @@ static void HelpMarker(const char* desc) } } -// Helper to wire demo markers located in code to a interactive browser +// Helper to wire demo markers located in code to an interactive browser typedef void (*ImGuiDemoMarkerCallback)(const char* file, int line, const char* section, void* user_data); -extern ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback; -extern void* GImGuiDemoMarkerCallbackUserData; -ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback = NULL; -void* GImGuiDemoMarkerCallbackUserData = NULL; +extern ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback; +extern void* GImGuiDemoMarkerCallbackUserData; +ImGuiDemoMarkerCallback GImGuiDemoMarkerCallback = NULL; +void* GImGuiDemoMarkerCallbackUserData = NULL; #define IMGUI_DEMO_MARKER(section) do { if (GImGuiDemoMarkerCallback != NULL) GImGuiDemoMarkerCallback(__FILE__, __LINE__, section, GImGuiDemoMarkerCallbackUserData); } while (0) -// Helper to display basic user controls. -void ImGui::ShowUserGuide() -{ - ImGuiIO& io = ImGui::GetIO(); - ImGui::BulletText("Double-click on title bar to collapse window."); - ImGui::BulletText( - "Click and drag on lower corner to resize window\n" - "(double-click to auto fit window to its contents)."); - ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text."); - ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields."); - ImGui::BulletText("CTRL+Tab to select a window."); - if (io.FontAllowUserScaling) - ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents."); - ImGui::BulletText("While inputing text:\n"); - ImGui::Indent(); - ImGui::BulletText("CTRL+Left/Right to word jump."); - ImGui::BulletText("CTRL+A or double-click to select all."); - ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste."); - ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo."); - ImGui::BulletText("ESCAPE to revert."); - ImGui::BulletText("You can apply arithmetic operators +,*,/ on numerical values.\nUse +- to subtract."); - ImGui::Unindent(); - ImGui::BulletText("With keyboard navigation enabled:"); - ImGui::Indent(); - ImGui::BulletText("Arrow keys to navigate."); - ImGui::BulletText("Space to activate a widget."); - ImGui::BulletText("Return to input text into a widget."); - ImGui::BulletText("Escape to deactivate a widget, close popup, exit child window."); - ImGui::BulletText("Alt to jump to the menu layer of a window."); - ImGui::Unindent(); -} - //----------------------------------------------------------------------------- // [SECTION] Demo Window / ShowDemoWindow() //----------------------------------------------------------------------------- +// - ShowDemoWindow() // - ShowDemoWindowWidgets() // - ShowDemoWindowLayout() // - ShowDemoWindowPopups() // - ShowDemoWindowTables() // - ShowDemoWindowColumns() -// - ShowDemoWindowMisc() +// - ShowDemoWindowInputs() //----------------------------------------------------------------------------- -// We split the contents of the big ShowDemoWindow() function into smaller functions -// (because the link time of very large functions grow non-linearly) -static void ShowDemoWindowWidgets(); -static void ShowDemoWindowLayout(); -static void ShowDemoWindowPopups(); -static void ShowDemoWindowTables(); -static void ShowDemoWindowColumns(); -static void ShowDemoWindowMisc(); - // Demonstrate most Dear ImGui features (this is big function!) // You may execute this function to experiment with the UI and understand what it does. // You may then search for keywords in the code when you are interested by a specific feature. void ImGui::ShowDemoWindow(bool* p_open) { // Exceptionally add an extra assert here for people confused about initial Dear ImGui setup - // Most ImGui functions would normally just crash if the context is missing. + // Most functions would normally just crash if the context is missing. IM_ASSERT(ImGui::GetCurrentContext() != NULL && "Missing dear imgui context. Refer to examples app!"); // Examples Apps (accessible from the "Examples" menu) static bool show_app_main_menu_bar = false; static bool show_app_documents = false; - static bool show_app_console = false; static bool show_app_log = false; static bool show_app_layout = false; @@ -287,7 +266,6 @@ void ImGui::ShowDemoWindow(bool* p_open) if (show_app_main_menu_bar) ShowExampleAppMainMenuBar(); if (show_app_documents) ShowExampleAppDocuments(&show_app_documents); - if (show_app_console) ShowExampleAppConsole(&show_app_console); if (show_app_log) ShowExampleAppLog(&show_app_log); if (show_app_layout) ShowExampleAppLayout(&show_app_layout); @@ -300,15 +278,21 @@ void ImGui::ShowDemoWindow(bool* p_open) if (show_app_window_titles) ShowExampleAppWindowTitles(&show_app_window_titles); if (show_app_custom_rendering) ShowExampleAppCustomRendering(&show_app_custom_rendering); - // Dear ImGui Apps (accessible from the "Tools" menu) + // Dear ImGui Tools/Apps (accessible from the "Tools" menu) static bool show_app_metrics = false; + static bool show_app_debug_log = false; static bool show_app_stack_tool = false; - static bool show_app_style_editor = false; static bool show_app_about = false; + static bool show_app_style_editor = false; - if (show_app_metrics) { ImGui::ShowMetricsWindow(&show_app_metrics); } - if (show_app_stack_tool) { ImGui::ShowStackToolWindow(&show_app_stack_tool); } - if (show_app_about) { ImGui::ShowAboutWindow(&show_app_about); } + if (show_app_metrics) + ImGui::ShowMetricsWindow(&show_app_metrics); + if (show_app_debug_log) + ImGui::ShowDebugLogWindow(&show_app_debug_log); + if (show_app_stack_tool) + ImGui::ShowStackToolWindow(&show_app_stack_tool); + if (show_app_about) + ImGui::ShowAboutWindow(&show_app_about); if (show_app_style_editor) { ImGui::Begin("Dear ImGui Style Editor", &show_app_style_editor); @@ -357,10 +341,8 @@ void ImGui::ShowDemoWindow(bool* p_open) } // Most "big" widgets share a common width settings by default. See 'Demo->Layout->Widgets Width' for details. - // e.g. Use 2/3 of the space for widgets and 1/3 for labels (right align) //ImGui::PushItemWidth(-ImGui::GetWindowWidth() * 0.35f); - // e.g. Leave a fixed amount of width for labels (by passing a negative value), the rest goes to widgets. ImGui::PushItemWidth(ImGui::GetFontSize() * -12); @@ -395,10 +377,14 @@ void ImGui::ShowDemoWindow(bool* p_open) if (ImGui::BeginMenu("Tools")) { IMGUI_DEMO_MARKER("Menu/Tools"); -#ifndef IMGUI_DISABLE_METRICS_WINDOW - ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics); - ImGui::MenuItem("Stack Tool", NULL, &show_app_stack_tool); +#ifndef IMGUI_DISABLE_DEBUG_TOOLS + const bool has_debug_tools = true; +#else + const bool has_debug_tools = false; #endif + ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics, has_debug_tools); + ImGui::MenuItem("Debug Log", NULL, &show_app_debug_log, has_debug_tools); + ImGui::MenuItem("Stack Tool", NULL, &show_app_stack_tool, has_debug_tools); ImGui::MenuItem("Style Editor", NULL, &show_app_style_editor); ImGui::MenuItem("About Dear ImGui", NULL, &show_app_about); ImGui::EndMenu(); @@ -406,7 +392,7 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::EndMenuBar(); } - ImGui::Text("dear imgui says hello. (%s)", IMGUI_VERSION); + ImGui::Text("dear imgui says hello! (%s) (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM); ImGui::Spacing(); IMGUI_DEMO_MARKER("Help"); @@ -423,7 +409,7 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::BulletText("See the ShowDemoWindow() code in imgui_demo.cpp. <- you are here!"); ImGui::BulletText("See comments in imgui.cpp."); ImGui::BulletText("See example applications in the examples/ folder."); - ImGui::BulletText("Read the FAQ at http://www.dearimgui.org/faq/"); + ImGui::BulletText("Read the FAQ at http://www.dearimgui.com/faq/"); ImGui::BulletText("Set 'io.ConfigFlags |= NavEnableKeyboard' for keyboard controls."); ImGui::BulletText("Set 'io.ConfigFlags |= NavEnableGamepad' for gamepad controls."); ImGui::Separator(); @@ -439,6 +425,7 @@ void ImGui::ShowDemoWindow(bool* p_open) if (ImGui::TreeNode("Configuration##2")) { + ImGui::SeparatorText("General"); ImGui::CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", &io.ConfigFlags, ImGuiConfigFlags_NavEnableKeyboard); ImGui::SameLine(); HelpMarker("Enable keyboard controls."); ImGui::CheckboxFlags("io.ConfigFlags: NavEnableGamepad", &io.ConfigFlags, ImGuiConfigFlags_NavEnableGamepad); @@ -454,23 +441,39 @@ void ImGui::ShowDemoWindow(bool* p_open) ImGui::SameLine(); ImGui::Text("<>"); } - if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Space))) + if (ImGui::IsKeyPressed(ImGuiKey_Space)) io.ConfigFlags &= ~ImGuiConfigFlags_NoMouse; } ImGui::CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", &io.ConfigFlags, ImGuiConfigFlags_NoMouseCursorChange); ImGui::SameLine(); HelpMarker("Instruct backend to not alter mouse cursor shape and visibility."); + ImGui::Checkbox("io.ConfigInputTrickleEventQueue", &io.ConfigInputTrickleEventQueue); + ImGui::SameLine(); HelpMarker("Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates."); + ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor); + ImGui::SameLine(); HelpMarker("Instruct Dear ImGui to render a mouse cursor itself. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something)."); + + ImGui::SeparatorText("Widgets"); ImGui::Checkbox("io.ConfigInputTextCursorBlink", &io.ConfigInputTextCursorBlink); - ImGui::SameLine(); HelpMarker("Enable blinking cursor (optional as some users consider it to be distracting)"); + ImGui::SameLine(); HelpMarker("Enable blinking cursor (optional as some users consider it to be distracting)."); + ImGui::Checkbox("io.ConfigInputTextEnterKeepActive", &io.ConfigInputTextEnterKeepActive); + ImGui::SameLine(); HelpMarker("Pressing Enter will keep item active and select contents (single-line only)."); ImGui::Checkbox("io.ConfigDragClickToInputText", &io.ConfigDragClickToInputText); ImGui::SameLine(); HelpMarker("Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving)."); ImGui::Checkbox("io.ConfigWindowsResizeFromEdges", &io.ConfigWindowsResizeFromEdges); ImGui::SameLine(); HelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback."); ImGui::Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", &io.ConfigWindowsMoveFromTitleBarOnly); - ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor); - ImGui::SameLine(); HelpMarker("Instruct Dear ImGui to render a mouse cursor itself. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something)."); + ImGui::Checkbox("io.ConfigMacOSXBehaviors", &io.ConfigMacOSXBehaviors); ImGui::Text("Also see Style->Rendering for rendering options."); + + ImGui::SeparatorText("Debug"); + ImGui::BeginDisabled(); + ImGui::Checkbox("io.ConfigDebugBeginReturnValueOnce", &io.ConfigDebugBeginReturnValueOnce); // . + ImGui::EndDisabled(); + ImGui::SameLine(); HelpMarker("First calls to Begin()/BeginChild() will return false.\n\nTHIS OPTION IS DISABLED because it needs to be set at application boot-time to make sense. Showing the disabled option is a way to make this feature easier to discover"); + ImGui::Checkbox("io.ConfigDebugBeginReturnValueLoop", &io.ConfigDebugBeginReturnValueLoop); + ImGui::SameLine(); HelpMarker("Some calls to Begin()/BeginChild() will return false.\n\nWill cycle through window depths then repeat. Windows should be flickering while running."); + ImGui::TreePop(); - ImGui::Separator(); + ImGui::Spacing(); } IMGUI_DEMO_MARKER("Configuration/Backend Flags"); @@ -480,14 +483,15 @@ void ImGui::ShowDemoWindow(bool* p_open) "Those flags are set by the backends (imgui_impl_xxx files) to specify their capabilities.\n" "Here we expose them as read-only fields to avoid breaking interactions with your backend."); - // Make a local copy to avoid modifying actual backend flags. - ImGuiBackendFlags backend_flags = io.BackendFlags; - ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", &backend_flags, ImGuiBackendFlags_HasGamepad); - ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", &backend_flags, ImGuiBackendFlags_HasMouseCursors); - ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", &backend_flags, ImGuiBackendFlags_HasSetMousePos); - ImGui::CheckboxFlags("io.BackendFlags: RendererHasVtxOffset", &backend_flags, ImGuiBackendFlags_RendererHasVtxOffset); + // FIXME: Maybe we need a BeginReadonly() equivalent to keep label bright? + ImGui::BeginDisabled(); + ImGui::CheckboxFlags("io.BackendFlags: HasGamepad", &io.BackendFlags, ImGuiBackendFlags_HasGamepad); + ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", &io.BackendFlags, ImGuiBackendFlags_HasMouseCursors); + ImGui::CheckboxFlags("io.BackendFlags: HasSetMousePos", &io.BackendFlags, ImGuiBackendFlags_HasSetMousePos); + ImGui::CheckboxFlags("io.BackendFlags: RendererHasVtxOffset", &io.BackendFlags, ImGuiBackendFlags_RendererHasVtxOffset); + ImGui::EndDisabled(); ImGui::TreePop(); - ImGui::Separator(); + ImGui::Spacing(); } IMGUI_DEMO_MARKER("Configuration/Style"); @@ -496,7 +500,7 @@ void ImGui::ShowDemoWindow(bool* p_open) HelpMarker("The same contents can be accessed in 'Tools->Style Editor' or by calling the ShowStyleEditor() function."); ImGui::ShowStyleEditor(); ImGui::TreePop(); - ImGui::Separator(); + ImGui::Spacing(); } IMGUI_DEMO_MARKER("Configuration/Capture, Logging"); @@ -544,7 +548,7 @@ void ImGui::ShowDemoWindow(bool* p_open) ShowDemoWindowLayout(); ShowDemoWindowPopups(); ShowDemoWindowTables(); - ShowDemoWindowMisc(); + ShowDemoWindowInputs(); // End of ShowDemoWindow() ImGui::PopItemWidth(); @@ -564,6 +568,8 @@ static void ShowDemoWindowWidgets() IMGUI_DEMO_MARKER("Widgets/Basic"); if (ImGui::TreeNode("Basic")) { + ImGui::SeparatorText("General"); + IMGUI_DEMO_MARKER("Widgets/Basic/Button"); static int clicked = 0; if (ImGui::Button("Button")) @@ -618,35 +624,41 @@ static void ShowDemoWindowWidgets() ImGui::SameLine(); ImGui::Text("%d", counter); - IMGUI_DEMO_MARKER("Widgets/Basic/Tooltips"); - ImGui::Text("Hover over me"); - if (ImGui::IsItemHovered()) - ImGui::SetTooltip("I am a tooltip"); - - ImGui::SameLine(); - ImGui::Text("- or me"); - if (ImGui::IsItemHovered()) { - ImGui::BeginTooltip(); - ImGui::Text("I am a fancy tooltip"); - static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f }; - ImGui::PlotLines("Curve", arr, IM_ARRAYSIZE(arr)); - ImGui::EndTooltip(); + // Tooltips + IMGUI_DEMO_MARKER("Widgets/Basic/Tooltips"); + //ImGui::AlignTextToFramePadding(); + ImGui::Text("Tooltips:"); + + ImGui::SameLine(); + ImGui::SmallButton("Button"); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("I am a tooltip"); + + ImGui::SameLine(); + ImGui::SmallButton("Fancy"); + if (ImGui::IsItemHovered() && ImGui::BeginTooltip()) + { + ImGui::Text("I am a fancy tooltip"); + static float arr[] = { 0.6f, 0.1f, 1.0f, 0.5f, 0.92f, 0.1f, 0.2f }; + ImGui::PlotLines("Curve", arr, IM_ARRAYSIZE(arr)); + ImGui::Text("Sin(time) = %f", sinf((float)ImGui::GetTime())); + ImGui::EndTooltip(); + } + + ImGui::SameLine(); + ImGui::SmallButton("Delayed"); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) // With a delay + ImGui::SetTooltip("I am a tooltip with a delay."); + + ImGui::SameLine(); + HelpMarker( + "Tooltip are created by using the IsItemHovered() function over any kind of item."); } - ImGui::Separator(); ImGui::LabelText("label", "Value"); - { - // Using the _simplified_ one-liner Combo() api here - // See "Combo" section for examples of how to use the more flexible BeginCombo()/EndCombo() api. - IMGUI_DEMO_MARKER("Widgets/Basic/Combo"); - const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIIIIII", "JJJJ", "KKKKKKK" }; - static int item_current = 0; - ImGui::Combo("combo", &item_current, items, IM_ARRAYSIZE(items)); - ImGui::SameLine(); HelpMarker( - "Using the simplified one-liner Combo API here.\nRefer to the \"Combo\" section below for an explanation of how to use the more flexible and general BeginCombo/EndCombo API."); - } + ImGui::SeparatorText("Inputs"); { // To wire InputText() with std::string or any other custom string type, @@ -658,7 +670,7 @@ static void ShowDemoWindowWidgets() "USER:\n" "Hold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" - "CTRL+A or double-click to select all.\n" + "CTRL+A or Double-Click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n\n" @@ -673,10 +685,6 @@ static void ShowDemoWindowWidgets() IMGUI_DEMO_MARKER("Widgets/Basic/InputInt, InputFloat"); static int i0 = 123; ImGui::InputInt("input int", &i0); - ImGui::SameLine(); HelpMarker( - "You can apply arithmetic operators +,*,/ on numerical values.\n" - " e.g. [ 100 ], input \'*2\', result becomes [ 200 ]\n" - "Use +- to subtract."); static float f0 = 0.001f; ImGui::InputFloat("input float", &f0, 0.01f, 1.0f, "%.3f"); @@ -694,6 +702,8 @@ static void ShowDemoWindowWidgets() ImGui::InputFloat3("input float3", vec4a); } + ImGui::SeparatorText("Drags"); + { IMGUI_DEMO_MARKER("Widgets/Basic/DragInt, DragFloat"); static int i1 = 50, i2 = 42; @@ -710,6 +720,8 @@ static void ShowDemoWindowWidgets() ImGui::DragFloat("drag small float", &f2, 0.0001f, 0.0f, 0.0f, "%.06f ns"); } + ImGui::SeparatorText("Sliders"); + { IMGUI_DEMO_MARKER("Widgets/Basic/SliderInt, SliderFloat"); static int i1 = 0; @@ -736,6 +748,8 @@ static void ShowDemoWindowWidgets() ImGui::SameLine(); HelpMarker("Using the format string parameter to display a name instead of the underlying integer."); } + ImGui::SeparatorText("Selectors/Pickers"); + { IMGUI_DEMO_MARKER("Widgets/Basic/ColorEdit3, ColorEdit4"); static float col1[3] = { 1.0f, 0.0f, 0.2f }; @@ -750,6 +764,17 @@ static void ShowDemoWindowWidgets() ImGui::ColorEdit4("color 2", col2); } + { + // Using the _simplified_ one-liner Combo() api here + // See "Combo" section for examples of how to use the more flexible BeginCombo()/EndCombo() api. + IMGUI_DEMO_MARKER("Widgets/Basic/Combo"); + const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIIIIII", "JJJJ", "KKKKKKK" }; + static int item_current = 0; + ImGui::Combo("combo", &item_current, items, IM_ARRAYSIZE(items)); + ImGui::SameLine(); HelpMarker( + "Using the simplified one-liner Combo API here.\nRefer to the \"Combo\" section below for an explanation of how to use the more flexible and general BeginCombo/EndCombo API."); + } + { // Using the _simplified_ one-liner ListBox() api here // See "List boxes" section for examples of how to use the more flexible BeginListBox()/EndListBox() api. @@ -979,7 +1004,7 @@ static void ShowDemoWindowWidgets() // Note that characters values are preserved even by InputText() if the font cannot be displayed, // so you can safely copy & paste garbled characters into another application. ImGui::TextWrapped( - "CJK text will only appears if the font was loaded with the appropriate CJK character ranges. " + "CJK text will only appear if the font was loaded with the appropriate CJK character ranges. " "Call io.Fonts->AddFontFromFileTTF() manually to load extra character ranges. " "Read docs/FONTS.md for details."); ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string. @@ -1020,16 +1045,17 @@ static void ShowDemoWindowWidgets() float my_tex_w = (float)io.Fonts->TexWidth; float my_tex_h = (float)io.Fonts->TexHeight; { + static bool use_text_color_for_tint = false; + ImGui::Checkbox("Use Text Color for Tint", &use_text_color_for_tint); ImGui::Text("%.0fx%.0f", my_tex_w, my_tex_h); ImVec2 pos = ImGui::GetCursorScreenPos(); ImVec2 uv_min = ImVec2(0.0f, 0.0f); // Top-left ImVec2 uv_max = ImVec2(1.0f, 1.0f); // Lower-right - ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint - ImVec4 border_col = ImVec4(1.0f, 1.0f, 1.0f, 0.5f); // 50% opaque white + ImVec4 tint_col = use_text_color_for_tint ? ImGui::GetStyleColorVec4(ImGuiCol_Text) : ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint + ImVec4 border_col = ImGui::GetStyleColorVec4(ImGuiCol_Border); ImGui::Image(my_tex_id, ImVec2(my_tex_w, my_tex_h), uv_min, uv_max, tint_col, border_col); - if (ImGui::IsItemHovered()) + if (ImGui::IsItemHovered() && ImGui::BeginTooltip()) { - ImGui::BeginTooltip(); float region_sz = 32.0f; float region_x = io.MousePos.x - pos.x - region_sz * 0.5f; float region_y = io.MousePos.y - pos.y - region_sz * 0.5f; @@ -1052,15 +1078,21 @@ static void ShowDemoWindowWidgets() static int pressed_count = 0; for (int i = 0; i < 8; i++) { + // UV coordinates are often (0.0f, 0.0f) and (1.0f, 1.0f) to display an entire textures. + // Here are trying to display only a 32x32 pixels area of the texture, hence the UV computation. + // Read about UV coordinates here: https://github.com/ocornut/imgui/wiki/Image-Loading-and-Displaying-Examples ImGui::PushID(i); - int frame_padding = -1 + i; // -1 == uses default padding (style.FramePadding) - ImVec2 size = ImVec2(32.0f, 32.0f); // Size of the image we want to make visible - ImVec2 uv0 = ImVec2(0.0f, 0.0f); // UV coordinates for lower-left - ImVec2 uv1 = ImVec2(32.0f / my_tex_w, 32.0f / my_tex_h);// UV coordinates for (32,32) in our texture - ImVec4 bg_col = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); // Black background - ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint - if (ImGui::ImageButton(my_tex_id, size, uv0, uv1, frame_padding, bg_col, tint_col)) + if (i > 0) + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(i - 1.0f, i - 1.0f)); + ImVec2 size = ImVec2(32.0f, 32.0f); // Size of the image we want to make visible + ImVec2 uv0 = ImVec2(0.0f, 0.0f); // UV coordinates for lower-left + ImVec2 uv1 = ImVec2(32.0f / my_tex_w, 32.0f / my_tex_h); // UV coordinates for (32,32) in our texture + ImVec4 bg_col = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); // Black background + ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); // No tint + if (ImGui::ImageButton("", my_tex_id, size, uv0, uv1, bg_col, tint_col)) pressed_count += 1; + if (i > 0) + ImGui::PopStyleVar(); ImGui::PopID(); ImGui::SameLine(); } @@ -1072,6 +1104,7 @@ static void ShowDemoWindowWidgets() IMGUI_DEMO_MARKER("Widgets/Combo"); if (ImGui::TreeNode("Combo")) { + // Combo Boxes are also called "Dropdown" in other systems // Expose flags as checkbox for the demo static ImGuiComboFlags flags = 0; ImGui::CheckboxFlags("ImGuiComboFlags_PopupAlignLeft", &flags, ImGuiComboFlags_PopupAlignLeft); @@ -1436,7 +1469,7 @@ static void ShowDemoWindowWidgets() static char buf3[64]; static int edit_count = 0; ImGui::InputText("Edit", buf3, 64, ImGuiInputTextFlags_CallbackEdit, Funcs::MyCallback, (void*)&edit_count); - ImGui::SameLine(); HelpMarker("Here we toggle the casing of the first character on every edits + count edits."); + ImGui::SameLine(); HelpMarker("Here we toggle the casing of the first character on every edit + count edits."); ImGui::SameLine(); ImGui::Text("(%d)", edit_count); ImGui::TreePop(); @@ -1676,7 +1709,7 @@ static void ShowDemoWindowWidgets() } // Use functions to generate output - // FIXME: This is rather awkward because current plot API only pass in indices. + // FIXME: This is actually VERY awkward because current plot API only pass in indices. // We probably want an API passing floats and user provide sample rate/count. struct Funcs { @@ -1684,7 +1717,7 @@ static void ShowDemoWindowWidgets() static float Saw(void*, int i) { return (i & 1) ? 1.0f : -1.0f; } }; static int func_type = 0, display_count = 70; - ImGui::Separator(); + ImGui::SeparatorText("Functions"); ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8); ImGui::Combo("func", &func_type, "Sin\0Saw\0"); ImGui::SameLine(); @@ -1727,6 +1760,7 @@ static void ShowDemoWindowWidgets() static bool drag_and_drop = true; static bool options_menu = true; static bool hdr = false; + ImGui::SeparatorText("Options"); ImGui::Checkbox("With Alpha Preview", &alpha_preview); ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview); ImGui::Checkbox("With Drag and Drop", &drag_and_drop); @@ -1735,6 +1769,7 @@ static void ShowDemoWindowWidgets() ImGuiColorEditFlags misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (drag_and_drop ? 0 : ImGuiColorEditFlags_NoDragDrop) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions); IMGUI_DEMO_MARKER("Widgets/Color/ColorEdit"); + ImGui::SeparatorText("Inline color editor"); ImGui::Text("Color widget:"); ImGui::SameLine(); HelpMarker( "Click on the color square to open a color picker.\n" @@ -1832,7 +1867,7 @@ static void ShowDemoWindowWidgets() ImGui::ColorButton("MyColor##3c", *(ImVec4*)&color, misc_flags | (no_border ? ImGuiColorEditFlags_NoBorder : 0), ImVec2(80, 80)); IMGUI_DEMO_MARKER("Widgets/Color/ColorPicker"); - ImGui::Text("Color picker:"); + ImGui::SeparatorText("Color picker"); static bool alpha = true; static bool alpha_bar = true; static bool side_preview = true; @@ -1856,10 +1891,9 @@ static void ShowDemoWindowWidgets() ImGui::Combo("Display Mode", &display_mode, "Auto/Current\0None\0RGB Only\0HSV Only\0Hex Only\0"); ImGui::SameLine(); HelpMarker( "ColorEdit defaults to displaying RGB inputs if you don't specify a display mode, " - "but the user can change it with a right-click.\n\nColorPicker defaults to displaying RGB+HSV+Hex " + "but the user can change it with a right-click on those inputs.\n\nColorPicker defaults to displaying RGB+HSV+Hex " "if you don't specify a display mode.\n\nYou can change the defaults using SetColorEditOptions()."); - ImGui::Combo("Picker Mode", &picker_mode, "Auto/Current\0Hue bar + SV rect\0Hue wheel + SV triangle\0"); - ImGui::SameLine(); HelpMarker("User can right-click the picker to change mode."); + ImGui::SameLine(); HelpMarker("When not specified explicitly (Auto/Current mode), user can right-click the picker to change mode."); ImGuiColorEditFlags flags = misc_flags; if (!alpha) flags |= ImGuiColorEditFlags_NoAlpha; // This is by default if you call ColorPicker3() instead of ColorPicker4() if (alpha_bar) flags |= ImGuiColorEditFlags_AlphaBar; @@ -1883,6 +1917,15 @@ static void ShowDemoWindowWidgets() if (ImGui::Button("Default: Float + HDR + Hue Wheel")) ImGui::SetColorEditOptions(ImGuiColorEditFlags_Float | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_PickerHueWheel); + // Always both a small version of both types of pickers (to make it more visible in the demo to people who are skimming quickly through it) + ImGui::Text("Both types:"); + float w = (ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ItemSpacing.y) * 0.40f; + ImGui::SetNextItemWidth(w); + ImGui::ColorPicker3("##MyColor##5", (float*)&color, ImGuiColorEditFlags_PickerHueBar | ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoAlpha); + ImGui::SameLine(); + ImGui::SetNextItemWidth(w); + ImGui::ColorPicker3("##MyColor##6", (float*)&color, ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoAlpha); + // HSV encoded support (to avoid RGB<>HSV round trips and singularities when S==0 or V==0) static ImVec4 color_hsv(0.23f, 1.0f, 1.0f, 1.0f); // Stored as HSV! ImGui::Spacing(); @@ -1953,7 +1996,7 @@ static void ShowDemoWindowWidgets() // - integer/float/double // To avoid polluting the public API with all possible combinations, we use the ImGuiDataType enum // to pass the type, and passing all arguments by pointer. - // This is the reason the test code below creates local variables to hold "zero" "one" etc. for each types. + // This is the reason the test code below creates local variables to hold "zero" "one" etc. for each type. // In practice, if you frequently use a given type that is not covered by the normal API entry points, // you can wrap it yourself inside a 1 line function which can take typed argument as value instead of void*, // and then pass their address to the generic function. For example: @@ -1995,16 +2038,17 @@ static void ShowDemoWindowWidgets() const float drag_speed = 0.2f; static bool drag_clamp = false; IMGUI_DEMO_MARKER("Widgets/Data Types/Drags"); - ImGui::Text("Drags:"); + ImGui::SeparatorText("Drags"); ImGui::Checkbox("Clamp integers to 0..50", &drag_clamp); ImGui::SameLine(); HelpMarker( - "As with every widgets in dear imgui, we never modify values unless there is a user interaction.\n" + "As with every widget in dear imgui, we never modify values unless there is a user interaction.\n" "You can override the clamping limits by using CTRL+Click to input a value."); ImGui::DragScalar("drag s8", ImGuiDataType_S8, &s8_v, drag_speed, drag_clamp ? &s8_zero : NULL, drag_clamp ? &s8_fifty : NULL); ImGui::DragScalar("drag u8", ImGuiDataType_U8, &u8_v, drag_speed, drag_clamp ? &u8_zero : NULL, drag_clamp ? &u8_fifty : NULL, "%u ms"); ImGui::DragScalar("drag s16", ImGuiDataType_S16, &s16_v, drag_speed, drag_clamp ? &s16_zero : NULL, drag_clamp ? &s16_fifty : NULL); ImGui::DragScalar("drag u16", ImGuiDataType_U16, &u16_v, drag_speed, drag_clamp ? &u16_zero : NULL, drag_clamp ? &u16_fifty : NULL, "%u ms"); ImGui::DragScalar("drag s32", ImGuiDataType_S32, &s32_v, drag_speed, drag_clamp ? &s32_zero : NULL, drag_clamp ? &s32_fifty : NULL); + ImGui::DragScalar("drag s32 hex", ImGuiDataType_S32, &s32_v, drag_speed, drag_clamp ? &s32_zero : NULL, drag_clamp ? &s32_fifty : NULL, "0x%08X"); ImGui::DragScalar("drag u32", ImGuiDataType_U32, &u32_v, drag_speed, drag_clamp ? &u32_zero : NULL, drag_clamp ? &u32_fifty : NULL, "%u ms"); ImGui::DragScalar("drag s64", ImGuiDataType_S64, &s64_v, drag_speed, drag_clamp ? &s64_zero : NULL, drag_clamp ? &s64_fifty : NULL); ImGui::DragScalar("drag u64", ImGuiDataType_U64, &u64_v, drag_speed, drag_clamp ? &u64_zero : NULL, drag_clamp ? &u64_fifty : NULL); @@ -2014,7 +2058,7 @@ static void ShowDemoWindowWidgets() ImGui::DragScalar("drag double log",ImGuiDataType_Double, &f64_v, 0.0005f, &f64_zero, &f64_one, "0 < %.10f < 1", ImGuiSliderFlags_Logarithmic); IMGUI_DEMO_MARKER("Widgets/Data Types/Sliders"); - ImGui::Text("Sliders"); + ImGui::SeparatorText("Sliders"); ImGui::SliderScalar("slider s8 full", ImGuiDataType_S8, &s8_v, &s8_min, &s8_max, "%d"); ImGui::SliderScalar("slider u8 full", ImGuiDataType_U8, &u8_v, &u8_min, &u8_max, "%u"); ImGui::SliderScalar("slider s16 full", ImGuiDataType_S16, &s16_v, &s16_min, &s16_max, "%d"); @@ -2022,6 +2066,7 @@ static void ShowDemoWindowWidgets() ImGui::SliderScalar("slider s32 low", ImGuiDataType_S32, &s32_v, &s32_zero, &s32_fifty,"%d"); ImGui::SliderScalar("slider s32 high", ImGuiDataType_S32, &s32_v, &s32_hi_a, &s32_hi_b, "%d"); ImGui::SliderScalar("slider s32 full", ImGuiDataType_S32, &s32_v, &s32_min, &s32_max, "%d"); + ImGui::SliderScalar("slider s32 hex", ImGuiDataType_S32, &s32_v, &s32_zero, &s32_fifty, "0x%04X"); ImGui::SliderScalar("slider u32 low", ImGuiDataType_U32, &u32_v, &u32_zero, &u32_fifty,"%u"); ImGui::SliderScalar("slider u32 high", ImGuiDataType_U32, &u32_v, &u32_hi_a, &u32_hi_b, "%u"); ImGui::SliderScalar("slider u32 full", ImGuiDataType_U32, &u32_v, &u32_min, &u32_max, "%u"); @@ -2038,7 +2083,7 @@ static void ShowDemoWindowWidgets() ImGui::SliderScalar("slider double low log",ImGuiDataType_Double, &f64_v, &f64_zero, &f64_one, "%.10f", ImGuiSliderFlags_Logarithmic); ImGui::SliderScalar("slider double high", ImGuiDataType_Double, &f64_v, &f64_lo_a, &f64_hi_a, "%e grams"); - ImGui::Text("Sliders (reverse)"); + ImGui::SeparatorText("Sliders (reverse)"); ImGui::SliderScalar("slider s8 reverse", ImGuiDataType_S8, &s8_v, &s8_max, &s8_min, "%d"); ImGui::SliderScalar("slider u8 reverse", ImGuiDataType_U8, &u8_v, &u8_max, &u8_min, "%u"); ImGui::SliderScalar("slider s32 reverse", ImGuiDataType_S32, &s32_v, &s32_fifty, &s32_zero, "%d"); @@ -2048,16 +2093,16 @@ static void ShowDemoWindowWidgets() IMGUI_DEMO_MARKER("Widgets/Data Types/Inputs"); static bool inputs_step = true; - ImGui::Text("Inputs"); + ImGui::SeparatorText("Inputs"); ImGui::Checkbox("Show step buttons", &inputs_step); ImGui::InputScalar("input s8", ImGuiDataType_S8, &s8_v, inputs_step ? &s8_one : NULL, NULL, "%d"); ImGui::InputScalar("input u8", ImGuiDataType_U8, &u8_v, inputs_step ? &u8_one : NULL, NULL, "%u"); ImGui::InputScalar("input s16", ImGuiDataType_S16, &s16_v, inputs_step ? &s16_one : NULL, NULL, "%d"); ImGui::InputScalar("input u16", ImGuiDataType_U16, &u16_v, inputs_step ? &u16_one : NULL, NULL, "%u"); ImGui::InputScalar("input s32", ImGuiDataType_S32, &s32_v, inputs_step ? &s32_one : NULL, NULL, "%d"); - ImGui::InputScalar("input s32 hex", ImGuiDataType_S32, &s32_v, inputs_step ? &s32_one : NULL, NULL, "%08X", ImGuiInputTextFlags_CharsHexadecimal); + ImGui::InputScalar("input s32 hex", ImGuiDataType_S32, &s32_v, inputs_step ? &s32_one : NULL, NULL, "%04X"); ImGui::InputScalar("input u32", ImGuiDataType_U32, &u32_v, inputs_step ? &u32_one : NULL, NULL, "%u"); - ImGui::InputScalar("input u32 hex", ImGuiDataType_U32, &u32_v, inputs_step ? &u32_one : NULL, NULL, "%08X", ImGuiInputTextFlags_CharsHexadecimal); + ImGui::InputScalar("input u32 hex", ImGuiDataType_U32, &u32_v, inputs_step ? &u32_one : NULL, NULL, "%08X"); ImGui::InputScalar("input s64", ImGuiDataType_S64, &s64_v, inputs_step ? &s64_one : NULL); ImGui::InputScalar("input u64", ImGuiDataType_U64, &u64_v, inputs_step ? &u64_one : NULL); ImGui::InputScalar("input float", ImGuiDataType_Float, &f32_v, inputs_step ? &f32_one : NULL); @@ -2072,22 +2117,23 @@ static void ShowDemoWindowWidgets() static float vec4f[4] = { 0.10f, 0.20f, 0.30f, 0.44f }; static int vec4i[4] = { 1, 5, 100, 255 }; + ImGui::SeparatorText("2-wide"); ImGui::InputFloat2("input float2", vec4f); ImGui::DragFloat2("drag float2", vec4f, 0.01f, 0.0f, 1.0f); ImGui::SliderFloat2("slider float2", vec4f, 0.0f, 1.0f); ImGui::InputInt2("input int2", vec4i); ImGui::DragInt2("drag int2", vec4i, 1, 0, 255); ImGui::SliderInt2("slider int2", vec4i, 0, 255); - ImGui::Spacing(); + ImGui::SeparatorText("3-wide"); ImGui::InputFloat3("input float3", vec4f); ImGui::DragFloat3("drag float3", vec4f, 0.01f, 0.0f, 1.0f); ImGui::SliderFloat3("slider float3", vec4f, 0.0f, 1.0f); ImGui::InputInt3("input int3", vec4i); ImGui::DragInt3("drag int3", vec4i, 1, 0, 255); ImGui::SliderInt3("slider int3", vec4i, 0, 255); - ImGui::Spacing(); + ImGui::SeparatorText("4-wide"); ImGui::InputFloat4("input float4", vec4f); ImGui::DragFloat4("drag float4", vec4f, 0.01f, 0.0f, 1.0f); ImGui::SliderFloat4("slider float4", vec4f, 0.0f, 1.0f); @@ -2295,7 +2341,7 @@ static void ShowDemoWindowWidgets() HelpMarker("Testing how various types of items are interacting with the IsItemXXX functions. Note that the bool return value of most ImGui function is generally equivalent to calling ImGui::IsItemHovered()."); ImGui::Checkbox("Item Disabled", &item_disabled); - // Submit selected item item so we can query their status in the code following it. + // Submit selected items so we can query their status in the code following it. bool ret = false; static bool b = false; static float col4f[4] = { 1.0f, 0.5, 0.0f, 1.0f }; @@ -2319,6 +2365,10 @@ static void ShowDemoWindowWidgets() if (item_type == 14){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::Combo("ITEM: Combo", ¤t, items, IM_ARRAYSIZE(items)); } if (item_type == 15){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); } + bool hovered_delay_none = ImGui::IsItemHovered(); + bool hovered_delay_short = ImGui::IsItemHovered(ImGuiHoveredFlags_DelayShort); + bool hovered_delay_normal = ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal); + // Display the values of IsItemHovered() and other common item state functions. // Note that the ImGuiHoveredFlags_XXX flags can be combined. // Because BulletText is an item itself and that would affect the output of IsItemXXX functions, @@ -2363,6 +2413,8 @@ static void ShowDemoWindowWidgets() ImGui::GetItemRectMax().x, ImGui::GetItemRectMax().y, ImGui::GetItemRectSize().x, ImGui::GetItemRectSize().y ); + ImGui::BulletText( + "w/ Hovering Delay: None = %d, Fast %d, Normal = %d", hovered_delay_none, hovered_delay_short, hovered_delay_normal); if (item_disabled) ImGui::EndDisabled(); @@ -2467,6 +2519,26 @@ static void ShowDemoWindowWidgets() ImGui::SameLine(); HelpMarker("Demonstrate using BeginDisabled()/EndDisabled() across this section."); ImGui::TreePop(); } + + IMGUI_DEMO_MARKER("Widgets/Text Filter"); + if (ImGui::TreeNode("Text Filter")) + { + // Helper class to easy setup a text filter. + // You may want to implement a more feature-full filtering scheme in your own application. + HelpMarker("Not a widget per-se, but ImGuiTextFilter is a helper to perform simple filtering on text strings."); + static ImGuiTextFilter filter; + ImGui::Text("Filter usage:\n" + " \"\" display all lines\n" + " \"xxx\" display lines containing \"xxx\"\n" + " \"xxx,yyy\" display lines containing \"xxx\" or \"yyy\"\n" + " \"-xxx\" hide lines containing \"xxx\""); + filter.Draw(); + const char* lines[] = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }; + for (int i = 0; i < IM_ARRAYSIZE(lines); i++) + if (filter.PassFilter(lines[i])) + ImGui::BulletText("%s", lines[i]); + ImGui::TreePop(); + } } static void ShowDemoWindowLayout() @@ -2478,6 +2550,8 @@ static void ShowDemoWindowLayout() IMGUI_DEMO_MARKER("Layout/Child windows"); if (ImGui::TreeNode("Child windows")) { + ImGui::SeparatorText("Child windows"); + HelpMarker("Use child windows to begin into a self-contained independent scrolling/clipping regions within a host window."); static bool disable_mouse_wheel = false; static bool disable_menu = false; @@ -2530,7 +2604,7 @@ static void ShowDemoWindowLayout() ImGui::PopStyleVar(); } - ImGui::Separator(); + ImGui::SeparatorText("Misc/Advanced"); // Demonstrate a few extra things // - Changing ImGuiCol_ChildBg (which is transparent black in default styles) @@ -3193,59 +3267,58 @@ static void ShowDemoWindowLayout() ImGui::DragFloat2("size", (float*)&size, 0.5f, 1.0f, 200.0f, "%.0f"); ImGui::TextWrapped("(Click and drag to scroll)"); + HelpMarker( + "(Left) Using ImGui::PushClipRect():\n" + "Will alter ImGui hit-testing logic + ImDrawList rendering.\n" + "(use this if you want your clipping rectangle to affect interactions)\n\n" + "(Center) Using ImDrawList::PushClipRect():\n" + "Will alter ImDrawList rendering only.\n" + "(use this as a shortcut if you are only using ImDrawList calls)\n\n" + "(Right) Using ImDrawList::AddText() with a fine ClipRect:\n" + "Will alter only this specific ImDrawList::AddText() rendering.\n" + "This is often used internally to avoid altering the clipping rectangle and minimize draw calls."); + for (int n = 0; n < 3; n++) { if (n > 0) ImGui::SameLine(); - ImGui::PushID(n); - ImGui::BeginGroup(); // Lock X position - ImGui::InvisibleButton("##empty", size); + ImGui::PushID(n); + ImGui::InvisibleButton("##canvas", size); if (ImGui::IsItemActive() && ImGui::IsMouseDragging(ImGuiMouseButton_Left)) { offset.x += ImGui::GetIO().MouseDelta.x; offset.y += ImGui::GetIO().MouseDelta.y; } + ImGui::PopID(); + if (!ImGui::IsItemVisible()) // Skip rendering as ImDrawList elements are not clipped. + continue; + const ImVec2 p0 = ImGui::GetItemRectMin(); const ImVec2 p1 = ImGui::GetItemRectMax(); const char* text_str = "Line 1 hello\nLine 2 clip me!"; const ImVec2 text_pos = ImVec2(p0.x + offset.x, p0.y + offset.y); ImDrawList* draw_list = ImGui::GetWindowDrawList(); - switch (n) { case 0: - HelpMarker( - "Using ImGui::PushClipRect():\n" - "Will alter ImGui hit-testing logic + ImDrawList rendering.\n" - "(use this if you want your clipping rectangle to affect interactions)"); ImGui::PushClipRect(p0, p1, true); draw_list->AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255)); draw_list->AddText(text_pos, IM_COL32_WHITE, text_str); ImGui::PopClipRect(); break; case 1: - HelpMarker( - "Using ImDrawList::PushClipRect():\n" - "Will alter ImDrawList rendering only.\n" - "(use this as a shortcut if you are only using ImDrawList calls)"); draw_list->PushClipRect(p0, p1, true); draw_list->AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255)); draw_list->AddText(text_pos, IM_COL32_WHITE, text_str); draw_list->PopClipRect(); break; case 2: - HelpMarker( - "Using ImDrawList::AddText() with a fine ClipRect:\n" - "Will alter only this specific ImDrawList::AddText() rendering.\n" - "(this is often used internally to avoid altering the clipping rectangle and minimize draw calls)"); ImVec4 clip_rect(p0.x, p0.y, p1.x, p1.y); // AddText() takes a ImVec4* here so let's convert. draw_list->AddRectFilled(p0, p1, IM_COL32(90, 90, 120, 255)); draw_list->AddText(ImGui::GetFont(), ImGui::GetFontSize(), text_pos, IM_COL32_WHITE, text_str, NULL, 0.0f, &clip_rect); break; } - ImGui::EndGroup(); - ImGui::PopID(); } ImGui::TreePop(); @@ -3295,8 +3368,7 @@ static void ShowDemoWindowPopups() ImGui::TextUnformatted(selected_fish == -1 ? "" : names[selected_fish]); if (ImGui::BeginPopup("my_select_popup")) { - ImGui::Text("Aquarium"); - ImGui::Separator(); + ImGui::SeparatorText("Aquarium"); for (int i = 0; i < IM_ARRAYSIZE(names); i++) if (ImGui::Selectable(names[i])) selected_fish = i; @@ -3382,7 +3454,7 @@ static void ShowDemoWindowPopups() // if (IsItemHovered() && IsMouseReleased(ImGuiMouseButton_Right)) // OpenPopup(id); // return BeginPopup(id); - // For advanced advanced uses you may want to replicate and customize this code. + // For advanced uses you may want to replicate and customize this code. // See more details in BeginPopupContextItem(). // Example 1 @@ -3390,11 +3462,14 @@ static void ShowDemoWindowPopups() // and BeginPopupContextItem() will use the last item ID as the popup ID. { const char* names[5] = { "Label1", "Label2", "Label3", "Label4", "Label5" }; + static int selected = -1; for (int n = 0; n < 5; n++) { - ImGui::Selectable(names[n]); + if (ImGui::Selectable(names[n], selected == n)) + selected = n; if (ImGui::BeginPopupContextItem()) // <-- use last item id as popup id { + selected = n; ImGui::Text("This a popup for \"%s\"!", names[n]); if (ImGui::Button("Close")) ImGui::CloseCurrentPopup(); @@ -3411,7 +3486,7 @@ static void ShowDemoWindowPopups() { HelpMarker("Text() elements don't have stable identifiers so we need to provide one."); static float value = 0.5f; - ImGui::Text("Value = %.3f <-- (1) right-click this value", value); + ImGui::Text("Value = %.3f <-- (1) right-click this text", value); if (ImGui::BeginPopupContextItem("my popup")) { if (ImGui::Selectable("Set to zero")) value = 0.0f; @@ -3470,7 +3545,7 @@ static void ShowDemoWindowPopups() if (ImGui::BeginPopupModal("Delete?", NULL, ImGuiWindowFlags_AlwaysAutoResize)) { - ImGui::Text("All those beautiful files will be deleted.\nThis operation cannot be undone!\n\n"); + ImGui::Text("All those beautiful files will be deleted.\nThis operation cannot be undone!"); ImGui::Separator(); //static int unused_i = 0; @@ -3538,26 +3613,19 @@ static void ShowDemoWindowPopups() ImGui::TextWrapped("Below we are testing adding menu items to a regular window. It's rather unusual but should work!"); ImGui::Separator(); - // Note: As a quirk in this very specific example, we want to differentiate the parent of this menu from the - // parent of the various popup menus above. To do so we are encloding the items in a PushID()/PopID() block - // to make them two different menusets. If we don't, opening any popup above and hovering our menu here would - // open it. This is because once a menu is active, we allow to switch to a sibling menu by just hovering on it, - // which is the desired behavior for regular menus. - ImGui::PushID("foo"); ImGui::MenuItem("Menu item", "CTRL+M"); if (ImGui::BeginMenu("Menu inside a regular window")) { ShowExampleMenuFile(); ImGui::EndMenu(); } - ImGui::PopID(); ImGui::Separator(); ImGui::TreePop(); } } // Dummy data structure that we use for the Table demo. -// (pre-C++11 doesn't allow us to instantiate ImVector template if this structure if defined inside the demo function) +// (pre-C++11 doesn't allow us to instantiate ImVector template if this structure is defined inside the demo function) namespace { // We are passing our own identifier to TableSetupColumn() to facilitate identifying columns in the sorting code. @@ -3660,9 +3728,8 @@ static void EditTableSizingFlags(ImGuiTableFlags* p_flags) } ImGui::SameLine(); ImGui::TextDisabled("(?)"); - if (ImGui::IsItemHovered()) + if (ImGui::IsItemHovered() && ImGui::BeginTooltip()) { - ImGui::BeginTooltip(); ImGui::PushTextWrapPos(ImGui::GetFontSize() * 50.0f); for (int m = 0; m < IM_ARRAYSIZE(policies); m++) { @@ -3776,7 +3843,7 @@ static void ShowDemoWindowTables() } // [Method 2] Using TableNextColumn() called multiple times, instead of using a for loop + TableSetColumnIndex(). - // This is generally more convenient when you have code manually submitting the contents of each columns. + // This is generally more convenient when you have code manually submitting the contents of each column. HelpMarker("Using TableNextRow() + calling TableNextColumn() _before_ each cell, manually."); if (ImGui::BeginTable("table2", 3)) { @@ -3794,10 +3861,10 @@ static void ShowDemoWindowTables() } // [Method 3] We call TableNextColumn() _before_ each cell. We never call TableNextRow(), - // as TableNextColumn() will automatically wrap around and create new roes as needed. + // as TableNextColumn() will automatically wrap around and create new rows as needed. // This is generally more convenient when your cells all contains the same type of data. HelpMarker( - "Only using TableNextColumn(), which tends to be convenient for tables where every cells contains the same type of contents.\n" + "Only using TableNextColumn(), which tends to be convenient for tables where every cell contains the same type of contents.\n" "This is also more similar to the old NextColumn() function of the Columns API, and provided to facilitate the Columns->Tables API transition."); if (ImGui::BeginTable("table3", 3)) { @@ -3849,7 +3916,7 @@ static void ShowDemoWindowTables() ImGui::SameLine(); ImGui::RadioButton("Text", &contents_type, CT_Text); ImGui::SameLine(); ImGui::RadioButton("FillButton", &contents_type, CT_FillButton); ImGui::Checkbox("Display headers", &display_headers); - ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appears in Headers"); + ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appear in Headers"); PopStyleCompact(); if (ImGui::BeginTable("table1", 3, flags)) @@ -3874,7 +3941,7 @@ static void ShowDemoWindowTables() sprintf(buf, "Hello %d,%d", column, row); if (contents_type == CT_Text) ImGui::TextUnformatted(buf); - else if (contents_type) + else if (contents_type == CT_FillButton) ImGui::Button(buf, ImVec2(-FLT_MIN, 0.0f)); } } @@ -3888,8 +3955,8 @@ static void ShowDemoWindowTables() IMGUI_DEMO_MARKER("Tables/Resizable, stretch"); if (ImGui::TreeNode("Resizable, stretch")) { - // By default, if we don't enable ScrollX the sizing policy for each columns is "Stretch" - // Each columns maintain a sizing weight, and they will occupy all available width. + // By default, if we don't enable ScrollX the sizing policy for each column is "Stretch" + // All columns maintain a sizing weight, and they will occupy all available width. static ImGuiTableFlags flags = ImGuiTableFlags_SizingStretchSame | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody; PushStyleCompact(); ImGui::CheckboxFlags("ImGuiTableFlags_Resizable", &flags, ImGuiTableFlags_Resizable); @@ -4011,7 +4078,7 @@ static void ShowDemoWindowTables() ImGui::CheckboxFlags("ImGuiTableFlags_Reorderable", &flags, ImGuiTableFlags_Reorderable); ImGui::CheckboxFlags("ImGuiTableFlags_Hideable", &flags, ImGuiTableFlags_Hideable); ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); - ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers)"); + ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appear in Headers)"); PopStyleCompact(); if (ImGui::BeginTable("table1", 3, flags)) @@ -4069,7 +4136,7 @@ static void ShowDemoWindowTables() "- any form of row selection\n" "Because of this, activating BorderOuterV sets the default to PadOuterX. Using PadOuterX or NoPadOuterX you can override the default.\n\n" "Actual padding values are using style.CellPadding.\n\n" - "In this demo we don't show horizontal borders to emphasis how they don't affect default horizontal padding."); + "In this demo we don't show horizontal borders to emphasize how they don't affect default horizontal padding."); static ImGuiTableFlags flags1 = ImGuiTableFlags_BordersV; PushStyleCompact(); @@ -4418,14 +4485,16 @@ static void ShowDemoWindowTables() { ImGui::TableNextColumn(); ImGui::PushID(column); - ImGui::AlignTextToFramePadding(); // FIXME-TABLE: Workaround for wrong text baseline propagation + ImGui::AlignTextToFramePadding(); // FIXME-TABLE: Workaround for wrong text baseline propagation across columns ImGui::Text("'%s'", column_names[column]); ImGui::Spacing(); ImGui::Text("Input flags:"); EditTableColumnsFlags(&column_flags[column]); ImGui::Spacing(); ImGui::Text("Output flags:"); + ImGui::BeginDisabled(); ShowTableColumnsStatusFlags(column_flags_out[column]); + ImGui::EndDisabled(); ImGui::PopID(); } PopStyleCompact(); @@ -4536,7 +4605,7 @@ static void ShowDemoWindowTables() IMGUI_DEMO_MARKER("Tables/Nested tables"); if (ImGui::TreeNode("Nested tables")) { - HelpMarker("This demonstrate embedding a table into another table cell."); + HelpMarker("This demonstrates embedding a table into another table cell."); if (ImGui::BeginTable("table_nested1", 2, ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable)) { @@ -4581,7 +4650,7 @@ static void ShowDemoWindowTables() IMGUI_DEMO_MARKER("Tables/Row height"); if (ImGui::TreeNode("Row height")) { - HelpMarker("You can pass a 'min_row_height' to TableNextRow().\n\nRows are padded with 'style.CellPadding.y' on top and bottom, so effectively the minimum row height will always be >= 'style.CellPadding.y * 2.0f'.\n\nWe cannot honor a _maximum_ row height as that would requires a unique clipping rectangle per row."); + HelpMarker("You can pass a 'min_row_height' to TableNextRow().\n\nRows are padded with 'style.CellPadding.y' on top and bottom, so effectively the minimum row height will always be >= 'style.CellPadding.y * 2.0f'.\n\nWe cannot honor a _maximum_ row height as that would require a unique clipping rectangle per row."); if (ImGui::BeginTable("table_row_height", 1, ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInnerV)) { for (int row = 0; row < 10; row++) @@ -4830,7 +4899,7 @@ static void ShowDemoWindowTables() ImGui::TableSetColumnIndex(1); ImGui::SliderFloat("float1", &dummy_f, 0.0f, 1.0f); ImGui::TableSetColumnIndex(2); - ImGui::SliderFloat("float2", &dummy_f, 0.0f, 1.0f); + ImGui::SliderFloat("##float2", &dummy_f, 0.0f, 1.0f); // No visible label since right-aligned ImGui::PopID(); } ImGui::EndTable(); @@ -5000,18 +5069,23 @@ static void ShowDemoWindowTables() if (ImGui::TreeNode("Synced instances")) { HelpMarker("Multiple tables with the same identifier will share their settings, width, visibility, order etc."); + + static ImGuiTableFlags flags = ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoSavedSettings; + ImGui::CheckboxFlags("ImGuiTableFlags_ScrollY", &flags, ImGuiTableFlags_ScrollY); + ImGui::CheckboxFlags("ImGuiTableFlags_SizingFixedFit", &flags, ImGuiTableFlags_SizingFixedFit); for (int n = 0; n < 3; n++) { char buf[32]; sprintf(buf, "Synced Table %d", n); bool open = ImGui::CollapsingHeader(buf, ImGuiTreeNodeFlags_DefaultOpen); - if (open && ImGui::BeginTable("Table", 3, ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoSavedSettings)) + if (open && ImGui::BeginTable("Table", 3, flags, ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 5))) { ImGui::TableSetupColumn("One"); ImGui::TableSetupColumn("Two"); ImGui::TableSetupColumn("Three"); ImGui::TableHeadersRow(); - for (int cell = 0; cell < 9; cell++) + const int cell_count = (n == 1) ? 27 : 9; // Make second table have a scrollbar to verify that additional decoration is not affecting column positions. + for (int cell = 0; cell < cell_count; cell++) { ImGui::TableNextColumn(); ImGui::Text("this cell %d", cell); @@ -5143,7 +5217,7 @@ static void ShowDemoWindowTables() static bool show_headers = true; static bool show_wrapped_text = false; //static ImGuiTextFilter filter; - //ImGui::SetNextItemOpen(true, ImGuiCond_Once); // FIXME-TABLE: Enabling this results in initial clipped first pass on table which tend to affects column sizing + //ImGui::SetNextItemOpen(true, ImGuiCond_Once); // FIXME-TABLE: Enabling this results in initial clipped first pass on table which tend to affect column sizing if (ImGui::TreeNode("Options")) { // Make the UI compact because there are so many fields @@ -5170,8 +5244,8 @@ static void ShowDemoWindowTables() ImGui::CheckboxFlags("ImGuiTableFlags_BordersH", &flags, ImGuiTableFlags_BordersH); ImGui::CheckboxFlags("ImGuiTableFlags_BordersOuterH", &flags, ImGuiTableFlags_BordersOuterH); ImGui::CheckboxFlags("ImGuiTableFlags_BordersInnerH", &flags, ImGuiTableFlags_BordersInnerH); - ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appears in Headers"); - ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appears in Headers)"); + ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBody", &flags, ImGuiTableFlags_NoBordersInBody); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body (borders will always appear in Headers"); + ImGui::CheckboxFlags("ImGuiTableFlags_NoBordersInBodyUntilResize", &flags, ImGuiTableFlags_NoBordersInBodyUntilResize); ImGui::SameLine(); HelpMarker("Disable vertical borders in columns Body until hovered for resize (borders will always appear in Headers)"); ImGui::TreePop(); } @@ -5234,7 +5308,7 @@ static void ShowDemoWindowTables() HelpMarker("If scrolling is disabled (ScrollX and ScrollY not set):\n" "- The table is output directly in the parent window.\n" "- OuterSize.x < 0.0f will right-align the table.\n" - "- OuterSize.x = 0.0f will narrow fit the table unless there are any Stretch column.\n" + "- OuterSize.x = 0.0f will narrow fit the table unless there are any Stretch columns.\n" "- OuterSize.y then becomes the minimum size for the table, which will extend vertically if there are more rows (unless NoHostExtendY is set)."); // From a user point of view we will tend to use 'inner_width' differently depending on whether our table is embedding scrolling. @@ -5639,82 +5713,121 @@ static void ShowDemoWindowColumns() ImGui::TreePop(); } -static void ShowDemoWindowMisc() +static void ShowDemoWindowInputs() { - IMGUI_DEMO_MARKER("Filtering"); - if (ImGui::CollapsingHeader("Filtering")) - { - // Helper class to easy setup a text filter. - // You may want to implement a more feature-full filtering scheme in your own application. - static ImGuiTextFilter filter; - ImGui::Text("Filter usage:\n" - " \"\" display all lines\n" - " \"xxx\" display lines containing \"xxx\"\n" - " \"xxx,yyy\" display lines containing \"xxx\" or \"yyy\"\n" - " \"-xxx\" hide lines containing \"xxx\""); - filter.Draw(); - const char* lines[] = { "aaa1.c", "bbb1.c", "ccc1.c", "aaa2.cpp", "bbb2.cpp", "ccc2.cpp", "abc.h", "hello, world" }; - for (int i = 0; i < IM_ARRAYSIZE(lines); i++) - if (filter.PassFilter(lines[i])) - ImGui::BulletText("%s", lines[i]); - } - - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus"); - if (ImGui::CollapsingHeader("Inputs, Navigation & Focus")) + IMGUI_DEMO_MARKER("Inputs & Focus"); + if (ImGui::CollapsingHeader("Inputs & Focus")) { ImGuiIO& io = ImGui::GetIO(); - // Display ImGuiIO output flags - ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse); - ImGui::Text("WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose); - ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard); - ImGui::Text("WantTextInput: %d", io.WantTextInput); - ImGui::Text("WantSetMousePos: %d", io.WantSetMousePos); - ImGui::Text("NavActive: %d, NavVisible: %d", io.NavActive, io.NavVisible); - - // Display Mouse state - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse State"); - if (ImGui::TreeNode("Mouse State")) + // Display inputs submitted to ImGuiIO + IMGUI_DEMO_MARKER("Inputs & Focus/Inputs"); + ImGui::SetNextItemOpen(true, ImGuiCond_Once); + if (ImGui::TreeNode("Inputs")) { + HelpMarker( + "This is a simplified view. See more detailed input state:\n" + "- in 'Tools->Metrics/Debugger->Inputs'.\n" + "- in 'Tools->Debug Log->IO'."); if (ImGui::IsMousePosValid()) ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y); else ImGui::Text("Mouse pos: "); ImGui::Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y); - - int count = IM_ARRAYSIZE(io.MouseDown); - ImGui::Text("Mouse down:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseDown(i)) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); } - ImGui::Text("Mouse clicked:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d (%d)", i, ImGui::GetMouseClickedCount(i)); } - ImGui::Text("Mouse released:"); for (int i = 0; i < count; i++) if (ImGui::IsMouseReleased(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); } + ImGui::Text("Mouse down:"); + for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDown(i)) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); } ImGui::Text("Mouse wheel: %.1f", io.MouseWheel); - ImGui::Text("Pen Pressure: %.1f", io.PenPressure); // Note: currently unused + + // We iterate both legacy native range and named ImGuiKey ranges, which is a little odd but this allows displaying the data for old/new backends. + // User code should never have to go through such hoops! You can generally iterate between ImGuiKey_NamedKey_BEGIN and ImGuiKey_NamedKey_END. +#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO + struct funcs { static bool IsLegacyNativeDupe(ImGuiKey) { return false; } }; + ImGuiKey start_key = ImGuiKey_NamedKey_BEGIN; +#else + struct funcs { static bool IsLegacyNativeDupe(ImGuiKey key) { return key < 512 && ImGui::GetIO().KeyMap[key] != -1; } }; // Hide Native<>ImGuiKey duplicates when both exists in the array + ImGuiKey start_key = (ImGuiKey)0; +#endif + ImGui::Text("Keys down:"); for (ImGuiKey key = start_key; key < ImGuiKey_NamedKey_END; key = (ImGuiKey)(key + 1)) { if (funcs::IsLegacyNativeDupe(key) || !ImGui::IsKeyDown(key)) continue; ImGui::SameLine(); ImGui::Text((key < ImGuiKey_NamedKey_BEGIN) ? "\"%s\"" : "\"%s\" %d", ImGui::GetKeyName(key), key); } + ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : ""); + ImGui::Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine(); ImGui::Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public. + ImGui::TreePop(); } - // Display Keyboard/Mouse state - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Keyboard & Navigation State"); - if (ImGui::TreeNode("Keyboard & Navigation State")) + // Display ImGuiIO output flags + IMGUI_DEMO_MARKER("Inputs & Focus/Outputs"); + ImGui::SetNextItemOpen(true, ImGuiCond_Once); + if (ImGui::TreeNode("Outputs")) { - ImGui::Text("Keys down:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyDown(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X) (%.02f secs)", i, i, io.KeysDownDuration[i]); } - ImGui::Text("Keys pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X)", i, i); } - ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X)", i, i); } - ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : ""); - ImGui::Text("Chars queue:"); for (int i = 0; i < io.InputQueueCharacters.Size; i++) { ImWchar c = io.InputQueueCharacters[i]; ImGui::SameLine(); ImGui::Text("\'%c\' (0x%04X)", (c > ' ' && c <= 255) ? (char)c : '?', c); } // FIXME: We should convert 'c' to UTF-8 here but the functions are not public. + HelpMarker( + "The value of io.WantCaptureMouse and io.WantCaptureKeyboard are normally set by Dear ImGui " + "to instruct your application of how to route inputs. Typically, when a value is true, it means " + "Dear ImGui wants the corresponding inputs and we expect the underlying application to ignore them.\n\n" + "The most typical case is: when hovering a window, Dear ImGui set io.WantCaptureMouse to true, " + "and underlying application should ignore mouse inputs (in practice there are many and more subtle " + "rules leading to how those flags are set)."); + ImGui::Text("io.WantCaptureMouse: %d", io.WantCaptureMouse); + ImGui::Text("io.WantCaptureMouseUnlessPopupClose: %d", io.WantCaptureMouseUnlessPopupClose); + ImGui::Text("io.WantCaptureKeyboard: %d", io.WantCaptureKeyboard); + ImGui::Text("io.WantTextInput: %d", io.WantTextInput); + ImGui::Text("io.WantSetMousePos: %d", io.WantSetMousePos); + ImGui::Text("io.NavActive: %d, io.NavVisible: %d", io.NavActive, io.NavVisible); + + IMGUI_DEMO_MARKER("Inputs & Focus/Outputs/WantCapture override"); + if (ImGui::TreeNode("WantCapture override")) + { + HelpMarker( + "Hovering the colored canvas will override io.WantCaptureXXX fields.\n" + "Notice how normally (when set to none), the value of io.WantCaptureKeyboard would be false when hovering and true when clicking."); + static int capture_override_mouse = -1; + static int capture_override_keyboard = -1; + const char* capture_override_desc[] = { "None", "Set to false", "Set to true" }; + ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15); + ImGui::SliderInt("SetNextFrameWantCaptureMouse() on hover", &capture_override_mouse, -1, +1, capture_override_desc[capture_override_mouse + 1], ImGuiSliderFlags_AlwaysClamp); + ImGui::SetNextItemWidth(ImGui::GetFontSize() * 15); + ImGui::SliderInt("SetNextFrameWantCaptureKeyboard() on hover", &capture_override_keyboard, -1, +1, capture_override_desc[capture_override_keyboard + 1], ImGuiSliderFlags_AlwaysClamp); + + ImGui::ColorButton("##panel", ImVec4(0.7f, 0.1f, 0.7f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, ImVec2(128.0f, 96.0f)); // Dummy item + if (ImGui::IsItemHovered() && capture_override_mouse != -1) + ImGui::SetNextFrameWantCaptureMouse(capture_override_mouse == 1); + if (ImGui::IsItemHovered() && capture_override_keyboard != -1) + ImGui::SetNextFrameWantCaptureKeyboard(capture_override_keyboard == 1); - ImGui::Text("NavInputs down:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputs[i] > 0.0f) { ImGui::SameLine(); ImGui::Text("[%d] %.2f (%.02f secs)", i, io.NavInputs[i], io.NavInputsDownDuration[i]); } - ImGui::Text("NavInputs pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputsDownDuration[i] == 0.0f) { ImGui::SameLine(); ImGui::Text("[%d]", i); } + ImGui::TreePop(); + } + ImGui::TreePop(); + } - ImGui::Button("Hovering me sets the\nkeyboard capture flag"); - if (ImGui::IsItemHovered()) - ImGui::CaptureKeyboardFromApp(true); - ImGui::SameLine(); - ImGui::Button("Holding me clears the\nthe keyboard capture flag"); - if (ImGui::IsItemActive()) - ImGui::CaptureKeyboardFromApp(false); + // Display mouse cursors + IMGUI_DEMO_MARKER("Inputs & Focus/Mouse Cursors"); + if (ImGui::TreeNode("Mouse Cursors")) + { + const char* mouse_cursors_names[] = { "Arrow", "TextInput", "ResizeAll", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand", "NotAllowed" }; + IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_COUNT); + + ImGuiMouseCursor current = ImGui::GetMouseCursor(); + ImGui::Text("Current mouse cursor = %d: %s", current, mouse_cursors_names[current]); + ImGui::BeginDisabled(true); + ImGui::CheckboxFlags("io.BackendFlags: HasMouseCursors", &io.BackendFlags, ImGuiBackendFlags_HasMouseCursors); + ImGui::EndDisabled(); + + ImGui::Text("Hover to see mouse cursors:"); + ImGui::SameLine(); HelpMarker( + "Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. " + "If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, " + "otherwise your backend needs to handle it."); + for (int i = 0; i < ImGuiMouseCursor_COUNT; i++) + { + char label[32]; + sprintf(label, "Mouse cursor %d: %s", i, mouse_cursors_names[i]); + ImGui::Bullet(); ImGui::Selectable(label, false); + if (ImGui::IsItemHovered()) + ImGui::SetMouseCursor(i); + } ImGui::TreePop(); } - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Tabbing"); + IMGUI_DEMO_MARKER("Inputs & Focus/Tabbing"); if (ImGui::TreeNode("Tabbing")) { ImGui::Text("Use TAB/SHIFT+TAB to cycle through keyboard editable fields."); @@ -5722,15 +5835,15 @@ static void ShowDemoWindowMisc() ImGui::InputText("1", buf, IM_ARRAYSIZE(buf)); ImGui::InputText("2", buf, IM_ARRAYSIZE(buf)); ImGui::InputText("3", buf, IM_ARRAYSIZE(buf)); - ImGui::PushAllowKeyboardFocus(false); + ImGui::PushTabStop(false); ImGui::InputText("4 (tab skip)", buf, IM_ARRAYSIZE(buf)); ImGui::SameLine(); HelpMarker("Item won't be cycled through when using TAB or Shift+Tab."); - ImGui::PopAllowKeyboardFocus(); + ImGui::PopTabStop(); ImGui::InputText("5", buf, IM_ARRAYSIZE(buf)); ImGui::TreePop(); } - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Focus from code"); + IMGUI_DEMO_MARKER("Inputs & Focus/Focus from code"); if (ImGui::TreeNode("Focus from code")) { bool focus_1 = ImGui::Button("Focus on 1"); ImGui::SameLine(); @@ -5747,12 +5860,12 @@ static void ShowDemoWindowMisc() ImGui::InputText("2", buf, IM_ARRAYSIZE(buf)); if (ImGui::IsItemActive()) has_focus = 2; - ImGui::PushAllowKeyboardFocus(false); + ImGui::PushTabStop(false); if (focus_3) ImGui::SetKeyboardFocusHere(); ImGui::InputText("3 (tab skip)", buf, IM_ARRAYSIZE(buf)); if (ImGui::IsItemActive()) has_focus = 3; ImGui::SameLine(); HelpMarker("Item won't be cycled through when using TAB or Shift+Tab."); - ImGui::PopAllowKeyboardFocus(); + ImGui::PopTabStop(); if (has_focus) ImGui::Text("Item with focus: %d", has_focus); @@ -5772,7 +5885,7 @@ static void ShowDemoWindowMisc() ImGui::TreePop(); } - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Dragging"); + IMGUI_DEMO_MARKER("Inputs & Focus/Dragging"); if (ImGui::TreeNode("Dragging")) { ImGui::TextWrapped("You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget."); @@ -5800,30 +5913,6 @@ static void ShowDemoWindowMisc() ImGui::Text("io.MouseDelta: (%.1f, %.1f)", mouse_delta.x, mouse_delta.y); ImGui::TreePop(); } - - IMGUI_DEMO_MARKER("Inputs, Navigation & Focus/Mouse cursors"); - if (ImGui::TreeNode("Mouse cursors")) - { - const char* mouse_cursors_names[] = { "Arrow", "TextInput", "ResizeAll", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE", "Hand", "NotAllowed" }; - IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_COUNT); - - ImGuiMouseCursor current = ImGui::GetMouseCursor(); - ImGui::Text("Current mouse cursor = %d: %s", current, mouse_cursors_names[current]); - ImGui::Text("Hover to see mouse cursors:"); - ImGui::SameLine(); HelpMarker( - "Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. " - "If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, " - "otherwise your backend needs to handle it."); - for (int i = 0; i < ImGuiMouseCursor_COUNT; i++) - { - char label[32]; - sprintf(label, "Mouse cursor %d: %s", i, mouse_cursors_names[i]); - ImGui::Bullet(); ImGui::Selectable(label, false); - if (ImGui::IsItemHovered()) - ImGui::SetMouseCursor(i); - } - ImGui::TreePop(); - } } } @@ -5868,6 +5957,9 @@ void ImGui::ShowAboutWindow(bool* p_open) #ifdef IMGUI_DISABLE_OBSOLETE_FUNCTIONS ImGui::Text("define: IMGUI_DISABLE_OBSOLETE_FUNCTIONS"); #endif +#ifdef IMGUI_DISABLE_OBSOLETE_KEYIO + ImGui::Text("define: IMGUI_DISABLE_OBSOLETE_KEYIO"); +#endif #ifdef IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS ImGui::Text("define: IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS"); #endif @@ -5924,6 +6016,9 @@ void ImGui::ShowAboutWindow(bool* p_open) #endif #ifdef __clang_version__ ImGui::Text("define: __clang_version__=%s", __clang_version__); +#endif +#ifdef __EMSCRIPTEN__ + ImGui::Text("define: __EMSCRIPTEN__"); #endif ImGui::Separator(); ImGui::Text("io.BackendPlatformName: %s", io.BackendPlatformName ? io.BackendPlatformName : "NULL"); @@ -5981,7 +6076,7 @@ void ImGui::ShowAboutWindow(bool* p_open) namespace ImGui { IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas); } // Demo helper function to select among loaded fonts. -// Here we use the regular BeginCombo()/EndCombo() api which is more the more flexible one. +// Here we use the regular BeginCombo()/EndCombo() api which is the more flexible one. void ImGui::ShowFontSelector(const char* label) { ImGuiIO& io = ImGui::GetIO(); @@ -6073,7 +6168,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) { if (ImGui::BeginTabItem("Sizes")) { - ImGui::Text("Main"); + ImGui::SeparatorText("Main"); ImGui::SliderFloat2("WindowPadding", (float*)&style.WindowPadding, 0.0f, 20.0f, "%.0f"); ImGui::SliderFloat2("FramePadding", (float*)&style.FramePadding, 0.0f, 20.0f, "%.0f"); ImGui::SliderFloat2("CellPadding", (float*)&style.CellPadding, 0.0f, 20.0f, "%.0f"); @@ -6083,22 +6178,24 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) ImGui::SliderFloat("IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f, "%.0f"); ImGui::SliderFloat("ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); ImGui::SliderFloat("GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f, "%.0f"); - ImGui::Text("Borders"); + + ImGui::SeparatorText("Borders"); ImGui::SliderFloat("WindowBorderSize", &style.WindowBorderSize, 0.0f, 1.0f, "%.0f"); ImGui::SliderFloat("ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f, "%.0f"); ImGui::SliderFloat("PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f, "%.0f"); ImGui::SliderFloat("FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f, "%.0f"); ImGui::SliderFloat("TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f, "%.0f"); - ImGui::Text("Rounding"); + + ImGui::SeparatorText("Rounding"); ImGui::SliderFloat("WindowRounding", &style.WindowRounding, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("ChildRounding", &style.ChildRounding, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("FrameRounding", &style.FrameRounding, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("PopupRounding", &style.PopupRounding, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("ScrollbarRounding", &style.ScrollbarRounding, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("GrabRounding", &style.GrabRounding, 0.0f, 12.0f, "%.0f"); - ImGui::SliderFloat("LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f"); ImGui::SliderFloat("TabRounding", &style.TabRounding, 0.0f, 12.0f, "%.0f"); - ImGui::Text("Alignment"); + + ImGui::SeparatorText("Widgets"); ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f"); int window_menu_button_position = style.WindowMenuButtonPosition + 1; if (ImGui::Combo("WindowMenuButtonPosition", (int*)&window_menu_button_position, "None\0Left\0Right\0")) @@ -6108,9 +6205,13 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) ImGui::SameLine(); HelpMarker("Alignment applies when a button is larger than its text content."); ImGui::SliderFloat2("SelectableTextAlign", (float*)&style.SelectableTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); HelpMarker("Alignment applies when a selectable is larger than its text content."); - ImGui::Text("Safe Area Padding"); - ImGui::SameLine(); HelpMarker("Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured)."); - ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); + ImGui::SliderFloat("SeparatorTextBorderSize", &style.SeparatorTextBorderSize, 0.0f, 10.0f, "%.0f"); + ImGui::SliderFloat2("SeparatorTextAlign", (float*)&style.SeparatorTextAlign, 0.0f, 1.0f, "%.2f"); + ImGui::SliderFloat2("SeparatorTextPadding", (float*)&style.SeparatorTextPadding, 0.0f, 40.0f, "%0.f"); + ImGui::SliderFloat("LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f"); + + ImGui::SeparatorText("Misc"); + ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f"); ImGui::SameLine(); HelpMarker("Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured)."); ImGui::EndTabItem(); } @@ -6220,10 +6321,11 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) // When editing the "Circle Segment Max Error" value, draw a preview of its effect on auto-tessellated circles. ImGui::DragFloat("Circle Tessellation Max Error", &style.CircleTessellationMaxError , 0.005f, 0.10f, 5.0f, "%.2f", ImGuiSliderFlags_AlwaysClamp); - if (ImGui::IsItemActive()) - { + const bool show_samples = ImGui::IsItemActive(); + if (show_samples) ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos()); - ImGui::BeginTooltip(); + if (show_samples && ImGui::BeginTooltip()) + { ImGui::TextUnformatted("(R = radius, N = number of segments)"); ImGui::Spacing(); ImDrawList* draw_list = ImGui::GetWindowDrawList(); @@ -6273,6 +6375,40 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref) ImGui::PopItemWidth(); } +//----------------------------------------------------------------------------- +// [SECTION] User Guide / ShowUserGuide() +//----------------------------------------------------------------------------- + +void ImGui::ShowUserGuide() +{ + ImGuiIO& io = ImGui::GetIO(); + ImGui::BulletText("Double-click on title bar to collapse window."); + ImGui::BulletText( + "Click and drag on lower corner to resize window\n" + "(double-click to auto fit window to its contents)."); + ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text."); + ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields."); + ImGui::BulletText("CTRL+Tab to select a window."); + if (io.FontAllowUserScaling) + ImGui::BulletText("CTRL+Mouse Wheel to zoom window contents."); + ImGui::BulletText("While inputing text:\n"); + ImGui::Indent(); + ImGui::BulletText("CTRL+Left/Right to word jump."); + ImGui::BulletText("CTRL+A or double-click to select all."); + ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste."); + ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo."); + ImGui::BulletText("ESCAPE to revert."); + ImGui::Unindent(); + ImGui::BulletText("With keyboard navigation enabled:"); + ImGui::Indent(); + ImGui::BulletText("Arrow keys to navigate."); + ImGui::BulletText("Space to activate a widget."); + ImGui::BulletText("Return to input text into a widget."); + ImGui::BulletText("Escape to deactivate a widget, close popup, exit child window."); + ImGui::BulletText("Alt to jump to the menu layer of a window."); + ImGui::Unindent(); +} + //----------------------------------------------------------------------------- // [SECTION] Example App: Main Menu Bar / ShowExampleAppMainMenuBar() //----------------------------------------------------------------------------- @@ -6386,6 +6522,7 @@ static void ShowExampleMenuFile() IM_ASSERT(0); } if (ImGui::MenuItem("Checked", NULL, true)) {} + ImGui::Separator(); if (ImGui::MenuItem("Quit", "Alt+F4")) {} } @@ -6507,72 +6644,76 @@ struct ExampleAppConsole // Reserve enough left-over height for 1 separator + 1 input text const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing(); - ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), false, ImGuiWindowFlags_HorizontalScrollbar); - if (ImGui::BeginPopupContextWindow()) + if (ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footer_height_to_reserve), false, ImGuiWindowFlags_HorizontalScrollbar)) { - if (ImGui::Selectable("Clear")) ClearLog(); - ImGui::EndPopup(); - } + if (ImGui::BeginPopupContextWindow()) + { + if (ImGui::Selectable("Clear")) ClearLog(); + ImGui::EndPopup(); + } - // Display every line as a separate entry so we can change their color or add custom widgets. - // If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end()); - // NB- if you have thousands of entries this approach may be too inefficient and may require user-side clipping - // to only process visible items. The clipper will automatically measure the height of your first item and then - // "seek" to display only items in the visible area. - // To use the clipper we can replace your standard loop: - // for (int i = 0; i < Items.Size; i++) - // With: - // ImGuiListClipper clipper; - // clipper.Begin(Items.Size); - // while (clipper.Step()) - // for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) - // - That your items are evenly spaced (same height) - // - That you have cheap random access to your elements (you can access them given their index, - // without processing all the ones before) - // You cannot this code as-is if a filter is active because it breaks the 'cheap random-access' property. - // We would need random-access on the post-filtered list. - // A typical application wanting coarse clipping and filtering may want to pre-compute an array of indices - // or offsets of items that passed the filtering test, recomputing this array when user changes the filter, - // and appending newly elements as they are inserted. This is left as a task to the user until we can manage - // to improve this example code! - // If your items are of variable height: - // - Split them into same height items would be simpler and facilitate random-seeking into your list. - // - Consider using manual call to IsRectVisible() and skipping extraneous decoration from your items. - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 1)); // Tighten spacing - if (copy_to_clipboard) - ImGui::LogToClipboard(); - for (int i = 0; i < Items.Size; i++) - { - const char* item = Items[i]; - if (!Filter.PassFilter(item)) - continue; + // Display every line as a separate entry so we can change their color or add custom widgets. + // If you only want raw text you can use ImGui::TextUnformatted(log.begin(), log.end()); + // NB- if you have thousands of entries this approach may be too inefficient and may require user-side clipping + // to only process visible items. The clipper will automatically measure the height of your first item and then + // "seek" to display only items in the visible area. + // To use the clipper we can replace your standard loop: + // for (int i = 0; i < Items.Size; i++) + // With: + // ImGuiListClipper clipper; + // clipper.Begin(Items.Size); + // while (clipper.Step()) + // for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) + // - That your items are evenly spaced (same height) + // - That you have cheap random access to your elements (you can access them given their index, + // without processing all the ones before) + // You cannot this code as-is if a filter is active because it breaks the 'cheap random-access' property. + // We would need random-access on the post-filtered list. + // A typical application wanting coarse clipping and filtering may want to pre-compute an array of indices + // or offsets of items that passed the filtering test, recomputing this array when user changes the filter, + // and appending newly elements as they are inserted. This is left as a task to the user until we can manage + // to improve this example code! + // If your items are of variable height: + // - Split them into same height items would be simpler and facilitate random-seeking into your list. + // - Consider using manual call to IsRectVisible() and skipping extraneous decoration from your items. + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 1)); // Tighten spacing + if (copy_to_clipboard) + ImGui::LogToClipboard(); + for (int i = 0; i < Items.Size; i++) + { + const char* item = Items[i]; + if (!Filter.PassFilter(item)) + continue; - // Normally you would store more information in your item than just a string. - // (e.g. make Items[] an array of structure, store color/type etc.) - ImVec4 color; - bool has_color = false; - if (strstr(item, "[error]")) { color = ImVec4(1.0f, 0.4f, 0.4f, 1.0f); has_color = true; } - else if (strncmp(item, "# ", 2) == 0) { color = ImVec4(1.0f, 0.8f, 0.6f, 1.0f); has_color = true; } - if (has_color) - ImGui::PushStyleColor(ImGuiCol_Text, color); - ImGui::TextUnformatted(item); - if (has_color) - ImGui::PopStyleColor(); - } - if (copy_to_clipboard) - ImGui::LogFinish(); + // Normally you would store more information in your item than just a string. + // (e.g. make Items[] an array of structure, store color/type etc.) + ImVec4 color; + bool has_color = false; + if (strstr(item, "[error]")) { color = ImVec4(1.0f, 0.4f, 0.4f, 1.0f); has_color = true; } + else if (strncmp(item, "# ", 2) == 0) { color = ImVec4(1.0f, 0.8f, 0.6f, 1.0f); has_color = true; } + if (has_color) + ImGui::PushStyleColor(ImGuiCol_Text, color); + ImGui::TextUnformatted(item); + if (has_color) + ImGui::PopStyleColor(); + } + if (copy_to_clipboard) + ImGui::LogFinish(); - if (ScrollToBottom || (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())) - ImGui::SetScrollHereY(1.0f); - ScrollToBottom = false; + // Keep up at the bottom of the scroll region if we were already at the bottom at the beginning of the frame. + // Using a scrollbar or mouse-wheel will take away from the bottom edge. + if (ScrollToBottom || (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())) + ImGui::SetScrollHereY(1.0f); + ScrollToBottom = false; - ImGui::PopStyleVar(); + ImGui::PopStyleVar(); + } ImGui::EndChild(); ImGui::Separator(); // Command-line bool reclaim_focus = false; - ImGuiInputTextFlags input_text_flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory; + ImGuiInputTextFlags input_text_flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_EscapeClearsAll | ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory; if (ImGui::InputText("Input", InputBuf, IM_ARRAYSIZE(InputBuf), input_text_flags, &TextEditCallbackStub, (void*)this)) { char* s = InputBuf; @@ -6814,63 +6955,66 @@ struct ExampleAppLog Filter.Draw("Filter", -100.0f); ImGui::Separator(); - ImGui::BeginChild("scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar); - - if (clear) - Clear(); - if (copy) - ImGui::LogToClipboard(); - ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); - const char* buf = Buf.begin(); - const char* buf_end = Buf.end(); - if (Filter.IsActive()) + if (ImGui::BeginChild("scrolling", ImVec2(0, 0), false, ImGuiWindowFlags_HorizontalScrollbar)) { - // In this example we don't use the clipper when Filter is enabled. - // This is because we don't have a random access on the result on our filter. - // A real application processing logs with ten of thousands of entries may want to store the result of - // search/filter.. especially if the filtering function is not trivial (e.g. reg-exp). - for (int line_no = 0; line_no < LineOffsets.Size; line_no++) - { - const char* line_start = buf + LineOffsets[line_no]; - const char* line_end = (line_no + 1 < LineOffsets.Size) ? (buf + LineOffsets[line_no + 1] - 1) : buf_end; - if (Filter.PassFilter(line_start, line_end)) - ImGui::TextUnformatted(line_start, line_end); - } - } - else - { - // The simplest and easy way to display the entire buffer: - // ImGui::TextUnformatted(buf_begin, buf_end); - // And it'll just work. TextUnformatted() has specialization for large blob of text and will fast-forward - // to skip non-visible lines. Here we instead demonstrate using the clipper to only process lines that are - // within the visible area. - // If you have tens of thousands of items and their processing cost is non-negligible, coarse clipping them - // on your side is recommended. Using ImGuiListClipper requires - // - A) random access into your data - // - B) items all being the same height, - // both of which we can handle since we an array pointing to the beginning of each line of text. - // When using the filter (in the block of code above) we don't have random access into the data to display - // anymore, which is why we don't use the clipper. Storing or skimming through the search result would make - // it possible (and would be recommended if you want to search through tens of thousands of entries). - ImGuiListClipper clipper; - clipper.Begin(LineOffsets.Size); - while (clipper.Step()) - { - for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++) + if (clear) + Clear(); + if (copy) + ImGui::LogToClipboard(); + + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); + const char* buf = Buf.begin(); + const char* buf_end = Buf.end(); + if (Filter.IsActive()) + { + // In this example we don't use the clipper when Filter is enabled. + // This is because we don't have random access to the result of our filter. + // A real application processing logs with ten of thousands of entries may want to store the result of + // search/filter.. especially if the filtering function is not trivial (e.g. reg-exp). + for (int line_no = 0; line_no < LineOffsets.Size; line_no++) { const char* line_start = buf + LineOffsets[line_no]; const char* line_end = (line_no + 1 < LineOffsets.Size) ? (buf + LineOffsets[line_no + 1] - 1) : buf_end; - ImGui::TextUnformatted(line_start, line_end); + if (Filter.PassFilter(line_start, line_end)) + ImGui::TextUnformatted(line_start, line_end); } } - clipper.End(); - } - ImGui::PopStyleVar(); - - if (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) - ImGui::SetScrollHereY(1.0f); + else + { + // The simplest and easy way to display the entire buffer: + // ImGui::TextUnformatted(buf_begin, buf_end); + // And it'll just work. TextUnformatted() has specialization for large blob of text and will fast-forward + // to skip non-visible lines. Here we instead demonstrate using the clipper to only process lines that are + // within the visible area. + // If you have tens of thousands of items and their processing cost is non-negligible, coarse clipping them + // on your side is recommended. Using ImGuiListClipper requires + // - A) random access into your data + // - B) items all being the same height, + // both of which we can handle since we have an array pointing to the beginning of each line of text. + // When using the filter (in the block of code above) we don't have random access into the data to display + // anymore, which is why we don't use the clipper. Storing or skimming through the search result would make + // it possible (and would be recommended if you want to search through tens of thousands of entries). + ImGuiListClipper clipper; + clipper.Begin(LineOffsets.Size); + while (clipper.Step()) + { + for (int line_no = clipper.DisplayStart; line_no < clipper.DisplayEnd; line_no++) + { + const char* line_start = buf + LineOffsets[line_no]; + const char* line_end = (line_no + 1 < LineOffsets.Size) ? (buf + LineOffsets[line_no + 1] - 1) : buf_end; + ImGui::TextUnformatted(line_start, line_end); + } + } + clipper.End(); + } + ImGui::PopStyleVar(); + // Keep up at the bottom of the scroll region if we were already at the bottom at the beginning of the frame. + // Using a scrollbar or mouse-wheel will take away from the bottom edge. + if (AutoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) + ImGui::SetScrollHereY(1.0f); + } ImGui::EndChild(); ImGui::End(); } @@ -6922,7 +7066,7 @@ static void ShowExampleAppLayout(bool* p_open) { if (ImGui::BeginMenu("File")) { - if (ImGui::MenuItem("Close")) *p_open = false; + if (ImGui::MenuItem("Close", "Ctrl+W")) { *p_open = false; } ImGui::EndMenu(); } ImGui::EndMenuBar(); @@ -7150,51 +7294,82 @@ static void ShowExampleAppAutoResize(bool* p_open) //----------------------------------------------------------------------------- // Demonstrate creating a window with custom resize constraints. +// Note that size constraints currently don't work on a docked window (when in 'docking' branch) static void ShowExampleAppConstrainedResize(bool* p_open) { struct CustomConstraints { // Helper functions to demonstrate programmatic constraints - static void Square(ImGuiSizeCallbackData* data) { data->DesiredSize.x = data->DesiredSize.y = IM_MAX(data->DesiredSize.x, data->DesiredSize.y); } - static void Step(ImGuiSizeCallbackData* data) { float step = (float)(int)(intptr_t)data->UserData; data->DesiredSize = ImVec2((int)(data->DesiredSize.x / step + 0.5f) * step, (int)(data->DesiredSize.y / step + 0.5f) * step); } + // FIXME: This doesn't take account of decoration size (e.g. title bar), library should make this easier. + static void AspectRatio(ImGuiSizeCallbackData* data) { float aspect_ratio = *(float*)data->UserData; data->DesiredSize.x = IM_MAX(data->CurrentSize.x, data->CurrentSize.y); data->DesiredSize.y = (float)(int)(data->DesiredSize.x / aspect_ratio); } + static void Square(ImGuiSizeCallbackData* data) { data->DesiredSize.x = data->DesiredSize.y = IM_MAX(data->CurrentSize.x, data->CurrentSize.y); } + static void Step(ImGuiSizeCallbackData* data) { float step = *(float*)data->UserData; data->DesiredSize = ImVec2((int)(data->CurrentSize.x / step + 0.5f) * step, (int)(data->CurrentSize.y / step + 0.5f) * step); } }; const char* test_desc[] = { + "Between 100x100 and 500x500", + "At least 100x100", "Resize vertical only", "Resize horizontal only", - "Width > 100, Height > 100", - "Width 400-500", - "Height 400-500", + "Width Between 400 and 500", + "Custom: Aspect Ratio 16:9", "Custom: Always Square", "Custom: Fixed Steps (100)", }; + // Options static bool auto_resize = false; - static int type = 0; + static bool window_padding = true; + static int type = 5; // Aspect Ratio static int display_lines = 10; - if (type == 0) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, FLT_MAX)); // Vertical only - if (type == 1) ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)); // Horizontal only - if (type == 2) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)); // Width > 100, Height > 100 - if (type == 3) ImGui::SetNextWindowSizeConstraints(ImVec2(400, -1), ImVec2(500, -1)); // Width 400-500 - if (type == 4) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 400), ImVec2(-1, 500)); // Height 400-500 - if (type == 5) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Square); // Always Square - if (type == 6) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Step, (void*)(intptr_t)100); // Fixed Step - ImGuiWindowFlags flags = auto_resize ? ImGuiWindowFlags_AlwaysAutoResize : 0; - if (ImGui::Begin("Example: Constrained Resize", p_open, flags)) + // Submit constraint + float aspect_ratio = 16.0f / 9.0f; + float fixed_step = 100.0f; + if (type == 0) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(500, 500)); // Between 100x100 and 500x500 + if (type == 1) ImGui::SetNextWindowSizeConstraints(ImVec2(100, 100), ImVec2(FLT_MAX, FLT_MAX)); // Width > 100, Height > 100 + if (type == 2) ImGui::SetNextWindowSizeConstraints(ImVec2(-1, 0), ImVec2(-1, FLT_MAX)); // Vertical only + if (type == 3) ImGui::SetNextWindowSizeConstraints(ImVec2(0, -1), ImVec2(FLT_MAX, -1)); // Horizontal only + if (type == 4) ImGui::SetNextWindowSizeConstraints(ImVec2(400, -1), ImVec2(500, -1)); // Width Between and 400 and 500 + if (type == 5) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::AspectRatio, (void*)&aspect_ratio); // Aspect ratio + if (type == 6) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Square); // Always Square + if (type == 7) ImGui::SetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, FLT_MAX), CustomConstraints::Step, (void*)&fixed_step); // Fixed Step + + // Submit window + if (!window_padding) + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); + const ImGuiWindowFlags window_flags = auto_resize ? ImGuiWindowFlags_AlwaysAutoResize : 0; + const bool window_open = ImGui::Begin("Example: Constrained Resize", p_open, window_flags); + if (!window_padding) + ImGui::PopStyleVar(); + if (window_open) { IMGUI_DEMO_MARKER("Examples/Constrained Resizing window"); - if (ImGui::Button("200x200")) { ImGui::SetWindowSize(ImVec2(200, 200)); } ImGui::SameLine(); - if (ImGui::Button("500x500")) { ImGui::SetWindowSize(ImVec2(500, 500)); } ImGui::SameLine(); - if (ImGui::Button("800x200")) { ImGui::SetWindowSize(ImVec2(800, 200)); } - ImGui::SetNextItemWidth(200); - ImGui::Combo("Constraint", &type, test_desc, IM_ARRAYSIZE(test_desc)); - ImGui::SetNextItemWidth(200); - ImGui::DragInt("Lines", &display_lines, 0.2f, 1, 100); - ImGui::Checkbox("Auto-resize", &auto_resize); - for (int i = 0; i < display_lines; i++) - ImGui::Text("%*sHello, sailor! Making this line long enough for the example.", i * 4, ""); + if (ImGui::GetIO().KeyShift) + { + // Display a dummy viewport (in your real app you would likely use ImageButton() to display a texture. + ImVec2 avail_size = ImGui::GetContentRegionAvail(); + ImVec2 pos = ImGui::GetCursorScreenPos(); + ImGui::ColorButton("viewport", ImVec4(0.5f, 0.2f, 0.5f, 1.0f), ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoDragDrop, avail_size); + ImGui::SetCursorScreenPos(ImVec2(pos.x + 10, pos.y + 10)); + ImGui::Text("%.2f x %.2f", avail_size.x, avail_size.y); + } + else + { + ImGui::Text("(Hold SHIFT to display a dummy viewport)"); + if (ImGui::Button("Set 200x200")) { ImGui::SetWindowSize(ImVec2(200, 200)); } ImGui::SameLine(); + if (ImGui::Button("Set 500x500")) { ImGui::SetWindowSize(ImVec2(500, 500)); } ImGui::SameLine(); + if (ImGui::Button("Set 800x200")) { ImGui::SetWindowSize(ImVec2(800, 200)); } + ImGui::SetNextItemWidth(ImGui::GetFontSize() * 20); + ImGui::Combo("Constraint", &type, test_desc, IM_ARRAYSIZE(test_desc)); + ImGui::SetNextItemWidth(ImGui::GetFontSize() * 20); + ImGui::DragInt("Lines", &display_lines, 0.2f, 1, 100); + ImGui::Checkbox("Auto-resize", &auto_resize); + ImGui::Checkbox("Window padding", &window_padding); + for (int i = 0; i < display_lines; i++) + ImGui::Text("%*sHello, sailor! Making this line long enough for the example.", i * 4, ""); + } } ImGui::End(); } @@ -7207,28 +7382,34 @@ static void ShowExampleAppConstrainedResize(bool* p_open) // + a context-menu to choose which corner of the screen to use. static void ShowExampleAppSimpleOverlay(bool* p_open) { - static int corner = 0; + static int location = 0; ImGuiIO& io = ImGui::GetIO(); ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav; - if (corner != -1) + if (location >= 0) { const float PAD = 10.0f; const ImGuiViewport* viewport = ImGui::GetMainViewport(); ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any! ImVec2 work_size = viewport->WorkSize; ImVec2 window_pos, window_pos_pivot; - window_pos.x = (corner & 1) ? (work_pos.x + work_size.x - PAD) : (work_pos.x + PAD); - window_pos.y = (corner & 2) ? (work_pos.y + work_size.y - PAD) : (work_pos.y + PAD); - window_pos_pivot.x = (corner & 1) ? 1.0f : 0.0f; - window_pos_pivot.y = (corner & 2) ? 1.0f : 0.0f; + window_pos.x = (location & 1) ? (work_pos.x + work_size.x - PAD) : (work_pos.x + PAD); + window_pos.y = (location & 2) ? (work_pos.y + work_size.y - PAD) : (work_pos.y + PAD); + window_pos_pivot.x = (location & 1) ? 1.0f : 0.0f; + window_pos_pivot.y = (location & 2) ? 1.0f : 0.0f; ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot); window_flags |= ImGuiWindowFlags_NoMove; } + else if (location == -2) + { + // Center window + ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f)); + window_flags |= ImGuiWindowFlags_NoMove; + } ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background if (ImGui::Begin("Example: Simple overlay", p_open, window_flags)) { IMGUI_DEMO_MARKER("Examples/Simple Overlay"); - ImGui::Text("Simple overlay\n" "in the corner of the screen.\n" "(right-click to change position)"); + ImGui::Text("Simple overlay\n" "(right-click to change position)"); ImGui::Separator(); if (ImGui::IsMousePosValid()) ImGui::Text("Mouse Position: (%.1f,%.1f)", io.MousePos.x, io.MousePos.y); @@ -7236,11 +7417,12 @@ static void ShowExampleAppSimpleOverlay(bool* p_open) ImGui::Text("Mouse Position: "); if (ImGui::BeginPopupContextWindow()) { - if (ImGui::MenuItem("Custom", NULL, corner == -1)) corner = -1; - if (ImGui::MenuItem("Top-left", NULL, corner == 0)) corner = 0; - if (ImGui::MenuItem("Top-right", NULL, corner == 1)) corner = 1; - if (ImGui::MenuItem("Bottom-left", NULL, corner == 2)) corner = 2; - if (ImGui::MenuItem("Bottom-right", NULL, corner == 3)) corner = 3; + if (ImGui::MenuItem("Custom", NULL, location == -1)) location = -1; + if (ImGui::MenuItem("Center", NULL, location == -2)) location = -2; + if (ImGui::MenuItem("Top-left", NULL, location == 0)) location = 0; + if (ImGui::MenuItem("Top-right", NULL, location == 1)) location = 1; + if (ImGui::MenuItem("Bottom-left", NULL, location == 2)) location = 2; + if (ImGui::MenuItem("Bottom-right", NULL, location == 3)) location = 3; if (p_open && ImGui::MenuItem("Close")) *p_open = false; ImGui::EndPopup(); } @@ -7256,10 +7438,10 @@ static void ShowExampleAppSimpleOverlay(bool* p_open) static void ShowExampleAppFullscreen(bool* p_open) { static bool use_work_area = true; - static ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings; + static ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings; // We demonstrate using the full viewport area or the work area (without menu-bars, task-bars etc.) - // Based on your use case you may want one of the other. + // Based on your use case you may want one or the other. const ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(use_work_area ? viewport->WorkPos : viewport->Pos); ImGui::SetNextWindowSize(use_work_area ? viewport->WorkSize : viewport->Size); @@ -7288,8 +7470,8 @@ static void ShowExampleAppFullscreen(bool* p_open) // [SECTION] Example App: Manipulating Window Titles / ShowExampleAppWindowTitles() //----------------------------------------------------------------------------- -// Demonstrate using "##" and "###" in identifiers to manipulate ID generation. -// This apply to all regular items as well. +// Demonstrate the use of "##" and "###" in identifiers to manipulate ID generation. +// This applies to all regular items as well. // Read FAQ section "How can I have multiple widgets with the same label?" for details. static void ShowExampleAppWindowTitles(bool*) { @@ -7509,8 +7691,8 @@ static void ShowExampleAppCustomRendering(bool* p_open) // Context menu (under default mouse threshold) ImVec2 drag_delta = ImGui::GetMouseDragDelta(ImGuiMouseButton_Right); - if (opt_enable_context_menu && ImGui::IsMouseReleased(ImGuiMouseButton_Right) && drag_delta.x == 0.0f && drag_delta.y == 0.0f) - ImGui::OpenPopupOnItemClick("context"); + if (opt_enable_context_menu && drag_delta.x == 0.0f && drag_delta.y == 0.0f) + ImGui::OpenPopupOnItemClick("context", ImGuiPopupFlags_MouseButtonRight); if (ImGui::BeginPopup("context")) { if (adding_line) @@ -7694,7 +7876,8 @@ void ShowExampleAppDocuments(bool* p_open) if (ImGui::MenuItem("Close All Documents", NULL, false, open_count > 0)) for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++) app.Documents[doc_n].DoQueueClose(); - if (ImGui::MenuItem("Exit", "Alt+F4")) {} + if (ImGui::MenuItem("Exit", "Ctrl+F4") && p_open) + *p_open = false; ImGui::EndMenu(); } ImGui::EndMenuBar(); diff --git a/Sources/CImGui/imgui/imgui_draw.cpp b/Sources/CImGui/imgui/imgui_draw.cpp index bf1da15..182ec83 100644 --- a/Sources/CImGui/imgui/imgui_draw.cpp +++ b/Sources/CImGui/imgui/imgui_draw.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.86 +// dear imgui, v1.89.5 // (drawing and font code) /* @@ -26,38 +26,24 @@ Index of this file: #define _CRT_SECURE_NO_WARNINGS #endif -#include "imgui.h" -#ifndef IMGUI_DISABLE - #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif +#include "imgui.h" +#ifndef IMGUI_DISABLE #include "imgui_internal.h" #ifdef IMGUI_ENABLE_FREETYPE #include "misc/freetype/imgui_freetype.h" #endif #include // vsnprintf, sscanf, printf -#if !defined(alloca) -#if defined(__GLIBC__) || defined(__sun) || defined(__APPLE__) || defined(__NEWLIB__) -#include // alloca (glibc uses . Note that Cygwin may have _WIN32 defined, so the order matters here) -#elif defined(_WIN32) -#include // alloca -#if !defined(alloca) -#define alloca _alloca // for clang with MS Codegen -#endif -#else -#include // alloca -#endif -#endif // Visual Studio warnings #ifdef _MSC_VER #pragma warning (disable: 4127) // condition expression is constant #pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff) #pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen -#pragma warning (disable: 6255) // [Static Analyzer] _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead. #pragma warning (disable: 26451) // [Static Analyzer] Arithmetic overflow : Using operator 'xxx' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator 'xxx' to avoid overflow(io.2). #pragma warning (disable: 26812) // [Static Analyzer] The enum type 'xxx' is unscoped. Prefer 'enum class' over 'enum' (Enum.3). [MSVC Static Analyzer) #endif @@ -67,9 +53,6 @@ Index of this file: #if __has_warning("-Wunknown-warning-option") #pragma clang diagnostic ignored "-Wunknown-warning-option" // warning: unknown warning group 'xxx' // not all warnings are known by all Clang versions and they tend to be rename-happy.. so ignoring warnings triggers new warnings on some configuration. Great! #endif -#if __has_warning("-Walloca") -#pragma clang diagnostic ignored "-Walloca" // warning: use of function '__builtin_alloca' is discouraged -#endif #pragma clang diagnostic ignored "-Wunknown-pragmas" // warning: unknown warning group 'xxx' #pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast // yes, they are more terse. #pragma clang diagnostic ignored "-Wfloat-equal" // warning: comparing floating point with == or != is unsafe // storing and comparing against same constants ok. @@ -90,7 +73,7 @@ Index of this file: #endif //------------------------------------------------------------------------- -// [SECTION] STB libraries implementation +// [SECTION] STB libraries implementation (for stb_truetype and stb_rect_pack) //------------------------------------------------------------------------- // Compile time options: @@ -393,7 +376,7 @@ void ImDrawListSharedData::SetCircleTessellationMaxError(float max_error) for (int i = 0; i < IM_ARRAYSIZE(CircleSegmentCounts); i++) { const float radius = (float)i; - CircleSegmentCounts[i] = (ImU8)((i > 0) ? IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, CircleSegmentMaxError) : 0); + CircleSegmentCounts[i] = (ImU8)((i > 0) ? IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(radius, CircleSegmentMaxError) : IM_DRAWLIST_ARCFAST_SAMPLE_MAX); } ArcFastRadiusCutoff = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(IM_DRAWLIST_ARCFAST_SAMPLE_MAX, CircleSegmentMaxError); } @@ -402,10 +385,11 @@ void ImDrawListSharedData::SetCircleTessellationMaxError(float max_error) void ImDrawList::_ResetForNewFrame() { // Verify that the ImDrawCmd fields we want to memcmp() are contiguous in memory. - // (those should be IM_STATIC_ASSERT() in theory but with our pre C++11 setup the whole check doesn't compile with GCC) - IM_ASSERT(IM_OFFSETOF(ImDrawCmd, ClipRect) == 0); - IM_ASSERT(IM_OFFSETOF(ImDrawCmd, TextureId) == sizeof(ImVec4)); - IM_ASSERT(IM_OFFSETOF(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID)); + IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, ClipRect) == 0); + IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, TextureId) == sizeof(ImVec4)); + IM_STATIC_ASSERT(IM_OFFSETOF(ImDrawCmd, VtxOffset) == sizeof(ImVec4) + sizeof(ImTextureID)); + if (_Splitter._Count > 1) + _Splitter.Merge(this); CmdBuffer.resize(0); IdxBuffer.resize(0); @@ -464,11 +448,13 @@ void ImDrawList::AddDrawCmd() // Note that this leaves the ImDrawList in a state unfit for further commands, as most code assume that CmdBuffer.Size > 0 && CmdBuffer.back().UserCallback == NULL void ImDrawList::_PopUnusedDrawCmd() { - if (CmdBuffer.Size == 0) - return; - ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; - if (curr_cmd->ElemCount == 0 && curr_cmd->UserCallback == NULL) + while (CmdBuffer.Size > 0) + { + ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; + if (curr_cmd->ElemCount != 0 || curr_cmd->UserCallback != NULL) + return;// break; CmdBuffer.pop_back(); + } } void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data) @@ -488,9 +474,10 @@ void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data) } // Compare ClipRect, TextureId and VtxOffset with a single memcmp() -#define ImDrawCmd_HeaderSize (IM_OFFSETOF(ImDrawCmd, VtxOffset) + sizeof(unsigned int)) -#define ImDrawCmd_HeaderCompare(CMD_LHS, CMD_RHS) (memcmp(CMD_LHS, CMD_RHS, ImDrawCmd_HeaderSize)) // Compare ClipRect, TextureId, VtxOffset -#define ImDrawCmd_HeaderCopy(CMD_DST, CMD_SRC) (memcpy(CMD_DST, CMD_SRC, ImDrawCmd_HeaderSize)) // Copy ClipRect, TextureId, VtxOffset +#define ImDrawCmd_HeaderSize (IM_OFFSETOF(ImDrawCmd, VtxOffset) + sizeof(unsigned int)) +#define ImDrawCmd_HeaderCompare(CMD_LHS, CMD_RHS) (memcmp(CMD_LHS, CMD_RHS, ImDrawCmd_HeaderSize)) // Compare ClipRect, TextureId, VtxOffset +#define ImDrawCmd_HeaderCopy(CMD_DST, CMD_SRC) (memcpy(CMD_DST, CMD_SRC, ImDrawCmd_HeaderSize)) // Copy ClipRect, TextureId, VtxOffset +#define ImDrawCmd_AreSequentialIdxOffset(CMD_0, CMD_1) (CMD_0->IdxOffset + CMD_0->ElemCount == CMD_1->IdxOffset) // Try to merge two last draw commands void ImDrawList::_TryMergeDrawCmds() @@ -498,7 +485,7 @@ void ImDrawList::_TryMergeDrawCmds() IM_ASSERT_PARANOID(CmdBuffer.Size > 0); ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1]; ImDrawCmd* prev_cmd = curr_cmd - 1; - if (ImDrawCmd_HeaderCompare(curr_cmd, prev_cmd) == 0 && curr_cmd->UserCallback == NULL && prev_cmd->UserCallback == NULL) + if (ImDrawCmd_HeaderCompare(curr_cmd, prev_cmd) == 0 && ImDrawCmd_AreSequentialIdxOffset(prev_cmd, curr_cmd) && curr_cmd->UserCallback == NULL && prev_cmd->UserCallback == NULL) { prev_cmd->ElemCount += curr_cmd->ElemCount; CmdBuffer.pop_back(); @@ -521,7 +508,7 @@ void ImDrawList::_OnChangedClipRect() // Try to merge with previous command if it matches, else use current command ImDrawCmd* prev_cmd = curr_cmd - 1; - if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1 && ImDrawCmd_HeaderCompare(&_CmdHeader, prev_cmd) == 0 && prev_cmd->UserCallback == NULL) + if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1 && ImDrawCmd_HeaderCompare(&_CmdHeader, prev_cmd) == 0 && ImDrawCmd_AreSequentialIdxOffset(prev_cmd, curr_cmd) && prev_cmd->UserCallback == NULL) { CmdBuffer.pop_back(); return; @@ -544,7 +531,7 @@ void ImDrawList::_OnChangedTextureID() // Try to merge with previous command if it matches, else use current command ImDrawCmd* prev_cmd = curr_cmd - 1; - if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1 && ImDrawCmd_HeaderCompare(&_CmdHeader, prev_cmd) == 0 && prev_cmd->UserCallback == NULL) + if (curr_cmd->ElemCount == 0 && CmdBuffer.Size > 1 && ImDrawCmd_HeaderCompare(&_CmdHeader, prev_cmd) == 0 && ImDrawCmd_AreSequentialIdxOffset(prev_cmd, curr_cmd) && prev_cmd->UserCallback == NULL) { CmdBuffer.pop_back(); return; @@ -580,7 +567,7 @@ int ImDrawList::_CalcCircleAutoSegmentCount(float radius) const } // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) -void ImDrawList::PushClipRect(ImVec2 cr_min, ImVec2 cr_max, bool intersect_with_current_clip_rect) +void ImDrawList::PushClipRect(const ImVec2& cr_min, const ImVec2& cr_max, bool intersect_with_current_clip_rect) { ImVec4 cr(cr_min.x, cr_min.y, cr_max.x, cr_max.y); if (intersect_with_current_clip_rect) @@ -720,7 +707,7 @@ void ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, c // We avoid using the ImVec2 math operators here to reduce cost to a minimum for debug/non-inlined builds. void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 col, ImDrawFlags flags, float thickness) { - if (points_count < 2) + if (points_count < 2 || (col & IM_COL32_A_MASK) == 0) return; const bool closed = (flags & ImDrawFlags_Closed) != 0; @@ -753,7 +740,8 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 // Temporary buffer // The first items are normals at each line point, then after that there are either 2 or 4 temp points for each line point - ImVec2* temp_normals = (ImVec2*)alloca(points_count * ((use_texture || !thick_line) ? 3 : 5) * sizeof(ImVec2)); //-V630 + _Data->TempBuffer.reserve_discard(points_count * ((use_texture || !thick_line) ? 3 : 5)); + ImVec2* temp_normals = _Data->TempBuffer.Data; ImVec2* temp_points = temp_normals + points_count; // Calculate normals (tangents) for each line segment @@ -973,10 +961,11 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 } } -// We intentionally avoid using ImVec2 and its math operators here to reduce cost to a minimum for debug/non-inlined builds. +// - We intentionally avoid using ImVec2 and its math operators here to reduce cost to a minimum for debug/non-inlined builds. +// - Filled shapes must always use clockwise winding order. The anti-aliasing fringe depends on it. Counter-clockwise shapes will have "inward" anti-aliasing. void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col) { - if (points_count < 3) + if (points_count < 3 || (col & IM_COL32_A_MASK) == 0) return; const ImVec2 uv = _Data->TexUvWhitePixel; @@ -1000,7 +989,8 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun } // Compute normals - ImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2)); //-V630 + _Data->TempBuffer.reserve_discard(points_count); + ImVec2* temp_normals = _Data->TempBuffer.Data; for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++) { const ImVec2& p0 = points[i0]; @@ -1057,7 +1047,7 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun void ImDrawList::_PathArcToFastEx(const ImVec2& center, float radius, int a_min_sample, int a_max_sample, int a_step) { - if (radius <= 0.0f) + if (radius < 0.5f) { _Path.push_back(center); return; @@ -1149,7 +1139,7 @@ void ImDrawList::_PathArcToFastEx(const ImVec2& center, float radius, int a_min_ void ImDrawList::_PathArcToN(const ImVec2& center, float radius, float a_min, float a_max, int num_segments) { - if (radius <= 0.0f) + if (radius < 0.5f) { _Path.push_back(center); return; @@ -1168,7 +1158,7 @@ void ImDrawList::_PathArcToN(const ImVec2& center, float radius, float a_min, fl // 0: East, 3: South, 6: West, 9: North, 12: East void ImDrawList::PathArcToFast(const ImVec2& center, float radius, int a_min_of_12, int a_max_of_12) { - if (radius <= 0.0f) + if (radius < 0.5f) { _Path.push_back(center); return; @@ -1178,7 +1168,7 @@ void ImDrawList::PathArcToFast(const ImVec2& center, float radius, int a_min_of_ void ImDrawList::PathArcTo(const ImVec2& center, float radius, float a_min, float a_max, int num_segments) { - if (radius <= 0.0f) + if (radius < 0.5f) { _Path.push_back(center); return; @@ -1206,8 +1196,8 @@ void ImDrawList::PathArcTo(const ImVec2& center, float radius, float a_min, floa const float a_min_segment_angle = a_min_sample * IM_PI * 2.0f / IM_DRAWLIST_ARCFAST_SAMPLE_MAX; const float a_max_segment_angle = a_max_sample * IM_PI * 2.0f / IM_DRAWLIST_ARCFAST_SAMPLE_MAX; - const bool a_emit_start = (a_min_segment_angle - a_min) != 0.0f; - const bool a_emit_end = (a_max - a_max_segment_angle) != 0.0f; + const bool a_emit_start = ImAbs(a_min_segment_angle - a_min) >= 1e-5f; + const bool a_emit_end = ImAbs(a_max - a_max_segment_angle) >= 1e-5f; _Path.reserve(_Path.Size + (a_mid_samples + 1 + (a_emit_start ? 1 : 0) + (a_emit_end ? 1 : 0))); if (a_emit_start) @@ -1294,6 +1284,7 @@ void ImDrawList::PathBezierCubicCurveTo(const ImVec2& p2, const ImVec2& p3, cons ImVec2 p1 = _Path.back(); if (num_segments == 0) { + IM_ASSERT(_Data->CurveTessellationTol > 0.0f); PathBezierCubicCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, _Data->CurveTessellationTol, 0); // Auto-tessellated } else @@ -1309,6 +1300,7 @@ void ImDrawList::PathBezierQuadraticCurveTo(const ImVec2& p2, const ImVec2& p3, ImVec2 p1 = _Path.back(); if (num_segments == 0) { + IM_ASSERT(_Data->CurveTessellationTol > 0.0f); PathBezierQuadraticCurveToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, _Data->CurveTessellationTol, 0);// Auto-tessellated } else @@ -1323,6 +1315,7 @@ IM_STATIC_ASSERT(ImDrawFlags_RoundCornersTopLeft == (1 << 4)); static inline ImDrawFlags FixRectCornerFlags(ImDrawFlags flags) { #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + // Obsoleted in 1.82 (from February 2021) // Legacy Support for hard coded ~0 (used to be a suggested equivalent to ImDrawCornerFlags_All) // ~0 --> ImDrawFlags_RoundCornersAll or 0 if (flags == ~0) @@ -1359,7 +1352,7 @@ void ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, ImDr rounding = ImMin(rounding, ImFabs(b.x - a.x) * ( ((flags & ImDrawFlags_RoundCornersTop) == ImDrawFlags_RoundCornersTop) || ((flags & ImDrawFlags_RoundCornersBottom) == ImDrawFlags_RoundCornersBottom) ? 0.5f : 1.0f ) - 1.0f); rounding = ImMin(rounding, ImFabs(b.y - a.y) * ( ((flags & ImDrawFlags_RoundCornersLeft) == ImDrawFlags_RoundCornersLeft) || ((flags & ImDrawFlags_RoundCornersRight) == ImDrawFlags_RoundCornersRight) ? 0.5f : 1.0f ) - 1.0f); - if (rounding <= 0.0f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone) + if (rounding < 0.5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone) { PathLineTo(a); PathLineTo(ImVec2(b.x, a.y)); @@ -1405,7 +1398,7 @@ void ImDrawList::AddRectFilled(const ImVec2& p_min, const ImVec2& p_max, ImU32 c { if ((col & IM_COL32_A_MASK) == 0) return; - if (rounding <= 0.0f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone) + if (rounding < 0.5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone) { PrimReserve(6, 4); PrimRect(p_min, p_max, col); @@ -1481,7 +1474,7 @@ void ImDrawList::AddTriangleFilled(const ImVec2& p1, const ImVec2& p2, const ImV void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int num_segments, float thickness) { - if ((col & IM_COL32_A_MASK) == 0 || radius <= 0.0f) + if ((col & IM_COL32_A_MASK) == 0 || radius < 0.5f) return; if (num_segments <= 0) @@ -1505,7 +1498,7 @@ void ImDrawList::AddCircle(const ImVec2& center, float radius, ImU32 col, int nu void ImDrawList::AddCircleFilled(const ImVec2& center, float radius, ImU32 col, int num_segments) { - if ((col & IM_COL32_A_MASK) == 0 || radius <= 0.0f) + if ((col & IM_COL32_A_MASK) == 0 || radius < 0.5f) return; if (num_segments <= 0) @@ -1645,7 +1638,7 @@ void ImDrawList::AddImageRounded(ImTextureID user_texture_id, const ImVec2& p_mi return; flags = FixRectCornerFlags(flags); - if (rounding <= 0.0f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone) + if (rounding < 0.5f || (flags & ImDrawFlags_RoundCornersMask_) == ImDrawFlags_RoundCornersNone) { AddImage(user_texture_id, p_min, p_max, uv_min, uv_max, col); return; @@ -1733,13 +1726,13 @@ void ImDrawListSplitter::Merge(ImDrawList* draw_list) for (int i = 1; i < _Count; i++) { ImDrawChannel& ch = _Channels[i]; - - // Equivalent of PopUnusedDrawCmd() for this channel's cmdbuffer and except we don't need to test for UserCallback. - if (ch._CmdBuffer.Size > 0 && ch._CmdBuffer.back().ElemCount == 0) + if (ch._CmdBuffer.Size > 0 && ch._CmdBuffer.back().ElemCount == 0 && ch._CmdBuffer.back().UserCallback == NULL) // Equivalent of PopUnusedDrawCmd() ch._CmdBuffer.pop_back(); if (ch._CmdBuffer.Size > 0 && last_cmd != NULL) { + // Do not include ImDrawCmd_AreSequentialIdxOffset() in the compare as we rebuild IdxOffset values ourselves. + // Manipulating IdxOffset (e.g. by reordering draw commands like done by RenderDimmedBackgroundBehindWindow()) is not supported within a splitter. ImDrawCmd* next_cmd = &ch._CmdBuffer[0]; if (ImDrawCmd_HeaderCompare(last_cmd, next_cmd) == 0 && last_cmd->UserCallback == NULL && next_cmd->UserCallback == NULL) { @@ -2297,10 +2290,11 @@ void ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], fl void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride) { + IM_ASSERT_PARANOID(w <= stride); unsigned char* data = pixels + x + y * stride; - for (int j = h; j > 0; j--, data += stride) - for (int i = 0; i < w; i++) - data[i] = table[data[i]]; + for (int j = h; j > 0; j--, data += stride - w) + for (int i = w; i > 0; i--, data++) + *data = table[*data]; } #ifdef IMGUI_ENABLE_STB_TRUETYPE @@ -2317,7 +2311,7 @@ struct ImFontBuildSrcData int GlyphsHighest; // Highest requested codepoint int GlyphsCount; // Glyph count (excluding missing glyphs and glyphs already set by an earlier source font) ImBitVector GlyphsSet; // Glyph bit map (random access, 1-bit per codepoint. This will be a maximum of 8KB) - ImVector GlyphsList; // Glyph codepoints list (flattened version of GlyphsMap) + ImVector GlyphsList; // Glyph codepoints list (flattened version of GlyphsSet) }; // Temporary data for one destination ImFont* (multiple source fonts can be merged into one destination ImFont) @@ -2389,7 +2383,12 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas) ImFontBuildDstData& dst_tmp = dst_tmp_array[src_tmp.DstIndex]; src_tmp.SrcRanges = cfg.GlyphRanges ? cfg.GlyphRanges : atlas->GetGlyphRangesDefault(); for (const ImWchar* src_range = src_tmp.SrcRanges; src_range[0] && src_range[1]; src_range += 2) + { + // Check for valid range. This may also help detect *some* dangling pointers, because a common + // user error is to setup ImFontConfig::GlyphRanges with a pointer to data that isn't persistent. + IM_ASSERT(src_range[0] <= src_range[1]); src_tmp.GlyphsHighest = ImMax(src_tmp.GlyphsHighest, (int)src_range[1]); + } dst_tmp.SrcCount++; dst_tmp.GlyphsHighest = ImMax(dst_tmp.GlyphsHighest, src_tmp.GlyphsHighest); } @@ -2637,8 +2636,8 @@ void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opa for (int i = 0; i < pack_rects.Size; i++) if (pack_rects[i].was_packed) { - user_rects[i].X = pack_rects[i].x; - user_rects[i].Y = pack_rects[i].y; + user_rects[i].X = (unsigned short)pack_rects[i].x; + user_rects[i].Y = (unsigned short)pack_rects[i].y; IM_ASSERT(pack_rects[i].w == user_rects[i].Width && pack_rects[i].h == user_rects[i].Height); atlas->TexHeight = ImMax(atlas->TexHeight, pack_rects[i].y + pack_rects[i].h); } @@ -2738,13 +2737,13 @@ static void ImFontAtlasBuildRenderLinesTexData(ImFontAtlas* atlas) { unsigned int* write_ptr = &atlas->TexPixelsRGBA32[r->X + ((r->Y + y) * atlas->TexWidth)]; for (unsigned int i = 0; i < pad_left; i++) - *(write_ptr + i) = IM_COL32_BLACK_TRANS; + *(write_ptr + i) = IM_COL32(255, 255, 255, 0); for (unsigned int i = 0; i < line_width; i++) *(write_ptr + pad_left + i) = IM_COL32_WHITE; for (unsigned int i = 0; i < pad_right; i++) - *(write_ptr + pad_left + line_width + i) = IM_COL32_BLACK_TRANS; + *(write_ptr + pad_left + line_width + i) = IM_COL32(255, 255, 255, 0); } // Calculate UVs for this line @@ -2817,6 +2816,17 @@ const ImWchar* ImFontAtlas::GetGlyphRangesDefault() return &ranges[0]; } +const ImWchar* ImFontAtlas::GetGlyphRangesGreek() +{ + static const ImWchar ranges[] = + { + 0x0020, 0x00FF, // Basic Latin + Latin Supplement + 0x0370, 0x03FF, // Greek and Coptic + 0, + }; + return &ranges[0]; +} + const ImWchar* ImFontAtlas::GetGlyphRangesKorean() { static const ImWchar ranges[] = @@ -2933,19 +2943,19 @@ const ImWchar* ImFontAtlas::GetGlyphRangesJapanese() // 2999 ideograms code points for Japanese // - 2136 Joyo (meaning "for regular use" or "for common use") Kanji code points // - 863 Jinmeiyo (meaning "for personal name") Kanji code points - // - Sourced from the character information database of the Information-technology Promotion Agency, Japan - // - https://mojikiban.ipa.go.jp/mji/ - // - Available under the terms of the Creative Commons Attribution-ShareAlike 2.1 Japan (CC BY-SA 2.1 JP). - // - https://creativecommons.org/licenses/by-sa/2.1/jp/deed.en - // - https://creativecommons.org/licenses/by-sa/2.1/jp/legalcode - // - You can generate this code by the script at: - // - https://github.com/vaiorabbit/everyday_use_kanji + // - Sourced from official information provided by the government agencies of Japan: + // - List of Joyo Kanji by the Agency for Cultural Affairs + // - https://www.bunka.go.jp/kokugo_nihongo/sisaku/joho/joho/kijun/naikaku/kanji/ + // - List of Jinmeiyo Kanji by the Ministry of Justice + // - http://www.moj.go.jp/MINJI/minji86.html + // - Available under the terms of the Creative Commons Attribution 4.0 International (CC BY 4.0). + // - https://creativecommons.org/licenses/by/4.0/legalcode + // - You can generate this code by the script at: + // - https://github.com/vaiorabbit/everyday_use_kanji // - References: // - List of Joyo Kanji - // - (Official list by the Agency for Cultural Affairs) https://www.bunka.go.jp/kokugo_nihongo/sisaku/joho/joho/kakuki/14/tosin02/index.html // - (Wikipedia) https://en.wikipedia.org/wiki/List_of_j%C5%8Dy%C5%8D_kanji // - List of Jinmeiyo Kanji - // - (Official list by the Ministry of Justice) http://www.moj.go.jp/MINJI/minji86.html // - (Wikipedia) https://en.wikipedia.org/wiki/Jinmeiy%C5%8D_kanji // - Missing 1 Joyo Kanji: U+20B9F (Kun'yomi: Shikaru, On'yomi: Shitsu,shichi), see https://github.com/ocornut/imgui/pull/3627 for details. // You can use ImFontGlyphRangesBuilder to create your own ranges derived from this, by merging existing ranges or adding new characters. @@ -3108,7 +3118,8 @@ ImFont::ImFont() FallbackAdvanceX = 0.0f; FallbackChar = (ImWchar)-1; EllipsisChar = (ImWchar)-1; - DotChar = (ImWchar)-1; + EllipsisWidth = EllipsisCharStep = 0.0f; + EllipsisCharCount = 0; FallbackGlyph = NULL; ContainerAtlas = NULL; ConfigData = NULL; @@ -3196,8 +3207,20 @@ void ImFont::BuildLookupTable() const ImWchar dots_chars[] = { (ImWchar)'.', (ImWchar)0xFF0E }; if (EllipsisChar == (ImWchar)-1) EllipsisChar = FindFirstExistingGlyph(this, ellipsis_chars, IM_ARRAYSIZE(ellipsis_chars)); - if (DotChar == (ImWchar)-1) - DotChar = FindFirstExistingGlyph(this, dots_chars, IM_ARRAYSIZE(dots_chars)); + const ImWchar dot_char = FindFirstExistingGlyph(this, dots_chars, IM_ARRAYSIZE(dots_chars)); + if (EllipsisChar != (ImWchar)-1) + { + EllipsisCharCount = 1; + EllipsisWidth = EllipsisCharStep = FindGlyph(EllipsisChar)->X1; + } + else if (dot_char != (ImWchar)-1) + { + const ImFontGlyph* glyph = FindGlyph(dot_char); + EllipsisChar = dot_char; + EllipsisCharCount = 3; + EllipsisCharStep = (glyph->X1 - glyph->X0) + 1.0f; + EllipsisWidth = EllipsisCharStep * 3.0f - 1.0f; + } // Setup fallback character const ImWchar fallback_chars[] = { (ImWchar)IM_UNICODE_CODEPOINT_INVALID, (ImWchar)'?', (ImWchar)' ' }; @@ -3329,11 +3352,21 @@ const ImFontGlyph* ImFont::FindGlyphNoFallback(ImWchar c) const return &Glyphs.Data[i]; } -const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const +// Wrapping skips upcoming blanks +static inline const char* CalcWordWrapNextLineStartA(const char* text, const char* text_end) { - // Simple word-wrapping for English, not full-featured. Please submit failing cases! - // FIXME: Much possible improvements (don't cut things like "word !", "word!!!" but cut within "word,,,,", more sensible support for punctuations, support for Unicode punctuations, etc.) + while (text < text_end && ImCharIsBlankA(*text)) + text++; + if (*text == '\n') + text++; + return text; +} +// Simple word-wrapping for English, not full-featured. Please submit failing cases! +// This will return the next location to wrap from. If no wrapping if necessary, this will fast-forward to e.g. text_end. +// FIXME: Much possible improvements (don't cut things like "word !", "word!!!" but cut within "word,,,,", more sensible support for punctuations, support for Unicode punctuations, etc.) +const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const +{ // For references, possible wrap point marked with ^ // "aaa bbb, ccc,ddd. eee fff. ggg!" // ^ ^ ^ ^ ^__ ^ ^ @@ -3345,7 +3378,6 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c // Cut words that cannot possibly fit within one line. // e.g.: "The tropical fish" with ~5 characters worth of width --> "The tr" "opical" "fish" - float line_width = 0.0f; float word_width = 0.0f; float blank_width = 0.0f; @@ -3356,6 +3388,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c bool inside_word = true; const char* s = text; + IM_ASSERT(text_end != NULL); while (s < text_end) { unsigned int c = (unsigned int)*s; @@ -3364,8 +3397,6 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c next_s = s + 1; else next_s = s + ImTextCharFromUtf8(&c, s, text_end); - if (c == 0) - break; if (c < 32) { @@ -3425,6 +3456,10 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c s = next_s; } + // Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity. + // +1 may not be a character start point in UTF-8 but it's ok because caller loops use (text >= word_wrap_eol). + if (s == text && text < text_end) + return s + 1; return s; } @@ -3449,11 +3484,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons { // Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature. if (!word_wrap_eol) - { word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - line_width); - if (word_wrap_eol == s) // Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity. - word_wrap_eol++; // +1 may not be a character start point in UTF-8 but it's ok because we use s >= word_wrap_eol below - } if (s >= word_wrap_eol) { @@ -3462,13 +3493,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons text_size.y += line_height; line_width = 0.0f; word_wrap_eol = NULL; - - // Wrapping skips upcoming blanks - while (s < text_end) - { - const char c = *s; - if (ImCharIsBlankA(c)) { s++; } else if (c == '\n') { s++; break; } else { break; } - } + s = CalcWordWrapNextLineStartA(s, text_end); // Wrapping skips upcoming blanks continue; } } @@ -3477,15 +3502,9 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons const char* prev_s = s; unsigned int c = (unsigned int)*s; if (c < 0x80) - { s += 1; - } else - { s += ImTextCharFromUtf8(&c, s, text_end); - if (c == 0) // Malformed UTF-8? - break; - } if (c < 32) { @@ -3523,7 +3542,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons } // Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound. -void ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, ImWchar c) const +void ImFont::RenderChar(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, ImWchar c) const { const ImFontGlyph* glyph = FindGlyph(c); if (!glyph || !glyph->Visible) @@ -3531,38 +3550,47 @@ void ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col if (glyph->Colored) col |= ~IM_COL32_A_MASK; float scale = (size >= 0.0f) ? (size / FontSize) : 1.0f; - pos.x = IM_FLOOR(pos.x); - pos.y = IM_FLOOR(pos.y); + float x = IM_FLOOR(pos.x); + float y = IM_FLOOR(pos.y); draw_list->PrimReserve(6, 4); - draw_list->PrimRectUV(ImVec2(pos.x + glyph->X0 * scale, pos.y + glyph->Y0 * scale), ImVec2(pos.x + glyph->X1 * scale, pos.y + glyph->Y1 * scale), ImVec2(glyph->U0, glyph->V0), ImVec2(glyph->U1, glyph->V1), col); + draw_list->PrimRectUV(ImVec2(x + glyph->X0 * scale, y + glyph->Y0 * scale), ImVec2(x + glyph->X1 * scale, y + glyph->Y1 * scale), ImVec2(glyph->U0, glyph->V0), ImVec2(glyph->U1, glyph->V1), col); } // Note: as with every ImDrawList drawing function, this expects that the font atlas texture is bound. -void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width, bool cpu_fine_clip) const +void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width, bool cpu_fine_clip) const { if (!text_end) text_end = text_begin + strlen(text_begin); // ImGui:: functions generally already provides a valid text_end, so this is merely to handle direct calls. // Align to be pixel perfect - pos.x = IM_FLOOR(pos.x); - pos.y = IM_FLOOR(pos.y); - float x = pos.x; - float y = pos.y; + float x = IM_FLOOR(pos.x); + float y = IM_FLOOR(pos.y); if (y > clip_rect.w) return; + const float start_x = x; const float scale = size / FontSize; const float line_height = FontSize * scale; const bool word_wrap_enabled = (wrap_width > 0.0f); - const char* word_wrap_eol = NULL; // Fast-forward to first visible line const char* s = text_begin; - if (y + line_height < clip_rect.y && !word_wrap_enabled) + if (y + line_height < clip_rect.y) while (y + line_height < clip_rect.y && s < text_end) { - s = (const char*)memchr(s, '\n', text_end - s); - s = s ? s + 1 : text_end; + const char* line_end = (const char*)memchr(s, '\n', text_end - s); + if (word_wrap_enabled) + { + // FIXME-OPT: This is not optimal as do first do a search for \n before calling CalcWordWrapPositionA(). + // If the specs for CalcWordWrapPositionA() were reworked to optionally return on \n we could combine both. + // However it is still better than nothing performing the fast-forward! + s = CalcWordWrapPositionA(scale, s, line_end ? line_end : text_end, wrap_width); + s = CalcWordWrapNextLineStartA(s, text_end); + } + else + { + s = line_end ? line_end + 1 : text_end; + } y += line_height; } @@ -3588,12 +3616,12 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col const int idx_count_max = (int)(text_end - s) * 6; const int idx_expected_size = draw_list->IdxBuffer.Size + idx_count_max; draw_list->PrimReserve(idx_count_max, vtx_count_max); - - ImDrawVert* vtx_write = draw_list->_VtxWritePtr; - ImDrawIdx* idx_write = draw_list->_IdxWritePtr; - unsigned int vtx_current_idx = draw_list->_VtxCurrentIdx; + ImDrawVert* vtx_write = draw_list->_VtxWritePtr; + ImDrawIdx* idx_write = draw_list->_IdxWritePtr; + unsigned int vtx_index = draw_list->_VtxCurrentIdx; const ImU32 col_untinted = col | ~IM_COL32_A_MASK; + const char* word_wrap_eol = NULL; while (s < text_end) { @@ -3601,24 +3629,14 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col { // Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature. if (!word_wrap_eol) - { - word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - (x - pos.x)); - if (word_wrap_eol == s) // Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity. - word_wrap_eol++; // +1 may not be a character start point in UTF-8 but it's ok because we use s >= word_wrap_eol below - } + word_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - (x - start_x)); if (s >= word_wrap_eol) { - x = pos.x; + x = start_x; y += line_height; word_wrap_eol = NULL; - - // Wrapping skips upcoming blanks - while (s < text_end) - { - const char c = *s; - if (ImCharIsBlankA(c)) { s++; } else if (c == '\n') { s++; break; } else { break; } - } + s = CalcWordWrapNextLineStartA(s, text_end); // Wrapping skips upcoming blanks continue; } } @@ -3626,21 +3644,15 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col // Decode and advance source unsigned int c = (unsigned int)*s; if (c < 0x80) - { s += 1; - } else - { s += ImTextCharFromUtf8(&c, s, text_end); - if (c == 0) // Malformed UTF-8? - break; - } if (c < 32) { if (c == '\n') { - x = pos.x; + x = start_x; y += line_height; if (y > clip_rect.w) break; // break out of main loop @@ -3705,14 +3717,14 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col // We are NOT calling PrimRectUV() here because non-inlined causes too much overhead in a debug builds. Inlined here: { - idx_write[0] = (ImDrawIdx)(vtx_current_idx); idx_write[1] = (ImDrawIdx)(vtx_current_idx+1); idx_write[2] = (ImDrawIdx)(vtx_current_idx+2); - idx_write[3] = (ImDrawIdx)(vtx_current_idx); idx_write[4] = (ImDrawIdx)(vtx_current_idx+2); idx_write[5] = (ImDrawIdx)(vtx_current_idx+3); vtx_write[0].pos.x = x1; vtx_write[0].pos.y = y1; vtx_write[0].col = glyph_col; vtx_write[0].uv.x = u1; vtx_write[0].uv.y = v1; vtx_write[1].pos.x = x2; vtx_write[1].pos.y = y1; vtx_write[1].col = glyph_col; vtx_write[1].uv.x = u2; vtx_write[1].uv.y = v1; vtx_write[2].pos.x = x2; vtx_write[2].pos.y = y2; vtx_write[2].col = glyph_col; vtx_write[2].uv.x = u2; vtx_write[2].uv.y = v2; vtx_write[3].pos.x = x1; vtx_write[3].pos.y = y2; vtx_write[3].col = glyph_col; vtx_write[3].uv.x = u1; vtx_write[3].uv.y = v2; + idx_write[0] = (ImDrawIdx)(vtx_index); idx_write[1] = (ImDrawIdx)(vtx_index + 1); idx_write[2] = (ImDrawIdx)(vtx_index + 2); + idx_write[3] = (ImDrawIdx)(vtx_index); idx_write[4] = (ImDrawIdx)(vtx_index + 2); idx_write[5] = (ImDrawIdx)(vtx_index + 3); vtx_write += 4; - vtx_current_idx += 4; + vtx_index += 4; idx_write += 6; } } @@ -3726,7 +3738,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col draw_list->CmdBuffer[draw_list->CmdBuffer.Size - 1].ElemCount -= (idx_expected_size - draw_list->IdxBuffer.Size); draw_list->_VtxWritePtr = vtx_write; draw_list->_IdxWritePtr = idx_write; - draw_list->_VtxCurrentIdx = vtx_current_idx; + draw_list->_VtxCurrentIdx = vtx_index; } //----------------------------------------------------------------------------- @@ -3736,7 +3748,6 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col // - RenderArrow() // - RenderBullet() // - RenderCheckMark() -// - RenderMouseCursor() // - RenderArrowPointingAt() // - RenderRectFilledRangeH() // - RenderRectFilledWithHole() @@ -3779,6 +3790,7 @@ void ImGui::RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir d void ImGui::RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col) { + // FIXME-OPT: This should be baked in font. draw_list->AddCircleFilled(pos, draw_list->_Data->FontSize * 0.20f, col, 8); } @@ -3797,27 +3809,6 @@ void ImGui::RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float draw_list->PathStroke(col, 0, thickness); } -void ImGui::RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow) -{ - if (mouse_cursor == ImGuiMouseCursor_None) - return; - IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT); - - ImFontAtlas* font_atlas = draw_list->_Data->Font->ContainerAtlas; - ImVec2 offset, size, uv[4]; - if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2])) - { - pos -= offset; - ImTextureID tex_id = font_atlas->TexID; - draw_list->PushTextureID(tex_id); - draw_list->AddImage(tex_id, pos + ImVec2(1, 0) * scale, pos + (ImVec2(1, 0) + size) * scale, uv[2], uv[3], col_shadow); - draw_list->AddImage(tex_id, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv[2], uv[3], col_shadow); - draw_list->AddImage(tex_id, pos, pos + size * scale, uv[2], uv[3], col_border); - draw_list->AddImage(tex_id, pos, pos + size * scale, uv[0], uv[1], col_fill); - draw_list->PopTextureID(); - } -} - // Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side. void ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col) { @@ -3900,7 +3891,7 @@ void ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, Im draw_list->PathFillConvex(col); } -void ImGui::RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect inner, ImU32 col, float rounding) +void ImGui::RenderRectFilledWithHole(ImDrawList* draw_list, const ImRect& outer, const ImRect& inner, ImU32 col, float rounding) { const bool fill_L = (inner.Min.x > outer.Min.x); const bool fill_R = (inner.Max.x < outer.Max.x); diff --git a/Sources/CImGui/imgui/imgui_internal.h b/Sources/CImGui/imgui/imgui_internal.h index 73d58f6..70e6000 100644 --- a/Sources/CImGui/imgui/imgui_internal.h +++ b/Sources/CImGui/imgui/imgui_internal.h @@ -1,10 +1,12 @@ -// dear imgui, v1.86 +// dear imgui, v1.89.5 // (internal structures/api) -// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility! -// Set: -// #define IMGUI_DEFINE_MATH_OPERATORS -// To implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators) +// You may use this file to debug, understand or extend Dear ImGui features but we don't provide any guarantee of forward compatibility. +// To implement maths operators for ImVec2 (disabled by default to not conflict with using IM_VEC2_CLASS_EXTRA with your own math types+operators), use: +/* +#define IMGUI_DEFINE_MATH_OPERATORS +#include "imgui_internal.h" +*/ /* @@ -18,6 +20,7 @@ Index of this file: // [SECTION] Generic helpers // [SECTION] ImDrawList support // [SECTION] Widgets support: flags, enums, data structures +// [SECTION] Inputs support // [SECTION] Clipper support // [SECTION] Navigation support // [SECTION] Columns support @@ -25,6 +28,7 @@ Index of this file: // [SECTION] Docking support // [SECTION] Viewport support // [SECTION] Settings support +// [SECTION] Localization support // [SECTION] Metrics, Debug tools // [SECTION] Generic context hooks // [SECTION] ImGuiContext (main imgui context) @@ -54,7 +58,7 @@ Index of this file: #include // INT_MIN, INT_MAX // Enable SSE intrinsics if available -#if (defined __SSE__ || defined __x86_64__ || defined _M_X64) && !defined(IMGUI_DISABLE_SSE) +#if (defined __SSE__ || defined __x86_64__ || defined _M_X64 || (defined(_M_IX86_FP) && (_M_IX86_FP >= 1))) && !defined(IMGUI_DISABLE_SSE) #define IMGUI_ENABLE_SSE #include #endif @@ -91,6 +95,12 @@ Index of this file: #pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead #endif +// In 1.89.4, we moved the implementation of "courtesy maths operators" from imgui_internal.h in imgui.h +// As they are frequently requested, we do not want to encourage to many people using imgui_internal.h +#if defined(IMGUI_DEFINE_MATH_OPERATORS) && !defined(IMGUI_DEFINE_MATH_OPERATORS_IMPLEMENTED) +#error Please '#define IMGUI_DEFINE_MATH_OPERATORS' _BEFORE_ including imgui.h! +#endif + // Legacy defines #ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Renamed in 1.74 #error Use IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS @@ -116,10 +126,13 @@ struct ImDrawListSharedData; // Data shared between all ImDrawList instan struct ImGuiColorMod; // Stacked color modifier, backup of modified data so we can restore it struct ImGuiContext; // Main Dear ImGui context struct ImGuiContextHook; // Hook for extensions like ImGuiTestEngine +struct ImGuiDataVarInfo; // Variable information (e.g. to avoid style variables from an enum) struct ImGuiDataTypeInfo; // Type information associated to a ImGuiDataType enum struct ImGuiGroupData; // Stacked storage data for BeginGroup()/EndGroup() struct ImGuiInputTextState; // Internal state of the currently focused/edited text input box +struct ImGuiInputTextDeactivateData;// Short term storage to backup text of a deactivating InputText() while another is stealing active id struct ImGuiLastItemData; // Status storage for last submitted items +struct ImGuiLocEntry; // A localization entry. struct ImGuiMenuColumns; // Simple column measurement, currently used for MenuItem() only struct ImGuiNavItemData; // Result of a gamepad/keyboard directional navigation move query result struct ImGuiMetricsConfig; // Storage for ShowMetricsWindow() and DebugNodeXXX() functions @@ -135,6 +148,7 @@ struct ImGuiTabBar; // Storage for a tab bar struct ImGuiTabItem; // Storage for a tab item (within a tab bar) struct ImGuiTable; // Storage for a table struct ImGuiTableColumn; // Storage for one column of a table +struct ImGuiTableInstanceData; // Storage for one instance of a same table struct ImGuiTableTempData; // Temporary storage for one table (one per table in the stack), shared between tables. struct ImGuiTableSettings; // Storage for a table .ini settings struct ImGuiTableColumnsSettings; // Storage for a column .ini settings @@ -142,14 +156,19 @@ struct ImGuiWindow; // Storage for one window struct ImGuiWindowTempData; // Temporary storage for one window (that's the data which in theory we could ditch at the end of the frame, in practice we currently keep it for each window) struct ImGuiWindowSettings; // Storage for a window .ini settings (we keep one of those even if the actual window wasn't instanced during this session) +// Enumerations // Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists. +enum ImGuiLocKey : int; // -> enum ImGuiLocKey // Enum: a localization entry for translation. typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical + +// Flags typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later) -typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag() -typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags +typedef int ImGuiDebugLogFlags; // -> enum ImGuiDebugLogFlags_ // Flags: for ShowDebugLogWindow(), g.DebugLogFlags +typedef int ImGuiInputFlags; // -> enum ImGuiInputFlags_ // Flags: for IsKeyPressed(), IsMouseClicked(), SetKeyOwner(), SetItemKeyOwner() etc. +typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag(), g.LastItemData.InFlags +typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for g.LastItemData.StatusFlags typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns() typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight() -typedef int ImGuiNavDirSourceFlags; // -> enum ImGuiNavDirSourceFlags_ // Flags: for GetNavInputAmount2d() typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions @@ -191,23 +210,32 @@ namespace ImStb // [SECTION] Macros //----------------------------------------------------------------------------- -// Debug Logging -#ifndef IMGUI_DEBUG_LOG -#define IMGUI_DEBUG_LOG(_FMT,...) printf("[%05d] " _FMT, GImGui->FrameCount, __VA_ARGS__) +// Debug Printing Into TTY +// (since IMGUI_VERSION_NUM >= 18729: IMGUI_DEBUG_LOG was reworked into IMGUI_DEBUG_PRINTF (and removed framecount from it). If you were using a #define IMGUI_DEBUG_LOG please rename) +#ifndef IMGUI_DEBUG_PRINTF +#ifndef IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS +#define IMGUI_DEBUG_PRINTF(_FMT,...) printf(_FMT, __VA_ARGS__) +#else +#define IMGUI_DEBUG_PRINTF(_FMT,...) ((void)0) +#endif #endif -// Debug Logging for selected systems. Remove the '((void)0) //' to enable. -//#define IMGUI_DEBUG_LOG_POPUP IMGUI_DEBUG_LOG // Enable log -//#define IMGUI_DEBUG_LOG_NAV IMGUI_DEBUG_LOG // Enable log -#define IMGUI_DEBUG_LOG_POPUP(...) ((void)0) // Disable log -#define IMGUI_DEBUG_LOG_NAV(...) ((void)0) // Disable log +// Debug Logging for ShowDebugLogWindow(). This is designed for relatively rare events so please don't spam. +#ifndef IMGUI_DISABLE_DEBUG_TOOLS +#define IMGUI_DEBUG_LOG(...) ImGui::DebugLog(__VA_ARGS__) +#else +#define IMGUI_DEBUG_LOG(...) ((void)0) +#endif +#define IMGUI_DEBUG_LOG_ACTIVEID(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventActiveId) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) +#define IMGUI_DEBUG_LOG_FOCUS(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventFocus) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) +#define IMGUI_DEBUG_LOG_POPUP(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventPopup) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) +#define IMGUI_DEBUG_LOG_NAV(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventNav) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) +#define IMGUI_DEBUG_LOG_SELECTION(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventSelection)IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) +#define IMGUI_DEBUG_LOG_CLIPPER(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventClipper) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) +#define IMGUI_DEBUG_LOG_IO(...) do { if (g.DebugLogFlags & ImGuiDebugLogFlags_EventIO) IMGUI_DEBUG_LOG(__VA_ARGS__); } while (0) // Static Asserts -#if (__cplusplus >= 201100) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201100) #define IM_STATIC_ASSERT(_COND) static_assert(_COND, "") -#else -#define IM_STATIC_ASSERT(_COND) typedef char static_assertion_##__line__[(_COND)?1:-1] -#endif // "Paranoid" Debug Asserts are meant to only be enabled during specific debugging/work, otherwise would slow down the code too much. // We currently don't have many of those so the effect is currently negligible, but onward intent to add more aggressive ones in the code. @@ -231,8 +259,10 @@ namespace ImStb #else #define IM_NEWLINE "\n" #endif +#ifndef IM_TABSIZE // Until we move this to runtime and/or add proper tab support, at least allow users to compile-time override #define IM_TABSIZE (4) -#define IM_MEMALIGN(_OFF,_ALIGN) (((_OFF) + (_ALIGN - 1)) & ~(_ALIGN - 1)) // Memory align e.g. IM_ALIGN(0,4)=0, IM_ALIGN(1,4)=4, IM_ALIGN(4,4)=4, IM_ALIGN(5,4)=8 +#endif +#define IM_MEMALIGN(_OFF,_ALIGN) (((_OFF) + ((_ALIGN) - 1)) & ~((_ALIGN) - 1)) // Memory align e.g. IM_ALIGN(0,4)=0, IM_ALIGN(1,4)=4, IM_ALIGN(4,4)=4, IM_ALIGN(5,4)=8 #define IM_F32_TO_INT8_UNBOUND(_VAL) ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f))) // Unsaturated, for display purpose #define IM_F32_TO_INT8_SAT(_VAL) ((int)(ImSaturate(_VAL) * 255.0f + 0.5f)) // Saturated, always output 0..255 #define IM_FLOOR(_VAL) ((float)(int)(_VAL)) // ImFloor() is not inlined in MSVC debug builds @@ -279,7 +309,8 @@ namespace ImStb // - Helpers: Hashing // - Helpers: Sorting // - Helpers: Bit manipulation -// - Helpers: String, Formatting +// - Helpers: String +// - Helpers: Formatting // - Helpers: UTF-8 <> wchar conversions // - Helpers: ImVec2/ImVec4 operators // - Helpers: Maths @@ -292,14 +323,12 @@ namespace ImStb // - Helper: ImSpan<>, ImSpanAllocator<> // - Helper: ImPool<> // - Helper: ImChunkStream<> +// - Helper: ImGuiTextIndex //----------------------------------------------------------------------------- // Helpers: Hashing -IMGUI_API ImGuiID ImHashData(const void* data, size_t data_size, ImU32 seed = 0); -IMGUI_API ImGuiID ImHashStr(const char* data, size_t data_size = 0, ImU32 seed = 0); -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS -static inline ImGuiID ImHash(const void* data, int size, ImU32 seed = 0) { return size ? ImHashData(data, (size_t)size, seed) : ImHashStr((const char*)data, 0, seed); } // [moved to ImHashStr/ImHashData in 1.68] -#endif +IMGUI_API ImGuiID ImHashData(const void* data, size_t data_size, ImGuiID seed = 0); +IMGUI_API ImGuiID ImHashStr(const char* data, size_t data_size = 0, ImGuiID seed = 0); // Helpers: Sorting #ifndef ImQsort @@ -314,7 +343,7 @@ static inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & static inline bool ImIsPowerOfTwo(ImU64 v) { return v != 0 && (v & (v - 1)) == 0; } static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; } -// Helpers: String, Formatting +// Helpers: String IMGUI_API int ImStricmp(const char* str1, const char* str2); IMGUI_API int ImStrnicmp(const char* str1, const char* str2, size_t count); IMGUI_API void ImStrncpy(char* dst, const char* src, size_t count); @@ -327,14 +356,23 @@ IMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* bu IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end); IMGUI_API void ImStrTrimBlanks(char* str); IMGUI_API const char* ImStrSkipBlank(const char* str); +IM_MSVC_RUNTIME_CHECKS_OFF +static inline char ImToUpper(char c) { return (c >= 'a' && c <= 'z') ? c &= ~32 : c; } +static inline bool ImCharIsBlankA(char c) { return c == ' ' || c == '\t'; } +static inline bool ImCharIsBlankW(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; } +IM_MSVC_RUNTIME_CHECKS_RESTORE + +// Helpers: Formatting IMGUI_API int ImFormatString(char* buf, size_t buf_size, const char* fmt, ...) IM_FMTARGS(3); IMGUI_API int ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args) IM_FMTLIST(3); +IMGUI_API void ImFormatStringToTempBuffer(const char** out_buf, const char** out_buf_end, const char* fmt, ...) IM_FMTARGS(3); +IMGUI_API void ImFormatStringToTempBufferV(const char** out_buf, const char** out_buf_end, const char* fmt, va_list args) IM_FMTLIST(3); IMGUI_API const char* ImParseFormatFindStart(const char* format); IMGUI_API const char* ImParseFormatFindEnd(const char* format); IMGUI_API const char* ImParseFormatTrimDecorations(const char* format, char* buf, size_t buf_size); +IMGUI_API void ImParseFormatSanitizeForPrinting(const char* fmt_in, char* fmt_out, size_t fmt_out_size); +IMGUI_API const char* ImParseFormatSanitizeForScanning(const char* fmt_in, char* fmt_out, size_t fmt_out_size); IMGUI_API int ImParseFormatPrecision(const char* format, int default_value); -static inline bool ImCharIsBlankA(char c) { return c == ' ' || c == '\t'; } -static inline bool ImCharIsBlankW(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; } // Helpers: UTF-8 <> wchar conversions IMGUI_API const char* ImTextCharToUtf8(char out_buf[5], unsigned int c); // return out_buf @@ -345,29 +383,6 @@ IMGUI_API int ImTextCountCharsFromUtf8(const char* in_text, const char IMGUI_API int ImTextCountUtf8BytesFromChar(const char* in_text, const char* in_text_end); // return number of bytes to express one char in UTF-8 IMGUI_API int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end); // return number of bytes to express string in UTF-8 -// Helpers: ImVec2/ImVec4 operators -// We are keeping those disabled by default so they don't leak in user space, to allow user enabling implicit cast operators between ImVec2 and their own types (using IM_VEC2_CLASS_EXTRA etc.) -// We unfortunately don't have a unary- operator for ImVec2 because this would needs to be defined inside the class itself. -#ifdef IMGUI_DEFINE_MATH_OPERATORS -IM_MSVC_RUNTIME_CHECKS_OFF -static inline ImVec2 operator*(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x * rhs, lhs.y * rhs); } -static inline ImVec2 operator/(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x / rhs, lhs.y / rhs); } -static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x + rhs.x, lhs.y + rhs.y); } -static inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x - rhs.x, lhs.y - rhs.y); } -static inline ImVec2 operator*(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); } -static inline ImVec2 operator/(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x / rhs.x, lhs.y / rhs.y); } -static inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; } -static inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; } -static inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; } -static inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; } -static inline ImVec2& operator*=(ImVec2& lhs, const ImVec2& rhs) { lhs.x *= rhs.x; lhs.y *= rhs.y; return lhs; } -static inline ImVec2& operator/=(ImVec2& lhs, const ImVec2& rhs) { lhs.x /= rhs.x; lhs.y /= rhs.y; return lhs; } -static inline ImVec4 operator+(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z, lhs.w + rhs.w); } -static inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z, lhs.w - rhs.w); } -static inline ImVec4 operator*(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z, lhs.w * rhs.w); } -IM_MSVC_RUNTIME_CHECKS_RESTORE -#endif - // Helpers: File System #ifdef IMGUI_DISABLE_FILE_FUNCTIONS #define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS @@ -441,14 +456,16 @@ static inline float ImLengthSqr(const ImVec2& lhs) static inline float ImLengthSqr(const ImVec4& lhs) { return (lhs.x * lhs.x) + (lhs.y * lhs.y) + (lhs.z * lhs.z) + (lhs.w * lhs.w); } static inline float ImInvLength(const ImVec2& lhs, float fail_value) { float d = (lhs.x * lhs.x) + (lhs.y * lhs.y); if (d > 0.0f) return ImRsqrt(d); return fail_value; } static inline float ImFloor(float f) { return (float)(int)(f); } -static inline float ImFloorSigned(float f) { return (float)((f >= 0 || (int)f == f) ? (int)f : (int)f - 1); } // Decent replacement for floorf() +static inline float ImFloorSigned(float f) { return (float)((f >= 0 || (float)(int)f == f) ? (int)f : (int)f - 1); } // Decent replacement for floorf() static inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2((float)(int)(v.x), (float)(int)(v.y)); } +static inline ImVec2 ImFloorSigned(const ImVec2& v) { return ImVec2(ImFloorSigned(v.x), ImFloorSigned(v.y)); } static inline int ImModPositive(int a, int b) { return (a + b) % b; } static inline float ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; } static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); } static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; } static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); } static inline bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; } +static inline float ImExponentialMovingAverage(float avg, float sample, int n) { avg -= avg / n; avg += sample / n; return avg; } IM_MSVC_RUNTIME_CHECKS_RESTORE // Helpers: Geometry @@ -469,17 +486,17 @@ IM_MSVC_RUNTIME_CHECKS_OFF struct ImVec1 { float x; - ImVec1() { x = 0.0f; } - ImVec1(float _x) { x = _x; } + constexpr ImVec1() : x(0.0f) { } + constexpr ImVec1(float _x) : x(_x) { } }; // Helper: ImVec2ih (2D vector, half-size integer, for long-term packed storage) struct ImVec2ih { short x, y; - ImVec2ih() { x = y = 0; } - ImVec2ih(short _x, short _y) { x = _x; y = _y; } - explicit ImVec2ih(const ImVec2& rhs) { x = (short)rhs.x; y = (short)rhs.y; } + constexpr ImVec2ih() : x(0), y(0) {} + constexpr ImVec2ih(short _x, short _y) : x(_x), y(_y) {} + constexpr explicit ImVec2ih(const ImVec2& rhs) : x((short)rhs.x), y((short)rhs.y) {} }; // Helper: ImRect (2D axis aligned bounding-box) @@ -489,10 +506,10 @@ struct IMGUI_API ImRect ImVec2 Min; // Upper-left ImVec2 Max; // Lower-right - ImRect() : Min(0.0f, 0.0f), Max(0.0f, 0.0f) {} - ImRect(const ImVec2& min, const ImVec2& max) : Min(min), Max(max) {} - ImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {} - ImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {} + constexpr ImRect() : Min(0.0f, 0.0f), Max(0.0f, 0.0f) {} + constexpr ImRect(const ImVec2& min, const ImVec2& max) : Min(min), Max(max) {} + constexpr ImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {} + constexpr ImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {} ImVec2 GetCenter() const { return ImVec2((Min.x + Max.x) * 0.5f, (Min.y + Max.y) * 0.5f); } ImVec2 GetSize() const { return ImVec2(Max.x - Min.x, Max.y - Min.y); } @@ -519,9 +536,12 @@ struct IMGUI_API ImRect bool IsInverted() const { return Min.x > Max.x || Min.y > Max.y; } ImVec4 ToVec4() const { return ImVec4(Min.x, Min.y, Max.x, Max.y); } }; -IM_MSVC_RUNTIME_CHECKS_RESTORE // Helper: ImBitArray +#define IM_BITARRAY_TESTBIT(_ARRAY, _N) ((_ARRAY[(_N) >> 5] & ((ImU32)1 << ((_N) & 31))) != 0) // Macro version of ImBitArrayTestBit(): ensure args have side-effect or are costly! +#define IM_BITARRAY_CLEARBIT(_ARRAY, _N) ((_ARRAY[(_N) >> 5] &= ~((ImU32)1 << ((_N) & 31)))) // Macro version of ImBitArrayClearBit(): ensure args have side-effect or are costly! +inline size_t ImBitArrayGetStorageSizeInBytes(int bitcount) { return (size_t)((bitcount + 31) >> 5) << 2; } +inline void ImBitArrayClearAllBits(ImU32* arr, int bitcount){ memset(arr, 0, ImBitArrayGetStorageSizeInBytes(bitcount)); } inline bool ImBitArrayTestBit(const ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); return (arr[n >> 5] & mask) != 0; } inline void ImBitArrayClearBit(ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); arr[n >> 5] &= ~mask; } inline void ImBitArraySetBit(ImU32* arr, int n) { ImU32 mask = (ImU32)1 << (n & 31); arr[n >> 5] |= mask; } @@ -538,19 +558,22 @@ inline void ImBitArraySetBitRange(ImU32* arr, int n, int n2) // Works on ran } } +typedef ImU32* ImBitArrayPtr; // Name for use in structs + // Helper: ImBitArray class (wrapper over ImBitArray functions) // Store 1-bit per value. -template -struct IMGUI_API ImBitArray +template +struct ImBitArray { ImU32 Storage[(BITCOUNT + 31) >> 5]; ImBitArray() { ClearAllBits(); } void ClearAllBits() { memset(Storage, 0, sizeof(Storage)); } void SetAllBits() { memset(Storage, 255, sizeof(Storage)); } - bool TestBit(int n) const { IM_ASSERT(n < BITCOUNT); return ImBitArrayTestBit(Storage, n); } - void SetBit(int n) { IM_ASSERT(n < BITCOUNT); ImBitArraySetBit(Storage, n); } - void ClearBit(int n) { IM_ASSERT(n < BITCOUNT); ImBitArrayClearBit(Storage, n); } - void SetBitRange(int n, int n2) { ImBitArraySetBitRange(Storage, n, n2); } // Works on range [n..n2) + bool TestBit(int n) const { n += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT); return IM_BITARRAY_TESTBIT(Storage, n); } + void SetBit(int n) { n += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT); ImBitArraySetBit(Storage, n); } + void ClearBit(int n) { n += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT); ImBitArrayClearBit(Storage, n); } + void SetBitRange(int n, int n2) { n += OFFSET; n2 += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT && n2 > n && n2 <= BITCOUNT); ImBitArraySetBitRange(Storage, n, n2); } // Works on range [n..n2) + bool operator[](int n) const { n += OFFSET; IM_ASSERT(n >= 0 && n < BITCOUNT); return IM_BITARRAY_TESTBIT(Storage, n); } }; // Helper: ImBitVector @@ -560,10 +583,11 @@ struct IMGUI_API ImBitVector ImVector Storage; void Create(int sz) { Storage.resize((sz + 31) >> 5); memset(Storage.Data, 0, (size_t)Storage.Size * sizeof(Storage.Data[0])); } void Clear() { Storage.clear(); } - bool TestBit(int n) const { IM_ASSERT(n < (Storage.Size << 5)); return ImBitArrayTestBit(Storage.Data, n); } + bool TestBit(int n) const { IM_ASSERT(n < (Storage.Size << 5)); return IM_BITARRAY_TESTBIT(Storage.Data, n); } void SetBit(int n) { IM_ASSERT(n < (Storage.Size << 5)); ImBitArraySetBit(Storage.Data, n); } void ClearBit(int n) { IM_ASSERT(n < (Storage.Size << 5)); ImBitArrayClearBit(Storage.Data, n); } }; +IM_MSVC_RUNTIME_CHECKS_RESTORE // Helper: ImSpan<> // Pointing to a span of data we don't own. @@ -621,7 +645,7 @@ struct ImSpanAllocator // Honor constructor/destructor. Add/remove invalidate all pointers. Indexes have the same lifetime as the associated object. typedef int ImPoolIdx; template -struct IMGUI_API ImPool +struct ImPool { ImVector Buf; // Contiguous data ImGuiStorage Map; // ID->Index @@ -658,7 +682,7 @@ struct IMGUI_API ImPool // We store the chunk size first, and align the final size on 4 bytes boundaries. // The tedious/zealous amount of casting is to avoid -Wcast-align warnings. template -struct IMGUI_API ImChunkStream +struct ImChunkStream { ImVector Buf; @@ -676,6 +700,20 @@ struct IMGUI_API ImChunkStream }; +// Helper: ImGuiTextIndex<> +// Maintain a line index for a text buffer. This is a strong candidate to be moved into the public API. +struct ImGuiTextIndex +{ + ImVector LineOffsets; + int EndOffset = 0; // Because we don't own text buffer we need to maintain EndOffset (may bake in LineOffsets?) + + void clear() { LineOffsets.clear(); EndOffset = 0; } + int size() { return LineOffsets.Size; } + const char* get_line_begin(const char* base, int n) { return base + LineOffsets[n]; } + const char* get_line_end(const char* base, int n) { return base + (n + 1 < LineOffsets.Size ? (LineOffsets[n + 1] - 1) : EndOffset); } + void append(const char* base, int old_size, int new_size); +}; + //----------------------------------------------------------------------------- // [SECTION] ImDrawList support //----------------------------------------------------------------------------- @@ -690,7 +728,6 @@ struct IMGUI_API ImChunkStream // // Rendering circles with an odd number of segments, while mathematically correct will produce // asymmetrical results on the raster grid. Therefore we're rounding N to next even number (7->8, 8->8, 9->10 etc.) -// #define IM_ROUNDUP_TO_EVEN(_V) ((((_V) + 1) / 2) * 2) #define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN 4 #define IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX 512 @@ -718,6 +755,9 @@ struct IMGUI_API ImDrawListSharedData ImVec4 ClipRectFullscreen; // Value for PushClipRectFullscreen() ImDrawListFlags InitialFlags; // Initial flags at the beginning of the frame (it is possible to alter flags on a per-drawlist basis afterwards) + // [Internal] Temp write buffer + ImVector TempBuffer; + // [Internal] Lookup tables ImVec2 ArcFastVtx[IM_DRAWLIST_ARCFAST_TABLE_SIZE]; // Sample points on the quarter of the circle. float ArcFastRadiusCutoff; // Cutoff radius after which arc drawing will fallback to slower PathArcTo() @@ -742,23 +782,31 @@ struct ImDrawDataBuilder // [SECTION] Widgets support: flags, enums, data structures //----------------------------------------------------------------------------- -// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin(). +// Flags used by upcoming items +// - input: PushItemFlag() manipulates g.CurrentItemFlags, ItemAdd() calls may add extra flags. +// - output: stored in g.LastItemData.InFlags +// Current window shared by all windows. // This is going to be exposed in imgui.h when stabilized enough. enum ImGuiItemFlags_ { + // Controlled by user ImGuiItemFlags_None = 0, - ImGuiItemFlags_NoTabStop = 1 << 0, // false // Disable keyboard tabbing (FIXME: should merge with _NoNav) + ImGuiItemFlags_NoTabStop = 1 << 0, // false // Disable keyboard tabbing. This is a "lighter" version of ImGuiItemFlags_NoNav. ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings. ImGuiItemFlags_Disabled = 1 << 2, // false // Disable interactions but doesn't affect visuals. See BeginDisabled()/EndDisabled(). See github.com/ocornut/imgui/issues/211 - ImGuiItemFlags_NoNav = 1 << 3, // false // Disable keyboard/gamepad directional navigation (FIXME: should merge with _NoTabStop) + ImGuiItemFlags_NoNav = 1 << 3, // false // Disable any form of focusing (keyboard/gamepad directional navigation and SetKeyboardFocusHere() calls) ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false // Disable item being a candidate for default focus (e.g. used by title bar items) ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // Disable MenuItem/Selectable() automatically closing their popup window ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets) ImGuiItemFlags_ReadOnly = 1 << 7, // false // [ALPHA] Allow hovering interactions but underlying value is not changed. - ImGuiItemFlags_Inputable = 1 << 8 // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature. + ImGuiItemFlags_NoWindowHoverableCheck = 1 << 8, // false // Disable hoverable check in ItemHoverable() + + // Controlled by widget code + ImGuiItemFlags_Inputable = 1 << 10, // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature. }; -// Storage for LastItem data +// Status flags for an already submitted item +// - output: stored in g.LastItemData.StatusFlags enum ImGuiItemStatusFlags_ { ImGuiItemStatusFlags_None = 0, @@ -770,14 +818,16 @@ enum ImGuiItemStatusFlags_ ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag. ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set. ImGuiItemStatusFlags_HoveredWindow = 1 << 7, // Override the HoveredWindow test to allow cross-window hover testing. - ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8 // Set when the Focusable item just got focused by Tabbing (FIXME: to be removed soon) + ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8, // Set when the Focusable item just got focused by Tabbing (FIXME: to be removed soon) + ImGuiItemStatusFlags_Visible = 1 << 9, // [WIP] Set when item is overlapping the current clipping rectangle (Used internally. Please don't use yet: API/system will change as we refactor Itemadd()). + // Additional status + semantic for ImGuiTestEngine #ifdef IMGUI_ENABLE_TEST_ENGINE - , // [imgui_tests only] - ImGuiItemStatusFlags_Openable = 1 << 20, // - ImGuiItemStatusFlags_Opened = 1 << 21, // - ImGuiItemStatusFlags_Checkable = 1 << 22, // - ImGuiItemStatusFlags_Checked = 1 << 23 // + ImGuiItemStatusFlags_Openable = 1 << 20, // Item is an openable (e.g. TreeNode) + ImGuiItemStatusFlags_Opened = 1 << 21, // Opened status + ImGuiItemStatusFlags_Checkable = 1 << 22, // Item is a checkable (e.g. CheckBox, MenuItem) + ImGuiItemStatusFlags_Checked = 1 << 23, // Checked status + ImGuiItemStatusFlags_Inputable = 1 << 24, // Item is a text-inputable (e.g. InputText, SliderXXX, DragXXX) #endif }; @@ -787,7 +837,7 @@ enum ImGuiInputTextFlagsPrivate_ // [Internal] ImGuiInputTextFlags_Multiline = 1 << 26, // For internal use by InputTextMultiline() ImGuiInputTextFlags_NoMarkEdited = 1 << 27, // For internal use by functions using InputText() before reformatting data - ImGuiInputTextFlags_MergedItem = 1 << 28 // For internal use by TempInputText(), will skip calling ItemAdd(). Require bounding-box to strictly match. + ImGuiInputTextFlags_MergedItem = 1 << 28, // For internal use by TempInputText(), will skip calling ItemAdd(). Require bounding-box to strictly match. }; // Extend ImGuiButtonFlags_ @@ -807,23 +857,25 @@ enum ImGuiButtonFlagsPrivate_ ImGuiButtonFlags_AlignTextBaseLine = 1 << 15, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine ImGuiButtonFlags_NoKeyModifiers = 1 << 16, // disable mouse interaction if a key modifier is held ImGuiButtonFlags_NoHoldingActiveId = 1 << 17, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only) - ImGuiButtonFlags_NoNavFocus = 1 << 18, // don't override navigation focus when activated + ImGuiButtonFlags_NoNavFocus = 1 << 18, // don't override navigation focus when activated (FIXME: this is essentially used everytime an item uses ImGuiItemFlags_NoNav, but because legacy specs don't requires LastItemData to be set ButtonBehavior(), we can't poll g.LastItemData.InFlags) ImGuiButtonFlags_NoHoveredOnFocus = 1 << 19, // don't report as hovered when nav focus is on this item + ImGuiButtonFlags_NoSetKeyOwner = 1 << 20, // don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!) + ImGuiButtonFlags_NoTestKeyOwner = 1 << 21, // don't test key/input owner when polling the key (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!) ImGuiButtonFlags_PressedOnMask_ = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold, - ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease + ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease, }; // Extend ImGuiComboFlags_ enum ImGuiComboFlagsPrivate_ { - ImGuiComboFlags_CustomPreview = 1 << 20 // enable BeginComboPreview() + ImGuiComboFlags_CustomPreview = 1 << 20, // enable BeginComboPreview() }; // Extend ImGuiSliderFlags_ enum ImGuiSliderFlagsPrivate_ { ImGuiSliderFlags_Vertical = 1 << 20, // Should this slider be orientated vertically? - ImGuiSliderFlags_ReadOnly = 1 << 21 + ImGuiSliderFlags_ReadOnly = 1 << 21, }; // Extend ImGuiSelectableFlags_ @@ -835,35 +887,35 @@ enum ImGuiSelectableFlagsPrivate_ ImGuiSelectableFlags_SelectOnClick = 1 << 22, // Override button behavior to react on Click (default is Click+Release) ImGuiSelectableFlags_SelectOnRelease = 1 << 23, // Override button behavior to react on Release (default is Click+Release) ImGuiSelectableFlags_SpanAvailWidth = 1 << 24, // Span all avail width even if we declared less for layout purpose. FIXME: We may be able to remove this (added in 6251d379, 2bcafc86 for menus) - ImGuiSelectableFlags_DrawHoveredWhenHeld = 1 << 25, // Always show active when held, even is not hovered. This concept could probably be renamed/formalized somehow. - ImGuiSelectableFlags_SetNavIdOnHover = 1 << 26, // Set Nav/Focus ID on mouse hover (used by MenuItem) - ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 27 // Disable padding each side with ItemSpacing * 0.5f + ImGuiSelectableFlags_SetNavIdOnHover = 1 << 25, // Set Nav/Focus ID on mouse hover (used by MenuItem) + ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 26, // Disable padding each side with ItemSpacing * 0.5f + ImGuiSelectableFlags_NoSetKeyOwner = 1 << 27, // Don't set key/input owner on the initial click (note: mouse buttons are keys! often, the key in question will be ImGuiKey_MouseLeft!) }; // Extend ImGuiTreeNodeFlags_ enum ImGuiTreeNodeFlagsPrivate_ { - ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 20 + ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 20, }; enum ImGuiSeparatorFlags_ { - ImGuiSeparatorFlags_None = 0, - ImGuiSeparatorFlags_Horizontal = 1 << 0, // Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar - ImGuiSeparatorFlags_Vertical = 1 << 1, - ImGuiSeparatorFlags_SpanAllColumns = 1 << 2 + ImGuiSeparatorFlags_None = 0, + ImGuiSeparatorFlags_Horizontal = 1 << 0, // Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar + ImGuiSeparatorFlags_Vertical = 1 << 1, + ImGuiSeparatorFlags_SpanAllColumns = 1 << 2, }; enum ImGuiTextFlags_ { - ImGuiTextFlags_None = 0, - ImGuiTextFlags_NoWidthForLargeClippedText = 1 << 0 + ImGuiTextFlags_None = 0, + ImGuiTextFlags_NoWidthForLargeClippedText = 1 << 0, }; enum ImGuiTooltipFlags_ { - ImGuiTooltipFlags_None = 0, - ImGuiTooltipFlags_OverridePreviousTooltip = 1 << 0 // Override will clear/ignore previously submitted tooltip (defaults to append) + ImGuiTooltipFlags_None = 0, + ImGuiTooltipFlags_OverridePreviousTooltip = 1 << 0, // Override will clear/ignore previously submitted tooltip (defaults to append) }; // FIXME: this is in development, not exposed/functional as a generic feature yet. @@ -880,7 +932,7 @@ enum ImGuiLogType ImGuiLogType_TTY, ImGuiLogType_File, ImGuiLogType_Buffer, - ImGuiLogType_Clipboard + ImGuiLogType_Clipboard, }; // X/Y enums are fixed to 0/1 so they may be used to index ImVec2 @@ -894,36 +946,22 @@ enum ImGuiAxis enum ImGuiPlotType { ImGuiPlotType_Lines, - ImGuiPlotType_Histogram -}; - -enum ImGuiInputSource -{ - ImGuiInputSource_None = 0, - ImGuiInputSource_Mouse, - ImGuiInputSource_Keyboard, - ImGuiInputSource_Gamepad, - ImGuiInputSource_Nav, // Stored in g.ActiveIdSource only - ImGuiInputSource_Clipboard, // Currently only used by InputText() - ImGuiInputSource_COUNT -}; - -// FIXME-NAV: Clarify/expose various repeat delay/rate -enum ImGuiInputReadMode -{ - ImGuiInputReadMode_Down, - ImGuiInputReadMode_Pressed, - ImGuiInputReadMode_Released, - ImGuiInputReadMode_Repeat, - ImGuiInputReadMode_RepeatSlow, - ImGuiInputReadMode_RepeatFast + ImGuiPlotType_Histogram, }; enum ImGuiPopupPositionPolicy { ImGuiPopupPositionPolicy_Default, ImGuiPopupPositionPolicy_ComboBox, - ImGuiPopupPositionPolicy_Tooltip + ImGuiPopupPositionPolicy_Tooltip, +}; + +struct ImGuiDataVarInfo +{ + ImGuiDataType Type; + ImU32 Count; // 1+ + ImU32 Offset; // Offset in parent structure + void* GetVarPtr(void* parent) const { return (void*)((unsigned char*)parent + Offset); } }; struct ImGuiDataTypeTempStorage @@ -945,14 +983,14 @@ enum ImGuiDataTypePrivate_ { ImGuiDataType_String = ImGuiDataType_COUNT + 1, ImGuiDataType_Pointer, - ImGuiDataType_ID + ImGuiDataType_ID, }; // Stacked color modifier, backup of modified data so we can restore it struct ImGuiColorMod { - ImGuiCol Col; - ImVec4 BackupValue; + ImGuiCol Col; + ImVec4 BackupValue; }; // Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable. @@ -1012,10 +1050,20 @@ struct IMGUI_API ImGuiMenuColumns void CalcNextTotalWidth(bool update_offsets); }; +// Internal temporary state for deactivating InputText() instances. +struct IMGUI_API ImGuiInputTextDeactivatedState +{ + ImGuiID ID; // widget id owning the text state (which just got deactivated) + ImVector TextA; // text buffer + + ImGuiInputTextDeactivatedState() { memset(this, 0, sizeof(*this)); } + void ClearFreeMemory() { ID = 0; TextA.clear(); } +}; // Internal state of the currently focused/edited text input box // For a given item ID, access with ImGui::GetInputTextState() struct IMGUI_API ImGuiInputTextState { + ImGuiContext* Ctx; // parent UI context (needs to be set explicitly by parent). ImGuiID ID; // widget id owning the text state int CurLenW, CurLenA; // we need to maintain our buffer length in both UTF-8 and wchar format. UTF-8 length is valid even if TextA is not. ImVector TextW; // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer. @@ -1029,7 +1077,7 @@ struct IMGUI_API ImGuiInputTextState bool CursorFollow; // set when we want scrolling to follow the current cursor position (not always!) bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection bool Edited; // edited this frame - ImGuiInputTextFlags Flags; // copy of InputText() flags + ImGuiInputTextFlags Flags; // copy of InputText() flags. may be used to check if e.g. ImGuiInputTextFlags_Password is set. ImGuiInputTextState() { memset(this, 0, sizeof(*this)); } void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); } @@ -1054,13 +1102,14 @@ struct ImGuiPopupData { ImGuiID PopupId; // Set on OpenPopup() ImGuiWindow* Window; // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup() - ImGuiWindow* SourceWindow; // Set on OpenPopup() copy of NavWindow at the time of opening the popup + ImGuiWindow* BackupNavWindow;// Set on OpenPopup(), a NavWindow that will be restored on popup close + int ParentNavLayer; // Resolved on BeginPopup(). Actually a ImGuiNavLayer type (declared down below), initialized to -1 which is not part of an enum, but serves well-enough as "not any of layers" value int OpenFrameCount; // Set on OpenPopup() ImGuiID OpenParentId; // Set on OpenPopup(), we need this to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items) ImVec2 OpenPopupPos; // Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse) ImVec2 OpenMousePos; // Set on OpenPopup(), copy of mouse position at the time of opening popup - ImGuiPopupData() { memset(this, 0, sizeof(*this)); OpenFrameCount = -1; } + ImGuiPopupData() { memset(this, 0, sizeof(*this)); ParentNavLayer = OpenFrameCount = -1; } }; enum ImGuiNextWindowDataFlags_ @@ -1073,7 +1122,7 @@ enum ImGuiNextWindowDataFlags_ ImGuiNextWindowDataFlags_HasSizeConstraint = 1 << 4, ImGuiNextWindowDataFlags_HasFocus = 1 << 5, ImGuiNextWindowDataFlags_HasBgAlpha = 1 << 6, - ImGuiNextWindowDataFlags_HasScroll = 1 << 7 + ImGuiNextWindowDataFlags_HasScroll = 1 << 7, }; // Storage for SetNexWindow** functions @@ -1103,7 +1152,7 @@ enum ImGuiNextItemDataFlags_ { ImGuiNextItemDataFlags_None = 0, ImGuiNextItemDataFlags_HasWidth = 1 << 0, - ImGuiNextItemDataFlags_HasOpen = 1 << 1 + ImGuiNextItemDataFlags_HasOpen = 1 << 1, }; struct ImGuiNextItemData @@ -1144,8 +1193,8 @@ struct IMGUI_API ImGuiStackSizes short SizeOfDisabledStack; ImGuiStackSizes() { memset(this, 0, sizeof(*this)); } - void SetToCurrentState(); - void CompareWithCurrentState(); + void SetToContextState(ImGuiContext* ctx); + void CompareWithContextState(ImGuiContext* ctx); }; // Data saved for each window pushed into the stack @@ -1160,6 +1209,7 @@ struct ImGuiShrinkWidthItem { int Index; float Width; + float InitialWidth; }; struct ImGuiPtrOrIndex @@ -1171,6 +1221,175 @@ struct ImGuiPtrOrIndex ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; } }; +//----------------------------------------------------------------------------- +// [SECTION] Inputs support +//----------------------------------------------------------------------------- + +// Bit array for named keys +typedef ImBitArray ImBitArrayForNamedKeys; + +// [Internal] Key ranges +#define ImGuiKey_LegacyNativeKey_BEGIN 0 +#define ImGuiKey_LegacyNativeKey_END 512 +#define ImGuiKey_Keyboard_BEGIN (ImGuiKey_NamedKey_BEGIN) +#define ImGuiKey_Keyboard_END (ImGuiKey_GamepadStart) +#define ImGuiKey_Gamepad_BEGIN (ImGuiKey_GamepadStart) +#define ImGuiKey_Gamepad_END (ImGuiKey_GamepadRStickDown + 1) +#define ImGuiKey_Mouse_BEGIN (ImGuiKey_MouseLeft) +#define ImGuiKey_Mouse_END (ImGuiKey_MouseWheelY + 1) +#define ImGuiKey_Aliases_BEGIN (ImGuiKey_Mouse_BEGIN) +#define ImGuiKey_Aliases_END (ImGuiKey_Mouse_END) + +// [Internal] Named shortcuts for Navigation +#define ImGuiKey_NavKeyboardTweakSlow ImGuiMod_Ctrl +#define ImGuiKey_NavKeyboardTweakFast ImGuiMod_Shift +#define ImGuiKey_NavGamepadTweakSlow ImGuiKey_GamepadL1 +#define ImGuiKey_NavGamepadTweakFast ImGuiKey_GamepadR1 +#define ImGuiKey_NavGamepadActivate ImGuiKey_GamepadFaceDown +#define ImGuiKey_NavGamepadCancel ImGuiKey_GamepadFaceRight +#define ImGuiKey_NavGamepadMenu ImGuiKey_GamepadFaceLeft +#define ImGuiKey_NavGamepadInput ImGuiKey_GamepadFaceUp + +enum ImGuiInputEventType +{ + ImGuiInputEventType_None = 0, + ImGuiInputEventType_MousePos, + ImGuiInputEventType_MouseWheel, + ImGuiInputEventType_MouseButton, + ImGuiInputEventType_Key, + ImGuiInputEventType_Text, + ImGuiInputEventType_Focus, + ImGuiInputEventType_COUNT +}; + +enum ImGuiInputSource +{ + ImGuiInputSource_None = 0, + ImGuiInputSource_Mouse, // Note: may be Mouse or TouchScreen or Pen. See io.MouseSource to distinguish them. + ImGuiInputSource_Keyboard, + ImGuiInputSource_Gamepad, + ImGuiInputSource_Clipboard, // Currently only used by InputText() + ImGuiInputSource_COUNT +}; + +// FIXME: Structures in the union below need to be declared as anonymous unions appears to be an extension? +// Using ImVec2() would fail on Clang 'union member 'MousePos' has a non-trivial default constructor' +struct ImGuiInputEventMousePos { float PosX, PosY; ImGuiMouseSource MouseSource; }; +struct ImGuiInputEventMouseWheel { float WheelX, WheelY; ImGuiMouseSource MouseSource; }; +struct ImGuiInputEventMouseButton { int Button; bool Down; ImGuiMouseSource MouseSource; }; +struct ImGuiInputEventKey { ImGuiKey Key; bool Down; float AnalogValue; }; +struct ImGuiInputEventText { unsigned int Char; }; +struct ImGuiInputEventAppFocused { bool Focused; }; + +struct ImGuiInputEvent +{ + ImGuiInputEventType Type; + ImGuiInputSource Source; + ImU32 EventId; // Unique, sequential increasing integer to identify an event (if you need to correlate them to other data). + union + { + ImGuiInputEventMousePos MousePos; // if Type == ImGuiInputEventType_MousePos + ImGuiInputEventMouseWheel MouseWheel; // if Type == ImGuiInputEventType_MouseWheel + ImGuiInputEventMouseButton MouseButton; // if Type == ImGuiInputEventType_MouseButton + ImGuiInputEventKey Key; // if Type == ImGuiInputEventType_Key + ImGuiInputEventText Text; // if Type == ImGuiInputEventType_Text + ImGuiInputEventAppFocused AppFocused; // if Type == ImGuiInputEventType_Focus + }; + bool AddedByTestEngine; + + ImGuiInputEvent() { memset(this, 0, sizeof(*this)); } +}; + +// Input function taking an 'ImGuiID owner_id' argument defaults to (ImGuiKeyOwner_Any == 0) aka don't test ownership, which matches legacy behavior. +#define ImGuiKeyOwner_Any ((ImGuiID)0) // Accept key that have an owner, UNLESS a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease. +#define ImGuiKeyOwner_None ((ImGuiID)-1) // Require key to have no owner. + +typedef ImS16 ImGuiKeyRoutingIndex; + +// Routing table entry (sizeof() == 16 bytes) +struct ImGuiKeyRoutingData +{ + ImGuiKeyRoutingIndex NextEntryIndex; + ImU16 Mods; // Technically we'd only need 4-bits but for simplify we store ImGuiMod_ values which need 16-bits. ImGuiMod_Shortcut is already translated to Ctrl/Super. + ImU8 RoutingNextScore; // Lower is better (0: perfect score) + ImGuiID RoutingCurr; + ImGuiID RoutingNext; + + ImGuiKeyRoutingData() { NextEntryIndex = -1; Mods = 0; RoutingNextScore = 255; RoutingCurr = RoutingNext = ImGuiKeyOwner_None; } +}; + +// Routing table: maintain a desired owner for each possible key-chord (key + mods), and setup owner in NewFrame() when mods are matching. +// Stored in main context (1 instance) +struct ImGuiKeyRoutingTable +{ + ImGuiKeyRoutingIndex Index[ImGuiKey_NamedKey_COUNT]; // Index of first entry in Entries[] + ImVector Entries; + ImVector EntriesNext; // Double-buffer to avoid reallocation (could use a shared buffer) + + ImGuiKeyRoutingTable() { Clear(); } + void Clear() { for (int n = 0; n < IM_ARRAYSIZE(Index); n++) Index[n] = -1; Entries.clear(); EntriesNext.clear(); } +}; + +// This extends ImGuiKeyData but only for named keys (legacy keys don't support the new features) +// Stored in main context (1 per named key). In the future it might be merged into ImGuiKeyData. +struct ImGuiKeyOwnerData +{ + ImGuiID OwnerCurr; + ImGuiID OwnerNext; + bool LockThisFrame; // Reading this key requires explicit owner id (until end of frame). Set by ImGuiInputFlags_LockThisFrame. + bool LockUntilRelease; // Reading this key requires explicit owner id (until key is released). Set by ImGuiInputFlags_LockUntilRelease. When this is true LockThisFrame is always true as well. + + ImGuiKeyOwnerData() { OwnerCurr = OwnerNext = ImGuiKeyOwner_None; LockThisFrame = LockUntilRelease = false; } +}; + +// Flags for extended versions of IsKeyPressed(), IsMouseClicked(), Shortcut(), SetKeyOwner(), SetItemKeyOwner() +// Don't mistake with ImGuiInputTextFlags! (for ImGui::InputText() function) +enum ImGuiInputFlags_ +{ + // Flags for IsKeyPressed(), IsMouseClicked(), Shortcut() + ImGuiInputFlags_None = 0, + ImGuiInputFlags_Repeat = 1 << 0, // Return true on successive repeats. Default for legacy IsKeyPressed(). NOT Default for legacy IsMouseClicked(). MUST BE == 1. + ImGuiInputFlags_RepeatRateDefault = 1 << 1, // Repeat rate: Regular (default) + ImGuiInputFlags_RepeatRateNavMove = 1 << 2, // Repeat rate: Fast + ImGuiInputFlags_RepeatRateNavTweak = 1 << 3, // Repeat rate: Faster + ImGuiInputFlags_RepeatRateMask_ = ImGuiInputFlags_RepeatRateDefault | ImGuiInputFlags_RepeatRateNavMove | ImGuiInputFlags_RepeatRateNavTweak, + + // Flags for SetItemKeyOwner() + ImGuiInputFlags_CondHovered = 1 << 4, // Only set if item is hovered (default to both) + ImGuiInputFlags_CondActive = 1 << 5, // Only set if item is active (default to both) + ImGuiInputFlags_CondDefault_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive, + ImGuiInputFlags_CondMask_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive, + + // Flags for SetKeyOwner(), SetItemKeyOwner() + ImGuiInputFlags_LockThisFrame = 1 << 6, // Access to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared at end of frame. This is useful to make input-owner-aware code steal keys from non-input-owner-aware code. + ImGuiInputFlags_LockUntilRelease = 1 << 7, // Access to key data will require EXPLICIT owner ID (ImGuiKeyOwner_Any/0 will NOT accepted for polling). Cleared when the key is released or at end of each frame if key is released. This is useful to make input-owner-aware code steal keys from non-input-owner-aware code. + + // Routing policies for Shortcut() + low-level SetShortcutRouting() + // - The general idea is that several callers register interest in a shortcut, and only one owner gets it. + // - When a policy (other than _RouteAlways) is set, Shortcut() will register itself with SetShortcutRouting(), + // allowing the system to decide where to route the input among other route-aware calls. + // - Shortcut() uses ImGuiInputFlags_RouteFocused by default: meaning that a simple Shortcut() poll + // will register a route and only succeed when parent window is in the focus stack and if no-one + // with a higher priority is claiming the shortcut. + // - Using ImGuiInputFlags_RouteAlways is roughly equivalent to doing e.g. IsKeyPressed(key) + testing mods. + // - Priorities: GlobalHigh > Focused (when owner is active item) > Global > Focused (when focused window) > GlobalLow. + // - Can select only 1 policy among all available. + ImGuiInputFlags_RouteFocused = 1 << 8, // (Default) Register focused route: Accept inputs if window is in focus stack. Deep-most focused window takes inputs. ActiveId takes inputs over deep-most focused window. + ImGuiInputFlags_RouteGlobalLow = 1 << 9, // Register route globally (lowest priority: unless a focused window or active item registered the route) -> recommended Global priority. + ImGuiInputFlags_RouteGlobal = 1 << 10, // Register route globally (medium priority: unless an active item registered the route, e.g. CTRL+A registered by InputText). + ImGuiInputFlags_RouteGlobalHigh = 1 << 11, // Register route globally (highest priority: unlikely you need to use that: will interfere with every active items) + ImGuiInputFlags_RouteMask_ = ImGuiInputFlags_RouteFocused | ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteGlobalLow | ImGuiInputFlags_RouteGlobalHigh, // _Always not part of this! + ImGuiInputFlags_RouteAlways = 1 << 12, // Do not register route, poll keys directly. + ImGuiInputFlags_RouteUnlessBgFocused= 1 << 13, // Global routes will not be applied if underlying background/void is focused (== no Dear ImGui windows are focused). Useful for overlay applications. + ImGuiInputFlags_RouteExtraMask_ = ImGuiInputFlags_RouteAlways | ImGuiInputFlags_RouteUnlessBgFocused, + + // [Internal] Mask of which function support which flags + ImGuiInputFlags_SupportedByIsKeyPressed = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_, + ImGuiInputFlags_SupportedByShortcut = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_ | ImGuiInputFlags_RouteMask_ | ImGuiInputFlags_RouteExtraMask_, + ImGuiInputFlags_SupportedBySetKeyOwner = ImGuiInputFlags_LockThisFrame | ImGuiInputFlags_LockUntilRelease, + ImGuiInputFlags_SupportedBySetItemKeyOwner = ImGuiInputFlags_SupportedBySetKeyOwner | ImGuiInputFlags_CondMask_, +}; + //----------------------------------------------------------------------------- // [SECTION] Clipper support //----------------------------------------------------------------------------- @@ -1207,9 +1426,9 @@ struct ImGuiListClipperData enum ImGuiActivateFlags_ { ImGuiActivateFlags_None = 0, - ImGuiActivateFlags_PreferInput = 1 << 0, // Favor activation that requires keyboard text input (e.g. for Slider/Drag). Default if keyboard is available. - ImGuiActivateFlags_PreferTweak = 1 << 1, // Favor activation for tweaking with arrows or gamepad (e.g. for Slider/Drag). Default if keyboard is not available. - ImGuiActivateFlags_TryToPreserveState = 1 << 2 // Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection) + ImGuiActivateFlags_PreferInput = 1 << 0, // Favor activation that requires keyboard text input (e.g. for Slider/Drag). Default for Enter key. + ImGuiActivateFlags_PreferTweak = 1 << 1, // Favor activation for tweaking with arrows or gamepad (e.g. for Slider/Drag). Default for Space key and if keyboard is not used. + ImGuiActivateFlags_TryToPreserveState = 1 << 2, // Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection) }; // Early work-in-progress API for ScrollToItem() @@ -1224,7 +1443,7 @@ enum ImGuiScrollFlags_ ImGuiScrollFlags_AlwaysCenterY = 1 << 5, // Always center the result item on Y axis [default for Y axis for appearing window) ImGuiScrollFlags_NoScrollParent = 1 << 6, // Disable forwarding scrolling to parent window if required to keep item/rect visible (only scroll window the function was applied to). ImGuiScrollFlags_MaskX_ = ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleCenterX | ImGuiScrollFlags_AlwaysCenterX, - ImGuiScrollFlags_MaskY_ = ImGuiScrollFlags_KeepVisibleEdgeY | ImGuiScrollFlags_KeepVisibleCenterY | ImGuiScrollFlags_AlwaysCenterY + ImGuiScrollFlags_MaskY_ = ImGuiScrollFlags_KeepVisibleEdgeY | ImGuiScrollFlags_KeepVisibleCenterY | ImGuiScrollFlags_AlwaysCenterY, }; enum ImGuiNavHighlightFlags_ @@ -1233,16 +1452,7 @@ enum ImGuiNavHighlightFlags_ ImGuiNavHighlightFlags_TypeDefault = 1 << 0, ImGuiNavHighlightFlags_TypeThin = 1 << 1, ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2, // Draw rectangular highlight if (g.NavId == id) _even_ when using the mouse. - ImGuiNavHighlightFlags_NoRounding = 1 << 3 -}; - -enum ImGuiNavDirSourceFlags_ -{ - ImGuiNavDirSourceFlags_None = 0, - ImGuiNavDirSourceFlags_RawKeyboard = 1 << 0, // Raw keyboard (not pulled from nav), faciliate use of some functions before we can unify nav and keys - ImGuiNavDirSourceFlags_Keyboard = 1 << 1, - ImGuiNavDirSourceFlags_PadDPad = 1 << 2, - ImGuiNavDirSourceFlags_PadLStick = 1 << 3 + ImGuiNavHighlightFlags_NoRounding = 1 << 3, }; enum ImGuiNavMoveFlags_ @@ -1260,13 +1470,13 @@ enum ImGuiNavMoveFlags_ ImGuiNavMoveFlags_FocusApi = 1 << 9, ImGuiNavMoveFlags_Tabbing = 1 << 10, // == Focus + Activate if item is Inputable + DontChangeNavHighlight ImGuiNavMoveFlags_Activate = 1 << 11, - ImGuiNavMoveFlags_DontSetNavHighlight = 1 << 12 // Do not alter the visible state of keyboard vs mouse nav highlight + ImGuiNavMoveFlags_DontSetNavHighlight = 1 << 12, // Do not alter the visible state of keyboard vs mouse nav highlight }; enum ImGuiNavLayer { ImGuiNavLayer_Main = 0, // Main scrolling layer - ImGuiNavLayer_Menu = 1, // Menu layer (access with Alt/ImGuiNavInput_Menu) + ImGuiNavLayer_Menu = 1, // Menu layer (access with Alt) ImGuiNavLayer_COUNT }; @@ -1297,24 +1507,24 @@ enum ImGuiOldColumnFlags_ ImGuiOldColumnFlags_NoResize = 1 << 1, // Disable resizing columns when clicking on the dividers ImGuiOldColumnFlags_NoPreserveWidths = 1 << 2, // Disable column width preservation when adjusting columns ImGuiOldColumnFlags_NoForceWithinWindow = 1 << 3, // Disable forcing columns to fit within window - ImGuiOldColumnFlags_GrowParentContentsSize = 1 << 4 // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove. + ImGuiOldColumnFlags_GrowParentContentsSize = 1 << 4, // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove. // Obsolete names (will be removed) #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - , ImGuiColumnsFlags_None = ImGuiOldColumnFlags_None, + ImGuiColumnsFlags_None = ImGuiOldColumnFlags_None, ImGuiColumnsFlags_NoBorder = ImGuiOldColumnFlags_NoBorder, ImGuiColumnsFlags_NoResize = ImGuiOldColumnFlags_NoResize, ImGuiColumnsFlags_NoPreserveWidths = ImGuiOldColumnFlags_NoPreserveWidths, ImGuiColumnsFlags_NoForceWithinWindow = ImGuiOldColumnFlags_NoForceWithinWindow, - ImGuiColumnsFlags_GrowParentContentsSize = ImGuiOldColumnFlags_GrowParentContentsSize + ImGuiColumnsFlags_GrowParentContentsSize = ImGuiOldColumnFlags_GrowParentContentsSize, #endif }; struct ImGuiOldColumnData { - float OffsetNorm; // Column start offset, normalized 0.0 (far left) -> 1.0 (far right) + float OffsetNorm; // Column start offset, normalized 0.0 (far left) -> 1.0 (far right) float OffsetNormBeforeResize; - ImGuiOldColumnFlags Flags; // Not exposed + ImGuiOldColumnFlags Flags; // Not exposed ImRect ClipRect; ImGuiOldColumnData() { memset(this, 0, sizeof(*this)); } @@ -1403,6 +1613,7 @@ struct ImGuiWindowSettings ImVec2ih Size; bool Collapsed; bool WantApply; // Set when loaded from .ini data (to enable merging/loading .ini data into an already running context) + bool WantDelete; // Set to invalidate/delete the settings entry ImGuiWindowSettings() { memset(this, 0, sizeof(*this)); } char* GetName() { return (char*)(this + 1); } @@ -1423,32 +1634,61 @@ struct ImGuiSettingsHandler ImGuiSettingsHandler() { memset(this, 0, sizeof(*this)); } }; +//----------------------------------------------------------------------------- +// [SECTION] Localization support +//----------------------------------------------------------------------------- + +// This is experimental and not officially supported, it'll probably fall short of features, if/when it does we may backtrack. +enum ImGuiLocKey : int +{ + ImGuiLocKey_TableSizeOne, + ImGuiLocKey_TableSizeAllFit, + ImGuiLocKey_TableSizeAllDefault, + ImGuiLocKey_TableResetOrder, + ImGuiLocKey_WindowingMainMenuBar, + ImGuiLocKey_WindowingPopup, + ImGuiLocKey_WindowingUntitled, + ImGuiLocKey_COUNT +}; + +struct ImGuiLocEntry +{ + ImGuiLocKey Key; + const char* Text; +}; + + //----------------------------------------------------------------------------- // [SECTION] Metrics, Debug Tools //----------------------------------------------------------------------------- -struct ImGuiMetricsConfig +enum ImGuiDebugLogFlags_ { - bool ShowStackTool; - bool ShowWindowsRects; - bool ShowWindowsBeginOrder; - bool ShowTablesRects; - bool ShowDrawCmdMesh; - bool ShowDrawCmdBoundingBoxes; - int ShowWindowsRectsType; - int ShowTablesRectsType; + // Event types + ImGuiDebugLogFlags_None = 0, + ImGuiDebugLogFlags_EventActiveId = 1 << 0, + ImGuiDebugLogFlags_EventFocus = 1 << 1, + ImGuiDebugLogFlags_EventPopup = 1 << 2, + ImGuiDebugLogFlags_EventNav = 1 << 3, + ImGuiDebugLogFlags_EventClipper = 1 << 4, + ImGuiDebugLogFlags_EventSelection = 1 << 5, + ImGuiDebugLogFlags_EventIO = 1 << 6, + ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventSelection | ImGuiDebugLogFlags_EventIO, + ImGuiDebugLogFlags_OutputToTTY = 1 << 10, // Also send output to TTY +}; - ImGuiMetricsConfig() - { - ShowStackTool = false; - ShowWindowsRects = false; - ShowWindowsBeginOrder = false; - ShowTablesRects = false; - ShowDrawCmdMesh = true; - ShowDrawCmdBoundingBoxes = true; - ShowWindowsRectsType = -1; - ShowTablesRectsType = -1; - } +struct ImGuiMetricsConfig +{ + bool ShowDebugLog = false; + bool ShowStackTool = false; + bool ShowWindowsRects = false; + bool ShowWindowsBeginOrder = false; + bool ShowTablesRects = false; + bool ShowDrawCmdMesh = true; + bool ShowDrawCmdBoundingBoxes = true; + bool ShowAtlasTintedWithTextColor = false; + int ShowWindowsRectsType = -1; + int ShowTablesRectsType = -1; }; struct ImGuiStackLevelInfo @@ -1456,7 +1696,8 @@ struct ImGuiStackLevelInfo ImGuiID ID; ImS8 QueryFrameCount; // >= 1: Query in progress bool QuerySuccess; // Obtained result from DebugHookIdInfo() - char Desc[58]; // Arbitrarily sized buffer to hold a result (FIXME: could replace Results[] with a chunk stream?) + ImGuiDataType DataType : 8; + char Desc[57]; // Arbitrarily sized buffer to hold a result (FIXME: could replace Results[] with a chunk stream?) FIXME: Now that we added CTRL+C this should be fixed. ImGuiStackLevelInfo() { memset(this, 0, sizeof(*this)); } }; @@ -1468,8 +1709,10 @@ struct ImGuiStackTool int StackLevel; // -1: query stack and resize Results, >= 0: individual stack level ImGuiID QueryId; // ID to query details for ImVector Results; + bool CopyToClipboardOnCtrlC; + float CopyToClipboardLastTime; - ImGuiStackTool() { memset(this, 0, sizeof(*this)); } + ImGuiStackTool() { memset(this, 0, sizeof(*this)); CopyToClipboardLastTime = -FLT_MAX; } }; //----------------------------------------------------------------------------- @@ -1491,7 +1734,7 @@ struct ImGuiContextHook }; //----------------------------------------------------------------------------- -// [SECTION] ImGuiContext (main imgui context) +// [SECTION] ImGuiContext (main Dear ImGui context) //----------------------------------------------------------------------------- struct ImGuiContext @@ -1515,6 +1758,12 @@ struct ImGuiContext bool TestEngineHookItems; // Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log() void* TestEngine; // Test engine user data + // Inputs + ImVector InputEventsQueue; // Input events which will be trickled/written into IO structure. + ImVector InputEventsTrail; // Past input events processed in NewFrame(). This is to allow domain-specific application to access e.g mouse/pen trail. + ImGuiMouseSource InputEventsNextMouseSource; + ImU32 InputEventsNextEventId; + // Windows state ImVector Windows; // Windows, sorted in display order, back to front ImVector WindowsFocusOrder; // Root windows, sorted in focus order, back to front. @@ -1529,15 +1778,16 @@ struct ImGuiContext ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actual window that is moved is generally MovingWindow->RootWindow. ImGuiWindow* WheelingWindow; // Track the window we started mouse-wheeling on. Until a timer elapse or mouse has moved, generally keep scrolling the same window even if during the course of scrolling the mouse ends up hovering a child window. ImVec2 WheelingWindowRefMousePos; - float WheelingWindowTimer; + int WheelingWindowStartFrame; // This may be set one frame before WheelingWindow is != NULL + float WheelingWindowReleaseTimer; + ImVec2 WheelingWindowWheelRemainder; + ImVec2 WheelingAxisAvg; // Item/widgets state and tracking information ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line] ImGuiID HoveredId; // Hovered widget, filled during the frame ImGuiID HoveredIdPreviousFrame; bool HoveredIdAllowOverlap; - bool HoveredIdUsingMouseWheel; // Hovered widget will use mouse wheel. Blocks scrolling the underlying window. - bool HoveredIdPreviousFrameUsingMouseWheel; bool HoveredIdDisabled; // At least one widget passed the rect test, but has been discarded by disabled flag or popup inhibit. May be true even if HoveredId == 0. float HoveredIdTimer; // Measure contiguous hovering time float HoveredIdNotActiveTimer; // Measure contiguous hovering time where the item has not been active @@ -1550,13 +1800,9 @@ struct ImGuiContext bool ActiveIdHasBeenPressedBefore; // Track whether the active id led to a press (this is to allow changing between PressOnClick and PressOnRelease without pressing twice). Used by range_select branch. bool ActiveIdHasBeenEditedBefore; // Was the value associated to the widget Edited over the course of the Active state. bool ActiveIdHasBeenEditedThisFrame; - bool ActiveIdUsingMouseWheel; // Active widget will want to read mouse wheel. Blocks scrolling the underlying window. - ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it) - ImU32 ActiveIdUsingNavInputMask; // Active widget will want to read those nav inputs. - ImU64 ActiveIdUsingKeyInputMask; // Active widget will want to read those key inputs. When we grow the ImGuiKey enum we'll need to either to order the enum to make useful keys come first, either redesign this into e.g. a small array. ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior) ImGuiWindow* ActiveIdWindow; - ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard) + ImGuiInputSource ActiveIdSource; // Activating source: ImGuiInputSource_Mouse OR ImGuiInputSource_Keyboard OR ImGuiInputSource_Gamepad int ActiveIdMouseButton; ImGuiID ActiveIdPreviousFrame; bool ActiveIdPreviousFrameIsAlive; @@ -1565,8 +1811,22 @@ struct ImGuiContext ImGuiID LastActiveId; // Store the last non-zero ActiveId, useful for animation. float LastActiveIdTimer; // Store the last non-zero ActiveId timer since the beginning of activation, useful for animation. + // [EXPERIMENTAL] Key/Input Ownership + Shortcut Routing system + // - The idea is that instead of "eating" a given key, we can link to an owner. + // - Input query can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_None (== -1) or a custom ID. + // - Routing is requested ahead of time for a given chord (Key + Mods) and granted in NewFrame(). + ImGuiKeyOwnerData KeysOwnerData[ImGuiKey_NamedKey_COUNT]; + ImGuiKeyRoutingTable KeysRoutingTable; + ImU32 ActiveIdUsingNavDirMask; // Active widget will want to read those nav move requests (e.g. can activate a button and move away from it) + bool ActiveIdUsingAllKeyboardKeys; // Active widget will want to read all keyboard keys inputs. (FIXME: This is a shortcut for not taking ownership of 100+ keys but perhaps best to not have the inconsistency) +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + ImU32 ActiveIdUsingNavInputMask; // If you used this. Since (IMGUI_VERSION_NUM >= 18804) : 'g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel);' becomes 'SetKeyOwner(ImGuiKey_Escape, g.ActiveId) and/or SetKeyOwner(ImGuiKey_NavGamepadCancel, g.ActiveId);' +#endif + // Next window/item data - ImGuiItemFlags CurrentItemFlags; // == g.ItemFlagsStack.back() + ImGuiID CurrentFocusScopeId; // == g.FocusScopeStack.back() + ImGuiItemFlags CurrentItemFlags; // == g.ItemFlagsStack.back() + ImGuiID DebugLocateId; // Storage for DebugLocateItemOnHover() feature: this is read by ItemAdd() so we keep it in a hot/cached location ImGuiNextItemData NextItemData; // Storage for SetNextItem** functions ImGuiLastItemData LastItemData; // Storage for last submitted item (setup by ItemAdd) ImGuiNextWindowData NextWindowData; // Storage for SetNextWindow** functions @@ -1575,7 +1835,7 @@ struct ImGuiContext ImVector ColorStack; // Stack for PushStyleColor()/PopStyleColor() - inherited by Begin() ImVector StyleVarStack; // Stack for PushStyleVar()/PopStyleVar() - inherited by Begin() ImVector FontStack; // Stack for PushFont()/PopFont() - inherited by Begin() - ImVector FocusScopeStack; // Stack for PushFocusScope()/PopFocusScope() - not inherited by Begin(), unless child window + ImVector FocusScopeStack; // Stack for PushFocusScope()/PopFocusScope() - inherited by BeginChild(), pushed into by Begin() ImVectorItemFlagsStack; // Stack for PushItemFlag()/PopItemFlag() - inherited by Begin() ImVectorGroupStack; // Stack for BeginGroup()/EndGroup() - not inherited by Begin() ImVectorOpenPopupStack; // Which popups are open (persistent) @@ -1586,20 +1846,19 @@ struct ImGuiContext ImVector Viewports; // Active viewports (Size==1 in 'master' branch). Each viewports hold their copy of ImDrawData. // Gamepad/keyboard Navigation - ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusWindow' + ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow' ImGuiID NavId; // Focused item for navigation ImGuiID NavFocusScopeId; // Identify a selection scope (selection code often wants to "clear other items" when landing on an item of the selection set) - ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem() - ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0 - ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0 - ImGuiID NavActivateInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0; ImGuiActivateFlags_PreferInput will be set and NavActivateId will be 0. + ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItem() + ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0 + ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat) ImGuiActivateFlags NavActivateFlags; ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest). ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest). - ImGuiKeyModFlags NavJustMovedToKeyMods; + ImGuiKeyChord NavJustMovedToKeyMods; ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame. ImGuiActivateFlags NavNextActivateFlags; - ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard. + ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource_Keyboard or ImGuiInputSource_Mouse ImGuiNavLayer NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later. bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRectRel is valid bool NavMousePosDirty; // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default) @@ -1617,7 +1876,7 @@ struct ImGuiContext bool NavMoveForwardToNextFrame; ImGuiNavMoveFlags NavMoveFlags; ImGuiScrollFlags NavMoveScrollFlags; - ImGuiKeyModFlags NavMoveKeyMods; + ImGuiKeyChord NavMoveKeyMods; ImGuiDir NavMoveDir; // Direction of the move request (left/right/up/down) ImGuiDir NavMoveDirForDebug; ImGuiDir NavMoveClipDir; // FIXME-NAV: Describe the purpose of this better. Might want to rename? @@ -1632,12 +1891,16 @@ struct ImGuiContext ImGuiNavItemData NavTabbingResultFirst; // First tabbing request candidate within NavWindow and flattened hierarchy // Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize) + ImGuiKeyChord ConfigNavWindowingKeyNext; // = ImGuiMod_Ctrl | ImGuiKey_Tab, for reconfiguration (see #4828) + ImGuiKeyChord ConfigNavWindowingKeyPrev; // = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab ImGuiWindow* NavWindowingTarget; // Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most! ImGuiWindow* NavWindowingTargetAnim; // Record of last valid NavWindowingTarget until DimBgRatio and NavWindowingHighlightAlpha becomes 0.0f, so the fade-out can stay on it. ImGuiWindow* NavWindowingListWindow; // Internal window actually listing the CTRL+Tab contents float NavWindowingTimer; float NavWindowingHighlightAlpha; bool NavWindowingToggleLayer; + ImVec2 NavWindowingAccumDeltaPos; + ImVec2 NavWindowingAccumDeltaSize; // Render float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list) @@ -1666,7 +1929,7 @@ struct ImGuiContext int ClipperTempDataStacked; ImVector ClipperTempData; - // Table + // Tables ImGuiTable* CurrentTable; int TablesTempDataStacked; // Temporary table data size (because we leave previous instances undestructed, we generally don't use TablesTempData.Size) ImVector TablesTempData; // Temporary table data (buffers reused/shared across instances, support nesting) @@ -1680,17 +1943,27 @@ struct ImGuiContext ImVector CurrentTabBarStack; ImVector ShrinkWidthBuffer; + // Hover Delay system + ImGuiID HoverDelayId; + ImGuiID HoverDelayIdPreviousFrame; + float HoverDelayTimer; // Currently used IsItemHovered(), generally inferred from g.HoveredIdTimer but kept uncleared until clear timer elapse. + float HoverDelayClearTimer; // Currently used IsItemHovered(): grace time before g.TooltipHoverTimer gets cleared. + // Widget state ImVec2 MouseLastValidPos; ImGuiInputTextState InputTextState; + ImGuiInputTextDeactivatedState InputTextDeactivatedState; ImFont InputTextPasswordFont; ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc. ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets - float ColorEditLastHue; // Backup of last Hue associated to LastColor, so we can restore Hue in lossy RGB<>HSV round trips - float ColorEditLastSat; // Backup of last Saturation associated to LastColor, so we can restore Saturation in lossy RGB<>HSV round trips - ImU32 ColorEditLastColor; // RGB value with alpha set to 0. + ImGuiID ColorEditCurrentID; // Set temporarily while inside of the parent-most ColorEdit4/ColorPicker4 (because they call each others). + ImGuiID ColorEditSavedID; // ID we are saving/restoring HS for + float ColorEditSavedHue; // Backup of last Hue associated to LastColor, so we can restore Hue in lossy RGB<>HSV round trips + float ColorEditSavedSat; // Backup of last Saturation associated to LastColor, so we can restore Saturation in lossy RGB<>HSV round trips + ImU32 ColorEditSavedColor; // RGB value with alpha set to 0. ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker. ImGuiComboPreviewData ComboPreviewData; + float SliderGrabClickOffset; float SliderCurrentAccum; // Accumulated slider delta when using navigation controls. bool SliderCurrentAccumDirty; // Has the accumulated slider delta changed since last time we tried to apply it? bool DragCurrentAccumDirty; @@ -1700,13 +1973,12 @@ struct ImGuiContext float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled() short DisabledStackSize; short TooltipOverrideCount; - float TooltipSlowDelay; // Time before slow tooltips appears (FIXME: This is temporary until we merge in tooltip timer+priority work) ImVector ClipboardHandlerData; // If no custom clipboard handler is defined ImVector MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once // Platform support - ImVec2 PlatformImePos; // Cursor position request & last passed to the OS Input Method Editor - ImVec2 PlatformImeLastPos; + ImGuiPlatformImeData PlatformImeData; // Data updated by current frame + ImGuiPlatformImeData PlatformImeDataPrev; // Previous frame data (when changing we will call io.SetPlatformImeDataFn char PlatformLocaleDecimalPoint; // '.' or *localeconv()->decimal_point // Settings @@ -1719,6 +1991,9 @@ struct ImGuiContext ImVector Hooks; // Hooks for extensions (e.g. test engine) ImGuiID HookIdNext; // Next available HookId + // Localization + const char* LocalizationTable[ImGuiLocKey_COUNT]; + // Capture/Logging bool LogEnabled; // Currently capturing ImGuiLogType LogType; // Capture target @@ -1733,23 +2008,33 @@ struct ImGuiContext int LogDepthToExpandDefault; // Default/stored value for LogDepthMaxExpand if not specified in the LogXXX function call. // Debug Tools + ImGuiDebugLogFlags DebugLogFlags; + ImGuiTextBuffer DebugLogBuf; + ImGuiTextIndex DebugLogIndex; + ImU8 DebugLogClipperAutoDisableFrames; + ImU8 DebugLocateFrames; // For DebugLocateItemOnHover(). This is used together with DebugLocateId which is in a hot/cached spot above. + ImS8 DebugBeginReturnValueCullDepth; // Cycle between 0..9 then wrap around. bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker()) + ImU8 DebugItemPickerMouseButton; ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this ID ImGuiMetricsConfig DebugMetricsConfig; ImGuiStackTool DebugStackTool; // Misc - float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds. + float FramerateSecPerFrame[60]; // Calculate estimate of framerate for user over the last 60 frames.. int FramerateSecPerFrameIdx; int FramerateSecPerFrameCount; float FramerateSecPerFrameAccum; - int WantCaptureMouseNextFrame; // Explicit capture via CaptureKeyboardFromApp()/CaptureMouseFromApp() sets those flags - int WantCaptureKeyboardNextFrame; + int WantCaptureMouseNextFrame; // Explicit capture override via SetNextFrameWantCaptureMouse()/SetNextFrameWantCaptureKeyboard(). Default to -1. + int WantCaptureKeyboardNextFrame; // " int WantTextInputNextFrame; - char TempBuffer[1024 * 3 + 1]; // Temporary text buffer + ImVector TempBuffer; // Temporary text buffer ImGuiContext(ImFontAtlas* shared_font_atlas) { + IO.Ctx = this; + InputTextState.Ctx = this; + Initialized = false; FontAtlasOwnedByContext = shared_font_atlas ? false : true; Font = NULL; @@ -1763,18 +2048,21 @@ struct ImGuiContext TestEngineHookItems = false; TestEngine = NULL; + InputEventsNextMouseSource = ImGuiMouseSource_Mouse; + InputEventsNextEventId = 1; + WindowsActiveCount = 0; CurrentWindow = NULL; HoveredWindow = NULL; HoveredWindowUnderMovingWindow = NULL; MovingWindow = NULL; WheelingWindow = NULL; - WheelingWindowTimer = 0.0f; + WheelingWindowStartFrame = -1; + WheelingWindowReleaseTimer = 0.0f; DebugHookIdInfo = 0; HoveredId = HoveredIdPreviousFrame = 0; HoveredIdAllowOverlap = false; - HoveredIdUsingMouseWheel = HoveredIdPreviousFrameUsingMouseWheel = false; HoveredIdDisabled = false; HoveredIdTimer = HoveredIdNotActiveTimer = 0.0f; ActiveId = 0; @@ -1786,10 +2074,6 @@ struct ImGuiContext ActiveIdHasBeenPressedBefore = false; ActiveIdHasBeenEditedBefore = false; ActiveIdHasBeenEditedThisFrame = false; - ActiveIdUsingMouseWheel = false; - ActiveIdUsingNavDirMask = 0x00; - ActiveIdUsingNavInputMask = 0x00; - ActiveIdUsingKeyInputMask = 0x00; ActiveIdClickOffset = ImVec2(-1, -1); ActiveIdWindow = NULL; ActiveIdSource = ImGuiInputSource_None; @@ -1801,15 +2085,22 @@ struct ImGuiContext LastActiveId = 0; LastActiveIdTimer = 0.0f; + ActiveIdUsingNavDirMask = 0x00; + ActiveIdUsingAllKeyboardKeys = false; +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + ActiveIdUsingNavInputMask = 0x00; +#endif + + CurrentFocusScopeId = 0; CurrentItemFlags = ImGuiItemFlags_None; BeginMenuCount = 0; NavWindow = NULL; - NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavActivateInputId = 0; + NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = 0; NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0; NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None; - NavJustMovedToKeyMods = ImGuiKeyModFlags_None; - NavInputSource = ImGuiInputSource_None; + NavJustMovedToKeyMods = ImGuiMod_None; + NavInputSource = ImGuiInputSource_Keyboard; NavLayer = ImGuiNavLayer_Main; NavIdIsAlive = false; NavMousePosDirty = false; @@ -1824,12 +2115,14 @@ struct ImGuiContext NavMoveForwardToNextFrame = false; NavMoveFlags = ImGuiNavMoveFlags_None; NavMoveScrollFlags = ImGuiScrollFlags_None; - NavMoveKeyMods = ImGuiKeyModFlags_None; + NavMoveKeyMods = ImGuiMod_None; NavMoveDir = NavMoveDirForDebug = NavMoveClipDir = ImGuiDir_None; NavScoringDebugCount = 0; NavTabbingDir = 0; NavTabbingCounter = 0; + ConfigNavWindowingKeyNext = ImGuiMod_Ctrl | ImGuiKey_Tab; + ConfigNavWindowingKeyPrev = ImGuiMod_Ctrl | ImGuiMod_Shift | ImGuiKey_Tab; NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL; NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f; NavWindowingToggleLayer = false; @@ -1855,28 +2148,35 @@ struct ImGuiContext TablesTempDataStacked = 0; CurrentTabBar = NULL; + HoverDelayId = HoverDelayIdPreviousFrame = 0; + HoverDelayTimer = HoverDelayClearTimer = 0.0f; + TempInputId = 0; ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_; - ColorEditLastHue = ColorEditLastSat = 0.0f; - ColorEditLastColor = 0; + ColorEditCurrentID = ColorEditSavedID = 0; + ColorEditSavedHue = ColorEditSavedSat = 0.0f; + ColorEditSavedColor = 0; + SliderGrabClickOffset = 0.0f; SliderCurrentAccum = 0.0f; SliderCurrentAccumDirty = false; DragCurrentAccumDirty = false; DragCurrentAccum = 0.0f; DragSpeedDefaultRatio = 1.0f / 100.0f; + ScrollbarClickDeltaToGrabCenter = 0.0f; DisabledAlphaBackup = 0.0f; DisabledStackSize = 0; - ScrollbarClickDeltaToGrabCenter = 0.0f; TooltipOverrideCount = 0; - TooltipSlowDelay = 0.50f; - PlatformImePos = PlatformImeLastPos = ImVec2(FLT_MAX, FLT_MAX); + PlatformImeData.InputPos = ImVec2(0.0f, 0.0f); + PlatformImeDataPrev.InputPos = ImVec2(-1.0f, -1.0f); // Different to ensure initial submission PlatformLocaleDecimalPoint = '.'; SettingsLoaded = false; SettingsDirtyTimer = 0.0f; HookIdNext = 0; + memset(LocalizationTable, 0, sizeof(LocalizationTable)); + LogEnabled = false; LogType = ImGuiLogType_None; LogNextPrefix = LogNextSuffix = NULL; @@ -1886,14 +2186,19 @@ struct ImGuiContext LogDepthRef = 0; LogDepthToExpand = LogDepthToExpandDefault = 2; + DebugLogFlags = ImGuiDebugLogFlags_OutputToTTY; + DebugLocateId = 0; + DebugLogClipperAutoDisableFrames = 0; + DebugLocateFrames = 0; + DebugBeginReturnValueCullDepth = -1; DebugItemPickerActive = false; + DebugItemPickerMouseButton = ImGuiMouseButton_Left; DebugItemPickerBreakId = 0; memset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame)); FramerateSecPerFrameIdx = FramerateSecPerFrameCount = 0; FramerateSecPerFrameAccum = 0.0f; WantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = WantTextInputNextFrame = -1; - memset(TempBuffer, 0, sizeof(TempBuffer)); } }; @@ -1916,6 +2221,8 @@ struct IMGUI_API ImGuiWindowTempData ImVec2 PrevLineSize; float CurrLineTextBaseOffset; // Baseline offset (0.0f by default on a new line, generally == style.FramePadding.y when a framed item has been added). float PrevLineTextBaseOffset; + bool IsSameLine; + bool IsSetPos; ImVec1 Indent; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.) ImVec1 ColumnsOffset; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API. ImVec1 GroupOffset; @@ -1925,7 +2232,6 @@ struct IMGUI_API ImGuiWindowTempData ImGuiNavLayer NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1) short NavLayersActiveMask; // Which layers have been written to (result from previous frame) short NavLayersActiveMaskNext;// Which layers have been written to (accumulator for current frame) - ImGuiID NavFocusScopeIdCurrent; // Current focus scope ID while appending bool NavHideHighlightOneFrame; bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f) @@ -1953,9 +2259,11 @@ struct IMGUI_API ImGuiWindowTempData // Storage for one window struct IMGUI_API ImGuiWindow { + ImGuiContext* Ctx; // Parent UI context (needs to be set explicitly by parent). char* Name; // Window name, owned by the window. ImGuiID ID; // == ImHashStr(Name) ImGuiWindowFlags Flags; // See enum ImGuiWindowFlags_ + ImGuiViewportP* Viewport; // Always set in Begin(). Inactive windows may have a NULL value here if their viewport was discarded. ImVec2 Pos; // Position (always rounded-up to nearest pixel) ImVec2 Size; // Current size (==SizeFull or collapsed title bar size) ImVec2 SizeFull; // Size when non collapsed @@ -1965,6 +2273,9 @@ struct IMGUI_API ImGuiWindow ImVec2 WindowPadding; // Window padding at the time of Begin(). float WindowRounding; // Window rounding at the time of Begin(). May be clamped lower to avoid rendering artifacts with title bar, menu bar etc. float WindowBorderSize; // Window border size at the time of Begin(). + float DecoOuterSizeX1, DecoOuterSizeY1; // Left/Up offsets. Sum of non-scrolling outer decorations (X1 generally == 0.0f. Y1 generally = TitleBarHeight + MenuBarHeight). Locked during Begin(). + float DecoOuterSizeX2, DecoOuterSizeY2; // Right/Down offsets (X2 generally == ScrollbarSize.x, Y2 == ScrollbarSizes.y). + float DecoInnerSizeX1, DecoInnerSizeY1; // Applied AFTER/OVER InnerRect. Specialized for Tables as they use specialized form of clipping and frozen rows/columns are inside InnerRect (and not part of regular decoration sizes). int NameBufLen; // Size of buffer storing Name. May be larger than strlen(Name)! ImGuiID MoveId; // == window->GetID("#MOVE") ImGuiID ChildId; // ID of corresponding item in parent window (for navigation to return from child window to parent window) @@ -1988,6 +2299,7 @@ struct IMGUI_API ImGuiWindow bool HasCloseButton; // Set when the window has a close button (p_open != NULL) signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3) short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs) + short BeginCountPreviousFrame; // Number of Begin() during the previous frame short BeginOrderWithinParent; // Begin() order within immediate parent window, if we are a child window. Otherwise 0. short BeginOrderWithinContext; // Begin() order within entire imgui context. This is mostly used for debugging submission order related issues. short FocusOrder; // Order within WindowsFocusOrder[], altered when windows are focused. @@ -2041,6 +2353,7 @@ struct IMGUI_API ImGuiWindow ImGuiWindow* NavLastChildNavWindow; // When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.) ImGuiID NavLastIds[ImGuiNavLayer_COUNT]; // Last known NavId for this window, per layer (0/1) ImRect NavRectRel[ImGuiNavLayer_COUNT]; // Reference rectangle, in window relative space + ImGuiID NavRootFocusScopeId; // Focus Scope ID at the time of Begin() int MemoryDrawListIdxCapacity; // Backup of last idx/vtx count, so when waking up the window we can preallocate and avoid iterative alloc/copy int MemoryDrawListVtxCapacity; @@ -2053,17 +2366,14 @@ struct IMGUI_API ImGuiWindow ImGuiID GetID(const char* str, const char* str_end = NULL); ImGuiID GetID(const void* ptr); ImGuiID GetID(int n); - ImGuiID GetIDNoKeepAlive(const char* str, const char* str_end = NULL); - ImGuiID GetIDNoKeepAlive(const void* ptr); - ImGuiID GetIDNoKeepAlive(int n); ImGuiID GetIDFromRectangle(const ImRect& r_abs); - // We don't use g.FontSize because the window may be != g.CurrentWidow. + // We don't use g.FontSize because the window may be != g.CurrentWindow. ImRect Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); } - float CalcFontSize() const { ImGuiContext& g = *GImGui; float scale = g.FontBaseSize * FontWindowScale; if (ParentWindow) scale *= ParentWindow->FontWindowScale; return scale; } - float TitleBarHeight() const { ImGuiContext& g = *GImGui; return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + g.Style.FramePadding.y * 2.0f; } + float CalcFontSize() const { ImGuiContext& g = *Ctx; float scale = g.FontBaseSize * FontWindowScale; if (ParentWindow) scale *= ParentWindow->FontWindowScale; return scale; } + float TitleBarHeight() const { ImGuiContext& g = *Ctx; return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + g.Style.FramePadding.y * 2.0f; } ImRect TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight())); } - float MenuBarHeight() const { ImGuiContext& g = *GImGui; return (Flags & ImGuiWindowFlags_MenuBar) ? DC.MenuBarOffset.y + CalcFontSize() + g.Style.FramePadding.y * 2.0f : 0.0f; } + float MenuBarHeight() const { ImGuiContext& g = *Ctx; return (Flags & ImGuiWindowFlags_MenuBar) ? DC.MenuBarOffset.y + CalcFontSize() + g.Style.FramePadding.y * 2.0f : 0.0f; } ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); } }; @@ -2076,7 +2386,7 @@ enum ImGuiTabBarFlagsPrivate_ { ImGuiTabBarFlags_DockNode = 1 << 20, // Part of a dock node [we don't use this in the master branch but it facilitate branch syncing to keep this around] ImGuiTabBarFlags_IsFocused = 1 << 21, - ImGuiTabBarFlags_SaveSettings = 1 << 22 // FIXME: Settings are handled by the docking system, this only request the tab bar to mark settings dirty when reordering tabs + ImGuiTabBarFlags_SaveSettings = 1 << 22, // FIXME: Settings are handled by the docking system, this only request the tab bar to mark settings dirty when reordering tabs }; // Extend ImGuiTabItemFlags_ @@ -2084,7 +2394,7 @@ enum ImGuiTabItemFlagsPrivate_ { ImGuiTabItemFlags_SectionMask_ = ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing, ImGuiTabItemFlags_NoCloseButton = 1 << 20, // Track whether p_open was set or not (we'll need this info on the next frame to recompute ContentWidth during layout) - ImGuiTabItemFlags_Button = 1 << 21 // Used by TabItemButton, change the tab item behavior to mimic a button + ImGuiTabItemFlags_Button = 1 << 21, // Used by TabItemButton, change the tab item behavior to mimic a button }; // Storage for one active tab item (sizeof() 40 bytes) @@ -2097,12 +2407,13 @@ struct ImGuiTabItem float Offset; // Position relative to beginning of tab float Width; // Width currently displayed float ContentWidth; // Width of label, stored during BeginTabItem() call + float RequestedWidth; // Width optionally requested by caller, -1.0f is unused ImS32 NameOffset; // When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames ImS16 BeginOrder; // BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable - ImS16 IndexDuringLayout; // Index only used during TabBarLayout() + ImS16 IndexDuringLayout; // Index only used during TabBarLayout(). Tabs gets reordered so 'Tabs[n].IndexDuringLayout == n' but may mismatch during additions. bool WantClose; // Marked as closed by SetTabItemClosed() - ImGuiTabItem() { memset(this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; } + ImGuiTabItem() { memset(this, 0, sizeof(*this)); LastFrameVisible = LastFrameSelected = -1; RequestedWidth = -1.0f; NameOffset = -1; BeginOrder = IndexDuringLayout = -1; } }; // Storage for a tab bar (sizeof() 152 bytes) @@ -2141,12 +2452,6 @@ struct IMGUI_API ImGuiTabBar ImGuiTextBuffer TabsNames; // For non-docking tab bar we re-append names in a contiguous buffer. ImGuiTabBar(); - int GetTabOrder(const ImGuiTabItem* tab) const { return Tabs.index_from_ptr(tab); } - const char* GetTabName(const ImGuiTabItem* tab) const - { - IM_ASSERT(tab->NameOffset != -1 && tab->NameOffset < TabsNames.Buf.Size); - return TabsNames.Buf.Data + tab->NameOffset; - } }; //----------------------------------------------------------------------------- @@ -2154,12 +2459,11 @@ struct IMGUI_API ImGuiTabBar //----------------------------------------------------------------------------- #define IM_COL32_DISABLE IM_COL32(0,0,0,1) // Special sentinel code which cannot be used as a regular color. -#define IMGUI_TABLE_MAX_COLUMNS 64 // sizeof(ImU64) * 8. This is solely because we frequently encode columns set in a ImU64. -#define IMGUI_TABLE_MAX_DRAW_CHANNELS (4 + 64 * 2) // See TableSetupDrawChannels() +#define IMGUI_TABLE_MAX_COLUMNS 512 // May be further lifted // Our current column maximum is 64 but we may raise that in the future. -typedef ImS8 ImGuiTableColumnIdx; -typedef ImU8 ImGuiTableDrawChannelIdx; +typedef ImS16 ImGuiTableColumnIdx; +typedef ImU16 ImGuiTableDrawChannelIdx; // [Internal] sizeof() ~ 104 // We use the terminology "Enabled" to refer to a column that is not Hidden by user/api. @@ -2230,7 +2534,18 @@ struct ImGuiTableCellData ImGuiTableColumnIdx Column; // Column number }; -// FIXME-TABLE: more transient data could be stored in a per-stacked table structure: DrawSplitter, SortSpecs, incoming RowData +// Per-instance data that needs preserving across frames (seemingly most others do not need to be preserved aside from debug needs. Does that means they could be moved to ImGuiTableTempData?) +struct ImGuiTableInstanceData +{ + ImGuiID TableInstanceID; + float LastOuterHeight; // Outer height from last frame + float LastFirstRowHeight; // Height of first row from last frame (FIXME: this is used as "header height" and may be reworked) + float LastFrozenHeight; // Height of frozen section from last frame + + ImGuiTableInstanceData() { TableInstanceID = 0; LastOuterHeight = LastFirstRowHeight = LastFrozenHeight = 0.0f; } +}; + +// FIXME-TABLE: more transient data could be stored in a stacked ImGuiTableTempData: e.g. SortSpecs, incoming RowData struct IMGUI_API ImGuiTable { ImGuiID ID; @@ -2240,10 +2555,9 @@ struct IMGUI_API ImGuiTable ImSpan Columns; // Point within RawData[] ImSpan DisplayOrderToIndex; // Point within RawData[]. Store display order of columns (when not reordered, the values are 0...Count-1) ImSpan RowCellData; // Point within RawData[]. Store cells background requests for current row. - ImU64 EnabledMaskByDisplayOrder; // Column DisplayOrder -> IsEnabled map - ImU64 EnabledMaskByIndex; // Column Index -> IsEnabled map (== not hidden by user/api) in a format adequate for iterating column without touching cold data - ImU64 VisibleMaskByIndex; // Column Index -> IsVisibleX|IsVisibleY map (== not hidden by user/api && not hidden by scrolling/cliprect) - ImU64 RequestOutputMaskByIndex; // Column Index -> IsVisible || AutoFit (== expect user to submit items) + ImBitArrayPtr EnabledMaskByDisplayOrder; // Column DisplayOrder -> IsEnabled map + ImBitArrayPtr EnabledMaskByIndex; // Column Index -> IsEnabled map (== not hidden by user/api) in a format adequate for iterating column without touching cold data + ImBitArrayPtr VisibleMaskByIndex; // Column Index -> IsVisibleX|IsVisibleY map (== not hidden by user/api && not hidden by scrolling/cliprect) ImGuiTableFlags SettingsLoadedFlags; // Which data were loaded from the .ini file (e.g. when order is not altered we won't save order) int SettingsOffset; // Offset in g.SettingsTables int LastFrameActive; @@ -2272,11 +2586,10 @@ struct IMGUI_API ImGuiTable float CellPaddingY; float CellSpacingX1; // Spacing between non-bordered cells float CellSpacingX2; - float LastOuterHeight; // Outer height from last frame - float LastFirstRowHeight; // Height of first row from last frame float InnerWidth; // User value passed to BeginTable(), see comments at the top of BeginTable() for details. float ColumnsGivenWidth; // Sum of current column width float ColumnsAutoFitWidth; // Sum of ideal column width in order nothing to be clipped, used for auto-fitting and content width submission in outer window + float ColumnsStretchSumWeights; // Sum of weight of all enabled stretching columns float ResizedColumnNextWidth; float ResizeLockMinContentsX2; // Lock minimum contents width while resizing down in order to not create feedback loops. But we allow growing the table. float RefScale; // Reference scale to be able to rescale columns on font/dpi changes. @@ -2284,7 +2597,7 @@ struct IMGUI_API ImGuiTable ImRect InnerRect; // InnerRect but without decoration. As with OuterRect, for non-scrolling tables, InnerRect.Max.y is ImRect WorkRect; ImRect InnerClipRect; - ImRect BgClipRect; // We use this to cpu-clip cell background color fill + ImRect BgClipRect; // We use this to cpu-clip cell background color fill, evolve during the frame as we cross frozen rows boundaries ImRect Bg0ClipRectForDrawCmd; // Actual ImDrawCmd clip rect for BG0/1 channel. This tends to be == OuterWindow->ClipRect at BeginTable() because output in BG0/BG1 is cpu-clipped ImRect Bg2ClipRectForDrawCmd; // Actual ImDrawCmd clip rect for BG2 channel. This tends to be a correct, tight-fit, because output to BG2 are done by widgets relying on regular ClipRect. ImRect HostClipRect; // This is used to check if we can eventually merge our columns draw calls into the current draw call of the current window. @@ -2293,6 +2606,8 @@ struct IMGUI_API ImGuiTable ImGuiWindow* InnerWindow; // Window holding the table data (== OuterWindow or a child window) ImGuiTextBuffer ColumnsNames; // Contiguous buffer holding columns names ImDrawListSplitter* DrawSplitter; // Shortcut to TempData->DrawSplitter while in table. Isolate draw commands per columns to avoid switching clip rect constantly + ImGuiTableInstanceData InstanceDataFirst; + ImVector InstanceDataExtra; // FIXME-OPT: Using a small-vector pattern would be good. ImGuiTableColumnSortSpecs SortSpecsSingle; ImVector SortSpecsMulti; // FIXME-OPT: Using a small-vector pattern would be good. ImGuiTableSortSpecs SortSpecs; // Public facing sorts specs, this is what we return in TableGetSortSpecs() @@ -2334,6 +2649,8 @@ struct IMGUI_API ImGuiTable bool IsResetDisplayOrderRequest; bool IsUnfrozenRows; // Set when we got past the frozen row. bool IsDefaultSizingPolicy; // Set if user didn't explicitly set a sizing policy in BeginTable() + bool HasScrollbarYCurr; // Whether ANY instance of this table had a vertical scrollbar during the current frame. + bool HasScrollbarYPrev; // Whether ANY instance of this table had a vertical scrollbar during the previous. bool MemoryCompacted; bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis @@ -2428,6 +2745,7 @@ namespace ImGui IMGUI_API void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond = 0); IMGUI_API void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond = 0); IMGUI_API void SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const ImVec2& size); + IMGUI_API void SetWindowHiddendAndSkipItemsForCurrentFrame(ImGuiWindow* window); inline ImRect WindowRectAbsToRel(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x - off.x, r.Min.y - off.y, r.Max.x - off.x, r.Max.y - off.y); } inline ImRect WindowRectRelToAbs(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x + off.x, r.Min.y + off.y, r.Max.x + off.x, r.Max.y + off.y); } @@ -2449,10 +2767,11 @@ namespace ImGui IMGUI_API ImDrawList* GetForegroundDrawList(ImGuiViewport* viewport); // get foreground draw list for the given viewport. this draw list will be the last rendered one. Useful to quickly draw shapes/text over dear imgui contents. // Init - IMGUI_API void Initialize(ImGuiContext* context); - IMGUI_API void Shutdown(ImGuiContext* context); // Since 1.60 this is a _private_ function. You can call DestroyContext() to destroy the context created by CreateContext(). + IMGUI_API void Initialize(); + IMGUI_API void Shutdown(); // Since 1.60 this is a _private_ function. You can call DestroyContext() to destroy the context created by CreateContext(). // NewFrame + IMGUI_API void UpdateInputEvents(bool trickle_fast_inputs); IMGUI_API void UpdateHoveredWindowAndCaptureFlags(); IMGUI_API void StartMouseMovingWindow(ImGuiWindow* window); IMGUI_API void UpdateMouseMovingWindowNewFrame(); @@ -2463,17 +2782,28 @@ namespace ImGui IMGUI_API void RemoveContextHook(ImGuiContext* context, ImGuiID hook_to_remove); IMGUI_API void CallContextHooks(ImGuiContext* context, ImGuiContextHookType type); + // Viewports + IMGUI_API void SetWindowViewport(ImGuiWindow* window, ImGuiViewportP* viewport); + // Settings IMGUI_API void MarkIniSettingsDirty(); IMGUI_API void MarkIniSettingsDirty(ImGuiWindow* window); IMGUI_API void ClearIniSettings(); - IMGUI_API ImGuiWindowSettings* CreateNewWindowSettings(const char* name); - IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id); - IMGUI_API ImGuiWindowSettings* FindOrCreateWindowSettings(const char* name); + IMGUI_API void AddSettingsHandler(const ImGuiSettingsHandler* handler); + IMGUI_API void RemoveSettingsHandler(const char* type_name); IMGUI_API ImGuiSettingsHandler* FindSettingsHandler(const char* type_name); + // Settings - Windows + IMGUI_API ImGuiWindowSettings* CreateNewWindowSettings(const char* name); + IMGUI_API ImGuiWindowSettings* FindWindowSettingsByID(ImGuiID id); + IMGUI_API ImGuiWindowSettings* FindWindowSettingsByWindow(ImGuiWindow* window); + IMGUI_API void ClearWindowSettings(const char* name); + + // Localization + IMGUI_API void LocalizeRegisterEntries(const ImGuiLocEntry* entries, int count); + inline const char* LocalizeGetMsg(ImGuiLocKey key) { ImGuiContext& g = *GImGui; const char* msg = g.LocalizationTable[key]; return msg ? msg : "*Missing Text*"; } + // Scrolling - IMGUI_API void SetNextWindowScroll(const ImVec2& scroll); // Use -1.0f on one axis to leave as-is IMGUI_API void SetScrollX(ImGuiWindow* window, float scroll_x); IMGUI_API void SetScrollY(ImGuiWindow* window, float scroll_y); IMGUI_API void SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio); @@ -2488,7 +2818,6 @@ namespace ImGui //#endif // Basic Accessors - inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.LastItemData.ID; } // Get ID of last item (~~ often same ImGui::GetID(label) beforehand) inline ImGuiItemStatusFlags GetItemStatusFlags(){ ImGuiContext& g = *GImGui; return g.LastItemData.StatusFlags; } inline ImGuiItemFlags GetItemFlags() { ImGuiContext& g = *GImGui; return g.LastItemData.InFlags; } inline ImGuiID GetActiveID() { ImGuiContext& g = *GImGui; return g.ActiveId; } @@ -2502,12 +2831,14 @@ namespace ImGui IMGUI_API void MarkItemEdited(ImGuiID id); // Mark data associated to given item as "edited", used by IsItemDeactivatedAfterEdit() function. IMGUI_API void PushOverrideID(ImGuiID id); // Push given value as-is at the top of the ID stack (whereas PushID combines old and new hashes) IMGUI_API ImGuiID GetIDWithSeed(const char* str_id_begin, const char* str_id_end, ImGuiID seed); + IMGUI_API ImGuiID GetIDWithSeed(int n, ImGuiID seed); // Basic Helpers for widget code IMGUI_API void ItemSize(const ImVec2& size, float text_baseline_y = -1.0f); - IMGUI_API void ItemSize(const ImRect& bb, float text_baseline_y = -1.0f); + inline void ItemSize(const ImRect& bb, float text_baseline_y = -1.0f) { ItemSize(bb.GetSize(), text_baseline_y); } // FIXME: This is a misleading API since we expect CursorPos to be bb.Min. IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL, ImGuiItemFlags extra_flags = 0); IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id); + IMGUI_API bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags = 0); IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id); IMGUI_API void SetLastItemData(ImGuiID item_id, ImGuiItemFlags in_flags, ImGuiItemStatusFlags status_flags, const ImRect& item_rect); IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h); @@ -2517,20 +2848,10 @@ namespace ImGui IMGUI_API ImVec2 GetContentRegionMaxAbs(); IMGUI_API void ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_excess); - // Parameter stacks + // Parameter stacks (shared) IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled); IMGUI_API void PopItemFlag(); - -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - // Currently refactoring focus/nav/tabbing system - // If you have old/custom copy-and-pasted widgets that used FocusableItemRegister(): - // (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool tab_focused = FocusableItemRegister(...)' - // (Old) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0' - // (New) IMGUI_VERSION_NUM >= 18413: using 'ItemAdd(..., ImGuiItemFlags_Inputable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_FocusedTabbing) != 0 || g.NavActivateInputId == id' (WIP) - // Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText() - inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) { IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Inputable flag to ItemAdd() - inline void FocusableItemUnregister(ImGuiWindow* window) { IM_ASSERT(0); IM_UNUSED(window); } // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem -#endif + IMGUI_API const ImGuiDataVarInfo* GetStyleVarInfo(ImGuiStyleVar idx); // Logging/Capture IMGUI_API void LogBegin(ImGuiLogType type, int auto_open_depth); // -> BeginCapture() when we design v2 api, for now stay under the radar by using the old name. @@ -2546,7 +2867,7 @@ namespace ImGui IMGUI_API void ClosePopupsExceptModals(); IMGUI_API bool IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags); IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags); - IMGUI_API void BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags); + IMGUI_API bool BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags); IMGUI_API ImRect GetPopupAllowedExtentRect(ImGuiWindow* window); IMGUI_API ImGuiWindow* GetTopMostPopupModal(); IMGUI_API ImGuiWindow* GetTopMostAndVisiblePopupModal(); @@ -2573,37 +2894,107 @@ namespace ImGui IMGUI_API void NavMoveRequestCancel(); IMGUI_API void NavMoveRequestApplyResult(); IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags); - IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode); - IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f); - IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate); IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again. + IMGUI_API void SetNavWindow(ImGuiWindow* window); IMGUI_API void SetNavID(ImGuiID id, ImGuiNavLayer nav_layer, ImGuiID focus_scope_id, const ImRect& rect_rel); - // Focus Scope (WIP) - // This is generally used to identify a selection set (multiple of which may be in the same window), as selection - // patterns generally need to react (e.g. clear selection) when landing on an item of the set. - IMGUI_API void PushFocusScope(ImGuiID id); - IMGUI_API void PopFocusScope(); - inline ImGuiID GetFocusedFocusScope() { ImGuiContext& g = *GImGui; return g.NavFocusScopeId; } // Focus scope which is actually active - inline ImGuiID GetFocusScope() { ImGuiContext& g = *GImGui; return g.CurrentWindow->DC.NavFocusScopeIdCurrent; } // Focus scope we are outputting into, set by PushFocusScope() - // Inputs // FIXME: Eventually we should aim to move e.g. IsActiveIdUsingKey() into IsKeyXXX functions. - IMGUI_API void SetItemUsingMouseWheel(); - IMGUI_API void SetActiveIdUsingNavAndKeys(); - inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; } - inline bool IsActiveIdUsingNavInput(ImGuiNavInput input) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavInputMask & (1 << input)) != 0; } - inline bool IsActiveIdUsingKey(ImGuiKey key) { ImGuiContext& g = *GImGui; IM_ASSERT(key < 64); return (g.ActiveIdUsingKeyInputMask & ((ImU64)1 << key)) != 0; } + inline bool IsNamedKey(ImGuiKey key) { return key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END; } + inline bool IsNamedKeyOrModKey(ImGuiKey key) { return (key >= ImGuiKey_NamedKey_BEGIN && key < ImGuiKey_NamedKey_END) || key == ImGuiMod_Ctrl || key == ImGuiMod_Shift || key == ImGuiMod_Alt || key == ImGuiMod_Super || key == ImGuiMod_Shortcut; } + inline bool IsLegacyKey(ImGuiKey key) { return key >= ImGuiKey_LegacyNativeKey_BEGIN && key < ImGuiKey_LegacyNativeKey_END; } + inline bool IsKeyboardKey(ImGuiKey key) { return key >= ImGuiKey_Keyboard_BEGIN && key < ImGuiKey_Keyboard_END; } + inline bool IsGamepadKey(ImGuiKey key) { return key >= ImGuiKey_Gamepad_BEGIN && key < ImGuiKey_Gamepad_END; } + inline bool IsMouseKey(ImGuiKey key) { return key >= ImGuiKey_Mouse_BEGIN && key < ImGuiKey_Mouse_END; } + inline bool IsAliasKey(ImGuiKey key) { return key >= ImGuiKey_Aliases_BEGIN && key < ImGuiKey_Aliases_END; } + inline ImGuiKeyChord ConvertShortcutMod(ImGuiKeyChord key_chord) { ImGuiContext& g = *GImGui; IM_ASSERT_PARANOID(key_chord & ImGuiMod_Shortcut); return (key_chord & ~ImGuiMod_Shortcut) | (g.IO.ConfigMacOSXBehaviors ? ImGuiMod_Super : ImGuiMod_Ctrl); } + inline ImGuiKey ConvertSingleModFlagToKey(ImGuiContext* ctx, ImGuiKey key) + { + ImGuiContext& g = *ctx; + if (key == ImGuiMod_Ctrl) return ImGuiKey_ReservedForModCtrl; + if (key == ImGuiMod_Shift) return ImGuiKey_ReservedForModShift; + if (key == ImGuiMod_Alt) return ImGuiKey_ReservedForModAlt; + if (key == ImGuiMod_Super) return ImGuiKey_ReservedForModSuper; + if (key == ImGuiMod_Shortcut) return (g.IO.ConfigMacOSXBehaviors ? ImGuiKey_ReservedForModSuper : ImGuiKey_ReservedForModCtrl); + return key; + } + + IMGUI_API ImGuiKeyData* GetKeyData(ImGuiContext* ctx, ImGuiKey key); + inline ImGuiKeyData* GetKeyData(ImGuiKey key) { ImGuiContext& g = *GImGui; return GetKeyData(&g, key); } + IMGUI_API void GetKeyChordName(ImGuiKeyChord key_chord, char* out_buf, int out_buf_size); + inline ImGuiKey MouseButtonToKey(ImGuiMouseButton button) { IM_ASSERT(button >= 0 && button < ImGuiMouseButton_COUNT); return (ImGuiKey)(ImGuiKey_MouseLeft + button); } IMGUI_API bool IsMouseDragPastThreshold(ImGuiMouseButton button, float lock_threshold = -1.0f); - inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { ImGuiContext& g = *GImGui; const int key_index = g.IO.KeyMap[key]; return (key_index >= 0) ? IsKeyPressed(key_index, repeat) : false; } - inline bool IsNavInputDown(ImGuiNavInput n) { ImGuiContext& g = *GImGui; return g.IO.NavInputs[n] > 0.0f; } - inline bool IsNavInputTest(ImGuiNavInput n, ImGuiInputReadMode rm) { return (GetNavInputAmount(n, rm) > 0.0f); } - IMGUI_API ImGuiKeyModFlags GetMergedKeyModFlags(); + IMGUI_API ImVec2 GetKeyMagnitude2d(ImGuiKey key_left, ImGuiKey key_right, ImGuiKey key_up, ImGuiKey key_down); + IMGUI_API float GetNavTweakPressedAmount(ImGuiAxis axis); + IMGUI_API int CalcTypematicRepeatAmount(float t0, float t1, float repeat_delay, float repeat_rate); + IMGUI_API void GetTypematicRepeatRate(ImGuiInputFlags flags, float* repeat_delay, float* repeat_rate); + IMGUI_API void SetActiveIdUsingAllKeyboardKeys(); + inline bool IsActiveIdUsingNavDir(ImGuiDir dir) { ImGuiContext& g = *GImGui; return (g.ActiveIdUsingNavDirMask & (1 << dir)) != 0; } + + // [EXPERIMENTAL] Low-Level: Key/Input Ownership + // - The idea is that instead of "eating" a given input, we can link to an owner id. + // - Ownership is most often claimed as a result of reacting to a press/down event (but occasionally may be claimed ahead). + // - Input queries can then read input by specifying ImGuiKeyOwner_Any (== 0), ImGuiKeyOwner_None (== -1) or a custom ID. + // - Legacy input queries (without specifying an owner or _Any or _None) are equivalent to using ImGuiKeyOwner_Any (== 0). + // - Input ownership is automatically released on the frame after a key is released. Therefore: + // - for ownership registration happening as a result of a down/press event, the SetKeyOwner() call may be done once (common case). + // - for ownership registration happening ahead of a down/press event, the SetKeyOwner() call needs to be made every frame (happens if e.g. claiming ownership on hover). + // - SetItemKeyOwner() is a shortcut for common simple case. A custom widget will probably want to call SetKeyOwner() multiple times directly based on its interaction state. + // - This is marked experimental because not all widgets are fully honoring the Set/Test idioms. We will need to move forward step by step. + // Please open a GitHub Issue to submit your usage scenario or if there's a use case you need solved. + IMGUI_API ImGuiID GetKeyOwner(ImGuiKey key); + IMGUI_API void SetKeyOwner(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags = 0); + IMGUI_API void SetKeyOwnersForKeyChord(ImGuiKeyChord key, ImGuiID owner_id, ImGuiInputFlags flags = 0); + IMGUI_API void SetItemKeyOwner(ImGuiKey key, ImGuiInputFlags flags = 0); // Set key owner to last item if it is hovered or active. Equivalent to 'if (IsItemHovered() || IsItemActive()) { SetKeyOwner(key, GetItemID());'. + IMGUI_API bool TestKeyOwner(ImGuiKey key, ImGuiID owner_id); // Test that key is either not owned, either owned by 'owner_id' + inline ImGuiKeyOwnerData* GetKeyOwnerData(ImGuiContext* ctx, ImGuiKey key) { if (key & ImGuiMod_Mask_) key = ConvertSingleModFlagToKey(ctx, key); IM_ASSERT(IsNamedKey(key)); return &ctx->KeysOwnerData[key - ImGuiKey_NamedKey_BEGIN]; } + + // [EXPERIMENTAL] High-Level: Input Access functions w/ support for Key/Input Ownership + // - Important: legacy IsKeyPressed(ImGuiKey, bool repeat=true) _DEFAULTS_ to repeat, new IsKeyPressed() requires _EXPLICIT_ ImGuiInputFlags_Repeat flag. + // - Expected to be later promoted to public API, the prototypes are designed to replace existing ones (since owner_id can default to Any == 0) + // - Specifying a value for 'ImGuiID owner' will test that EITHER the key is NOT owned (UNLESS locked), EITHER the key is owned by 'owner'. + // Legacy functions use ImGuiKeyOwner_Any meaning that they typically ignore ownership, unless a call to SetKeyOwner() explicitly used ImGuiInputFlags_LockThisFrame or ImGuiInputFlags_LockUntilRelease. + // - Binding generators may want to ignore those for now, or suffix them with Ex() until we decide if this gets moved into public API. + IMGUI_API bool IsKeyDown(ImGuiKey key, ImGuiID owner_id); + IMGUI_API bool IsKeyPressed(ImGuiKey key, ImGuiID owner_id, ImGuiInputFlags flags = 0); // Important: when transitioning from old to new IsKeyPressed(): old API has "bool repeat = true", so would default to repeat. New API requiress explicit ImGuiInputFlags_Repeat. + IMGUI_API bool IsKeyReleased(ImGuiKey key, ImGuiID owner_id); + IMGUI_API bool IsMouseDown(ImGuiMouseButton button, ImGuiID owner_id); + IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, ImGuiID owner_id, ImGuiInputFlags flags = 0); + IMGUI_API bool IsMouseReleased(ImGuiMouseButton button, ImGuiID owner_id); + + // [EXPERIMENTAL] Shortcut Routing + // - ImGuiKeyChord = a ImGuiKey optionally OR-red with ImGuiMod_Alt/ImGuiMod_Ctrl/ImGuiMod_Shift/ImGuiMod_Super. + // ImGuiKey_C (accepted by functions taking ImGuiKey or ImGuiKeyChord) + // ImGuiKey_C | ImGuiMod_Ctrl (accepted by functions taking ImGuiKeyChord) + // ONLY ImGuiMod_XXX values are legal to 'OR' with an ImGuiKey. You CANNOT 'OR' two ImGuiKey values. + // - When using one of the routing flags (e.g. ImGuiInputFlags_RouteFocused): routes requested ahead of time given a chord (key + modifiers) and a routing policy. + // - Routes are resolved during NewFrame(): if keyboard modifiers are matching current ones: SetKeyOwner() is called + route is granted for the frame. + // - Route is granted to a single owner. When multiple requests are made we have policies to select the winning route. + // - Multiple read sites may use the same owner id and will all get the granted route. + // - For routing: when owner_id is 0 we use the current Focus Scope ID as a default owner in order to identify our location. + IMGUI_API bool Shortcut(ImGuiKeyChord key_chord, ImGuiID owner_id = 0, ImGuiInputFlags flags = 0); + IMGUI_API bool SetShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id = 0, ImGuiInputFlags flags = 0); + IMGUI_API bool TestShortcutRouting(ImGuiKeyChord key_chord, ImGuiID owner_id); + IMGUI_API ImGuiKeyRoutingData* GetShortcutRoutingData(ImGuiKeyChord key_chord); + + // [EXPERIMENTAL] Focus Scope + // This is generally used to identify a unique input location (for e.g. a selection set) + // There is one per window (automatically set in Begin), but: + // - Selection patterns generally need to react (e.g. clear a selection) when landing on one item of the set. + // So in order to identify a set multiple lists in same window may each need a focus scope. + // If you imagine an hypothetical BeginSelectionGroup()/EndSelectionGroup() api, it would likely call PushFocusScope()/EndFocusScope() + // - Shortcut routing also use focus scope as a default location identifier if an owner is not provided. + // We don't use the ID Stack for this as it is common to want them separate. + IMGUI_API void PushFocusScope(ImGuiID id); + IMGUI_API void PopFocusScope(); + inline ImGuiID GetCurrentFocusScope() { ImGuiContext& g = *GImGui; return g.CurrentFocusScopeId; } // Focus scope we are outputting into, set by PushFocusScope() // Drag and Drop + IMGUI_API bool IsDragDropActive(); IMGUI_API bool BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id); IMGUI_API void ClearDragDrop(); IMGUI_API bool IsDragDropPayloadBeingAccepted(); + IMGUI_API void RenderDragDropTargetRect(const ImRect& bb); // Internal Columns API (this is not exposed because we will encourage transitioning to the Tables API) IMGUI_API void SetWindowClipRectBeforeSetChannel(ImGuiWindow* window, const ImRect& clip_rect); @@ -2638,7 +3029,10 @@ namespace ImGui IMGUI_API void TableUpdateColumnsWeightFromWidth(ImGuiTable* table); IMGUI_API void TableDrawBorders(ImGuiTable* table); IMGUI_API void TableDrawContextMenu(ImGuiTable* table); + IMGUI_API bool TableBeginContextMenuPopup(ImGuiTable* table); IMGUI_API void TableMergeDrawChannels(ImGuiTable* table); + inline ImGuiTableInstanceData* TableGetInstanceData(ImGuiTable* table, int instance_no) { if (instance_no == 0) return &table->InstanceDataFirst; return &table->InstanceDataExtra[instance_no - 1]; } + inline ImGuiID TableGetInstanceID(ImGuiTable* table, int instance_no) { return TableGetInstanceData(table, instance_no)->TableInstanceID; } IMGUI_API void TableSortSpecsSanitize(ImGuiTable* table); IMGUI_API void TableSortSpecsBuild(ImGuiTable* table); IMGUI_API ImGuiSortDirection TableGetColumnNextSortDirection(ImGuiTableColumn* column); @@ -2650,7 +3044,7 @@ namespace ImGui IMGUI_API void TableEndCell(ImGuiTable* table); IMGUI_API ImRect TableGetCellBgRect(const ImGuiTable* table, int column_n); IMGUI_API const char* TableGetColumnName(const ImGuiTable* table, int column_n); - IMGUI_API ImGuiID TableGetColumnResizeID(const ImGuiTable* table, int column_n, int instance_no = 0); + IMGUI_API ImGuiID TableGetColumnResizeID(ImGuiTable* table, int column_n, int instance_no = 0); IMGUI_API float TableGetMaxColumnWidth(const ImGuiTable* table, int column_n); IMGUI_API void TableSetColumnWidthAutoSingle(ImGuiTable* table, int column_n); IMGUI_API void TableSetColumnWidthAutoAll(ImGuiTable* table); @@ -2664,20 +3058,27 @@ namespace ImGui IMGUI_API void TableSaveSettings(ImGuiTable* table); IMGUI_API void TableResetSettings(ImGuiTable* table); IMGUI_API ImGuiTableSettings* TableGetBoundSettings(ImGuiTable* table); - IMGUI_API void TableSettingsInstallHandler(ImGuiContext* context); + IMGUI_API void TableSettingsAddSettingsHandler(); IMGUI_API ImGuiTableSettings* TableSettingsCreate(ImGuiID id, int columns_count); IMGUI_API ImGuiTableSettings* TableSettingsFindByID(ImGuiID id); // Tab Bars + inline ImGuiTabBar* GetCurrentTabBar() { ImGuiContext& g = *GImGui; return g.CurrentTabBar; } IMGUI_API bool BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& bb, ImGuiTabBarFlags flags); IMGUI_API ImGuiTabItem* TabBarFindTabByID(ImGuiTabBar* tab_bar, ImGuiID tab_id); + IMGUI_API ImGuiTabItem* TabBarFindTabByOrder(ImGuiTabBar* tab_bar, int order); + IMGUI_API ImGuiTabItem* TabBarGetCurrentTab(ImGuiTabBar* tab_bar); + inline int TabBarGetTabOrder(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) { return tab_bar->Tabs.index_from_ptr(tab); } + IMGUI_API const char* TabBarGetTabName(ImGuiTabBar* tab_bar, ImGuiTabItem* tab); IMGUI_API void TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id); IMGUI_API void TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab); - IMGUI_API void TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int offset); - IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, ImVec2 mouse_pos); + IMGUI_API void TabBarQueueFocus(ImGuiTabBar* tab_bar, ImGuiTabItem* tab); + IMGUI_API void TabBarQueueReorder(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, int offset); + IMGUI_API void TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, ImVec2 mouse_pos); IMGUI_API bool TabBarProcessReorder(ImGuiTabBar* tab_bar); - IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags); - IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button); + IMGUI_API bool TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window); + IMGUI_API ImVec2 TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker); + IMGUI_API ImVec2 TabItemCalcSize(ImGuiWindow* window); IMGUI_API void TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col); IMGUI_API void TabItemLabelAndCloseButton(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImVec2 frame_padding, const char* label, ImGuiID tab_id, ImGuiID close_button_id, bool is_contents_visible, bool* out_just_closed, bool* out_text_clipped); @@ -2694,47 +3095,45 @@ namespace ImGui IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImDrawList* draw_list, ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding = 0.0f, ImDrawFlags flags = 0); IMGUI_API void RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags = ImGuiNavHighlightFlags_TypeDefault); // Navigation highlight IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text. + IMGUI_API void RenderMouseCursor(ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow); // Render helpers (those functions don't access any ImGui state!) IMGUI_API void RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale = 1.0f); IMGUI_API void RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col); IMGUI_API void RenderCheckMark(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz); - IMGUI_API void RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow); IMGUI_API void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col); IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding); - IMGUI_API void RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect inner, ImU32 col, float rounding); - -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - // [1.71: 2019/06/07: Updating prototypes of some of the internal functions. Leaving those for reference for a short while] - inline void RenderArrow(ImVec2 pos, ImGuiDir dir, float scale=1.0f) { ImGuiWindow* window = GetCurrentWindow(); RenderArrow(window->DrawList, pos, GetColorU32(ImGuiCol_Text), dir, scale); } - inline void RenderBullet(ImVec2 pos) { ImGuiWindow* window = GetCurrentWindow(); RenderBullet(window->DrawList, pos, GetColorU32(ImGuiCol_Text)); } -#endif + IMGUI_API void RenderRectFilledWithHole(ImDrawList* draw_list, const ImRect& outer, const ImRect& inner, ImU32 col, float rounding); // Widgets IMGUI_API void TextEx(const char* text, const char* text_end = NULL, ImGuiTextFlags flags = 0); IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0); + IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0); + IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col, ImGuiButtonFlags flags = 0); + IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags); + IMGUI_API void SeparatorTextEx(ImGuiID id, const char* label, const char* label_end, float extra_width); + IMGUI_API bool CheckboxFlags(const char* label, ImS64* flags, ImS64 flags_value); + IMGUI_API bool CheckboxFlags(const char* label, ImU64* flags, ImU64 flags_value); + + // Widgets: Window Decorations IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos); IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos); - IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0); IMGUI_API void Scrollbar(ImGuiAxis axis); IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 avail_v, ImS64 contents_v, ImDrawFlags flags); - IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col); IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis); IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis); IMGUI_API ImGuiID GetWindowResizeCornerID(ImGuiWindow* window, int n); // 0..3: corners IMGUI_API ImGuiID GetWindowResizeBorderID(ImGuiWindow* window, ImGuiDir dir); - IMGUI_API void SeparatorEx(ImGuiSeparatorFlags flags); - IMGUI_API bool CheckboxFlags(const char* label, ImS64* flags, ImS64 flags_value); - IMGUI_API bool CheckboxFlags(const char* label, ImU64* flags, ImU64 flags_value); // Widgets low-level behaviors IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0); IMGUI_API bool DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags); IMGUI_API bool SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, void* p_v, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb); - IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f); + IMGUI_API bool SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f, float hover_visibility_delay = 0.0f, ImU32 bg_col = 0); IMGUI_API bool TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL); - IMGUI_API bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0); // Consume previous SetNextItemOpen() data, if any. May return true when logging IMGUI_API void TreePushOverrideID(ImGuiID id); + IMGUI_API void TreeNodeSetOpen(ImGuiID id, bool open); + IMGUI_API bool TreeNodeUpdateNextOpen(ImGuiID id, ImGuiTreeNodeFlags flags); // Return open state. Consume previous SetNextItemOpen() data, if any. May return true when logging. // Template functions are instantiated in imgui_widgets.cpp for a finite number of types. // To use them externally (for custom widget) you may need an "extern template" statement in your code in order to link to existing instances and silence Clang warnings (see #2036). @@ -2743,23 +3142,24 @@ namespace ImGui template IMGUI_API T ScaleValueFromRatioT(ImGuiDataType data_type, float t, T v_min, T v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_size); template IMGUI_API bool DragBehaviorT(ImGuiDataType data_type, T* v, float v_speed, T v_min, T v_max, const char* format, ImGuiSliderFlags flags); template IMGUI_API bool SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, T* v, T v_min, T v_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb); - template IMGUI_API T RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, T v); + template IMGUI_API T RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, T v); template IMGUI_API bool CheckboxFlagsT(const char* label, T* flags, T flags_value); // Data type helpers IMGUI_API const ImGuiDataTypeInfo* DataTypeGetInfo(ImGuiDataType data_type); IMGUI_API int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* p_data, const char* format); IMGUI_API void DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, const void* arg_1, const void* arg_2); - IMGUI_API bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* p_data, const char* format); + IMGUI_API bool DataTypeApplyFromText(const char* buf, ImGuiDataType data_type, void* p_data, const char* format); IMGUI_API int DataTypeCompare(ImGuiDataType data_type, const void* arg_1, const void* arg_2); IMGUI_API bool DataTypeClamp(ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max); // InputText IMGUI_API bool InputTextEx(const char* label, const char* hint, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); + IMGUI_API void InputTextDeactivateHook(ImGuiID id); IMGUI_API bool TempInputText(const ImRect& bb, ImGuiID id, const char* label, char* buf, int buf_size, ImGuiInputTextFlags flags); IMGUI_API bool TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min = NULL, const void* p_clamp_max = NULL); inline bool TempInputIsActive(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.ActiveId == id && g.TempInputId == id); } - inline ImGuiInputTextState* GetInputTextState(ImGuiID id) { ImGuiContext& g = *GImGui; return (g.InputTextState.ID == id) ? &g.InputTextState : NULL; } // Get input text state if active + inline ImGuiInputTextState* GetInputTextState(ImGuiID id) { ImGuiContext& g = *GImGui; return (id != 0 && g.InputTextState.ID == id) ? &g.InputTextState : NULL; } // Get input text state if active // Color IMGUI_API void ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags); @@ -2767,7 +3167,7 @@ namespace ImGui IMGUI_API void ColorPickerOptionsPopup(const float* ref_col, ImGuiColorEditFlags flags); // Plot - IMGUI_API int PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size); + IMGUI_API int PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, const ImVec2& size_arg); // Shade functions (write over already created vertices) IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1); @@ -2778,29 +3178,56 @@ namespace ImGui IMGUI_API void GcCompactTransientWindowBuffers(ImGuiWindow* window); IMGUI_API void GcAwakeTransientWindowBuffers(ImGuiWindow* window); + // Debug Log + IMGUI_API void DebugLog(const char* fmt, ...) IM_FMTARGS(1); + IMGUI_API void DebugLogV(const char* fmt, va_list args) IM_FMTLIST(1); + // Debug Tools IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL); IMGUI_API void ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL); + IMGUI_API void ErrorCheckUsingSetCursorPosToExtendParentBoundaries(); + IMGUI_API void DebugLocateItem(ImGuiID target_id); // Call sparingly: only 1 at the same time! + IMGUI_API void DebugLocateItemOnHover(ImGuiID target_id); // Only call on reaction to a mouse Hover: because only 1 at the same time! + IMGUI_API void DebugLocateItemResolveWithLastItem(); inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); } inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; } - IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas); IMGUI_API void DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* data_id, const void* data_id_end); IMGUI_API void DebugNodeColumns(ImGuiOldColumns* columns); IMGUI_API void DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label); IMGUI_API void DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, const ImDrawList* draw_list, const ImDrawCmd* draw_cmd, bool show_mesh, bool show_aabb); IMGUI_API void DebugNodeFont(ImFont* font); + IMGUI_API void DebugNodeFontGlyph(ImFont* font, const ImFontGlyph* glyph); IMGUI_API void DebugNodeStorage(ImGuiStorage* storage, const char* label); IMGUI_API void DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label); IMGUI_API void DebugNodeTable(ImGuiTable* table); IMGUI_API void DebugNodeTableSettings(ImGuiTableSettings* settings); + IMGUI_API void DebugNodeInputTextState(ImGuiInputTextState* state); IMGUI_API void DebugNodeWindow(ImGuiWindow* window, const char* label); IMGUI_API void DebugNodeWindowSettings(ImGuiWindowSettings* settings); IMGUI_API void DebugNodeWindowsList(ImVector* windows, const char* label); IMGUI_API void DebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows, int windows_size, ImGuiWindow* parent_in_begin_stack); IMGUI_API void DebugNodeViewport(ImGuiViewportP* viewport); + IMGUI_API void DebugRenderKeyboardPreview(ImDrawList* draw_list); IMGUI_API void DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb); + // Obsolete functions +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS + inline void SetItemUsingMouseWheel() { SetItemKeyOwner(ImGuiKey_MouseWheelY); } // Changed in 1.89 + inline bool TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0) { return TreeNodeUpdateNextOpen(id, flags); } // Renamed in 1.89 + + // Refactored focus/nav/tabbing system in 1.82 and 1.84. If you have old/custom copy-and-pasted widgets that used FocusableItemRegister(): + // (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool tab_focused = FocusableItemRegister(...)' + // (Old) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0' + // (New) IMGUI_VERSION_NUM >= 18413: using 'ItemAdd(..., ImGuiItemFlags_Inputable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_FocusedTabbing) != 0 || (g.NavActivateId == id && (g.NavActivateFlags & ImGuiActivateFlags_PreferInput))' (WIP) + // Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText() + inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) { IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Inputable flag to ItemAdd() + inline void FocusableItemUnregister(ImGuiWindow* window) { IM_ASSERT(0); IM_UNUSED(window); } // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem +#endif +#ifndef IMGUI_DISABLE_OBSOLETE_KEYIO + inline bool IsKeyPressedMap(ImGuiKey key, bool repeat = true) { IM_ASSERT(IsNamedKey(key)); return IsKeyPressed(key, repeat); } // Removed in 1.87: Mapping from named key is always identity! +#endif + } // namespace ImGui @@ -2815,7 +3242,9 @@ struct ImFontBuilderIO }; // Helper for font builder +#ifdef IMGUI_ENABLE_STB_TRUETYPE IMGUI_API const ImFontBuilderIO* ImFontAtlasGetBuilderForStbTruetype(); +#endif IMGUI_API void ImFontAtlasBuildInit(ImFontAtlas* atlas); IMGUI_API void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent); IMGUI_API void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opaque); @@ -2830,16 +3259,18 @@ IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table //----------------------------------------------------------------------------- #ifdef IMGUI_ENABLE_TEST_ENGINE -extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, const ImRect& bb, ImGuiID id); +extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, ImGuiID id, const ImRect& bb, const ImGuiLastItemData* item_data); // item_data may be NULL extern void ImGuiTestEngineHook_ItemInfo(ImGuiContext* ctx, ImGuiID id, const char* label, ImGuiItemStatusFlags flags); extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const char* fmt, ...); extern const char* ImGuiTestEngine_FindItemDebugLabel(ImGuiContext* ctx, ImGuiID id); -#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID) // Register item bounding box -#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional) -#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log +// In IMGUI_VERSION_NUM >= 18934: changed IMGUI_TEST_ENGINE_ITEM_ADD(bb,id) to IMGUI_TEST_ENGINE_ITEM_ADD(id,bb,item_data); +#define IMGUI_TEST_ENGINE_ITEM_ADD(_ID,_BB,_ITEM_DATA) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _ID, _BB, _ITEM_DATA) // Register item bounding box +#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional) +#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log #else -#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)0) +#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) ((void)0) +#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)g) #endif //----------------------------------------------------------------------------- diff --git a/Sources/CImGui/imgui/imgui_tables.cpp b/Sources/CImGui/imgui/imgui_tables.cpp index 8a3fe93..6ec419d 100644 --- a/Sources/CImGui/imgui/imgui_tables.cpp +++ b/Sources/CImGui/imgui/imgui_tables.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.86 +// dear imgui, v1.89.5 // (tables and columns code) /* @@ -24,7 +24,7 @@ Index of this file: */ // Navigating this file: -// - In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. +// - In Visual Studio IDE: CTRL+comma ("Edit.GoToAll") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot. // - With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments. //----------------------------------------------------------------------------- @@ -188,12 +188,12 @@ Index of this file: #define _CRT_SECURE_NO_WARNINGS #endif -#include "imgui.h" -#ifndef IMGUI_DISABLE - #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif + +#include "imgui.h" +#ifndef IMGUI_DISABLE #include "imgui_internal.h" // System includes @@ -315,7 +315,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG return false; // Sanity checks - IM_ASSERT(columns_count > 0 && columns_count <= IMGUI_TABLE_MAX_COLUMNS && "Only 1..64 columns allowed!"); + IM_ASSERT(columns_count > 0 && columns_count < IMGUI_TABLE_MAX_COLUMNS); if (flags & ImGuiTableFlags_ScrollX) IM_ASSERT(inner_width >= 0.0f); @@ -332,11 +332,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG // Acquire storage for the table ImGuiTable* table = g.Tables.GetOrAddByKey(id); - const int instance_no = (table->LastFrameActive != g.FrameCount) ? 0 : table->InstanceCurrent + 1; - const ImGuiID instance_id = id + instance_no; const ImGuiTableFlags table_last_flags = table->Flags; - if (instance_no > 0) - IM_ASSERT(table->ColumnsCount == columns_count && "BeginTable(): Cannot change columns count mid-frame while preserving same ID"); // Acquire temporary buffers const int table_idx = g.Tables.GetIndex(table); @@ -352,9 +348,9 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG flags = TableFixFlags(flags, outer_window); // Initialize + const int instance_no = (table->LastFrameActive != g.FrameCount) ? 0 : table->InstanceCurrent + 1; table->ID = id; table->Flags = flags; - table->InstanceCurrent = (ImS16)instance_no; table->LastFrameActive = g.FrameCount; table->OuterWindow = table->InnerWindow = outer_window; table->ColumnsCount = columns_count; @@ -362,6 +358,23 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG table->InnerWidth = inner_width; temp_data->UserOuterSize = outer_size; + // Instance data (for instance 0, TableID == TableInstanceID) + ImGuiID instance_id; + table->InstanceCurrent = (ImS16)instance_no; + if (instance_no > 0) + { + IM_ASSERT(table->ColumnsCount == columns_count && "BeginTable(): Cannot change columns count mid-frame while preserving same ID"); + if (table->InstanceDataExtra.Size < instance_no) + table->InstanceDataExtra.push_back(ImGuiTableInstanceData()); + instance_id = GetIDWithSeed(instance_no, GetIDWithSeed("##Instances", NULL, id)); // Push "##Instance" followed by (int)instance_no in ID stack. + } + else + { + instance_id = id; + } + ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); + table_instance->TableInstanceID = instance_id; + // When not using a child window, WorkRect.Max will grow as we append contents. if (use_child_window) { @@ -393,6 +406,14 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG table->OuterRect = table->InnerWindow->Rect(); table->InnerRect = table->InnerWindow->InnerRect; IM_ASSERT(table->InnerWindow->WindowPadding.x == 0.0f && table->InnerWindow->WindowPadding.y == 0.0f && table->InnerWindow->WindowBorderSize == 0.0f); + + // When using multiple instances, ensure they have the same amount of horizontal decorations (aka vertical scrollbar) so stretched columns can be aligned) + if (instance_no == 0) + { + table->HasScrollbarYPrev = table->HasScrollbarYCurr; + table->HasScrollbarYCurr = false; + } + table->HasScrollbarYCurr |= (table->InnerWindow->ScrollMax.y > 0.0f); } else { @@ -402,7 +423,9 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG } // Push a standardized ID for both child-using and not-child-using tables - PushOverrideID(instance_id); + PushOverrideID(id); + if (instance_no > 0) + PushOverrideID(instance_id); // FIXME: Somehow this is not resolved by stack-tool, even tho GetIDWithSeed() submitted the symbol. // Backup a copy of host window members we will modify ImGuiWindow* inner_window = table->InnerWindow; @@ -537,7 +560,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG if (table->RefScale != 0.0f && table->RefScale != new_ref_scale_unit) { const float scale_factor = new_ref_scale_unit / table->RefScale; - //IMGUI_DEBUG_LOG("[table] %08X RefScaleUnit %.3f -> %.3f, scaling width by %.3f\n", table->ID, table->RefScaleUnit, new_ref_scale_unit, scale_factor); + //IMGUI_DEBUG_PRINT("[table] %08X RefScaleUnit %.3f -> %.3f, scaling width by %.3f\n", table->ID, table->RefScaleUnit, new_ref_scale_unit, scale_factor); for (int n = 0; n < columns_count; n++) table->Columns[n].WidthRequest = table->Columns[n].WidthRequest * scale_factor; } @@ -571,16 +594,22 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG void ImGui::TableBeginInitMemory(ImGuiTable* table, int columns_count) { // Allocate single buffer for our arrays - ImSpanAllocator<3> span_allocator; + const int columns_bit_array_size = (int)ImBitArrayGetStorageSizeInBytes(columns_count); + ImSpanAllocator<6> span_allocator; span_allocator.Reserve(0, columns_count * sizeof(ImGuiTableColumn)); span_allocator.Reserve(1, columns_count * sizeof(ImGuiTableColumnIdx)); span_allocator.Reserve(2, columns_count * sizeof(ImGuiTableCellData), 4); + for (int n = 3; n < 6; n++) + span_allocator.Reserve(n, columns_bit_array_size); table->RawData = IM_ALLOC(span_allocator.GetArenaSizeInBytes()); memset(table->RawData, 0, span_allocator.GetArenaSizeInBytes()); span_allocator.SetArenaBasePtr(table->RawData); span_allocator.GetSpan(0, &table->Columns); span_allocator.GetSpan(1, &table->DisplayOrderToIndex); span_allocator.GetSpan(2, &table->RowCellData); + table->EnabledMaskByDisplayOrder = (ImU32*)span_allocator.GetSpanPtrBegin(3); + table->EnabledMaskByIndex = (ImU32*)span_allocator.GetSpanPtrBegin(4); + table->VisibleMaskByIndex = (ImU32*)span_allocator.GetSpanPtrBegin(5); } // Apply queued resizing/reordering/hiding requests @@ -719,8 +748,8 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) const ImGuiTableFlags table_sizing_policy = (table->Flags & ImGuiTableFlags_SizingMask_); table->IsDefaultDisplayOrder = true; table->ColumnsEnabledCount = 0; - table->EnabledMaskByIndex = 0x00; - table->EnabledMaskByDisplayOrder = 0x00; + ImBitArrayClearAllBits(table->EnabledMaskByIndex, table->ColumnsCount); + ImBitArrayClearAllBits(table->EnabledMaskByDisplayOrder, table->ColumnsCount); table->LeftMostEnabledColumn = -1; table->MinColumnWidth = ImMax(1.0f, g.Style.FramePadding.x * 1.0f); // g.Style.ColumnsMinSpacing; // FIXME-TABLE @@ -785,8 +814,8 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) else table->LeftMostEnabledColumn = (ImGuiTableColumnIdx)column_n; column->IndexWithinEnabledSet = table->ColumnsEnabledCount++; - table->EnabledMaskByIndex |= (ImU64)1 << column_n; - table->EnabledMaskByDisplayOrder |= (ImU64)1 << column->DisplayOrder; + ImBitArraySetBit(table->EnabledMaskByIndex, column_n); + ImBitArraySetBit(table->EnabledMaskByDisplayOrder, column->DisplayOrder); prev_visible_column_idx = column_n; IM_ASSERT(column->IndexWithinEnabledSet <= column->DisplayOrder); @@ -834,7 +863,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) table->LeftMostStretchedColumn = table->RightMostStretchedColumn = -1; for (int column_n = 0; column_n < table->ColumnsCount; column_n++) { - if (!(table->EnabledMaskByIndex & ((ImU64)1 << column_n))) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByIndex, column_n)) continue; ImGuiTableColumn* column = &table->Columns[column_n]; @@ -850,7 +879,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) // Latch initial size for fixed columns and update it constantly for auto-resizing column (unless clipped!) if (column->AutoFitQueue != 0x00) column->WidthRequest = width_auto; - else if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !column_is_resizable && (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n))) + else if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !column_is_resizable && column->IsRequestOutput) column->WidthRequest = width_auto; // FIXME-TABLE: Increase minimum size during init frame to avoid biasing auto-fitting widgets @@ -886,17 +915,19 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) sum_width_requests += table->CellPaddingX * 2.0f; } table->ColumnsEnabledFixedCount = (ImGuiTableColumnIdx)count_fixed; + table->ColumnsStretchSumWeights = stretch_sum_weights; // [Part 4] Apply final widths based on requested widths const ImRect work_rect = table->WorkRect; const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1); - const float width_avail = ((table->Flags & ImGuiTableFlags_ScrollX) && table->InnerWidth == 0.0f) ? table->InnerClipRect.GetWidth() : work_rect.GetWidth(); + const float width_removed = (table->HasScrollbarYPrev && !table->InnerWindow->ScrollbarY) ? g.Style.ScrollbarSize : 0.0f; // To synchronize decoration width of synched tables with mismatching scrollbar state (#5920) + const float width_avail = ImMax(1.0f, (((table->Flags & ImGuiTableFlags_ScrollX) && table->InnerWidth == 0.0f) ? table->InnerClipRect.GetWidth() : work_rect.GetWidth()) - width_removed); const float width_avail_for_stretched_columns = width_avail - width_spacings - sum_width_requests; float width_remaining_for_stretched_columns = width_avail_for_stretched_columns; table->ColumnsGivenWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount; for (int column_n = 0; column_n < table->ColumnsCount; column_n++) { - if (!(table->EnabledMaskByIndex & ((ImU64)1 << column_n))) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByIndex, column_n)) continue; ImGuiTableColumn* column = &table->Columns[column_n]; @@ -923,7 +954,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) if (width_remaining_for_stretched_columns >= 1.0f && !(table->Flags & ImGuiTableFlags_PreciseWidths)) for (int order_n = table->ColumnsCount - 1; stretch_sum_weights > 0.0f && width_remaining_for_stretched_columns >= 1.0f && order_n >= 0; order_n--) { - if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n))) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByDisplayOrder, order_n)) continue; ImGuiTableColumn* column = &table->Columns[table->DisplayOrderToIndex[order_n]]; if (!(column->Flags & ImGuiTableColumnFlags_WidthStretch)) @@ -933,10 +964,19 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) width_remaining_for_stretched_columns -= 1.0f; } + // Determine if table is hovered which will be used to flag columns as hovered. + // - In principle we'd like to use the equivalent of IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem), + // but because our item is partially submitted at this point we use ItemHoverable() and a workaround (temporarily + // clear ActiveId, which is equivalent to the change provided by _AllowWhenBLockedByActiveItem). + // - This allows columns to be marked as hovered when e.g. clicking a button inside the column, or using drag and drop. + ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); table->HoveredColumnBody = -1; table->HoveredColumnBorder = -1; - const ImRect mouse_hit_rect(table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.Max.x, ImMax(table->OuterRect.Max.y, table->OuterRect.Min.y + table->LastOuterHeight)); + const ImRect mouse_hit_rect(table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.Max.x, ImMax(table->OuterRect.Max.y, table->OuterRect.Min.y + table_instance->LastOuterHeight)); + const ImGuiID backup_active_id = g.ActiveId; + g.ActiveId = 0; const bool is_hovering_table = ItemHoverable(mouse_hit_rect, 0); + g.ActiveId = backup_active_id; // [Part 6] Setup final position, offset, skip/clip states and clipping rectangles, detect hovered column // Process columns in their visible orders as we are comparing the visible order and adjusting host_clip_rect while looping. @@ -945,14 +985,13 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) float offset_x = ((table->FreezeColumnsCount > 0) ? table->OuterRect.Min.x : work_rect.Min.x) + table->OuterPaddingX - table->CellSpacingX1; ImRect host_clip_rect = table->InnerClipRect; //host_clip_rect.Max.x += table->CellPaddingX + table->CellSpacingX2; - table->VisibleMaskByIndex = 0x00; - table->RequestOutputMaskByIndex = 0x00; + ImBitArrayClearAllBits(table->VisibleMaskByIndex, table->ColumnsCount); for (int order_n = 0; order_n < table->ColumnsCount; order_n++) { const int column_n = table->DisplayOrderToIndex[order_n]; ImGuiTableColumn* column = &table->Columns[column_n]; - column->NavLayerCurrent = (ImS8)((table->FreezeRowsCount > 0 || column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main); + column->NavLayerCurrent = (ImS8)(table->FreezeRowsCount > 0 ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main); // Use Count NOT request so Header line changes layer when frozen if (offset_x_frozen && table->FreezeColumnsCount == visible_n) { @@ -963,7 +1002,7 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) // Clear status flags column->Flags &= ~ImGuiTableColumnFlags_StatusMask_; - if ((table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n)) == 0) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByDisplayOrder, order_n)) { // Hidden column: clear a few fields and we are done with it for the remainder of the function. // We set a zero-width clip rect but set Min.y/Max.y properly to not interfere with the clipper. @@ -1016,12 +1055,10 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) column->IsVisibleY = true; // (column->ClipRect.Max.y > column->ClipRect.Min.y); const bool is_visible = column->IsVisibleX; //&& column->IsVisibleY; if (is_visible) - table->VisibleMaskByIndex |= ((ImU64)1 << column_n); + ImBitArraySetBit(table->VisibleMaskByIndex, column_n); // Mark column as requesting output from user. Note that fixed + non-resizable sets are auto-fitting at all times and therefore always request output. column->IsRequestOutput = is_visible || column->AutoFitQueue != 0 || column->CannotSkipItemsQueue != 0; - if (column->IsRequestOutput) - table->RequestOutputMaskByIndex |= ((ImU64)1 << column_n); // Mark column as SkipItems (ignoring all items/layout) column->IsSkipItems = !column->IsEnabled || table->HostSkipItems; @@ -1096,30 +1133,29 @@ void ImGui::TableUpdateLayout(ImGuiTable* table) // [Part 10] Hit testing on borders if (table->Flags & ImGuiTableFlags_Resizable) TableUpdateBorders(table); - table->LastFirstRowHeight = 0.0f; + table_instance->LastFirstRowHeight = 0.0f; table->IsLayoutLocked = true; table->IsUsingHeaders = false; // [Part 11] Context menu - if (table->IsContextPopupOpen && table->InstanceCurrent == table->InstanceInteracted) + if (TableBeginContextMenuPopup(table)) { - const ImGuiID context_menu_id = ImHashStr("##ContextMenu", 0, table->ID); - if (BeginPopupEx(context_menu_id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings)) - { - TableDrawContextMenu(table); - EndPopup(); - } - else - { - table->IsContextPopupOpen = false; - } + TableDrawContextMenu(table); + EndPopup(); } - // [Part 13] Sanitize and build sort specs before we have a change to use them for display. + // [Part 12] Sanitize and build sort specs before we have a change to use them for display. // This path will only be exercised when sort specs are modified before header rows (e.g. init or visibility change) if (table->IsSortSpecsDirty && (table->Flags & ImGuiTableFlags_Sortable)) TableSortSpecsBuild(table); + // [Part 13] Setup inner window decoration size (for scrolling / nav tracking to properly take account of frozen rows/columns) + if (table->FreezeColumnsRequest > 0) + table->InnerWindow->DecoInnerSizeX1 = table->Columns[table->DisplayOrderToIndex[table->FreezeColumnsRequest - 1]].MaxX - table->OuterRect.Min.x; + if (table->FreezeRowsRequest > 0) + table->InnerWindow->DecoInnerSizeY1 = table_instance->LastFrozenHeight; + table_instance->LastFrozenHeight = 0.0f; + // Initial state ImGuiWindow* inner_window = table->InnerWindow; if (table->Flags & ImGuiTableFlags_NoClip) @@ -1141,14 +1177,15 @@ void ImGui::TableUpdateBorders(ImGuiTable* table) // use the final height from last frame. Because this is only affecting _interaction_ with columns, it is not // really problematic (whereas the actual visual will be displayed in EndTable() and using the current frame height). // Actual columns highlight/render will be performed in EndTable() and not be affected. + ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); const float hit_half_width = TABLE_RESIZE_SEPARATOR_HALF_THICKNESS; const float hit_y1 = table->OuterRect.Min.y; - const float hit_y2_body = ImMax(table->OuterRect.Max.y, hit_y1 + table->LastOuterHeight); - const float hit_y2_head = hit_y1 + table->LastFirstRowHeight; + const float hit_y2_body = ImMax(table->OuterRect.Max.y, hit_y1 + table_instance->LastOuterHeight); + const float hit_y2_head = hit_y1 + table_instance->LastFirstRowHeight; for (int order_n = 0; order_n < table->ColumnsCount; order_n++) { - if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n))) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByDisplayOrder, order_n)) continue; const int column_n = table->DisplayOrderToIndex[order_n]; @@ -1166,8 +1203,8 @@ void ImGui::TableUpdateBorders(ImGuiTable* table) ImGuiID column_id = TableGetColumnResizeID(table, column_n, table->InstanceCurrent); ImRect hit_rect(column->MaxX - hit_half_width, hit_y1, column->MaxX + hit_half_width, border_y2_hit); + ItemAdd(hit_rect, column_id, NULL, ImGuiItemFlags_NoNav); //GetForegroundDrawList()->AddRect(hit_rect.Min, hit_rect.Max, IM_COL32(255, 0, 0, 100)); - KeepAliveID(column_id); bool hovered = false, held = false; bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_NoNavFocus); @@ -1223,6 +1260,7 @@ void ImGui::EndTable() TableOpenContextMenu((int)table->HoveredColumnBody); // Finalize table height + ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); inner_window->DC.PrevLineSize = temp_data->HostBackupPrevLineSize; inner_window->DC.CurrLineSize = temp_data->HostBackupCurrLineSize; inner_window->DC.CursorMaxPos = temp_data->HostBackupCursorMaxPos; @@ -1233,7 +1271,7 @@ void ImGui::EndTable() else if (!(flags & ImGuiTableFlags_NoHostExtendY)) table->OuterRect.Max.y = table->InnerRect.Max.y = ImMax(table->OuterRect.Max.y, inner_content_max_y); // Patch OuterRect/InnerRect height table->WorkRect.Max.y = ImMax(table->WorkRect.Max.y, table->OuterRect.Max.y); - table->LastOuterHeight = table->OuterRect.GetHeight(); + table_instance->LastOuterHeight = table->OuterRect.GetHeight(); // Setup inner scrolling range // FIXME: This ideally should be done earlier, in BeginTable() SetNextWindowContentSize call, just like writing to inner_window->DC.CursorMaxPos.y, @@ -1279,17 +1317,23 @@ void ImGui::EndTable() splitter->Merge(inner_window->DrawList); // Update ColumnsAutoFitWidth to get us ahead for host using our size to auto-resize without waiting for next BeginTable() - const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1); - table->ColumnsAutoFitWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount; + float auto_fit_width_for_fixed = 0.0f; + float auto_fit_width_for_stretched = 0.0f; + float auto_fit_width_for_stretched_min = 0.0f; for (int column_n = 0; column_n < table->ColumnsCount; column_n++) - if (table->EnabledMaskByIndex & ((ImU64)1 << column_n)) + if (IM_BITARRAY_TESTBIT(table->EnabledMaskByIndex, column_n)) { ImGuiTableColumn* column = &table->Columns[column_n]; - if ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !(column->Flags & ImGuiTableColumnFlags_NoResize)) - table->ColumnsAutoFitWidth += column->WidthRequest; + float column_width_request = ((column->Flags & ImGuiTableColumnFlags_WidthFixed) && !(column->Flags & ImGuiTableColumnFlags_NoResize)) ? column->WidthRequest : TableGetColumnWidthAuto(table, column); + if (column->Flags & ImGuiTableColumnFlags_WidthFixed) + auto_fit_width_for_fixed += column_width_request; else - table->ColumnsAutoFitWidth += TableGetColumnWidthAuto(table, column); + auto_fit_width_for_stretched += column_width_request; + if ((column->Flags & ImGuiTableColumnFlags_WidthStretch) && (column->Flags & ImGuiTableColumnFlags_NoResize) != 0) + auto_fit_width_for_stretched_min = ImMax(auto_fit_width_for_stretched_min, column_width_request / (column->StretchWeight / table->ColumnsStretchSumWeights)); } + const float width_spacings = (table->OuterPaddingX * 2.0f) + (table->CellSpacingX1 + table->CellSpacingX2) * (table->ColumnsEnabledCount - 1); + table->ColumnsAutoFitWidth = width_spacings + (table->CellPaddingX * 2.0f) * table->ColumnsEnabledCount + auto_fit_width_for_fixed + ImMax(auto_fit_width_for_stretched, auto_fit_width_for_stretched_min); // Update scroll if ((table->Flags & ImGuiTableFlags_ScrollX) == 0 && inner_window != outer_window) @@ -1317,8 +1361,10 @@ void ImGui::EndTable() } // Pop from id stack - IM_ASSERT_USER_ERROR(inner_window->IDStack.back() == table->ID + table->InstanceCurrent, "Mismatching PushID/PopID!"); + IM_ASSERT_USER_ERROR(inner_window->IDStack.back() == table_instance->TableInstanceID, "Mismatching PushID/PopID!"); IM_ASSERT_USER_ERROR(outer_window->DC.ItemWidthStack.Size >= temp_data->HostBackupItemWidthStackSize, "Too many PopItemWidth!"); + if (table->InstanceCurrent > 0) + PopID(); PopID(); // Restore window data that we modified @@ -1569,27 +1615,30 @@ ImGuiTableColumnFlags ImGui::TableGetColumnFlags(int column_n) // Return the cell rectangle based on currently known height. // - Important: we generally don't know our row height until the end of the row, so Max.y will be incorrect in many situations. -// The only case where this is correct is if we provided a min_row_height to TableNextRow() and don't go below it. +// The only case where this is correct is if we provided a min_row_height to TableNextRow() and don't go below it, or in TableEndRow() when we locked that height. // - Important: if ImGuiTableFlags_PadOuterX is set but ImGuiTableFlags_PadInnerX is not set, the outer-most left and right // columns report a small offset so their CellBgRect can extend up to the outer border. +// FIXME: But the rendering code in TableEndRow() nullifies that with clamping required for scrolling. ImRect ImGui::TableGetCellBgRect(const ImGuiTable* table, int column_n) { const ImGuiTableColumn* column = &table->Columns[column_n]; float x1 = column->MinX; float x2 = column->MaxX; - if (column->PrevEnabledColumn == -1) - x1 -= table->CellSpacingX1; - if (column->NextEnabledColumn == -1) - x2 += table->CellSpacingX2; + //if (column->PrevEnabledColumn == -1) + // x1 -= table->OuterPaddingX; + //if (column->NextEnabledColumn == -1) + // x2 += table->OuterPaddingX; + x1 = ImMax(x1, table->WorkRect.Min.x); + x2 = ImMin(x2, table->WorkRect.Max.x); return ImRect(x1, table->RowPosY1, x2, table->RowPosY2); } // Return the resizing ID for the right-side of the given column. -ImGuiID ImGui::TableGetColumnResizeID(const ImGuiTable* table, int column_n, int instance_no) +ImGuiID ImGui::TableGetColumnResizeID(ImGuiTable* table, int column_n, int instance_no) { IM_ASSERT(column_n >= 0 && column_n < table->ColumnsCount); - ImGuiID id = table->ID + 1 + (instance_no * table->ColumnsCount) + column_n; - return id; + ImGuiID instance_id = TableGetInstanceID(table, instance_no); + return instance_id + 1 + column_n; // FIXME: #6140: still not ideal } // Return -1 when table is not hovered. return columns_count if the unused space at the right of visible columns is hovered. @@ -1620,7 +1669,7 @@ void ImGui::TableSetBgColor(ImGuiTableBgTarget target, ImU32 color, int column_n return; if (column_n == -1) column_n = table->CurrentColumn; - if ((table->VisibleMaskByIndex & ((ImU64)1 << column_n)) == 0) + if (!IM_BITARRAY_TESTBIT(table->VisibleMaskByIndex, column_n)) return; if (table->RowCellDataCurrent < 0 || table->RowCellData[table->RowCellDataCurrent].Column != column_n) table->RowCellDataCurrent++; @@ -1710,6 +1759,8 @@ void ImGui::TableBeginRow(ImGuiTable* table) table->RowTextBaseline = 0.0f; table->RowIndentOffsetX = window->DC.Indent.x - table->HostIndentX; // Lock indent window->DC.PrevLineTextBaseOffset = 0.0f; + window->DC.CurrLineSize = ImVec2(0.0f, 0.0f); + window->DC.IsSameLine = window->DC.IsSetPos = false; window->DC.CursorMaxPos.y = next_y1; // Making the header BG color non-transparent will allow us to overlay it multiple times when handling smooth dragging. @@ -1746,7 +1797,7 @@ void ImGui::TableEndRow(ImGuiTable* table) const bool unfreeze_rows_actual = (table->CurrentRow + 1 == table->FreezeRowsCount); const bool unfreeze_rows_request = (table->CurrentRow + 1 == table->FreezeRowsRequest); if (table->CurrentRow == 0) - table->LastFirstRowHeight = bg_y2 - bg_y1; + TableGetInstanceData(table, table->InstanceCurrent)->LastFirstRowHeight = bg_y2 - bg_y1; const bool is_visible = (bg_y2 >= table->InnerClipRect.Min.y && bg_y1 <= table->InnerClipRect.Max.y); if (is_visible) @@ -1797,10 +1848,12 @@ void ImGui::TableEndRow(ImGuiTable* table) ImGuiTableCellData* cell_data_end = &table->RowCellData[table->RowCellDataCurrent]; for (ImGuiTableCellData* cell_data = &table->RowCellData[0]; cell_data <= cell_data_end; cell_data++) { + // As we render the BG here we need to clip things (for layout we would not) + // FIXME: This cancels the OuterPadding addition done by TableGetCellBgRect(), need to keep it while rendering correctly while scrolling. const ImGuiTableColumn* column = &table->Columns[cell_data->Column]; ImRect cell_bg_rect = TableGetCellBgRect(table, cell_data->Column); cell_bg_rect.ClipWith(table->BgClipRect); - cell_bg_rect.Min.x = ImMax(cell_bg_rect.Min.x, column->ClipRect.Min.x); // So that first column after frozen one gets clipped + cell_bg_rect.Min.x = ImMax(cell_bg_rect.Min.x, column->ClipRect.Min.x); // So that first column after frozen one gets clipped when scrolling cell_bg_rect.Max.x = ImMin(cell_bg_rect.Max.x, column->MaxX); window->DrawList->AddRectFilled(cell_bg_rect.Min, cell_bg_rect.Max, cell_data->BgColor); } @@ -1820,17 +1873,15 @@ void ImGui::TableEndRow(ImGuiTable* table) // get the new cursor position. if (unfreeze_rows_request) for (int column_n = 0; column_n < table->ColumnsCount; column_n++) - { - ImGuiTableColumn* column = &table->Columns[column_n]; - column->NavLayerCurrent = (ImS8)((column_n < table->FreezeColumnsCount) ? ImGuiNavLayer_Menu : ImGuiNavLayer_Main); - } + table->Columns[column_n].NavLayerCurrent = ImGuiNavLayer_Main; if (unfreeze_rows_actual) { IM_ASSERT(table->IsUnfrozenRows == false); + const float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y); table->IsUnfrozenRows = true; + TableGetInstanceData(table, table->InstanceCurrent)->LastFrozenHeight = y0 - table->OuterRect.Min.y; // BgClipRect starts as table->InnerClipRect, reduce it now and make BgClipRectForDrawCmd == BgClipRect - float y0 = ImMax(table->RowPosY2 + 1, window->InnerClipRect.Min.y); table->BgClipRect.Min.y = table->Bg2ClipRectForDrawCmd.Min.y = ImMin(y0, window->InnerClipRect.Max.y); table->BgClipRect.Max.y = table->Bg2ClipRectForDrawCmd.Max.y = window->InnerClipRect.Max.y; table->Bg2DrawChannelCurrent = table->Bg2DrawChannelUnfrozen; @@ -1893,7 +1944,7 @@ bool ImGui::TableSetColumnIndex(int column_n) // Return whether the column is visible. User may choose to skip submitting items based on this return value, // however they shouldn't skip submitting for columns that may have the tallest contribution to row height. - return (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n)) != 0; + return table->Columns[column_n].IsRequestOutput; } // [Public] Append into the next column, wrap and create a new row when already on last column @@ -1918,8 +1969,7 @@ bool ImGui::TableNextColumn() // Return whether the column is visible. User may choose to skip submitting items based on this return value, // however they shouldn't skip submitting for columns that may have the tallest contribution to row height. - int column_n = table->CurrentColumn; - return (table->RequestOutputMaskByIndex & ((ImU64)1 << column_n)) != 0; + return table->Columns[table->CurrentColumn].IsRequestOutput; } @@ -1949,10 +1999,6 @@ void ImGui::TableBeginCell(ImGuiTable* table, int column_n) window->WorkRect.Max.x = column->WorkMaxX; window->DC.ItemWidth = column->ItemWidth; - // To allow ImGuiListClipper to function we propagate our row height - if (!column->IsEnabled) - window->DC.CursorPos.y = ImMax(window->DC.CursorPos.y, table->RowPosY2); - window->SkipItems = column->IsSkipItems; if (column->IsSkipItems) { @@ -1989,6 +2035,9 @@ void ImGui::TableEndCell(ImGuiTable* table) ImGuiTableColumn* column = &table->Columns[table->CurrentColumn]; ImGuiWindow* window = table->InnerWindow; + if (window->DC.IsSetPos) + ErrorCheckUsingSetCursorPosToExtendParentBoundaries(); + // Report maximum position so we can infer content size per column. float* p_max_pos_x; if (table->RowFlags & ImGuiTableRowFlags_Headers) @@ -1996,7 +2045,8 @@ void ImGui::TableEndCell(ImGuiTable* table) else p_max_pos_x = table->IsUnfrozenRows ? &column->ContentMaxXUnfrozen : &column->ContentMaxXFrozen; *p_max_pos_x = ImMax(*p_max_pos_x, window->DC.CursorMaxPos.x); - table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY); + if (column->IsEnabled) + table->RowPosY2 = ImMax(table->RowPosY2, window->DC.CursorMaxPos.y + table->CellPaddingY); column->ItemWidth = window->DC.ItemWidth; // Propagate text baseline for the entire row @@ -2083,7 +2133,7 @@ void ImGui::TableSetColumnWidth(int column_n, float width) if (column_0->WidthGiven == column_0_width || column_0->WidthRequest == column_0_width) return; - //IMGUI_DEBUG_LOG("TableSetColumnWidth(%d, %.1f->%.1f)\n", column_0_idx, column_0->WidthGiven, column_0_width); + //IMGUI_DEBUG_PRINT("TableSetColumnWidth(%d, %.1f->%.1f)\n", column_0_idx, column_0->WidthGiven, column_0_width); ImGuiTableColumn* column_1 = (column_0->NextEnabledColumn != -1) ? &table->Columns[column_0->NextEnabledColumn] : NULL; // In this surprisingly not simple because of how we support mixing Fixed and multiple Stretch columns. @@ -2256,7 +2306,7 @@ void ImGui::TableSetupDrawChannels(ImGuiTable* table) const int freeze_row_multiplier = (table->FreezeRowsCount > 0) ? 2 : 1; const int channels_for_row = (table->Flags & ImGuiTableFlags_NoClip) ? 1 : table->ColumnsEnabledCount; const int channels_for_bg = 1 + 1 * freeze_row_multiplier; - const int channels_for_dummy = (table->ColumnsEnabledCount < table->ColumnsCount || table->VisibleMaskByIndex != table->EnabledMaskByIndex) ? +1 : 0; + const int channels_for_dummy = (table->ColumnsEnabledCount < table->ColumnsCount || (memcmp(table->VisibleMaskByIndex, table->EnabledMaskByIndex, ImBitArrayGetStorageSizeInBytes(table->ColumnsCount)) != 0)) ? +1 : 0; const int channels_total = channels_for_bg + (channels_for_row * freeze_row_multiplier) + channels_for_dummy; table->DrawSplitter->Split(table->InnerWindow->DrawList, channels_total); table->DummyDrawChannel = (ImGuiTableDrawChannelIdx)((channels_for_dummy > 0) ? channels_total - 1 : -1); @@ -2330,19 +2380,26 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) // Track which groups we are going to attempt to merge, and which channels goes into each group. struct MergeGroup { - ImRect ClipRect; - int ChannelsCount; - ImBitArray ChannelsMask; - - MergeGroup() { ChannelsCount = 0; } + ImRect ClipRect; + int ChannelsCount; + ImBitArrayPtr ChannelsMask; }; int merge_group_mask = 0x00; - MergeGroup merge_groups[4]; + MergeGroup merge_groups[4] = {}; + + // Use a reusable temp buffer for the merge masks as they are dynamically sized. + const int max_draw_channels = (4 + table->ColumnsCount * 2); + const int size_for_masks_bitarrays_one = (int)ImBitArrayGetStorageSizeInBytes(max_draw_channels); + g.TempBuffer.reserve(size_for_masks_bitarrays_one * 5); + memset(g.TempBuffer.Data, 0, size_for_masks_bitarrays_one * 5); + for (int n = 0; n < IM_ARRAYSIZE(merge_groups); n++) + merge_groups[n].ChannelsMask = (ImBitArrayPtr)(void*)(g.TempBuffer.Data + (size_for_masks_bitarrays_one * n)); + ImBitArrayPtr remaining_mask = (ImBitArrayPtr)(void*)(g.TempBuffer.Data + (size_for_masks_bitarrays_one * 4)); // 1. Scan channels and take note of those which can be merged for (int column_n = 0; column_n < table->ColumnsCount; column_n++) { - if ((table->VisibleMaskByIndex & ((ImU64)1 << column_n)) == 0) + if (!IM_BITARRAY_TESTBIT(table->VisibleMaskByIndex, column_n)) continue; ImGuiTableColumn* column = &table->Columns[column_n]; @@ -2353,7 +2410,7 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) // Don't attempt to merge if there are multiple draw calls within the column ImDrawChannel* src_channel = &splitter->_Channels[channel_no]; - if (src_channel->_CmdBuffer.Size > 0 && src_channel->_CmdBuffer.back().ElemCount == 0) + if (src_channel->_CmdBuffer.Size > 0 && src_channel->_CmdBuffer.back().ElemCount == 0 && src_channel->_CmdBuffer.back().UserCallback == NULL) // Equivalent of PopUnusedDrawCmd() src_channel->_CmdBuffer.pop_back(); if (src_channel->_CmdBuffer.Size != 1) continue; @@ -2374,11 +2431,11 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) } const int merge_group_n = (has_freeze_h && column_n < table->FreezeColumnsCount ? 0 : 1) + (has_freeze_v && merge_group_sub_n == 0 ? 0 : 2); - IM_ASSERT(channel_no < IMGUI_TABLE_MAX_DRAW_CHANNELS); + IM_ASSERT(channel_no < max_draw_channels); MergeGroup* merge_group = &merge_groups[merge_group_n]; if (merge_group->ChannelsCount == 0) merge_group->ClipRect = ImRect(+FLT_MAX, +FLT_MAX, -FLT_MAX, -FLT_MAX); - merge_group->ChannelsMask.SetBit(channel_no); + ImBitArraySetBit(merge_group->ChannelsMask, channel_no); merge_group->ChannelsCount++; merge_group->ClipRect.Add(src_channel->_CmdBuffer[0].ClipRect); merge_group_mask |= (1 << merge_group_n); @@ -2414,9 +2471,8 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) const int LEADING_DRAW_CHANNELS = 2; g.DrawChannelsTempMergeBuffer.resize(splitter->_Count - LEADING_DRAW_CHANNELS); // Use shared temporary storage so the allocation gets amortized ImDrawChannel* dst_tmp = g.DrawChannelsTempMergeBuffer.Data; - ImBitArray remaining_mask; // We need 132-bit of storage - remaining_mask.SetBitRange(LEADING_DRAW_CHANNELS, splitter->_Count); - remaining_mask.ClearBit(table->Bg2DrawChannelUnfrozen); + ImBitArraySetBitRange(remaining_mask, LEADING_DRAW_CHANNELS, splitter->_Count); + ImBitArrayClearBit(remaining_mask, table->Bg2DrawChannelUnfrozen); IM_ASSERT(has_freeze_v == false || table->Bg2DrawChannelUnfrozen != TABLE_DRAW_CHANNEL_BG2_FROZEN); int remaining_count = splitter->_Count - (has_freeze_v ? LEADING_DRAW_CHANNELS + 1 : LEADING_DRAW_CHANNELS); //ImRect host_rect = (table->InnerWindow == table->OuterWindow) ? table->InnerClipRect : table->HostClipRect; @@ -2449,14 +2505,14 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) GetOverlayDrawList()->AddLine(merge_group->ClipRect.Max, merge_clip_rect.Max, IM_COL32(255, 100, 0, 200)); #endif remaining_count -= merge_group->ChannelsCount; - for (int n = 0; n < IM_ARRAYSIZE(remaining_mask.Storage); n++) - remaining_mask.Storage[n] &= ~merge_group->ChannelsMask.Storage[n]; + for (int n = 0; n < (size_for_masks_bitarrays_one >> 2); n++) + remaining_mask[n] &= ~merge_group->ChannelsMask[n]; for (int n = 0; n < splitter->_Count && merge_channels_count != 0; n++) { // Copy + overwrite new clip rect - if (!merge_group->ChannelsMask.TestBit(n)) + if (!IM_BITARRAY_TESTBIT(merge_group->ChannelsMask, n)) continue; - merge_group->ChannelsMask.ClearBit(n); + IM_BITARRAY_CLEARBIT(merge_group->ChannelsMask, n); merge_channels_count--; ImDrawChannel* channel = &splitter->_Channels[n]; @@ -2474,7 +2530,7 @@ void ImGui::TableMergeDrawChannels(ImGuiTable* table) // Append unmergeable channels that we didn't reorder at the end of the list for (int n = 0; n < splitter->_Count && remaining_count != 0; n++) { - if (!remaining_mask.TestBit(n)) + if (!IM_BITARRAY_TESTBIT(remaining_mask, n)) continue; ImDrawChannel* channel = &splitter->_Channels[n]; memcpy(dst_tmp++, channel, sizeof(ImDrawChannel)); @@ -2497,15 +2553,16 @@ void ImGui::TableDrawBorders(ImGuiTable* table) inner_drawlist->PushClipRect(table->Bg0ClipRectForDrawCmd.Min, table->Bg0ClipRectForDrawCmd.Max, false); // Draw inner border and resizing feedback + ImGuiTableInstanceData* table_instance = TableGetInstanceData(table, table->InstanceCurrent); const float border_size = TABLE_BORDER_SIZE; const float draw_y1 = table->InnerRect.Min.y; const float draw_y2_body = table->InnerRect.Max.y; - const float draw_y2_head = table->IsUsingHeaders ? ImMin(table->InnerRect.Max.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table->LastFirstRowHeight) : draw_y1; + const float draw_y2_head = table->IsUsingHeaders ? ImMin(table->InnerRect.Max.y, (table->FreezeRowsCount >= 1 ? table->InnerRect.Min.y : table->WorkRect.Min.y) + table_instance->LastFirstRowHeight) : draw_y1; if (table->Flags & ImGuiTableFlags_BordersInnerV) { for (int order_n = 0; order_n < table->ColumnsCount; order_n++) { - if (!(table->EnabledMaskByDisplayOrder & ((ImU64)1 << order_n))) + if (!IM_BITARRAY_TESTBIT(table->EnabledMaskByDisplayOrder, order_n)) continue; const int column_n = table->DisplayOrderToIndex[order_n]; @@ -2833,10 +2890,9 @@ void ImGui::TableHeadersRow() continue; // Push an id to allow unnamed labels (generally accidental, but let's behave nicely with them) - // - in your own code you may omit the PushID/PopID all-together, provided you know they won't collide - // - table->InstanceCurrent is only >0 when we use multiple BeginTable/EndTable calls with same identifier. + // In your own code you may omit the PushID/PopID all-together, provided you know they won't collide. const char* name = (TableGetColumnFlags(column_n) & ImGuiTableColumnFlags_NoHeaderLabel) ? "" : TableGetColumnName(column_n); - PushID(table->InstanceCurrent * table->ColumnsCount + column_n); + PushID(column_n); TableHeader(name); PopID(); } @@ -2982,7 +3038,7 @@ void ImGui::TableHeader(const char* label) RenderTextEllipsis(window->DrawList, label_pos, ImVec2(ellipsis_max, label_pos.y + label_height + g.Style.FramePadding.y), ellipsis_max, ellipsis_max, label, label_end, &label_size); const bool text_clipped = label_size.x > (ellipsis_max - label_pos.x); - if (text_clipped && hovered && g.HoveredIdNotActiveTimer > g.TooltipSlowDelay) + if (text_clipped && hovered && g.ActiveId == 0 && IsItemHovered(ImGuiHoveredFlags_DelayNormal)) SetTooltip("%.*s", (int)(label_end - label), label); // We don't use BeginPopupContextItem() because we want the popup to stay up even after the column is hidden @@ -3017,6 +3073,17 @@ void ImGui::TableOpenContextMenu(int column_n) } } +bool ImGui::TableBeginContextMenuPopup(ImGuiTable* table) +{ + if (!table->IsContextPopupOpen || table->InstanceCurrent != table->InstanceInteracted) + return false; + const ImGuiID context_menu_id = ImHashStr("##ContextMenu", 0, table->ID); + if (BeginPopupEx(context_menu_id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings)) + return true; + table->IsContextPopupOpen = false; + return false; +} + // Output context menu into current window (generally a popup) // FIXME-TABLE: Ideally this should be writable by the user. Full programmatic access to that data? void ImGui::TableDrawContextMenu(ImGuiTable* table) @@ -3036,15 +3103,15 @@ void ImGui::TableDrawContextMenu(ImGuiTable* table) if (column != NULL) { const bool can_resize = !(column->Flags & ImGuiTableColumnFlags_NoResize) && column->IsEnabled; - if (MenuItem("Size column to fit###SizeOne", NULL, false, can_resize)) + if (MenuItem(LocalizeGetMsg(ImGuiLocKey_TableSizeOne), NULL, false, can_resize)) // "###SizeOne" TableSetColumnWidthAutoSingle(table, column_n); } const char* size_all_desc; if (table->ColumnsEnabledFixedCount == table->ColumnsEnabledCount && (table->Flags & ImGuiTableFlags_SizingMask_) != ImGuiTableFlags_SizingFixedSame) - size_all_desc = "Size all columns to fit###SizeAll"; // All fixed + size_all_desc = LocalizeGetMsg(ImGuiLocKey_TableSizeAllFit); // "###SizeAll" All fixed else - size_all_desc = "Size all columns to default###SizeAll"; // All stretch or mixed + size_all_desc = LocalizeGetMsg(ImGuiLocKey_TableSizeAllDefault); // "###SizeAll" All stretch or mixed if (MenuItem(size_all_desc, NULL)) TableSetColumnWidthAutoAll(table); want_separator = true; @@ -3053,7 +3120,7 @@ void ImGui::TableDrawContextMenu(ImGuiTable* table) // Ordering if (table->Flags & ImGuiTableFlags_Reorderable) { - if (MenuItem("Reset order", NULL, false, !table->IsDefaultDisplayOrder)) + if (MenuItem(LocalizeGetMsg(ImGuiLocKey_TableResetOrder), NULL, false, !table->IsDefaultDisplayOrder)) table->IsResetDisplayOrderRequest = true; want_separator = true; } @@ -3422,9 +3489,8 @@ static void TableSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandle } } -void ImGui::TableSettingsInstallHandler(ImGuiContext* context) +void ImGui::TableSettingsAddSettingsHandler() { - ImGuiContext& g = *context; ImGuiSettingsHandler ini_handler; ini_handler.TypeName = "Table"; ini_handler.TypeHash = ImHashStr("Table"); @@ -3433,7 +3499,7 @@ void ImGui::TableSettingsInstallHandler(ImGuiContext* context) ini_handler.ReadLineFn = TableSettingsHandler_ReadLine; ini_handler.ApplyAllFn = TableSettingsHandler_ApplyAll; ini_handler.WriteAllFn = TableSettingsHandler_WriteAll; - g.SettingsHandlers.push_back(ini_handler); + AddSettingsHandler(&ini_handler); } //------------------------------------------------------------------------- @@ -3447,7 +3513,7 @@ void ImGui::TableSettingsInstallHandler(ImGuiContext* context) // Remove Table (currently only used by TestEngine) void ImGui::TableRemove(ImGuiTable* table) { - //IMGUI_DEBUG_LOG("TableRemove() id=0x%08X\n", table->ID); + //IMGUI_DEBUG_PRINT("TableRemove() id=0x%08X\n", table->ID); ImGuiContext& g = *GImGui; int table_idx = g.Tables.GetIndex(table); //memset(table->RawData.Data, 0, table->RawData.size_in_bytes()); @@ -3459,7 +3525,7 @@ void ImGui::TableRemove(ImGuiTable* table) // Free up/compact internal Table buffers for when it gets unused void ImGui::TableGcCompactTransientBuffers(ImGuiTable* table) { - //IMGUI_DEBUG_LOG("TableGcCompactTransientBuffers() id=0x%08X\n", table->ID); + //IMGUI_DEBUG_PRINT("TableGcCompactTransientBuffers() id=0x%08X\n", table->ID); ImGuiContext& g = *GImGui; IM_ASSERT(table->MemoryCompacted == false); table->SortSpecs.Specs = NULL; @@ -3503,7 +3569,7 @@ void ImGui::TableGcCompactSettings() // - DebugNodeTable() [Internal] //------------------------------------------------------------------------- -#ifndef IMGUI_DISABLE_METRICS_WINDOW +#ifndef IMGUI_DISABLE_DEBUG_TOOLS static const char* DebugNodeTableGetSizingPolicyDesc(ImGuiTableFlags sizing_policy) { @@ -3531,6 +3597,8 @@ void ImGui::DebugNodeTable(ImGuiTable* table) GetForegroundDrawList()->AddRect(GetItemRectMin(), GetItemRectMax(), IM_COL32(255, 255, 0, 255)); if (!open) return; + if (table->InstanceCurrent > 0) + ImGui::Text("** %d instances of same table! Some data below will refer to last instance.", table->InstanceCurrent + 1); bool clear_settings = SmallButton("Clear settings"); BulletText("OuterRect: Pos: (%.1f,%.1f) Size: (%.1f,%.1f) Sizing: '%s'", table->OuterRect.Min.x, table->OuterRect.Min.y, table->OuterRect.GetWidth(), table->OuterRect.GetHeight(), DebugNodeTableGetSizingPolicyDesc(table->Flags)); BulletText("ColumnsGivenWidth: %.1f, ColumnsAutoFitWidth: %.1f, InnerWidth: %.1f%s", table->ColumnsGivenWidth, table->ColumnsAutoFitWidth, table->InnerWidth, table->InnerWidth == 0.0f ? " (auto)" : ""); @@ -3595,7 +3663,7 @@ void ImGui::DebugNodeTableSettings(ImGuiTableSettings* settings) TreePop(); } -#else // #ifndef IMGUI_DISABLE_METRICS_WINDOW +#else // #ifndef IMGUI_DISABLE_DEBUG_TOOLS void ImGui::DebugNodeTable(ImGuiTable*) {} void ImGui::DebugNodeTableSettings(ImGuiTableSettings*) {} @@ -3935,6 +4003,7 @@ void ImGui::NextColumn() { // New row/line: column 0 honor IndentX. window->DC.ColumnsOffset.x = ImMax(column_padding - window->WindowPadding.x, 0.0f); + window->DC.IsSameLine = false; columns->LineMinY = columns->LineMaxY; } window->DC.CursorPos.x = IM_FLOOR(window->Pos.x + window->DC.Indent.x + window->DC.ColumnsOffset.x); @@ -3986,8 +4055,7 @@ void ImGui::EndColumns() const ImGuiID column_id = columns->ID + ImGuiID(n); const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH; const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2)); - KeepAliveID(column_id); - if (IsClippedEx(column_hit_rect, column_id)) // FIXME: Can be removed or replaced with a lower-level test + if (!ItemAdd(column_hit_rect, column_id, NULL, ImGuiItemFlags_NoNav)) continue; bool hovered = false, held = false; diff --git a/Sources/CImGui/imgui/imgui_widgets.cpp b/Sources/CImGui/imgui/imgui_widgets.cpp index f199ad4..1d4aee6 100644 --- a/Sources/CImGui/imgui/imgui_widgets.cpp +++ b/Sources/CImGui/imgui/imgui_widgets.cpp @@ -1,4 +1,4 @@ -// dear imgui, v1.86 +// dear imgui, v1.89.5 // (widgets code) /* @@ -32,16 +32,15 @@ Index of this file: #define _CRT_SECURE_NO_WARNINGS #endif -#include "imgui.h" -#ifndef IMGUI_DISABLE - #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif + +#include "imgui.h" +#ifndef IMGUI_DISABLE #include "imgui_internal.h" // System includes -#include // toupper #if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier #include // intptr_t #else @@ -82,6 +81,7 @@ Index of this file: #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind #pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked #pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead +#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion" // warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated #endif //------------------------------------------------------------------------- @@ -126,7 +126,7 @@ static const ImU64 IM_U64_MAX = (2ULL * 9223372036854775807LL + 1); // For InputTextEx() static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data, ImGuiInputSource input_source); static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end); -static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false); +static ImVec2 InputTextCalcTextSizeW(ImGuiContext* ctx, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false); //------------------------------------------------------------------------- // [SECTION] Widgets: Text, etc. @@ -166,7 +166,21 @@ void ImGui::TextEx(const char* text, const char* text_end, ImGuiTextFlags flags) const ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset); const float wrap_pos_x = window->DC.TextWrapPos; const bool wrap_enabled = (wrap_pos_x >= 0.0f); - if (text_end - text > 2000 && !wrap_enabled) + if (text_end - text <= 2000 || wrap_enabled) + { + // Common case + const float wrap_width = wrap_enabled ? CalcWrapWidthForPos(window->DC.CursorPos, wrap_pos_x) : 0.0f; + const ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width); + + ImRect bb(text_pos, text_pos + text_size); + ItemSize(text_size, 0.0f); + if (!ItemAdd(bb, 0)) + return; + + // Render (we don't hide text after ## in this end-user function) + RenderTextWrapped(bb.Min, text_begin, text_end, wrap_width); + } + else { // Long text! // Perform manual coarse clipping to optimize for long multi-line text @@ -239,19 +253,6 @@ void ImGui::TextEx(const char* text, const char* text_end, ImGuiTextFlags flags) ItemSize(text_size, 0.0f); ItemAdd(bb, 0); } - else - { - const float wrap_width = wrap_enabled ? CalcWrapWidthForPos(window->DC.CursorPos, wrap_pos_x) : 0.0f; - const ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width); - - ImRect bb(text_pos, text_pos + text_size); - ItemSize(text_size, 0.0f); - if (!ItemAdd(bb, 0)) - return; - - // Render (we don't hide text after ## in this end-user function) - RenderTextWrapped(bb.Min, text_begin, text_end, wrap_width); - } } void ImGui::TextUnformatted(const char* text, const char* text_end) @@ -273,10 +274,9 @@ void ImGui::TextV(const char* fmt, va_list args) if (window->SkipItems) return; - // FIXME-OPT: Handle the %s shortcut? - ImGuiContext& g = *GImGui; - const char* text_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); - TextEx(g.TempBuffer, text_end, ImGuiTextFlags_NoWidthForLargeClippedText); + const char* text, *text_end; + ImFormatStringToTempBufferV(&text, &text_end, fmt, args); + TextEx(text, text_end, ImGuiTextFlags_NoWidthForLargeClippedText); } void ImGui::TextColored(const ImVec4& col, const char* fmt, ...) @@ -290,10 +290,7 @@ void ImGui::TextColored(const ImVec4& col, const char* fmt, ...) void ImGui::TextColoredV(const ImVec4& col, const char* fmt, va_list args) { PushStyleColor(ImGuiCol_Text, col); - if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0) - TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting - else - TextV(fmt, args); + TextV(fmt, args); PopStyleColor(); } @@ -309,10 +306,7 @@ void ImGui::TextDisabledV(const char* fmt, va_list args) { ImGuiContext& g = *GImGui; PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]); - if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0) - TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting - else - TextV(fmt, args); + TextV(fmt, args); PopStyleColor(); } @@ -327,13 +321,10 @@ void ImGui::TextWrapped(const char* fmt, ...) void ImGui::TextWrappedV(const char* fmt, va_list args) { ImGuiContext& g = *GImGui; - bool need_backup = (g.CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position if one is already set + const bool need_backup = (g.CurrentWindow->DC.TextWrapPos < 0.0f); // Keep existing wrap position if one is already set if (need_backup) PushTextWrapPos(0.0f); - if (fmt[0] == '%' && fmt[1] == 's' && fmt[2] == 0) - TextEx(va_arg(args, const char*), NULL, ImGuiTextFlags_NoWidthForLargeClippedText); // Skip formatting - else - TextV(fmt, args); + TextV(fmt, args); if (need_backup) PopTextWrapPos(); } @@ -357,8 +348,8 @@ void ImGui::LabelTextV(const char* label, const char* fmt, va_list args) const ImGuiStyle& style = g.Style; const float w = CalcItemWidth(); - const char* value_text_begin = &g.TempBuffer[0]; - const char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); + const char* value_text_begin, *value_text_end; + ImFormatStringToTempBufferV(&value_text_begin, &value_text_end, fmt, args); const ImVec2 value_size = CalcTextSize(value_text_begin, value_text_end, false); const ImVec2 label_size = CalcTextSize(label, NULL, true); @@ -393,8 +384,8 @@ void ImGui::BulletTextV(const char* fmt, va_list args) ImGuiContext& g = *GImGui; const ImGuiStyle& style = g.Style; - const char* text_begin = g.TempBuffer; - const char* text_end = text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); + const char* text_begin, *text_end; + ImFormatStringToTempBufferV(&text_begin, &text_end, fmt, args); const ImVec2 label_size = CalcTextSize(text_begin, text_end, false); const ImVec2 total_size = ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x * 2) : 0.0f), label_size.y); // Empty text doesn't add padding ImVec2 pos = window->DC.CursorPos; @@ -507,8 +498,9 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool g.HoveredWindow = window; #ifdef IMGUI_ENABLE_TEST_ENGINE + // Alternate registration spot, for when caller didn't use ItemAdd() if (id != 0 && g.LastItemData.ID != id) - IMGUI_TEST_ENGINE_ITEM_ADD(bb, id); + IMGUI_TEST_ENGINE_ITEM_ADD(id, bb, NULL); #endif bool pressed = false; @@ -540,22 +532,28 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool hovered = false; // Mouse handling + const ImGuiID test_owner_id = (flags & ImGuiButtonFlags_NoTestKeyOwner) ? ImGuiKeyOwner_Any : id; if (hovered) { + // Poll mouse buttons + // - 'mouse_button_clicked' is generally carried into ActiveIdMouseButton when setting ActiveId. + // - Technically we only need some values in one code path, but since this is gated by hovered test this is fine. + int mouse_button_clicked = -1; + int mouse_button_released = -1; + for (int button = 0; button < 3; button++) + if (flags & (ImGuiButtonFlags_MouseButtonLeft << button)) // Handle ImGuiButtonFlags_MouseButtonRight and ImGuiButtonFlags_MouseButtonMiddle here. + { + if (IsMouseClicked(button, test_owner_id) && mouse_button_clicked == -1) { mouse_button_clicked = button; } + if (IsMouseReleased(button, test_owner_id) && mouse_button_released == -1) { mouse_button_released = button; } + } + + // Process initial action if (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt)) { - // Poll buttons - int mouse_button_clicked = -1; - int mouse_button_released = -1; - if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseClicked[0]) { mouse_button_clicked = 0; } - else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseClicked[1]) { mouse_button_clicked = 1; } - else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseClicked[2]) { mouse_button_clicked = 2; } - if ((flags & ImGuiButtonFlags_MouseButtonLeft) && g.IO.MouseReleased[0]) { mouse_button_released = 0; } - else if ((flags & ImGuiButtonFlags_MouseButtonRight) && g.IO.MouseReleased[1]) { mouse_button_released = 1; } - else if ((flags & ImGuiButtonFlags_MouseButtonMiddle) && g.IO.MouseReleased[2]) { mouse_button_released = 2; } - if (mouse_button_clicked != -1 && g.ActiveId != id) { + if (!(flags & ImGuiButtonFlags_NoSetKeyOwner)) + SetKeyOwner(MouseButtonToKey(mouse_button_clicked), id); if (flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere)) { SetActiveID(id, window); @@ -577,21 +575,23 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool FocusWindow(window); } } - if ((flags & ImGuiButtonFlags_PressedOnRelease) && mouse_button_released != -1) + if (flags & ImGuiButtonFlags_PressedOnRelease) { - // Repeat mode trumps on release behavior - const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay; - if (!has_repeated_at_least_once) - pressed = true; - if (!(flags & ImGuiButtonFlags_NoNavFocus)) - SetFocusID(id, window); - ClearActiveID(); + if (mouse_button_released != -1) + { + const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay; // Repeat mode trumps on release behavior + if (!has_repeated_at_least_once) + pressed = true; + if (!(flags & ImGuiButtonFlags_NoNavFocus)) + SetFocusID(id, window); + ClearActiveID(); + } } // 'Repeat' mode acts when held regardless of _PressedOn flags (see table above). // Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings. if (g.ActiveId == id && (flags & ImGuiButtonFlags_Repeat)) - if (g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0f && IsMouseClicked(g.ActiveIdMouseButton, true)) + if (g.IO.MouseDownDuration[g.ActiveIdMouseButton] > 0.0f && IsMouseClicked(g.ActiveIdMouseButton, test_owner_id, ImGuiInputFlags_Repeat)) pressed = true; } @@ -607,13 +607,22 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool if (g.NavActivateDownId == id) { bool nav_activated_by_code = (g.NavActivateId == id); - bool nav_activated_by_inputs = IsNavInputTest(ImGuiNavInput_Activate, (flags & ImGuiButtonFlags_Repeat) ? ImGuiInputReadMode_Repeat : ImGuiInputReadMode_Pressed); + bool nav_activated_by_inputs = (g.NavActivatePressedId == id); + if (!nav_activated_by_inputs && (flags & ImGuiButtonFlags_Repeat)) + { + // Avoid pressing multiple keys from triggering excessive amount of repeat events + const ImGuiKeyData* key1 = GetKeyData(ImGuiKey_Space); + const ImGuiKeyData* key2 = GetKeyData(ImGuiKey_Enter); + const ImGuiKeyData* key3 = GetKeyData(ImGuiKey_NavGamepadActivate); + const float t1 = ImMax(ImMax(key1->DownDuration, key2->DownDuration), key3->DownDuration); + nav_activated_by_inputs = CalcTypematicRepeatAmount(t1 - g.IO.DeltaTime, t1, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0; + } if (nav_activated_by_code || nav_activated_by_inputs) { // Set active id so it can be queried by user via IsItemActive(), equivalent of holding the mouse button. pressed = true; SetActiveID(id, window); - g.ActiveIdSource = ImGuiInputSource_Nav; + g.ActiveIdSource = g.NavInputSource; if (!(flags & ImGuiButtonFlags_NoNavFocus)) SetFocusID(id, window); } @@ -629,8 +638,12 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool g.ActiveIdClickOffset = g.IO.MousePos - bb.Min; const int mouse_button = g.ActiveIdMouseButton; - IM_ASSERT(mouse_button >= 0 && mouse_button < ImGuiMouseButton_COUNT); - if (g.IO.MouseDown[mouse_button]) + if (mouse_button == -1) + { + // Fallback for the rare situation were g.ActiveId was set programmatically or from another widget (e.g. #6304). + ClearActiveID(); + } + else if (IsMouseDown(mouse_button, test_owner_id)) { held = true; } @@ -643,7 +656,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool // Report as pressed when releasing the mouse (this is the most common path) bool is_double_click_release = (flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseReleased[mouse_button] && g.IO.MouseClickedLastCount[mouse_button] == 2; bool is_repeating_already = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button] >= g.IO.KeyRepeatDelay; // Repeat mode trumps - if (!is_double_click_release && !is_repeating_already) + bool is_button_avail_or_owned = TestKeyOwner(MouseButtonToKey(mouse_button), test_owner_id); + if (!is_double_click_release && !is_repeating_already && is_button_avail_or_owned) pressed = true; } ClearActiveID(); @@ -651,7 +665,7 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool if (!(flags & ImGuiButtonFlags_NoNavFocus)) g.NavDisableHighlight = true; } - else if (g.ActiveIdSource == ImGuiInputSource_Nav) + else if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) { // When activated using Nav, we hold on the ActiveID until activation button is released if (g.NavActivateDownId != id) @@ -731,6 +745,7 @@ bool ImGui::SmallButton(const char* label) // Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id) bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg, ImGuiButtonFlags flags) { + ImGuiContext& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); if (window->SkipItems) return false; @@ -748,16 +763,17 @@ bool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg, ImGuiBut bool hovered, held; bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); + IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags); return pressed; } bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiButtonFlags flags) { + ImGuiContext& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); if (window->SkipItems) return false; - ImGuiContext& g = *GImGui; const ImGuiID id = window->GetID(str_id); const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); const float default_size = GetFrameHeight(); @@ -778,6 +794,7 @@ bool ImGui::ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size, ImGuiBu RenderFrame(bb.Min, bb.Max, bg_col, true, g.Style.FrameRounding); RenderArrow(window->DrawList, bb.Min + ImVec2(ImMax(0.0f, (size.x - g.FontSize) * 0.5f), ImMax(0.0f, (size.y - g.FontSize) * 0.5f)), text_col, dir); + IMGUI_TEST_ENGINE_ITEM_INFO(id, str_id, g.LastItemData.StatusFlags); return pressed; } @@ -815,7 +832,7 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos) ImU32 col = GetColorU32(held ? ImGuiCol_ButtonActive : ImGuiCol_ButtonHovered); ImVec2 center = bb.GetCenter(); if (hovered) - window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col, 12); + window->DrawList->AddCircleFilled(center, ImMax(2.0f, g.FontSize * 0.5f + 1.0f), col); float cross_extent = g.FontSize * 0.5f * 0.7071f - 1.0f; ImU32 cross_col = GetColorU32(ImGuiCol_Text); @@ -839,9 +856,8 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos) // Render ImU32 bg_col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); ImU32 text_col = GetColorU32(ImGuiCol_Text); - ImVec2 center = bb.GetCenter(); if (hovered || held) - window->DrawList->AddCircleFilled(center/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col, 12); + window->DrawList->AddCircleFilled(bb.GetCenter()/*+ ImVec2(0.0f, -0.5f)*/, g.FontSize * 0.5f + 1.0f, bg_col); RenderArrow(window->DrawList, bb.Min + g.Style.FramePadding, text_col, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f); // Switch to moving the window after mouse is moved beyond the initial drag threshold @@ -853,7 +869,7 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos) ImGuiID ImGui::GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis) { - return window->GetIDNoKeepAlive(axis == ImGuiAxis_X ? "#SCROLLX" : "#SCROLLY"); + return window->GetID(axis == ImGuiAxis_X ? "#SCROLLX" : "#SCROLLY"); } // Return scrollbar rectangle, must only be called for corresponding axis if window->ScrollbarX/Y is set. @@ -874,9 +890,7 @@ void ImGui::Scrollbar(ImGuiAxis axis) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - const ImGuiID id = GetWindowScrollbarID(window, axis); - KeepAliveID(id); // Calculate scrollbar bounding box ImRect bb = GetWindowScrollbarRect(window, axis); @@ -945,6 +959,7 @@ bool ImGui::ScrollbarEx(const ImRect& bb_frame, ImGuiID id, ImGuiAxis axis, ImS6 // Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar(). bool held = false; bool hovered = false; + ItemAdd(bb_frame, id, NULL, ImGuiItemFlags_NoNav); ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_NoNavFocus); const ImS64 scroll_max = ImMax((ImS64)1, size_contents_v - size_avail_v); @@ -1024,20 +1039,21 @@ void ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& // ImageButton() is flawed as 'id' is always derived from 'texture_id' (see #2464 #1390) // We provide this internal helper to write your own variant while we figure out how to redesign the public ImageButton() API. -bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col) +bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col, ImGuiButtonFlags flags) { ImGuiContext& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); if (window->SkipItems) return false; - const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2); + const ImVec2 padding = g.Style.FramePadding; + const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2.0f); ItemSize(bb); if (!ItemAdd(bb, id)) return false; bool hovered, held; - bool pressed = ButtonBehavior(bb, id, &hovered, &held); + bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); // Render const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button); @@ -1050,9 +1066,21 @@ bool ImGui::ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size return pressed; } -// frame_padding < 0: uses FramePadding from style (default) -// frame_padding = 0: no framing -// frame_padding > 0: set framing size +bool ImGui::ImageButton(const char* str_id, ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& bg_col, const ImVec4& tint_col) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + if (window->SkipItems) + return false; + + return ImageButtonEx(window->GetID(str_id), user_texture_id, size, uv0, uv1, bg_col, tint_col); +} + +#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS +// Legacy API obsoleted in 1.89. Two differences with new ImageButton() +// - new ImageButton() requires an explicit 'const char* str_id' Old ImageButton() used opaque imTextureId (created issue with: multiple buttons with same image, transient texture id values, opaque computation of ID) +// - new ImageButton() always use style.FramePadding Old ImageButton() had an override argument. +// If you need to change padding with new ImageButton() you can use PushStyleVar(ImGuiStyleVar_FramePadding, value), consistent with other Button functions. bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col) { ImGuiContext& g = *GImGui; @@ -1065,9 +1093,14 @@ bool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const I const ImGuiID id = window->GetID("#image"); PopID(); - const ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : g.Style.FramePadding; - return ImageButtonEx(id, user_texture_id, size, uv0, uv1, padding, bg_col, tint_col); + if (frame_padding >= 0) + PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2((float)frame_padding, (float)frame_padding)); + bool ret = ImageButtonEx(id, user_texture_id, size, uv0, uv1, bg_col, tint_col); + if (frame_padding >= 0) + PopStyleVar(); + return ret; } +#endif // #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS bool ImGui::Checkbox(const char* label, bool* v) { @@ -1205,17 +1238,18 @@ bool ImGui::RadioButton(const char* label, bool active) MarkItemEdited(id); RenderNavHighlight(total_bb, id); - window->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), 16); + const int num_segment = window->DrawList->_CalcCircleAutoSegmentCount(radius); + window->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), num_segment); if (active) { const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f)); - window->DrawList->AddCircleFilled(center, radius - pad, GetColorU32(ImGuiCol_CheckMark), 16); + window->DrawList->AddCircleFilled(center, radius - pad, GetColorU32(ImGuiCol_CheckMark)); } if (style.FrameBorderSize > 0.0f) { - window->DrawList->AddCircle(center + ImVec2(1, 1), radius, GetColorU32(ImGuiCol_BorderShadow), 16, style.FrameBorderSize); - window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), 16, style.FrameBorderSize); + window->DrawList->AddCircle(center + ImVec2(1, 1), radius, GetColorU32(ImGuiCol_BorderShadow), num_segment, style.FrameBorderSize); + window->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), num_segment, style.FrameBorderSize); } ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y); @@ -1282,7 +1316,7 @@ void ImGui::Bullet() ImGuiContext& g = *GImGui; const ImGuiStyle& style = g.Style; - const float line_height = ImMax(ImMin(window->DC.CurrLineSize.y, g.FontSize + g.Style.FramePadding.y * 2), g.FontSize); + const float line_height = ImMax(ImMin(window->DC.CurrLineSize.y, g.FontSize + style.FramePadding.y * 2), g.FontSize); const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize, line_height)); ItemSize(bb); if (!ItemAdd(bb, 0)) @@ -1338,6 +1372,7 @@ void ImGui::NewLine() ImGuiContext& g = *GImGui; const ImGuiLayoutType backup_layout_type = window->DC.LayoutType; window->DC.LayoutType = ImGuiLayoutType_Vertical; + window->DC.IsSameLine = false; if (window->DC.CurrLineSize.y > 0.0f) // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height. ItemSize(ImVec2(0, 0)); else @@ -1357,6 +1392,7 @@ void ImGui::AlignTextToFramePadding() } // Horizontal/vertical separating line +// FIXME: Surprisingly, this seemingly simple widget is adjacent to MANY different legacy/tricky layout issues. void ImGui::SeparatorEx(ImGuiSeparatorFlags flags) { ImGuiWindow* window = GetCurrentWindow(); @@ -1366,20 +1402,19 @@ void ImGui::SeparatorEx(ImGuiSeparatorFlags flags) ImGuiContext& g = *GImGui; IM_ASSERT(ImIsPowerOfTwo(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical))); // Check that only 1 option is selected - float thickness_draw = 1.0f; - float thickness_layout = 0.0f; + const float thickness = 1.0f; // Cannot use g.Style.SeparatorTextSize yet for various reasons. if (flags & ImGuiSeparatorFlags_Vertical) { - // Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout. + // Vertical separator, for menu bars (use current line height). float y1 = window->DC.CursorPos.y; float y2 = window->DC.CursorPos.y + window->DC.CurrLineSize.y; - const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + thickness_draw, y2)); - ItemSize(ImVec2(thickness_layout, 0.0f)); + const ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + thickness, y2)); + ItemSize(ImVec2(thickness, 0.0f)); if (!ItemAdd(bb, 0)) return; // Draw - window->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator)); + window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Separator)); if (g.LogEnabled) LogText(" |"); } @@ -1407,13 +1442,14 @@ void ImGui::SeparatorEx(ImGuiSeparatorFlags flags) // We don't provide our width to the layout so that it doesn't get feed back into AutoFit // FIXME: This prevents ->CursorMaxPos based bounding box evaluation from working (e.g. TableEndCell) - const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + thickness_draw)); - ItemSize(ImVec2(0.0f, thickness_layout)); + const float thickness_for_layout = (thickness == 1.0f) ? 0.0f : thickness; // FIXME: See 1.70/1.71 Separator() change: makes legacy 1-px separator not affect layout yet. Should change. + const ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + thickness)); + ItemSize(ImVec2(0.0f, thickness_for_layout)); const bool item_visible = ItemAdd(bb, 0); if (item_visible) { // Draw - window->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x, bb.Min.y), GetColorU32(ImGuiCol_Separator)); + window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Separator)); if (g.LogEnabled) LogRenderedText(&bb.Min, "--------------------------------\n"); @@ -1439,17 +1475,78 @@ void ImGui::Separator() SeparatorEx(flags); } +void ImGui::SeparatorTextEx(ImGuiID id, const char* label, const char* label_end, float extra_w) +{ + ImGuiContext& g = *GImGui; + ImGuiWindow* window = g.CurrentWindow; + ImGuiStyle& style = g.Style; + + const ImVec2 label_size = CalcTextSize(label, label_end, false); + const ImVec2 pos = window->DC.CursorPos; + const ImVec2 padding = style.SeparatorTextPadding; + + const float separator_thickness = style.SeparatorTextBorderSize; + const ImVec2 min_size(label_size.x + extra_w + padding.x * 2.0f, ImMax(label_size.y + padding.y * 2.0f, separator_thickness)); + const ImRect bb(pos, ImVec2(window->WorkRect.Max.x, pos.y + min_size.y)); + const float text_baseline_y = ImFloor((bb.GetHeight() - label_size.y) * style.SeparatorTextAlign.y + 0.99999f); //ImMax(padding.y, ImFloor((style.SeparatorTextSize - label_size.y) * 0.5f)); + ItemSize(min_size, text_baseline_y); + if (!ItemAdd(bb, id)) + return; + + const float sep1_x1 = pos.x; + const float sep2_x2 = bb.Max.x; + const float seps_y = ImFloor((bb.Min.y + bb.Max.y) * 0.5f + 0.99999f); + + const float label_avail_w = ImMax(0.0f, sep2_x2 - sep1_x1 - padding.x * 2.0f); + const ImVec2 label_pos(pos.x + padding.x + ImMax(0.0f, (label_avail_w - label_size.x - extra_w) * style.SeparatorTextAlign.x), pos.y + text_baseline_y); // FIXME-ALIGN + + // This allows using SameLine() to position something in the 'extra_w' + window->DC.CursorPosPrevLine.x = label_pos.x + label_size.x; + + const ImU32 separator_col = GetColorU32(ImGuiCol_Separator); + if (label_size.x > 0.0f) + { + const float sep1_x2 = label_pos.x - style.ItemSpacing.x; + const float sep2_x1 = label_pos.x + label_size.x + extra_w + style.ItemSpacing.x; + if (sep1_x2 > sep1_x1 && separator_thickness > 0.0f) + window->DrawList->AddLine(ImVec2(sep1_x1, seps_y), ImVec2(sep1_x2, seps_y), separator_col, separator_thickness); + if (sep2_x2 > sep2_x1 && separator_thickness > 0.0f) + window->DrawList->AddLine(ImVec2(sep2_x1, seps_y), ImVec2(sep2_x2, seps_y), separator_col, separator_thickness); + if (g.LogEnabled) + LogSetNextTextDecoration("---", NULL); + RenderTextEllipsis(window->DrawList, label_pos, ImVec2(bb.Max.x, bb.Max.y + style.ItemSpacing.y), bb.Max.x, bb.Max.x, label, label_end, &label_size); + } + else + { + if (g.LogEnabled) + LogText("---"); + if (separator_thickness > 0.0f) + window->DrawList->AddLine(ImVec2(sep1_x1, seps_y), ImVec2(sep2_x2, seps_y), separator_col, separator_thickness); + } +} + +void ImGui::SeparatorText(const char* label) +{ + ImGuiWindow* window = GetCurrentWindow(); + if (window->SkipItems) + return; + + // The SeparatorText() vs SeparatorTextEx() distinction is designed to be considerate that we may want: + // - allow headers to be draggable items (would require a stable ID + a noticeable highlight) + // - this high-level entry point to allow formatting? (may require ID separate from formatted string) + // - because of this we probably can't turn 'const char* label' into 'const char* fmt, ...' + // Otherwise, we can decide that users wanting to drag this would layout a dedicated drag-item, + // and then we can turn this into a format function. + SeparatorTextEx(0, label, FindRenderedTextEnd(label), 0.0f); +} + // Using 'hover_visibility_delay' allows us to hide the highlight and mouse cursor for a short time, which can be convenient to reduce visual noise. -bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend, float hover_visibility_delay) +bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend, float hover_visibility_delay, ImU32 bg_col) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - const ImGuiItemFlags item_flags_backup = g.CurrentItemFlags; - g.CurrentItemFlags |= ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus; - bool item_add = ItemAdd(bb, id); - g.CurrentItemFlags = item_flags_backup; - if (!item_add) + if (!ItemAdd(bb, id, NULL, ImGuiItemFlags_NoNav)) return false; bool hovered, held; @@ -1492,7 +1589,9 @@ bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float } } - // Render + // Render at new position + if (bg_col & IM_COL32_A_MASK) + window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, bg_col, 0.0f); const ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : (hovered && g.HoveredIdTimer >= hover_visibility_delay) ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator); window->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, 0.0f); @@ -1533,7 +1632,7 @@ void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_exc width_excess -= width_to_remove_per_item * count_same_width; } - // Round width and redistribute remainder left-to-right (could make it an option of the function?) + // Round width and redistribute remainder // Ensure that e.g. the right-most tab of a shrunk tab-bar always reaches exactly at the same distance from the right-most edge of the tab bar separator. width_excess = 0.0f; for (int n = 0; n < count; n++) @@ -1542,10 +1641,13 @@ void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_exc width_excess += items[n].Width - width_rounded; items[n].Width = width_rounded; } - if (width_excess > 0.0f) - for (int n = 0; n < count; n++) - if (items[n].Index < (int)(width_excess + 0.01f)) - items[n].Width += 1.0f; + while (width_excess > 0.0f) + for (int n = 0; n < count && width_excess > 0.0f; n++) + { + float width_to_add = ImMin(items[n].InitialWidth - items[n].Width, 1.0f); + items[n].Width += width_to_add; + width_excess -= width_to_add; + } } //------------------------------------------------------------------------- @@ -1667,7 +1769,12 @@ bool ImGui::BeginComboPopup(ImGuiID popup_id, const ImRect& bb, ImGuiComboFlags if (flags & ImGuiComboFlags_HeightRegular) popup_max_height_in_items = 8; else if (flags & ImGuiComboFlags_HeightSmall) popup_max_height_in_items = 4; else if (flags & ImGuiComboFlags_HeightLarge) popup_max_height_in_items = 20; - SetNextWindowSizeConstraints(ImVec2(w, 0.0f), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items))); + ImVec2 constraint_min(0.0f, 0.0f), constraint_max(FLT_MAX, FLT_MAX); + if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) == 0 || g.NextWindowData.SizeVal.x <= 0.0f) // Don't apply constraints if user specified a size + constraint_min.x = w; + if ((g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize) == 0 || g.NextWindowData.SizeVal.y <= 0.0f) + constraint_max.y = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items); + SetNextWindowSizeConstraints(constraint_min, constraint_max); } // This is essentially a specialized version of BeginPopupEx() @@ -1715,7 +1822,7 @@ bool ImGui::BeginComboPreview() ImGuiWindow* window = g.CurrentWindow; ImGuiComboPreviewData* preview_data = &g.ComboPreviewData; - if (window->SkipItems || !window->ClipRect.Overlaps(g.LastItemData.Rect)) // FIXME: Because we don't have a ImGuiItemStatusFlags_Visible flag to test last ItemAdd() result + if (window->SkipItems || !(g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Visible)) return false; IM_ASSERT(g.LastItemData.Rect.Min.x == preview_data->PreviewRect.Min.x && g.LastItemData.Rect.Min.y == preview_data->PreviewRect.Min.y); // Didn't call after BeginCombo/EndCombo block or forgot to pass ImGuiComboFlags_CustomPreview flag? if (!window->ClipRect.Contains(preview_data->PreviewRect)) // Narrower test (optional) @@ -1730,6 +1837,7 @@ bool ImGui::BeginComboPreview() window->DC.CursorPos = preview_data->PreviewRect.Min + g.Style.FramePadding; window->DC.CursorMaxPos = window->DC.CursorPos; window->DC.LayoutType = ImGuiLayoutType_Horizontal; + window->DC.IsSameLine = false; PushClipRect(preview_data->PreviewRect.Min, preview_data->PreviewRect.Max, true); return true; @@ -1755,6 +1863,7 @@ void ImGui::EndComboPreview() window->DC.CursorPosPrevLine = preview_data->BackupCursorPosPrevLine; window->DC.PrevLineTextBaseOffset = preview_data->BackupPrevLineTextBaseOffset; window->DC.LayoutType = preview_data->BackupLayout; + window->DC.IsSameLine = false; preview_data->PreviewRect = ImRect(); } @@ -1857,11 +1966,11 @@ bool ImGui::Combo(const char* label, int* current_item, const char* items_separa //------------------------------------------------------------------------- // [SECTION] Data Type and Data Formatting Helpers [Internal] //------------------------------------------------------------------------- -// - PatchFormatStringFloatToInt() // - DataTypeGetInfo() // - DataTypeFormatString() // - DataTypeApplyOp() // - DataTypeApplyOpFromText() +// - DataTypeCompare() // - DataTypeClamp() // - GetMinimumStepAtDecimalPrecision // - RoundScalarWithFormat<>() @@ -1887,30 +1996,6 @@ static const ImGuiDataTypeInfo GDataTypeInfo[] = }; IM_STATIC_ASSERT(IM_ARRAYSIZE(GDataTypeInfo) == ImGuiDataType_COUNT); -// FIXME-LEGACY: Prior to 1.61 our DragInt() function internally used floats and because of this the compile-time default value for format was "%.0f". -// Even though we changed the compile-time default, we expect users to have carried %f around, which would break the display of DragInt() calls. -// To honor backward compatibility we are rewriting the format string, unless IMGUI_DISABLE_OBSOLETE_FUNCTIONS is enabled. What could possibly go wrong?! -static const char* PatchFormatStringFloatToInt(const char* fmt) -{ - if (fmt[0] == '%' && fmt[1] == '.' && fmt[2] == '0' && fmt[3] == 'f' && fmt[4] == 0) // Fast legacy path for "%.0f" which is expected to be the most common case. - return "%d"; - const char* fmt_start = ImParseFormatFindStart(fmt); // Find % (if any, and ignore %%) - const char* fmt_end = ImParseFormatFindEnd(fmt_start); // Find end of format specifier, which itself is an exercise of confidence/recklessness (because snprintf is dependent on libc or user). - if (fmt_end > fmt_start && fmt_end[-1] == 'f') - { -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - if (fmt_start == fmt && fmt_end[0] == 0) - return "%d"; - ImGuiContext& g = *GImGui; - ImFormatString(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%.*s%%d%s", (int)(fmt_start - fmt), fmt, fmt_end); // Honor leading and trailing decorations, but lose alignment/precision. - return g.TempBuffer; -#else - IM_ASSERT(0 && "DragInt(): Invalid format string!"); // Old versions used a default parameter of "%.0f", please replace with e.g. "%d" -#endif - } - return fmt; -} - const ImGuiDataTypeInfo* ImGui::DataTypeGetInfo(ImGuiDataType data_type) { IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT); @@ -1992,24 +2077,10 @@ void ImGui::DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, const // User can input math operators (e.g. +100) to edit a numerical values. // NB: This is _not_ a full expression evaluator. We should probably add one and replace this dumb mess.. -bool ImGui::DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* p_data, const char* format) +bool ImGui::DataTypeApplyFromText(const char* buf, ImGuiDataType data_type, void* p_data, const char* format) { while (ImCharIsBlankA(*buf)) buf++; - - // We don't support '-' op because it would conflict with inputing negative value. - // Instead you can use +-100 to subtract from an existing value - char op = buf[0]; - if (op == '+' || op == '*' || op == '/') - { - buf++; - while (ImCharIsBlankA(*buf)) - buf++; - } - else - { - op = 0; - } if (!buf[0]) return false; @@ -2018,66 +2089,20 @@ bool ImGui::DataTypeApplyOpFromText(const char* buf, const char* initial_value_b ImGuiDataTypeTempStorage data_backup; memcpy(&data_backup, p_data, type_info->Size); - if (format == NULL) + // Sanitize format + // For float/double we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in, so force them into %f and %lf + char format_sanitized[32]; + if (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) format = type_info->ScanFmt; - - // FIXME-LEGACY: The aim is to remove those operators and write a proper expression evaluator at some point.. - int arg1i = 0; - if (data_type == ImGuiDataType_S32) - { - int* v = (int*)p_data; - int arg0i = *v; - float arg1f = 0.0f; - if (op && sscanf(initial_value_buf, format, &arg0i) < 1) - return false; - // Store operand in a float so we can use fractional value for multipliers (*1.1), but constant always parsed as integer so we can fit big integers (e.g. 2000000003) past float precision - if (op == '+') { if (sscanf(buf, "%d", &arg1i)) *v = (int)(arg0i + arg1i); } // Add (use "+-" to subtract) - else if (op == '*') { if (sscanf(buf, "%f", &arg1f)) *v = (int)(arg0i * arg1f); } // Multiply - else if (op == '/') { if (sscanf(buf, "%f", &arg1f) && arg1f != 0.0f) *v = (int)(arg0i / arg1f); } // Divide - else { if (sscanf(buf, format, &arg1i) == 1) *v = arg1i; } // Assign constant - } - else if (data_type == ImGuiDataType_Float) - { - // For floats we have to ignore format with precision (e.g. "%.2f") because sscanf doesn't take them in - format = "%f"; - float* v = (float*)p_data; - float arg0f = *v, arg1f = 0.0f; - if (op && sscanf(initial_value_buf, format, &arg0f) < 1) - return false; - if (sscanf(buf, format, &arg1f) < 1) - return false; - if (op == '+') { *v = arg0f + arg1f; } // Add (use "+-" to subtract) - else if (op == '*') { *v = arg0f * arg1f; } // Multiply - else if (op == '/') { if (arg1f != 0.0f) *v = arg0f / arg1f; } // Divide - else { *v = arg1f; } // Assign constant - } - else if (data_type == ImGuiDataType_Double) - { - format = "%lf"; // scanf differentiate float/double unlike printf which forces everything to double because of ellipsis - double* v = (double*)p_data; - double arg0f = *v, arg1f = 0.0; - if (op && sscanf(initial_value_buf, format, &arg0f) < 1) - return false; - if (sscanf(buf, format, &arg1f) < 1) - return false; - if (op == '+') { *v = arg0f + arg1f; } // Add (use "+-" to subtract) - else if (op == '*') { *v = arg0f * arg1f; } // Multiply - else if (op == '/') { if (arg1f != 0.0f) *v = arg0f / arg1f; } // Divide - else { *v = arg1f; } // Assign constant - } - else if (data_type == ImGuiDataType_U32 || data_type == ImGuiDataType_S64 || data_type == ImGuiDataType_U64) - { - // All other types assign constant - // We don't bother handling support for legacy operators since they are a little too crappy. Instead we will later implement a proper expression evaluator in the future. - if (sscanf(buf, format, p_data) < 1) - return false; - } else + format = ImParseFormatSanitizeForScanning(format, format_sanitized, IM_ARRAYSIZE(format_sanitized)); + + // Small types need a 32-bit buffer to receive the result from scanf() + int v32 = 0; + if (sscanf(buf, format, type_info->Size >= 4 ? p_data : &v32) < 1) + return false; + if (type_info->Size < 4) { - // Small types need a 32-bit buffer to receive the result from scanf() - int v32; - if (sscanf(buf, format, &v32) < 1) - return false; if (data_type == ImGuiDataType_S8) *(ImS8*)p_data = (ImS8)ImClamp(v32, (int)IM_S8_MIN, (int)IM_S8_MAX); else if (data_type == ImGuiDataType_U8) @@ -2159,45 +2184,17 @@ static float GetMinimumStepAtDecimalPrecision(int decimal_precision) } template -static const char* ImAtoi(const char* src, TYPE* output) -{ - int negative = 0; - if (*src == '-') { negative = 1; src++; } - if (*src == '+') { src++; } - TYPE v = 0; - while (*src >= '0' && *src <= '9') - v = (v * 10) + (*src++ - '0'); - *output = negative ? -v : v; - return src; -} - -// Sanitize format -// - Zero terminate so extra characters after format (e.g. "%f123") don't confuse atof/atoi -// - stb_sprintf.h supports several new modifiers which format numbers in a way that also makes them incompatible atof/atoi. -static void SanitizeFormatString(const char* fmt, char* fmt_out, size_t fmt_out_size) -{ - IM_UNUSED(fmt_out_size); - const char* fmt_end = ImParseFormatFindEnd(fmt); - IM_ASSERT((size_t)(fmt_end - fmt + 1) < fmt_out_size); // Format is too long, let us know if this happens to you! - while (fmt < fmt_end) - { - char c = *(fmt++); - if (c != '\'' && c != '$' && c != '_') // Custom flags provided by stb_sprintf.h. POSIX 2008 also supports '. - *(fmt_out++) = c; - } - *fmt_out = 0; // Zero-terminate -} - -template TYPE ImGui::RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, TYPE v) { + IM_UNUSED(data_type); + IM_ASSERT(data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double); const char* fmt_start = ImParseFormatFindStart(format); if (fmt_start[0] != '%' || fmt_start[1] == '%') // Don't apply if the value is not visible in the format string return v; // Sanitize format char fmt_sanitized[32]; - SanitizeFormatString(fmt_start, fmt_sanitized, IM_ARRAYSIZE(fmt_sanitized)); + ImParseFormatSanitizeForPrinting(fmt_start, fmt_sanitized, IM_ARRAYSIZE(fmt_sanitized)); fmt_start = fmt_sanitized; // Format value with our rounding, and read back @@ -2206,10 +2203,8 @@ TYPE ImGui::RoundScalarWithFormatT(const char* format, ImGuiDataType data_type, const char* p = v_str; while (*p == ' ') p++; - if (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) - v = (TYPE)ImAtof(p); - else - ImAtoi(p, (SIGNEDTYPE*)&v); + v = (TYPE)ImAtof(p); + return v; } @@ -2256,10 +2251,13 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const if (g.IO.KeyShift) adjust_delta *= 10.0f; } - else if (g.ActiveIdSource == ImGuiInputSource_Nav) + else if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) { const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0; - adjust_delta = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_RepeatFast, 1.0f / 10.0f, 10.0f)[axis]; + const bool tweak_slow = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakSlow : ImGuiKey_NavKeyboardTweakSlow); + const bool tweak_fast = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakFast : ImGuiKey_NavKeyboardTweakFast); + const float tweak_factor = tweak_slow ? 1.0f / 1.0f : tweak_fast ? 10.0f : 1.0f; + adjust_delta = GetNavTweakPressedAmount(axis) * tweak_factor; v_speed = ImMax(v_speed, GetMinimumStepAtDecimalPrecision(decimal_precision)); } adjust_delta *= v_speed; @@ -2313,8 +2311,8 @@ bool ImGui::DragBehaviorT(ImGuiDataType data_type, TYPE* v, float v_speed, const } // Round to user desired precision based on format string - if (!(flags & ImGuiSliderFlags_NoRoundToFormat)) - v_cur = RoundScalarWithFormatT(format, data_type, v_cur); + if (is_floating_point && !(flags & ImGuiSliderFlags_NoRoundToFormat)) + v_cur = RoundScalarWithFormatT(format, data_type, v_cur); // Preserve remainder after rounding has been applied. This also allow slow tweaking of values. g.DragCurrentAccumDirty = false; @@ -2357,9 +2355,10 @@ bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v ImGuiContext& g = *GImGui; if (g.ActiveId == id) { + // Those are the things we can do easily outside the DragBehaviorT<> template, saves code generation. if (g.ActiveIdSource == ImGuiInputSource_Mouse && !g.IO.MouseDown[0]) ClearActiveID(); - else if (g.ActiveIdSource == ImGuiInputSource_Nav && g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated) + else if ((g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) && g.NavActivatePressedId == id && !g.ActiveIdIsJustActivated) ClearActiveID(); } if (g.ActiveId != id) @@ -2410,36 +2409,38 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data, // Default format string when passing NULL if (format == NULL) format = DataTypeGetInfo(data_type)->PrintFmt; - else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.) - format = PatchFormatStringFloatToInt(format); - // Tabbing or CTRL-clicking on Drag turns it into an InputText const bool hovered = ItemHoverable(frame_bb, id); bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id); if (!temp_input_is_active) { + // Tabbing or CTRL-clicking on Drag turns it into an InputText const bool input_requested_by_tabbing = temp_input_allowed && (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_FocusedByTabbing) != 0; - const bool clicked = (hovered && g.IO.MouseClicked[0]); - const bool double_clicked = (hovered && g.IO.MouseClickedCount[0] == 2); - if (input_requested_by_tabbing || clicked || double_clicked || g.NavActivateId == id || g.NavActivateInputId == id) - { - SetActiveID(id, window); - SetFocusID(id, window); - FocusWindow(window); - g.ActiveIdUsingNavDirMask = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right); - if (temp_input_allowed) - if (input_requested_by_tabbing || (clicked && g.IO.KeyCtrl) || double_clicked || g.NavActivateInputId == id) - temp_input_is_active = true; - } + const bool clicked = hovered && IsMouseClicked(0, id); + const bool double_clicked = (hovered && g.IO.MouseClickedCount[0] == 2 && TestKeyOwner(ImGuiKey_MouseLeft, id)); + const bool make_active = (input_requested_by_tabbing || clicked || double_clicked || g.NavActivateId == id); + if (make_active && (clicked || double_clicked)) + SetKeyOwner(ImGuiKey_MouseLeft, id); + if (make_active && temp_input_allowed) + if (input_requested_by_tabbing || (clicked && g.IO.KeyCtrl) || double_clicked || (g.NavActivateId == id && (g.NavActivateFlags & ImGuiActivateFlags_PreferInput))) + temp_input_is_active = true; - // Experimental: simple click (without moving) turns Drag into an InputText + // (Optional) simple click (without moving) turns Drag into an InputText if (g.IO.ConfigDragClickToInputText && temp_input_allowed && !temp_input_is_active) if (g.ActiveId == id && hovered && g.IO.MouseReleased[0] && !IsMouseDragPastThreshold(0, g.IO.MouseDragThreshold * DRAG_MOUSE_THRESHOLD_FACTOR)) { - g.NavActivateId = g.NavActivateInputId = id; + g.NavActivateId = id; g.NavActivateFlags = ImGuiActivateFlags_PreferInput; temp_input_is_active = true; } + + if (make_active && !temp_input_is_active) + { + SetActiveID(id, window); + SetFocusID(id, window); + FocusWindow(window); + g.ActiveIdUsingNavDirMask = (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right); + } } if (temp_input_is_active) @@ -2469,7 +2470,7 @@ bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data, if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); - IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags); + IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | (temp_input_allowed ? ImGuiItemStatusFlags_Inputable : 0)); return value_changed; } @@ -2615,35 +2616,6 @@ bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_ return value_changed; } -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - -// Obsolete versions with power parameter. See https://github.com/ocornut/imgui/issues/3361 for details. -bool ImGui::DragScalar(const char* label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, float power) -{ - ImGuiSliderFlags drag_flags = ImGuiSliderFlags_None; - if (power != 1.0f) - { - IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!"); - IM_ASSERT(p_min != NULL && p_max != NULL); // When using a power curve the drag needs to have known bounds - drag_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths - } - return DragScalar(label, data_type, p_data, v_speed, p_min, p_max, format, drag_flags); -} - -bool ImGui::DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, float power) -{ - ImGuiSliderFlags drag_flags = ImGuiSliderFlags_None; - if (power != 1.0f) - { - IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!"); - IM_ASSERT(p_min != NULL && p_max != NULL); // When using a power curve the drag needs to have known bounds - drag_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths - } - return DragScalarN(label, data_type, p_data, components, v_speed, p_min, p_max, format, drag_flags); -} - -#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS - //------------------------------------------------------------------------- // [SECTION] Widgets: SliderScalar, SliderFloat, SliderInt, etc. //------------------------------------------------------------------------- @@ -2694,7 +2666,6 @@ float ImGui::ScaleRatioFromValueT(ImGuiDataType data_type, TYPE v, TYPE v_min, T v_max_fudged = -logarithmic_zero_epsilon; float result; - if (v_clamped <= v_min_fudged) result = 0.0f; // Workaround for values that are in-range but below our fudge else if (v_clamped >= v_max_fudged) @@ -2718,91 +2689,81 @@ float ImGui::ScaleRatioFromValueT(ImGuiDataType data_type, TYPE v, TYPE v_min, T return flipped ? (1.0f - result) : result; } - - // Linear slider - return (float)((FLOATTYPE)(SIGNEDTYPE)(v_clamped - v_min) / (FLOATTYPE)(SIGNEDTYPE)(v_max - v_min)); + else + { + // Linear slider + return (float)((FLOATTYPE)(SIGNEDTYPE)(v_clamped - v_min) / (FLOATTYPE)(SIGNEDTYPE)(v_max - v_min)); + } } // Convert a parametric position on a slider into a value v in the output space (the logical opposite of ScaleRatioFromValueT) template TYPE ImGui::ScaleValueFromRatioT(ImGuiDataType data_type, float t, TYPE v_min, TYPE v_max, bool is_logarithmic, float logarithmic_zero_epsilon, float zero_deadzone_halfsize) { - if (v_min == v_max) + // We special-case the extents because otherwise our logarithmic fudging can lead to "mathematically correct" + // but non-intuitive behaviors like a fully-left slider not actually reaching the minimum value. Also generally simpler. + if (t <= 0.0f || v_min == v_max) return v_min; - const bool is_floating_point = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double); + if (t >= 1.0f) + return v_max; - TYPE result; + TYPE result = (TYPE)0; if (is_logarithmic) { - // We special-case the extents because otherwise our fudging can lead to "mathematically correct" but non-intuitive behaviors like a fully-left slider not actually reaching the minimum value - if (t <= 0.0f) - result = v_min; - else if (t >= 1.0f) - result = v_max; - else - { - bool flipped = v_max < v_min; // Check if range is "backwards" - - // Fudge min/max to avoid getting silly results close to zero - FLOATTYPE v_min_fudged = (ImAbs((FLOATTYPE)v_min) < logarithmic_zero_epsilon) ? ((v_min < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_min; - FLOATTYPE v_max_fudged = (ImAbs((FLOATTYPE)v_max) < logarithmic_zero_epsilon) ? ((v_max < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_max; + // Fudge min/max to avoid getting silly results close to zero + FLOATTYPE v_min_fudged = (ImAbs((FLOATTYPE)v_min) < logarithmic_zero_epsilon) ? ((v_min < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_min; + FLOATTYPE v_max_fudged = (ImAbs((FLOATTYPE)v_max) < logarithmic_zero_epsilon) ? ((v_max < 0.0f) ? -logarithmic_zero_epsilon : logarithmic_zero_epsilon) : (FLOATTYPE)v_max; - if (flipped) - ImSwap(v_min_fudged, v_max_fudged); + const bool flipped = v_max < v_min; // Check if range is "backwards" + if (flipped) + ImSwap(v_min_fudged, v_max_fudged); - // Awkward special case - we need ranges of the form (-100 .. 0) to convert to (-100 .. -epsilon), not (-100 .. epsilon) - if ((v_max == 0.0f) && (v_min < 0.0f)) - v_max_fudged = -logarithmic_zero_epsilon; + // Awkward special case - we need ranges of the form (-100 .. 0) to convert to (-100 .. -epsilon), not (-100 .. epsilon) + if ((v_max == 0.0f) && (v_min < 0.0f)) + v_max_fudged = -logarithmic_zero_epsilon; - float t_with_flip = flipped ? (1.0f - t) : t; // t, but flipped if necessary to account for us flipping the range + float t_with_flip = flipped ? (1.0f - t) : t; // t, but flipped if necessary to account for us flipping the range - if ((v_min * v_max) < 0.0f) // Range crosses zero, so we have to do this in two parts - { - float zero_point_center = (-(float)ImMin(v_min, v_max)) / ImAbs((float)v_max - (float)v_min); // The zero point in parametric space - float zero_point_snap_L = zero_point_center - zero_deadzone_halfsize; - float zero_point_snap_R = zero_point_center + zero_deadzone_halfsize; - if (t_with_flip >= zero_point_snap_L && t_with_flip <= zero_point_snap_R) - result = (TYPE)0.0f; // Special case to make getting exactly zero possible (the epsilon prevents it otherwise) - else if (t_with_flip < zero_point_center) - result = (TYPE)-(logarithmic_zero_epsilon * ImPow(-v_min_fudged / logarithmic_zero_epsilon, (FLOATTYPE)(1.0f - (t_with_flip / zero_point_snap_L)))); - else - result = (TYPE)(logarithmic_zero_epsilon * ImPow(v_max_fudged / logarithmic_zero_epsilon, (FLOATTYPE)((t_with_flip - zero_point_snap_R) / (1.0f - zero_point_snap_R)))); - } - else if ((v_min < 0.0f) || (v_max < 0.0f)) // Entirely negative slider - result = (TYPE)-(-v_max_fudged * ImPow(-v_min_fudged / -v_max_fudged, (FLOATTYPE)(1.0f - t_with_flip))); + if ((v_min * v_max) < 0.0f) // Range crosses zero, so we have to do this in two parts + { + float zero_point_center = (-(float)ImMin(v_min, v_max)) / ImAbs((float)v_max - (float)v_min); // The zero point in parametric space + float zero_point_snap_L = zero_point_center - zero_deadzone_halfsize; + float zero_point_snap_R = zero_point_center + zero_deadzone_halfsize; + if (t_with_flip >= zero_point_snap_L && t_with_flip <= zero_point_snap_R) + result = (TYPE)0.0f; // Special case to make getting exactly zero possible (the epsilon prevents it otherwise) + else if (t_with_flip < zero_point_center) + result = (TYPE)-(logarithmic_zero_epsilon * ImPow(-v_min_fudged / logarithmic_zero_epsilon, (FLOATTYPE)(1.0f - (t_with_flip / zero_point_snap_L)))); else - result = (TYPE)(v_min_fudged * ImPow(v_max_fudged / v_min_fudged, (FLOATTYPE)t_with_flip)); + result = (TYPE)(logarithmic_zero_epsilon * ImPow(v_max_fudged / logarithmic_zero_epsilon, (FLOATTYPE)((t_with_flip - zero_point_snap_R) / (1.0f - zero_point_snap_R)))); } + else if ((v_min < 0.0f) || (v_max < 0.0f)) // Entirely negative slider + result = (TYPE)-(-v_max_fudged * ImPow(-v_min_fudged / -v_max_fudged, (FLOATTYPE)(1.0f - t_with_flip))); + else + result = (TYPE)(v_min_fudged * ImPow(v_max_fudged / v_min_fudged, (FLOATTYPE)t_with_flip)); } else { // Linear slider + const bool is_floating_point = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double); if (is_floating_point) { result = ImLerp(v_min, v_max, t); } - else + else if (t < 1.0) { // - For integer values we want the clicking position to match the grab box so we round above // This code is carefully tuned to work with large values (e.g. high ranges of U64) while preserving this property.. // - Not doing a *1.0 multiply at the end of a range as it tends to be lossy. While absolute aiming at a large s64/u64 // range is going to be imprecise anyway, with this check we at least make the edge values matches expected limits. - if (t < 1.0) - { - FLOATTYPE v_new_off_f = (SIGNEDTYPE)(v_max - v_min) * t; - result = (TYPE)((SIGNEDTYPE)v_min + (SIGNEDTYPE)(v_new_off_f + (FLOATTYPE)(v_min > v_max ? -0.5 : 0.5))); - } - else - { - result = v_max; - } + FLOATTYPE v_new_off_f = (SIGNEDTYPE)(v_max - v_min) * t; + result = (TYPE)((SIGNEDTYPE)v_min + (SIGNEDTYPE)(v_new_off_f + (FLOATTYPE)(v_min > v_max ? -0.5 : 0.5))); } } return result; } -// FIXME: Move more of the code into SliderBehavior() +// FIXME: Try to move more of the code into shared SliderBehavior() template bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_type, TYPE* v, const TYPE v_min, const TYPE v_max, const char* format, ImGuiSliderFlags flags, ImRect* out_grab_bb) { @@ -2812,13 +2773,14 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ const ImGuiAxis axis = (flags & ImGuiSliderFlags_Vertical) ? ImGuiAxis_Y : ImGuiAxis_X; const bool is_logarithmic = (flags & ImGuiSliderFlags_Logarithmic) != 0; const bool is_floating_point = (data_type == ImGuiDataType_Float) || (data_type == ImGuiDataType_Double); + const SIGNEDTYPE v_range = (v_min < v_max ? v_max - v_min : v_min - v_max); - const float grab_padding = 2.0f; + // Calculate bounds + const float grab_padding = 2.0f; // FIXME: Should be part of style. const float slider_sz = (bb.Max[axis] - bb.Min[axis]) - grab_padding * 2.0f; float grab_sz = style.GrabMinSize; - SIGNEDTYPE v_range = (v_min < v_max ? v_max - v_min : v_min - v_max); - if (!is_floating_point && v_range >= 0) // v_range < 0 may happen on integer overflows - grab_sz = ImMax((float)(slider_sz / (v_range + 1)), style.GrabMinSize); // For integer sliders: if possible have the grab size represent 1 unit + if (!is_floating_point && v_range >= 0) // v_range < 0 may happen on integer overflows + grab_sz = ImMax((float)(slider_sz / (v_range + 1)), style.GrabMinSize); // For integer sliders: if possible have the grab size represent 1 unit grab_sz = ImMin(grab_sz, slider_sz); const float slider_usable_sz = slider_sz - grab_sz; const float slider_usable_pos_min = bb.Min[axis] + grab_padding + grab_sz * 0.5f; @@ -2849,13 +2811,23 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ else { const float mouse_abs_pos = g.IO.MousePos[axis]; - clicked_t = (slider_usable_sz > 0.0f) ? ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0f; + if (g.ActiveIdIsJustActivated) + { + float grab_t = ScaleRatioFromValueT(data_type, *v, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize); + if (axis == ImGuiAxis_Y) + grab_t = 1.0f - grab_t; + const float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t); + const bool clicked_around_grab = (mouse_abs_pos >= grab_pos - grab_sz * 0.5f - 1.0f) && (mouse_abs_pos <= grab_pos + grab_sz * 0.5f + 1.0f); // No harm being extra generous here. + g.SliderGrabClickOffset = (clicked_around_grab && is_floating_point) ? mouse_abs_pos - grab_pos : 0.0f; + } + if (slider_usable_sz > 0.0f) + clicked_t = ImSaturate((mouse_abs_pos - g.SliderGrabClickOffset - slider_usable_pos_min) / slider_usable_sz); if (axis == ImGuiAxis_Y) clicked_t = 1.0f - clicked_t; set_new_value = true; } } - else if (g.ActiveIdSource == ImGuiInputSource_Nav) + else if (g.ActiveIdSource == ImGuiInputSource_Keyboard || g.ActiveIdSource == ImGuiInputSource_Gamepad) { if (g.ActiveIdIsJustActivated) { @@ -2863,25 +2835,26 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ g.SliderCurrentAccumDirty = false; } - const ImVec2 input_delta2 = GetNavInputAmount2d(ImGuiNavDirSourceFlags_Keyboard | ImGuiNavDirSourceFlags_PadDPad, ImGuiInputReadMode_RepeatFast, 0.0f, 0.0f); - float input_delta = (axis == ImGuiAxis_X) ? input_delta2.x : -input_delta2.y; + float input_delta = (axis == ImGuiAxis_X) ? GetNavTweakPressedAmount(axis) : -GetNavTweakPressedAmount(axis); if (input_delta != 0.0f) { + const bool tweak_slow = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakSlow : ImGuiKey_NavKeyboardTweakSlow); + const bool tweak_fast = IsKeyDown((g.NavInputSource == ImGuiInputSource_Gamepad) ? ImGuiKey_NavGamepadTweakFast : ImGuiKey_NavKeyboardTweakFast); const int decimal_precision = is_floating_point ? ImParseFormatPrecision(format, 3) : 0; if (decimal_precision > 0) { input_delta /= 100.0f; // Gamepad/keyboard tweak speeds in % of slider bounds - if (IsNavInputDown(ImGuiNavInput_TweakSlow)) + if (tweak_slow) input_delta /= 10.0f; } else { - if ((v_range >= -100.0f && v_range <= 100.0f) || IsNavInputDown(ImGuiNavInput_TweakSlow)) + if ((v_range >= -100.0f && v_range <= 100.0f) || tweak_slow) input_delta = ((input_delta < 0.0f) ? -1.0f : +1.0f) / (float)v_range; // Gamepad/keyboard tweak speeds in integer steps else input_delta /= 100.0f; } - if (IsNavInputDown(ImGuiNavInput_TweakFast)) + if (tweak_fast) input_delta *= 10.0f; g.SliderCurrentAccum += input_delta; @@ -2910,8 +2883,8 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ // Calculate what our "new" clicked_t will be, and thus how far we actually moved the slider, and subtract this from the accumulator TYPE v_new = ScaleValueFromRatioT(data_type, clicked_t, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize); - if (!(flags & ImGuiSliderFlags_NoRoundToFormat)) - v_new = RoundScalarWithFormatT(format, data_type, v_new); + if (is_floating_point && !(flags & ImGuiSliderFlags_NoRoundToFormat)) + v_new = RoundScalarWithFormatT(format, data_type, v_new); float new_clicked_t = ScaleRatioFromValueT(data_type, v_new, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize); if (delta > 0) @@ -2929,8 +2902,8 @@ bool ImGui::SliderBehaviorT(const ImRect& bb, ImGuiID id, ImGuiDataType data_typ TYPE v_new = ScaleValueFromRatioT(data_type, clicked_t, v_min, v_max, is_logarithmic, logarithmic_zero_epsilon, zero_deadzone_halfsize); // Round to user desired precision based on format string - if (!(flags & ImGuiSliderFlags_NoRoundToFormat)) - v_new = RoundScalarWithFormatT(format, data_type, v_new); + if (is_floating_point && !(flags & ImGuiSliderFlags_NoRoundToFormat)) + v_new = RoundScalarWithFormatT(format, data_type, v_new); // Apply result if (*v != v_new) @@ -2969,6 +2942,7 @@ bool ImGui::SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type // Read imgui.cpp "API BREAKING CHANGES" section for 1.78 if you hit this assert. IM_ASSERT((flags == 1 || (flags & ImGuiSliderFlags_InvalidMask_) == 0) && "Invalid ImGuiSliderFlags flag! Has the 'float power' argument been mistakenly cast to flags? Call function with ImGuiSliderFlags_Logarithmic flags instead."); + // Those are the things we can do easily outside the SliderBehaviorT<> template, saves code generation. ImGuiContext& g = *GImGui; if ((g.LastItemData.InFlags & ImGuiItemFlags_ReadOnly) || (flags & ImGuiSliderFlags_ReadOnly)) return false; @@ -3028,24 +3002,27 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat // Default format string when passing NULL if (format == NULL) format = DataTypeGetInfo(data_type)->PrintFmt; - else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.) - format = PatchFormatStringFloatToInt(format); - // Tabbing or CTRL-clicking on Slider turns it into an input box const bool hovered = ItemHoverable(frame_bb, id); bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id); if (!temp_input_is_active) { + // Tabbing or CTRL-clicking on Slider turns it into an input box const bool input_requested_by_tabbing = temp_input_allowed && (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_FocusedByTabbing) != 0; - const bool clicked = (hovered && g.IO.MouseClicked[0]); - if (input_requested_by_tabbing || clicked || g.NavActivateId == id || g.NavActivateInputId == id) + const bool clicked = hovered && IsMouseClicked(0, id); + const bool make_active = (input_requested_by_tabbing || clicked || g.NavActivateId == id); + if (make_active && clicked) + SetKeyOwner(ImGuiKey_MouseLeft, id); + if (make_active && temp_input_allowed) + if (input_requested_by_tabbing || (clicked && g.IO.KeyCtrl) || (g.NavActivateId == id && (g.NavActivateFlags & ImGuiActivateFlags_PreferInput))) + temp_input_is_active = true; + + if (make_active && !temp_input_is_active) { SetActiveID(id, window); SetFocusID(id, window); FocusWindow(window); g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right); - if (temp_input_allowed && (input_requested_by_tabbing || (clicked && g.IO.KeyCtrl) || g.NavActivateInputId == id)) - temp_input_is_active = true; } } @@ -3081,7 +3058,7 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat if (label_size.x > 0.0f) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); - IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags); + IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | (temp_input_allowed ? ImGuiItemStatusFlags_Inputable : 0)); return value_changed; } @@ -3192,12 +3169,13 @@ bool ImGui::VSliderScalar(const char* label, const ImVec2& size, ImGuiDataType d // Default format string when passing NULL if (format == NULL) format = DataTypeGetInfo(data_type)->PrintFmt; - else if (data_type == ImGuiDataType_S32 && strcmp(format, "%d") != 0) // (FIXME-LEGACY: Patch old "%.0f" format string to use "%d", read function more details.) - format = PatchFormatStringFloatToInt(format); const bool hovered = ItemHoverable(frame_bb, id); - if ((hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || g.NavActivateInputId == id) + const bool clicked = hovered && IsMouseClicked(0, id); + if (clicked || g.NavActivateId == id) { + if (clicked) + SetKeyOwner(ImGuiKey_MouseLeft, id); SetActiveID(id, window); SetFocusID(id, window); FocusWindow(window); @@ -3240,39 +3218,14 @@ bool ImGui::VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, return VSliderScalar(label, size, ImGuiDataType_S32, v, &v_min, &v_max, format, flags); } -#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS - -// Obsolete versions with power parameter. See https://github.com/ocornut/imgui/issues/3361 for details. -bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, float power) -{ - ImGuiSliderFlags slider_flags = ImGuiSliderFlags_None; - if (power != 1.0f) - { - IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!"); - slider_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths - } - return SliderScalar(label, data_type, p_data, p_min, p_max, format, slider_flags); -} - -bool ImGui::SliderScalarN(const char* label, ImGuiDataType data_type, void* v, int components, const void* v_min, const void* v_max, const char* format, float power) -{ - ImGuiSliderFlags slider_flags = ImGuiSliderFlags_None; - if (power != 1.0f) - { - IM_ASSERT(power == 1.0f && "Call function with ImGuiSliderFlags_Logarithmic flags instead of using the old 'float power' function!"); - slider_flags |= ImGuiSliderFlags_Logarithmic; // Fallback for non-asserting paths - } - return SliderScalarN(label, data_type, v, components, v_min, v_max, format, slider_flags); -} - -#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS - //------------------------------------------------------------------------- // [SECTION] Widgets: InputScalar, InputFloat, InputInt, etc. //------------------------------------------------------------------------- // - ImParseFormatFindStart() [Internal] // - ImParseFormatFindEnd() [Internal] // - ImParseFormatTrimDecorations() [Internal] +// - ImParseFormatSanitizeForPrinting() [Internal] +// - ImParseFormatSanitizeForScanning() [Internal] // - ImParseFormatPrecision() [Internal] // - TempInputTextScalar() [Internal] // - InputScalar() @@ -3336,6 +3289,57 @@ const char* ImParseFormatTrimDecorations(const char* fmt, char* buf, size_t buf_ return buf; } +// Sanitize format +// - Zero terminate so extra characters after format (e.g. "%f123") don't confuse atof/atoi +// - stb_sprintf.h supports several new modifiers which format numbers in a way that also makes them incompatible atof/atoi. +void ImParseFormatSanitizeForPrinting(const char* fmt_in, char* fmt_out, size_t fmt_out_size) +{ + const char* fmt_end = ImParseFormatFindEnd(fmt_in); + IM_UNUSED(fmt_out_size); + IM_ASSERT((size_t)(fmt_end - fmt_in + 1) < fmt_out_size); // Format is too long, let us know if this happens to you! + while (fmt_in < fmt_end) + { + char c = *fmt_in++; + if (c != '\'' && c != '$' && c != '_') // Custom flags provided by stb_sprintf.h. POSIX 2008 also supports '. + *(fmt_out++) = c; + } + *fmt_out = 0; // Zero-terminate +} + +// - For scanning we need to remove all width and precision fields and flags "%+3.7f" -> "%f". BUT don't strip types like "%I64d" which includes digits. ! "%07I64d" -> "%I64d" +const char* ImParseFormatSanitizeForScanning(const char* fmt_in, char* fmt_out, size_t fmt_out_size) +{ + const char* fmt_end = ImParseFormatFindEnd(fmt_in); + const char* fmt_out_begin = fmt_out; + IM_UNUSED(fmt_out_size); + IM_ASSERT((size_t)(fmt_end - fmt_in + 1) < fmt_out_size); // Format is too long, let us know if this happens to you! + bool has_type = false; + while (fmt_in < fmt_end) + { + char c = *fmt_in++; + if (!has_type && ((c >= '0' && c <= '9') || c == '.' || c == '+' || c == '#')) + continue; + has_type |= ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); // Stop skipping digits + if (c != '\'' && c != '$' && c != '_') // Custom flags provided by stb_sprintf.h. POSIX 2008 also supports '. + *(fmt_out++) = c; + } + *fmt_out = 0; // Zero-terminate + return fmt_out_begin; +} + +template +static const char* ImAtoi(const char* src, TYPE* output) +{ + int negative = 0; + if (*src == '-') { negative = 1; src++; } + if (*src == '+') { src++; } + TYPE v = 0; + while (*src >= '0' && *src <= '9') + v = (v * 10) + (*src++ - '0'); + *output = negative ? -v : v; + return src; +} + // Parse display precision back from the display format string // FIXME: This is still used by some navigation code path to infer a minimum tweak step, but we should aim to rework widgets so it isn't needed. int ImParseFormatPrecision(const char* fmt, int default_precision) @@ -3382,13 +3386,19 @@ bool ImGui::TempInputText(const ImRect& bb, ImGuiID id, const char* label, char* return value_changed; } +static inline ImGuiInputTextFlags InputScalar_DefaultCharsFilter(ImGuiDataType data_type, const char* format) +{ + if (data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) + return ImGuiInputTextFlags_CharsScientific; + const char format_last_char = format[0] ? format[strlen(format) - 1] : 0; + return (format_last_char == 'x' || format_last_char == 'X') ? ImGuiInputTextFlags_CharsHexadecimal : ImGuiInputTextFlags_CharsDecimal; +} + // Note that Drag/Slider functions are only forwarding the min/max values clamping values if the ImGuiSliderFlags_AlwaysClamp flag is set! // This is intended: this way we allow CTRL+Click manual input to set a value out of bounds, for maximum flexibility. // However this may not be ideal for all uses, as some user code may break on out of bound values. bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* p_data, const char* format, const void* p_clamp_min, const void* p_clamp_max) { - ImGuiContext& g = *GImGui; - char fmt_buf[32]; char data_buf[32]; format = ImParseFormatTrimDecorations(format, fmt_buf, IM_ARRAYSIZE(fmt_buf)); @@ -3396,7 +3406,8 @@ bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImG ImStrTrimBlanks(data_buf); ImGuiInputTextFlags flags = ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoMarkEdited; - flags |= ((data_type == ImGuiDataType_Float || data_type == ImGuiDataType_Double) ? ImGuiInputTextFlags_CharsScientific : ImGuiInputTextFlags_CharsDecimal); + flags |= InputScalar_DefaultCharsFilter(data_type, format); + bool value_changed = false; if (TempInputText(bb, id, label, data_buf, IM_ARRAYSIZE(data_buf), flags)) { @@ -3406,7 +3417,7 @@ bool ImGui::TempInputScalar(const ImRect& bb, ImGuiID id, const char* label, ImG memcpy(&data_backup, p_data, data_type_size); // Apply new value (or operations) then clamp - DataTypeApplyOpFromText(data_buf, g.InputTextState.InitialTextA.Data, data_type, p_data, NULL); + DataTypeApplyFromText(data_buf, data_type, p_data, format); if (p_clamp_min || p_clamp_max) { if (p_clamp_min && p_clamp_max && DataTypeCompare(data_type, p_clamp_min, p_clamp_max) > 0) @@ -3439,13 +3450,18 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data char buf[64]; DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, p_data, format); - bool value_changed = false; - if ((flags & (ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsScientific)) == 0) - flags |= ImGuiInputTextFlags_CharsDecimal; - flags |= ImGuiInputTextFlags_AutoSelectAll; - flags |= ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves by comparing the actual data rather than the string. + // Testing ActiveId as a minor optimization as filtering is not needed until active + if (g.ActiveId == 0 && (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsScientific)) == 0) + flags |= InputScalar_DefaultCharsFilter(data_type, format); + flags |= ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoMarkEdited; // We call MarkItemEdited() ourselves by comparing the actual data rather than the string. - if (p_step != NULL) + bool value_changed = false; + if (p_step == NULL) + { + if (InputText(label, buf, IM_ARRAYSIZE(buf), flags)) + value_changed = DataTypeApplyFromText(buf, data_type, p_data, format); + } + else { const float button_size = GetFrameHeight(); @@ -3453,7 +3469,8 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data PushID(label); SetNextItemWidth(ImMax(1.0f, CalcItemWidth() - (button_size + style.ItemInnerSpacing.x) * 2)); if (InputText("", buf, IM_ARRAYSIZE(buf), flags)) // PushId(label) + "" gives us the expected ID from outside point of view - value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialTextA.Data, data_type, p_data, format); + value_changed = DataTypeApplyFromText(buf, data_type, p_data, format); + IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Inputable); // Step buttons const ImVec2 backup_frame_padding = style.FramePadding; @@ -3487,11 +3504,6 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* p_data PopID(); EndGroup(); } - else - { - if (InputText(label, buf, IM_ARRAYSIZE(buf), flags)) - value_changed = DataTypeApplyOpFromText(buf, g.InputTextState.InitialTextA.Data, data_type, p_data, format); - } if (value_changed) MarkItemEdited(g.LastItemData.ID); @@ -3588,7 +3600,11 @@ bool ImGui::InputDouble(const char* label, double* v, double step, double step_f // - InputText() // - InputTextWithHint() // - InputTextMultiline() +// - InputTextGetCharInfo() [Internal] +// - InputTextReindexLines() [Internal] +// - InputTextReindexLinesRange() [Internal] // - InputTextEx() [Internal] +// - DebugNodeInputTextState() [Internal] //------------------------------------------------------------------------- bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) @@ -3604,7 +3620,7 @@ bool ImGui::InputTextMultiline(const char* label, char* buf, size_t buf_size, co bool ImGui::InputTextWithHint(const char* label, const char* hint, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) { - IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline() + IM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline() or InputTextEx() manually if you need multi-line + hint. return InputTextEx(label, hint, buf, (int)buf_size, ImVec2(0, 0), flags, callback, user_data); } @@ -3622,9 +3638,9 @@ static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** return line_count; } -static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line) +static ImVec2 InputTextCalcTextSizeW(ImGuiContext* ctx, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line) { - ImGuiContext& g = *GImGui; + ImGuiContext& g = *ctx; ImFont* font = g.Font; const float line_height = g.FontSize; const float scale = line_height / font->FontSize; @@ -3673,14 +3689,14 @@ namespace ImStb static int STB_TEXTEDIT_STRINGLEN(const ImGuiInputTextState* obj) { return obj->CurLenW; } static ImWchar STB_TEXTEDIT_GETCHAR(const ImGuiInputTextState* obj, int idx) { return obj->TextW[idx]; } -static float STB_TEXTEDIT_GETWIDTH(ImGuiInputTextState* obj, int line_start_idx, int char_idx) { ImWchar c = obj->TextW[line_start_idx + char_idx]; if (c == '\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; ImGuiContext& g = *GImGui; return g.Font->GetCharAdvance(c) * (g.FontSize / g.Font->FontSize); } +static float STB_TEXTEDIT_GETWIDTH(ImGuiInputTextState* obj, int line_start_idx, int char_idx) { ImWchar c = obj->TextW[line_start_idx + char_idx]; if (c == '\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; ImGuiContext& g = *obj->Ctx; return g.Font->GetCharAdvance(c) * (g.FontSize / g.Font->FontSize); } static int STB_TEXTEDIT_KEYTOTEXT(int key) { return key >= 0x200000 ? 0 : key; } static ImWchar STB_TEXTEDIT_NEWLINE = '\n'; static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, ImGuiInputTextState* obj, int line_start_idx) { const ImWchar* text = obj->TextW.Data; const ImWchar* text_remaining = NULL; - const ImVec2 size = InputTextCalcTextSizeW(text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true); + const ImVec2 size = InputTextCalcTextSizeW(obj->Ctx, text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true); r->x0 = 0.0f; r->x1 = size.x; r->baseline_y_delta = size.y; @@ -3689,19 +3705,40 @@ static void STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, ImGuiInputTextState* ob r->num_chars = (int)(text_remaining - (text + line_start_idx)); } -// When ImGuiInputTextFlags_Password is set, we don't want actions such as CTRL+Arrow to leak the fact that underlying data are blanks or separators. -static bool is_separator(unsigned int c) { return ImCharIsBlankW(c) || c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|' || c=='\n' || c=='\r'; } -static int is_word_boundary_from_right(ImGuiInputTextState* obj, int idx) { if (obj->Flags & ImGuiInputTextFlags_Password) return 0; return idx > 0 ? (is_separator(obj->TextW[idx - 1]) && !is_separator(obj->TextW[idx]) ) : 1; } -static int is_word_boundary_from_left(ImGuiInputTextState* obj, int idx) { if (obj->Flags & ImGuiInputTextFlags_Password) return 0; return idx > 0 ? (!is_separator(obj->TextW[idx - 1]) && is_separator(obj->TextW[idx])) : 1; } +static bool is_separator(unsigned int c) +{ + return c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|' || c=='\n' || c=='\r' || c=='.' || c=='!'; +} + +static int is_word_boundary_from_right(ImGuiInputTextState* obj, int idx) +{ + // When ImGuiInputTextFlags_Password is set, we don't want actions such as CTRL+Arrow to leak the fact that underlying data are blanks or separators. + if ((obj->Flags & ImGuiInputTextFlags_Password) || idx <= 0) + return 0; + + bool prev_white = ImCharIsBlankW(obj->TextW[idx - 1]); + bool prev_separ = is_separator(obj->TextW[idx - 1]); + bool curr_white = ImCharIsBlankW(obj->TextW[idx]); + bool curr_separ = is_separator(obj->TextW[idx]); + return ((prev_white || prev_separ) && !(curr_separ || curr_white)) || (curr_separ && !prev_separ); +} +static int is_word_boundary_from_left(ImGuiInputTextState* obj, int idx) +{ + if ((obj->Flags & ImGuiInputTextFlags_Password) || idx <= 0) + return 0; + + bool prev_white = ImCharIsBlankW(obj->TextW[idx]); + bool prev_separ = is_separator(obj->TextW[idx]); + bool curr_white = ImCharIsBlankW(obj->TextW[idx - 1]); + bool curr_separ = is_separator(obj->TextW[idx - 1]); + return ((prev_white) && !(curr_separ || curr_white)) || (curr_separ && !prev_separ); +} static int STB_TEXTEDIT_MOVEWORDLEFT_IMPL(ImGuiInputTextState* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; } static int STB_TEXTEDIT_MOVEWORDRIGHT_MAC(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; } -#define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h -#ifdef __APPLE__ // FIXME: Move setting to IO structure -#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_MAC -#else static int STB_TEXTEDIT_MOVEWORDRIGHT_WIN(ImGuiInputTextState* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; } -#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_WIN -#endif +static int STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(ImGuiInputTextState* obj, int idx) { ImGuiContext& g = *obj->Ctx; if (g.IO.ConfigMacOSXBehaviors) return STB_TEXTEDIT_MOVEWORDRIGHT_MAC(obj, idx); else return STB_TEXTEDIT_MOVEWORDRIGHT_WIN(obj, idx); } +#define STB_TEXTEDIT_MOVEWORDLEFT STB_TEXTEDIT_MOVEWORDLEFT_IMPL // They need to be #define for stb_textedit.h +#define STB_TEXTEDIT_MOVEWORDRIGHT STB_TEXTEDIT_MOVEWORDRIGHT_IMPL static void STB_TEXTEDIT_DELETECHARS(ImGuiInputTextState* obj, int pos, int n) { @@ -3779,11 +3816,12 @@ static void stb_textedit_replace(ImGuiInputTextState* str, STB_TexteditState* st { stb_text_makeundo_replace(str, state, 0, str->CurLenW, text_len); ImStb::STB_TEXTEDIT_DELETECHARS(str, 0, str->CurLenW); + state->cursor = state->select_start = state->select_end = 0; if (text_len <= 0) return; if (ImStb::STB_TEXTEDIT_INSERTCHARS(str, 0, text, text_len)) { - state->cursor = text_len; + state->cursor = state->select_start = state->select_end = text_len; state->has_preferred_x = 0; return; } @@ -3835,7 +3873,7 @@ void ImGuiInputTextCallbackData::InsertChars(int pos, const char* new_text, cons return; // Contrary to STB_TEXTEDIT_INSERTCHARS() this is working in the UTF8 buffer, hence the mildly similar code (until we remove the U16 buffer altogether!) - ImGuiContext& g = *GImGui; + ImGuiContext& g = *Ctx; ImGuiInputTextState* edit_state = &g.InputTextState; IM_ASSERT(edit_state->ID != 0 && g.ActiveId == edit_state->ID); IM_ASSERT(Buf == edit_state->TextA.Data); @@ -3868,7 +3906,7 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f if (c < 0x20) { bool pass = false; - pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline)); + pass |= (c == '\n' && (flags & ImGuiInputTextFlags_Multiline)); // Note that an Enter KEY will emit \r and be ignored (we poll for KEY in InputText() code) pass |= (c == '\t' && (flags & ImGuiInputTextFlags_AllowTabInput)); if (!pass) return false; @@ -3902,6 +3940,13 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f ImGuiContext& g = *GImGui; const unsigned c_decimal_point = (unsigned int)g.PlatformLocaleDecimalPoint; + // Full-width -> half-width conversion for numeric fields (https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block) + // While this is mostly convenient, this has the side-effect for uninformed users accidentally inputting full-width characters that they may + // scratch their head as to why it works in numerical fields vs in generic text fields it would require support in the font. + if (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsScientific | ImGuiInputTextFlags_CharsHexadecimal)) + if (c >= 0xFF01 && c <= 0xFF5E) + c = c - 0xFF01 + 0x21; + // Allow 0-9 . - + * / if (flags & ImGuiInputTextFlags_CharsDecimal) if (!(c >= '0' && c <= '9') && (c != c_decimal_point) && (c != '-') && (c != '+') && (c != '*') && (c != '/')) @@ -3920,18 +3965,21 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f // Turn a-z into A-Z if (flags & ImGuiInputTextFlags_CharsUppercase) if (c >= 'a' && c <= 'z') - *p_char = (c += (unsigned int)('A' - 'a')); + c += (unsigned int)('A' - 'a'); if (flags & ImGuiInputTextFlags_CharsNoBlank) if (ImCharIsBlankW(c)) return false; + + *p_char = c; } // Custom callback filter if (flags & ImGuiInputTextFlags_CallbackCharFilter) { + ImGuiContext& g = *GImGui; ImGuiInputTextCallbackData callback_data; - memset(&callback_data, 0, sizeof(ImGuiInputTextCallbackData)); + callback_data.Ctx = &g; callback_data.EventFlag = ImGuiInputTextFlags_CallbackCharFilter; callback_data.EventChar = (ImWchar)c; callback_data.Flags = flags; @@ -3946,6 +3994,56 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags f return true; } +// Find the shortest single replacement we can make to get the new text from the old text. +// Important: needs to be run before TextW is rewritten with the new characters because calling STB_TEXTEDIT_GETCHAR() at the end. +// FIXME: Ideally we should transition toward (1) making InsertChars()/DeleteChars() update undo-stack (2) discourage (and keep reconcile) or obsolete (and remove reconcile) accessing buffer directly. +static void InputTextReconcileUndoStateAfterUserCallback(ImGuiInputTextState* state, const char* new_buf_a, int new_length_a) +{ + ImGuiContext& g = *GImGui; + const ImWchar* old_buf = state->TextW.Data; + const int old_length = state->CurLenW; + const int new_length = ImTextCountCharsFromUtf8(new_buf_a, new_buf_a + new_length_a); + g.TempBuffer.reserve_discard((new_length + 1) * sizeof(ImWchar)); + ImWchar* new_buf = (ImWchar*)(void*)g.TempBuffer.Data; + ImTextStrFromUtf8(new_buf, new_length + 1, new_buf_a, new_buf_a + new_length_a); + + const int shorter_length = ImMin(old_length, new_length); + int first_diff; + for (first_diff = 0; first_diff < shorter_length; first_diff++) + if (old_buf[first_diff] != new_buf[first_diff]) + break; + if (first_diff == old_length && first_diff == new_length) + return; + + int old_last_diff = old_length - 1; + int new_last_diff = new_length - 1; + for (; old_last_diff >= first_diff && new_last_diff >= first_diff; old_last_diff--, new_last_diff--) + if (old_buf[old_last_diff] != new_buf[new_last_diff]) + break; + + const int insert_len = new_last_diff - first_diff + 1; + const int delete_len = old_last_diff - first_diff + 1; + if (insert_len > 0 || delete_len > 0) + if (STB_TEXTEDIT_CHARTYPE* p = stb_text_createundo(&state->Stb.undostate, first_diff, delete_len, insert_len)) + for (int i = 0; i < delete_len; i++) + p[i] = ImStb::STB_TEXTEDIT_GETCHAR(state, first_diff + i); +} + +// As InputText() retain textual data and we currently provide a path for user to not retain it (via local variables) +// we need some form of hook to reapply data back to user buffer on deactivation frame. (#4714) +// It would be more desirable that we discourage users from taking advantage of the "user not retaining data" trick, +// but that more likely be attractive when we do have _NoLiveEdit flag available. +void ImGui::InputTextDeactivateHook(ImGuiID id) +{ + ImGuiContext& g = *GImGui; + ImGuiInputTextState* state = &g.InputTextState; + if (id == 0 || state->ID != id) + return; + g.InputTextDeactivatedState.ID = state->ID; + g.InputTextDeactivatedState.TextA.resize(state->CurLenA + 1); + memcpy(g.InputTextDeactivatedState.TextA.Data, state->TextA.Data ? state->TextA.Data : "", state->CurLenA + 1); +} + // Edit a string of text // - buf_size account for the zero-terminator, so a buf_size of 6 can hold "Hello" but not "Hello!". // This is so we can easily call InputText() on static arrays using ARRAYSIZE() and to match @@ -4041,7 +4139,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ ImGuiInputTextState* state = GetInputTextState(id); const bool input_requested_by_tabbing = (item_status_flags & ImGuiItemStatusFlags_FocusedByTabbing) != 0; - const bool input_requested_by_nav = (g.ActiveId != id) && ((g.NavActivateInputId == id) || (g.NavActivateId == id && g.NavInputSource == ImGuiInputSource_Keyboard)); + const bool input_requested_by_nav = (g.ActiveId != id) && ((g.NavActivateId == id) && ((g.NavActivateFlags & ImGuiActivateFlags_PreferInput) || (g.NavInputSource == ImGuiInputSource_Keyboard))); const bool user_clicked = hovered && io.MouseClicked[0]; const bool user_scroll_finish = is_multiline && state != NULL && g.ActiveId == 0 && g.ActiveIdPreviousFrame == GetWindowScrollbarID(draw_window, ImGuiAxis_Y); @@ -4051,7 +4149,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ float scroll_y = is_multiline ? draw_window->Scroll.y : FLT_MAX; - const bool init_changed_specs = (state != NULL && state->Stb.single_line != !is_multiline); + const bool init_changed_specs = (state != NULL && state->Stb.single_line != !is_multiline); // state != NULL means its our state. const bool init_make_active = (user_clicked || user_scroll_finish || input_requested_by_nav || input_requested_by_tabbing); const bool init_state = (init_make_active || user_scroll_active); if ((init_state && g.ActiveId != id) || init_changed_specs) @@ -4060,23 +4158,30 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ state = &g.InputTextState; state->CursorAnimReset(); + // Backup state of deactivating item so they'll have a chance to do a write to output buffer on the same frame they report IsItemDeactivatedAfterEdit (#4714) + InputTextDeactivateHook(state->ID); + // Take a copy of the initial buffer value (both in original UTF-8 format and converted to wchar) // From the moment we focused we are ignoring the content of 'buf' (unless we are in read-only mode) const int buf_len = (int)strlen(buf); state->InitialTextA.resize(buf_len + 1); // UTF-8. we use +1 to make sure that .Data is always pointing to at least an empty string. memcpy(state->InitialTextA.Data, buf, buf_len + 1); + // Preserve cursor position and undo/redo stack if we come back to same widget + // FIXME: Since we reworked this on 2022/06, may want to differenciate recycle_cursor vs recycle_undostate? + bool recycle_state = (state->ID == id && !init_changed_specs); + if (recycle_state && (state->CurLenA != buf_len || (state->TextAIsValid && strncmp(state->TextA.Data, buf, buf_len) != 0))) + recycle_state = false; + // Start edition const char* buf_end = NULL; + state->ID = id; state->TextW.resize(buf_size + 1); // wchar count <= UTF-8 count. we use +1 to make sure that .Data is always pointing to at least an empty string. state->TextA.resize(0); state->TextAIsValid = false; // TextA is not valid yet (we will display buf until then) state->CurLenW = ImTextStrFromUtf8(state->TextW.Data, buf_size, buf, NULL, &buf_end); state->CurLenA = (int)(buf_end - buf); // We can't get the result from ImStrncpy() above because it is not UTF-8 aware. Here we'll cut off malformed UTF-8. - // Preserve cursor position and undo/redo stack if we come back to same widget - // FIXME: For non-readonly widgets we might be able to require that TextAIsValid && TextA == buf ? (untested) and discard undo stack if user buffer has changed. - const bool recycle_state = (state->ID == id && !init_changed_specs); if (recycle_state) { // Recycle existing cursor/selection/undo stack but clamp position @@ -4085,7 +4190,6 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ } else { - state->ID = id; state->ScrollX = 0.0f; stb_textedit_initialize_state(&state->Stb, !is_multiline); } @@ -4104,24 +4208,33 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ state->Stb.insert_mode = 1; // stb field name is indeed incorrect (see #2863) } + const bool is_osx = io.ConfigMacOSXBehaviors; if (g.ActiveId != id && init_make_active) { IM_ASSERT(state && state->ID == id); SetActiveID(id, window); SetFocusID(id, window); FocusWindow(window); - - // Declare our inputs - IM_ASSERT(ImGuiNavInput_COUNT < 32); + } + if (g.ActiveId == id) + { + // Declare some inputs, the other are registered and polled via Shortcut() routing system. + if (user_clicked) + SetKeyOwner(ImGuiKey_MouseLeft, id); g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Left) | (1 << ImGuiDir_Right); if (is_multiline || (flags & ImGuiInputTextFlags_CallbackHistory)) g.ActiveIdUsingNavDirMask |= (1 << ImGuiDir_Up) | (1 << ImGuiDir_Down); - g.ActiveIdUsingNavInputMask |= (1 << ImGuiNavInput_Cancel); - g.ActiveIdUsingKeyInputMask |= ((ImU64)1 << ImGuiKey_Home) | ((ImU64)1 << ImGuiKey_End); + SetKeyOwner(ImGuiKey_Home, id); + SetKeyOwner(ImGuiKey_End, id); if (is_multiline) - g.ActiveIdUsingKeyInputMask |= ((ImU64)1 << ImGuiKey_PageUp) | ((ImU64)1 << ImGuiKey_PageDown); - if (flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_AllowTabInput)) // Disable keyboard tabbing out as we will use the \t character. - g.ActiveIdUsingKeyInputMask |= ((ImU64)1 << ImGuiKey_Tab); + { + SetKeyOwner(ImGuiKey_PageUp, id); + SetKeyOwner(ImGuiKey_PageDown, id); + } + if (is_osx) + SetKeyOwner(ImGuiMod_Alt, id); + if (flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_AllowTabInput)) // Disable keyboard tabbing out as we will use the \t character. + SetShortcutRouting(ImGuiKey_Tab, id); } // We have an edge case if ActiveId was set through another widget (e.g. widget being swapped), clear id immediately (don't wait until the end of the function) @@ -4133,10 +4246,10 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ clear_active_id = true; // Lock the decision of whether we are going to take the path displaying the cursor or selection - const bool render_cursor = (g.ActiveId == id) || (state && user_scroll_active); + bool render_cursor = (g.ActiveId == id) || (state && user_scroll_active); bool render_selection = state && (state->HasSelection() || select_all) && (RENDER_SELECTION_WHEN_INACTIVE || render_cursor); bool value_changed = false; - bool enter_pressed = false; + bool validated = false; // When read-only we always use the live data passed to the function // FIXME-OPT: Because our selection/cursor code currently needs the wide text we need to convert it when active, which is not ideal :( @@ -4189,7 +4302,6 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ const float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + state->ScrollX; const float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y) : (g.FontSize * 0.5f)); - const bool is_osx = io.ConfigMacOSXBehaviors; if (select_all) { state->SelectAll(); @@ -4232,10 +4344,12 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ } else if (io.MouseClicked[0] && !state->SelectedAllMouseLock) { - // FIXME: unselect on late click could be done release? if (hovered) { - stb_textedit_click(state, &state->Stb, mouse_x, mouse_y); + if (io.KeyShift) + stb_textedit_drag(state, &state->Stb, mouse_x, mouse_y); + else + stb_textedit_click(state, &state->Stb, mouse_x, mouse_y); state->CursorAnimReset(); } } @@ -4248,19 +4362,18 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (state->SelectedAllMouseLock && !io.MouseDown[0]) state->SelectedAllMouseLock = false; - // It is ill-defined whether the backend needs to send a \t character when pressing the TAB keys. - // Win32 and GLFW naturally do it but not SDL. - const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper); - if ((flags & ImGuiInputTextFlags_AllowTabInput) && IsKeyPressedMap(ImGuiKey_Tab) && !ignore_char_inputs && !io.KeyShift && !is_readonly) - if (!io.InputQueueCharacters.contains('\t')) - { - unsigned int c = '\t'; // Insert TAB - if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard)) - state->OnKeyPressed((int)c); - } + // We expect backends to emit a Tab key but some also emit a Tab character which we ignore (#2467, #1336) + // (For Tab and Enter: Win32/SFML/Allegro are sending both keys and chars, GLFW and SDL are only sending keys. For Space they all send all threes) + if ((flags & ImGuiInputTextFlags_AllowTabInput) && Shortcut(ImGuiKey_Tab, id) && !is_readonly) + { + unsigned int c = '\t'; // Insert TAB + if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard)) + state->OnKeyPressed((int)c); + } // Process regular text input (before we check for Return because using some IME will effectively send a Return?) // We ignore CTRL inputs, but need to allow ALT+CTRL as some keyboards (e.g. German) use AltGR (which _is_ Alt+Ctrl) to input certain characters. + const bool ignore_char_inputs = (io.KeyCtrl && !io.KeyAlt) || (is_osx && io.KeySuper); if (io.InputQueueCharacters.Size > 0) { if (!ignore_char_inputs && !is_readonly && !input_requested_by_nav) @@ -4268,7 +4381,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ { // Insert character if they pass filtering unsigned int c = (unsigned int)io.InputQueueCharacters[n]; - if (c == '\t' && io.KeyShift) + if (c == '\t') // Skip Tab, see above. continue; if (InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Keyboard)) state->OnKeyPressed((int)c); @@ -4280,45 +4393,54 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ } // Process other shortcuts/key-presses - bool cancel_edit = false; + bool revert_edit = false; if (g.ActiveId == id && !g.ActiveIdIsJustActivated && !clear_active_id) { IM_ASSERT(state != NULL); - IM_ASSERT(io.KeyMods == GetMergedKeyModFlags() && "Mismatching io.KeyCtrl/io.KeyShift/io.KeyAlt/io.KeySuper vs io.KeyMods"); // We rarely do this check, but if anything let's do it here. const int row_count_per_page = ImMax((int)((inner_size.y - style.FramePadding.y) / g.FontSize), 1); state->Stb.row_count_per_page = row_count_per_page; const int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0); - const bool is_osx = io.ConfigMacOSXBehaviors; - const bool is_osx_shift_shortcut = is_osx && (io.KeyMods == (ImGuiKeyModFlags_Super | ImGuiKeyModFlags_Shift)); const bool is_wordmove_key_down = is_osx ? io.KeyAlt : io.KeyCtrl; // OS X style: Text editing cursor movement using Alt instead of Ctrl const bool is_startend_key_down = is_osx && io.KeySuper && !io.KeyCtrl && !io.KeyAlt; // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End - const bool is_ctrl_key_only = (io.KeyMods == ImGuiKeyModFlags_Ctrl); - const bool is_shift_key_only = (io.KeyMods == ImGuiKeyModFlags_Shift); - const bool is_shortcut_key = g.IO.ConfigMacOSXBehaviors ? (io.KeyMods == ImGuiKeyModFlags_Super) : (io.KeyMods == ImGuiKeyModFlags_Ctrl); - const bool is_cut = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Delete))) && !is_readonly && !is_password && (!is_multiline || state->HasSelection()); - const bool is_copy = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && !is_password && (!is_multiline || state->HasSelection()); - const bool is_paste = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && !is_readonly; - const bool is_undo = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Z)) && !is_readonly && is_undoable); - const bool is_redo = ((is_shortcut_key && IsKeyPressedMap(ImGuiKey_Y)) || (is_osx_shift_shortcut && IsKeyPressedMap(ImGuiKey_Z))) && !is_readonly && is_undoable; + // Using Shortcut() with ImGuiInputFlags_RouteFocused (default policy) to allow routing operations for other code (e.g. calling window trying to use CTRL+A and CTRL+B: formet would be handled by InputText) + // Otherwise we could simply assume that we own the keys as we are active. + const ImGuiInputFlags f_repeat = ImGuiInputFlags_Repeat; + const bool is_cut = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_X, id, f_repeat) || Shortcut(ImGuiMod_Shift | ImGuiKey_Delete, id, f_repeat)) && !is_readonly && !is_password && (!is_multiline || state->HasSelection()); + const bool is_copy = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_C, id) || Shortcut(ImGuiMod_Ctrl | ImGuiKey_Insert, id)) && !is_password && (!is_multiline || state->HasSelection()); + const bool is_paste = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_V, id, f_repeat) || Shortcut(ImGuiMod_Shift | ImGuiKey_Insert, id, f_repeat)) && !is_readonly; + const bool is_undo = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_Z, id, f_repeat)) && !is_readonly && is_undoable; + const bool is_redo = (Shortcut(ImGuiMod_Shortcut | ImGuiKey_Y, id, f_repeat) || (is_osx && Shortcut(ImGuiMod_Shortcut | ImGuiMod_Shift | ImGuiKey_Z, id, f_repeat))) && !is_readonly && is_undoable; + const bool is_select_all = Shortcut(ImGuiMod_Shortcut | ImGuiKey_A, id); // We allow validate/cancel with Nav source (gamepad) to makes it easier to undo an accidental NavInput press with no keyboard wired, but otherwise it isn't very useful. - const bool is_validate_enter = IsKeyPressedMap(ImGuiKey_Enter) || IsKeyPressedMap(ImGuiKey_KeyPadEnter); - const bool is_validate_nav = (IsNavInputTest(ImGuiNavInput_Activate, ImGuiInputReadMode_Pressed) && !IsKeyPressedMap(ImGuiKey_Space)) || IsNavInputTest(ImGuiNavInput_Input, ImGuiInputReadMode_Pressed); - const bool is_cancel = IsKeyPressedMap(ImGuiKey_Escape) || IsNavInputTest(ImGuiNavInput_Cancel, ImGuiInputReadMode_Pressed); - - if (IsKeyPressedMap(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_RightArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_UpArrow) && is_multiline) { if (io.KeyCtrl) SetScrollY(draw_window, ImMax(draw_window->Scroll.y - g.FontSize, 0.0f)); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTSTART : STB_TEXTEDIT_K_UP) | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_DownArrow) && is_multiline) { if (io.KeyCtrl) SetScrollY(draw_window, ImMin(draw_window->Scroll.y + g.FontSize, GetScrollMaxY())); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTEND : STB_TEXTEDIT_K_DOWN) | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_PageUp) && is_multiline) { state->OnKeyPressed(STB_TEXTEDIT_K_PGUP | k_mask); scroll_y -= row_count_per_page * g.FontSize; } - else if (IsKeyPressedMap(ImGuiKey_PageDown) && is_multiline) { state->OnKeyPressed(STB_TEXTEDIT_K_PGDOWN | k_mask); scroll_y += row_count_per_page * g.FontSize; } - else if (IsKeyPressedMap(ImGuiKey_Home)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_End)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_Delete) && !is_readonly && !is_cut) { state->OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); } - else if (IsKeyPressedMap(ImGuiKey_Backspace) && !is_readonly) + const bool nav_gamepad_active = (io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) != 0 && (io.BackendFlags & ImGuiBackendFlags_HasGamepad) != 0; + const bool is_enter_pressed = IsKeyPressed(ImGuiKey_Enter, true) || IsKeyPressed(ImGuiKey_KeypadEnter, true); + const bool is_gamepad_validate = nav_gamepad_active && (IsKeyPressed(ImGuiKey_NavGamepadActivate, false) || IsKeyPressed(ImGuiKey_NavGamepadInput, false)); + const bool is_cancel = Shortcut(ImGuiKey_Escape, id, f_repeat) || (nav_gamepad_active && Shortcut(ImGuiKey_NavGamepadCancel, id, f_repeat)); + + // FIXME: Should use more Shortcut() and reduce IsKeyPressed()+SetKeyOwner(), but requires modifiers combination to be taken account of. + if (IsKeyPressed(ImGuiKey_LeftArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); } + else if (IsKeyPressed(ImGuiKey_RightArrow)) { state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); } + else if (IsKeyPressed(ImGuiKey_UpArrow) && is_multiline) { if (io.KeyCtrl) SetScrollY(draw_window, ImMax(draw_window->Scroll.y - g.FontSize, 0.0f)); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTSTART : STB_TEXTEDIT_K_UP) | k_mask); } + else if (IsKeyPressed(ImGuiKey_DownArrow) && is_multiline) { if (io.KeyCtrl) SetScrollY(draw_window, ImMin(draw_window->Scroll.y + g.FontSize, GetScrollMaxY())); else state->OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTEND : STB_TEXTEDIT_K_DOWN) | k_mask); } + else if (IsKeyPressed(ImGuiKey_PageUp) && is_multiline) { state->OnKeyPressed(STB_TEXTEDIT_K_PGUP | k_mask); scroll_y -= row_count_per_page * g.FontSize; } + else if (IsKeyPressed(ImGuiKey_PageDown) && is_multiline) { state->OnKeyPressed(STB_TEXTEDIT_K_PGDOWN | k_mask); scroll_y += row_count_per_page * g.FontSize; } + else if (IsKeyPressed(ImGuiKey_Home)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); } + else if (IsKeyPressed(ImGuiKey_End)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); } + else if (IsKeyPressed(ImGuiKey_Delete) && !is_readonly && !is_cut) + { + if (!state->HasSelection()) + { + // OSX doesn't seem to have Super+Delete to delete until end-of-line, so we don't emulate that (as opposed to Super+Backspace) + if (is_wordmove_key_down) + state->OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT); + } + state->OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); + } + else if (IsKeyPressed(ImGuiKey_Backspace) && !is_readonly) { if (!state->HasSelection()) { @@ -4329,12 +4451,17 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ } state->OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask); } - else if (is_validate_enter) + else if (is_enter_pressed || is_gamepad_validate) { + // Determine if we turn Enter into a \n character bool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0; - if (!is_multiline || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl)) + if (!is_multiline || is_gamepad_validate || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl)) { - enter_pressed = clear_active_id = true; + validated = true; + if (io.ConfigInputTextEnterKeepActive && !is_multiline) + state->SelectAll(); // No need to scroll + else + clear_active_id = true; } else if (!is_readonly) { @@ -4343,21 +4470,32 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ state->OnKeyPressed((int)c); } } - else if (is_validate_nav) - { - IM_ASSERT(!is_validate_enter); - enter_pressed = clear_active_id = true; - } else if (is_cancel) { - clear_active_id = cancel_edit = true; + if (flags & ImGuiInputTextFlags_EscapeClearsAll) + { + if (state->CurLenA > 0) + { + revert_edit = true; + } + else + { + render_cursor = render_selection = false; + clear_active_id = true; + } + } + else + { + clear_active_id = revert_edit = true; + render_cursor = render_selection = false; + } } else if (is_undo || is_redo) { state->OnKeyPressed(is_undo ? STB_TEXTEDIT_K_UNDO : STB_TEXTEDIT_K_REDO); state->ClearSelection(); } - else if (is_shortcut_key && IsKeyPressedMap(ImGuiKey_A)) + else if (is_select_all) { state->SelectAll(); state->CursorFollow = true; @@ -4391,12 +4529,10 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ const int clipboard_len = (int)strlen(clipboard); ImWchar* clipboard_filtered = (ImWchar*)IM_ALLOC((clipboard_len + 1) * sizeof(ImWchar)); int clipboard_filtered_len = 0; - for (const char* s = clipboard; *s; ) + for (const char* s = clipboard; *s != 0; ) { unsigned int c; s += ImTextCharFromUtf8(&c, s, NULL); - if (c == 0) - break; if (!InputTextFilterCharacter(&c, flags, callback, callback_user_data, ImGuiInputSource_Clipboard)) continue; clipboard_filtered[clipboard_filtered_len++] = (ImWchar)c; @@ -4421,14 +4557,23 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (g.ActiveId == id) { IM_ASSERT(state != NULL); - if (cancel_edit) + if (revert_edit && !is_readonly) { - // Restore initial value. Only return true if restoring to the initial value changes the current buffer contents. - if (!is_readonly && strcmp(buf, state->InitialTextA.Data) != 0) + if (flags & ImGuiInputTextFlags_EscapeClearsAll) + { + // Clear input + apply_new_text = ""; + apply_new_text_length = 0; + STB_TEXTEDIT_CHARTYPE empty_string; + stb_textedit_replace(state, &state->Stb, &empty_string, 0); + } + else if (strcmp(buf, state->InitialTextA.Data) != 0) { + // Restore initial value. Only return true if restoring to the initial value changes the current buffer contents. // Push records into the undo stack so we can CTRL+Z the revert operation itself apply_new_text = state->InitialTextA.Data; apply_new_text_length = state->InitialTextA.Size - 1; + value_changed = true; ImVector w_text; if (apply_new_text_length > 0) { @@ -4439,22 +4584,24 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ } } + // Apply ASCII value + if (!is_readonly) + { + state->TextAIsValid = true; + state->TextA.resize(state->TextW.Size * 4 + 1); + ImTextStrToUtf8(state->TextA.Data, state->TextA.Size, state->TextW.Data, NULL); + } + // When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame. // If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail. // This also allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage (please note that if you use this property along ImGuiInputTextFlags_CallbackResize you can end up with your temporary string object unnecessarily allocating once a frame, either store your string data, either if you don't then don't use ImGuiInputTextFlags_CallbackResize). - bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0); + const bool apply_edit_back_to_user_buffer = !revert_edit || (validated && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0); if (apply_edit_back_to_user_buffer) { // Apply new value immediately - copy modified buffer back // Note that as soon as the input box is active, the in-widget value gets priority over any underlying modification of the input buffer // FIXME: We actually always render 'buf' when calling DrawList->AddText, making the comment above incorrect. // FIXME-OPT: CPU waste to do this every time the widget is active, should mark dirty state from the stb_textedit callbacks. - if (!is_readonly) - { - state->TextAIsValid = true; - state->TextA.resize(state->TextW.Size * 4 + 1); - ImTextStrToUtf8(state->TextA.Data, state->TextA.Size, state->TextW.Data, NULL); - } // User callback if ((flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory | ImGuiInputTextFlags_CallbackEdit | ImGuiInputTextFlags_CallbackAlways)) != 0) @@ -4463,18 +4610,18 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ // The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment. ImGuiInputTextFlags event_flag = 0; - ImGuiKey event_key = ImGuiKey_COUNT; - if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && IsKeyPressedMap(ImGuiKey_Tab)) + ImGuiKey event_key = ImGuiKey_None; + if ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && Shortcut(ImGuiKey_Tab, id)) { event_flag = ImGuiInputTextFlags_CallbackCompletion; event_key = ImGuiKey_Tab; } - else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(ImGuiKey_UpArrow)) + else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressed(ImGuiKey_UpArrow)) { event_flag = ImGuiInputTextFlags_CallbackHistory; event_key = ImGuiKey_UpArrow; } - else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(ImGuiKey_DownArrow)) + else if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressed(ImGuiKey_DownArrow)) { event_flag = ImGuiInputTextFlags_CallbackHistory; event_key = ImGuiKey_DownArrow; @@ -4491,7 +4638,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (event_flag) { ImGuiInputTextCallbackData callback_data; - memset(&callback_data, 0, sizeof(ImGuiInputTextCallbackData)); + callback_data.Ctx = &g; callback_data.EventFlag = event_flag; callback_data.Flags = flags; callback_data.UserData = callback_user_data; @@ -4523,9 +4670,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (callback_data.SelectionEnd != utf8_selection_end || buf_dirty) { state->Stb.select_end = (callback_data.SelectionEnd == callback_data.SelectionStart) ? state->Stb.select_start : ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionEnd); } if (buf_dirty) { + IM_ASSERT((flags & ImGuiInputTextFlags_ReadOnly) == 0); IM_ASSERT(callback_data.BufTextLen == (int)strlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text! + InputTextReconcileUndoStateAfterUserCallback(state, callback_data.Buf, callback_data.BufTextLen); // FIXME: Move the rest of this block inside function and rename to InputTextReconcileStateAfterUserCallback() ? if (callback_data.BufTextLen > backup_current_text_length && is_resizable) - state->TextW.resize(state->TextW.Size + (callback_data.BufTextLen - backup_current_text_length)); + state->TextW.resize(state->TextW.Size + (callback_data.BufTextLen - backup_current_text_length)); // Worse case scenario resize state->CurLenW = ImTextStrFromUtf8(state->TextW.Data, state->TextW.Size, callback_data.Buf, NULL); state->CurLenA = callback_data.BufTextLen; // Assume correct length and valid UTF-8 from user, saves us an extra strlen() state->CursorAnimReset(); @@ -4538,11 +4687,22 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ { apply_new_text = state->TextA.Data; apply_new_text_length = state->CurLenA; + value_changed = true; } } + } - // Clear temporary user storage - state->Flags = ImGuiInputTextFlags_None; + // Handle reapplying final data on deactivation (see InputTextDeactivateHook() for details) + if (g.InputTextDeactivatedState.ID == id) + { + if (g.ActiveId != id && IsItemDeactivatedAfterEdit() && !is_readonly) + { + apply_new_text = g.InputTextDeactivatedState.TextA.Data; + apply_new_text_length = g.InputTextDeactivatedState.TextA.Size - 1; + value_changed |= (strcmp(g.InputTextDeactivatedState.TextA.Data, buf) != 0); + //IMGUI_DEBUG_LOG("InputText(): apply Deactivated data for 0x%08X: \"%.*s\".\n", id, apply_new_text_length, apply_new_text); + } + g.InputTextDeactivatedState.ID = 0; } // Copy result to user buffer. This can currently only happen when (g.ActiveId == id) @@ -4555,6 +4715,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (is_resizable) { ImGuiInputTextCallbackData callback_data; + callback_data.Ctx = &g; callback_data.EventFlag = ImGuiInputTextFlags_CallbackResize; callback_data.Flags = flags; callback_data.Buf = buf; @@ -4567,11 +4728,10 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ apply_new_text_length = ImMin(callback_data.BufTextLen, buf_size - 1); IM_ASSERT(apply_new_text_length <= buf_size); } - //IMGUI_DEBUG_LOG("InputText(\"%s\"): apply_new_text length %d\n", label, apply_new_text_length); + //IMGUI_DEBUG_PRINT("InputText(\"%s\"): apply_new_text length %d\n", label, apply_new_text_length); // If the underlying buffer resize was denied or not carried to the next frame, apply_new_text_length+1 may be >= buf_size. ImStrncpy(buf, apply_new_text, ImMin(apply_new_text_length + 1, buf_size)); - value_changed = true; } // Release active ID at the end of the function (so e.g. pressing Return still does a final application of the value) @@ -4656,11 +4816,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ searches_result_line_no[1] = line_count; // Calculate 2d position by finding the beginning of the line and measuring distance - cursor_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x; + cursor_offset.x = InputTextCalcTextSizeW(&g, ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x; cursor_offset.y = searches_result_line_no[0] * g.FontSize; if (searches_result_line_no[1] >= 0) { - select_start_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x; + select_start_offset.x = InputTextCalcTextSizeW(&g, ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x; select_start_offset.y = searches_result_line_no[1] * g.FontSize; } @@ -4729,7 +4889,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ } else { - ImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true); + ImVec2 rect_size = InputTextCalcTextSizeW(&g, p, text_selected_end, &p, NULL, true); if (rect_size.x <= 0.0f) rect_size.x = IM_FLOOR(g.Font->GetCharAdvance((ImWchar)' ') * 0.50f); // So we can see selected empty lines ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos + ImVec2(rect_size.x, bg_offy_dn)); rect.ClipWith(clip_rect); @@ -4760,7 +4920,11 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ // Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.) if (!is_readonly) - g.PlatformImePos = ImVec2(cursor_screen_pos.x - 1.0f, cursor_screen_pos.y - g.FontSize); + { + g.PlatformImeData.WantVisible = true; + g.PlatformImeData.InputPos = ImVec2(cursor_screen_pos.x - 1.0f, cursor_screen_pos.y - g.FontSize); + g.PlatformImeData.InputLineHeight = g.FontSize; + } } } else @@ -4817,13 +4981,49 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ if (value_changed && !(flags & ImGuiInputTextFlags_NoMarkEdited)) MarkItemEdited(id); - IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags); + IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Inputable); if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0) - return enter_pressed; + return validated; else return value_changed; } +void ImGui::DebugNodeInputTextState(ImGuiInputTextState* state) +{ +#ifndef IMGUI_DISABLE_DEBUG_TOOLS + ImGuiContext& g = *GImGui; + ImStb::STB_TexteditState* stb_state = &state->Stb; + ImStb::StbUndoState* undo_state = &stb_state->undostate; + Text("ID: 0x%08X, ActiveID: 0x%08X", state->ID, g.ActiveId); + DebugLocateItemOnHover(state->ID); + Text("CurLenW: %d, CurLenA: %d, Cursor: %d, Selection: %d..%d", state->CurLenW, state->CurLenA, stb_state->cursor, stb_state->select_start, stb_state->select_end); + Text("has_preferred_x: %d (%.2f)", stb_state->has_preferred_x, stb_state->preferred_x); + Text("undo_point: %d, redo_point: %d, undo_char_point: %d, redo_char_point: %d", undo_state->undo_point, undo_state->redo_point, undo_state->undo_char_point, undo_state->redo_char_point); + if (BeginChild("undopoints", ImVec2(0.0f, GetTextLineHeight() * 15), true)) // Visualize undo state + { + PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); + for (int n = 0; n < STB_TEXTEDIT_UNDOSTATECOUNT; n++) + { + ImStb::StbUndoRecord* undo_rec = &undo_state->undo_rec[n]; + const char undo_rec_type = (n < undo_state->undo_point) ? 'u' : (n >= undo_state->redo_point) ? 'r' : ' '; + if (undo_rec_type == ' ') + BeginDisabled(); + char buf[64] = ""; + if (undo_rec_type != ' ' && undo_rec->char_storage != -1) + ImTextStrToUtf8(buf, IM_ARRAYSIZE(buf), undo_state->undo_char + undo_rec->char_storage, undo_state->undo_char + undo_rec->char_storage + undo_rec->insert_length); + Text("%c [%02d] where %03d, insert %03d, delete %03d, char_storage %03d \"%s\"", + undo_rec_type, n, undo_rec->where, undo_rec->insert_length, undo_rec->delete_length, undo_rec->char_storage, buf); + if (undo_rec_type == ' ') + EndDisabled(); + } + PopStyleVar(); + } + EndChild(); +#else + IM_UNUSED(state); +#endif +} + //------------------------------------------------------------------------- // [SECTION] Widgets: ColorEdit, ColorPicker, ColorButton, etc. //------------------------------------------------------------------------- @@ -4844,28 +5044,32 @@ bool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flag return ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha); } +static void ColorEditRestoreH(const float* col, float* H) +{ + ImGuiContext& g = *GImGui; + IM_ASSERT(g.ColorEditCurrentID != 0); + if (g.ColorEditSavedID != g.ColorEditCurrentID || g.ColorEditSavedColor != ImGui::ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0))) + return; + *H = g.ColorEditSavedHue; +} + // ColorEdit supports RGB and HSV inputs. In case of RGB input resulting color may have undefined hue and/or saturation. // Since widget displays both RGB and HSV values we must preserve hue and saturation to prevent these values resetting. static void ColorEditRestoreHS(const float* col, float* H, float* S, float* V) { - // This check is optional. Suppose we have two color widgets side by side, both widgets display different colors, but both colors have hue and/or saturation undefined. - // With color check: hue/saturation is preserved in one widget. Editing color in one widget would reset hue/saturation in another one. - // Without color check: common hue/saturation would be displayed in all widgets that have hue/saturation undefined. - // g.ColorEditLastColor is stored as ImU32 RGB value: this essentially gives us color equality check with reduced precision. - // Tiny external color changes would not be detected and this check would still pass. This is OK, since we only restore hue/saturation _only_ if they are undefined, - // therefore this change flipping hue/saturation from undefined to a very tiny value would still be represented in color picker. ImGuiContext& g = *GImGui; - if (g.ColorEditLastColor != ImGui::ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0))) + IM_ASSERT(g.ColorEditCurrentID != 0); + if (g.ColorEditSavedID != g.ColorEditCurrentID || g.ColorEditSavedColor != ImGui::ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0))) return; // When S == 0, H is undefined. // When H == 1 it wraps around to 0. - if (*S == 0.0f || (*H == 0.0f && g.ColorEditLastHue == 1)) - *H = g.ColorEditLastHue; + if (*S == 0.0f || (*H == 0.0f && g.ColorEditSavedHue == 1)) + *H = g.ColorEditSavedHue; // When V == 0, S is undefined. if (*V == 0.0f) - *S = g.ColorEditLastSat; + *S = g.ColorEditSavedSat; } // Edit colors components (each component in 0.0f..1.0f range). @@ -4888,6 +5092,9 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag BeginGroup(); PushID(label); + const bool set_current_color_edit_id = (g.ColorEditCurrentID == 0); + if (set_current_color_edit_id) + g.ColorEditCurrentID = window->IDStack.back(); // If we're not showing any slider there's no point in doing any HSV conversions const ImGuiColorEditFlags flags_untouched = flags; @@ -4921,7 +5128,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]); else if ((flags & ImGuiColorEditFlags_InputRGB) && (flags & ImGuiColorEditFlags_DisplayHSV)) { - // Hue is lost when converting from greyscale rgb (saturation=0). Restore it. + // Hue is lost when converting from grayscale rgb (saturation=0). Restore it. ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]); ColorEditRestoreHS(col, &f[0], &f[1], &f[2]); } @@ -4973,7 +5180,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag value_changed |= DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]); } if (!(flags & ImGuiColorEditFlags_NoOptions)) - OpenPopupOnItemClick("context"); + OpenPopupOnItemClick("context", ImGuiPopupFlags_MouseButtonRight); } } else if ((flags & ImGuiColorEditFlags_DisplayHex) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0) @@ -5001,7 +5208,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag IM_UNUSED(r); // Fixes C6031: Return value ignored: 'sscanf'. } if (!(flags & ImGuiColorEditFlags_NoOptions)) - OpenPopupOnItemClick("context"); + OpenPopupOnItemClick("context", ImGuiPopupFlags_MouseButtonRight); } ImGuiWindow* picker_active_window = NULL; @@ -5018,32 +5225,37 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag // Store current color and open a picker g.ColorPickerRef = col_v4; OpenPopup("picker"); - SetNextWindowPos(g.LastItemData.Rect.GetBL() + ImVec2(-1, style.ItemSpacing.y)); + SetNextWindowPos(g.LastItemData.Rect.GetBL() + ImVec2(0.0f, style.ItemSpacing.y)); } } if (!(flags & ImGuiColorEditFlags_NoOptions)) - OpenPopupOnItemClick("context"); + OpenPopupOnItemClick("context", ImGuiPopupFlags_MouseButtonRight); if (BeginPopup("picker")) { - picker_active_window = g.CurrentWindow; - if (label != label_display_end) + if (g.CurrentWindow->BeginCount == 1) { - TextEx(label, label_display_end); - Spacing(); + picker_active_window = g.CurrentWindow; + if (label != label_display_end) + { + TextEx(label, label_display_end); + Spacing(); + } + ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags_DataTypeMask_ | ImGuiColorEditFlags_PickerMask_ | ImGuiColorEditFlags_InputMask_ | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar; + ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags_DisplayMask_ | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf; + SetNextItemWidth(square_sz * 12.0f); // Use 256 + bar sizes? + value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x); } - ImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags_DataTypeMask_ | ImGuiColorEditFlags_PickerMask_ | ImGuiColorEditFlags_InputMask_ | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar; - ImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags_DisplayMask_ | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf; - SetNextItemWidth(square_sz * 12.0f); // Use 256 + bar sizes? - value_changed |= ColorPicker4("##picker", col, picker_flags, &g.ColorPickerRef.x); EndPopup(); } } if (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel)) { - const float text_offset_x = (flags & ImGuiColorEditFlags_NoInputs) ? w_button : w_full + style.ItemInnerSpacing.x; - window->DC.CursorPos = ImVec2(pos.x + text_offset_x, pos.y + style.FramePadding.y); + // Position not necessarily next to last submitted button (e.g. if style.ColorButtonPosition == ImGuiDir_Left), + // but we need to use SameLine() to setup baseline correctly. Might want to refactor SameLine() to simplify this. + SameLine(0.0f, style.ItemInnerSpacing.x); + window->DC.CursorPos.x = pos.x + ((flags & ImGuiColorEditFlags_NoInputs) ? w_button : w_full + style.ItemInnerSpacing.x); TextEx(label, label_display_end); } @@ -5055,10 +5267,11 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag f[n] = i[n] / 255.0f; if ((flags & ImGuiColorEditFlags_DisplayHSV) && (flags & ImGuiColorEditFlags_InputRGB)) { - g.ColorEditLastHue = f[0]; - g.ColorEditLastSat = f[1]; + g.ColorEditSavedHue = f[0]; + g.ColorEditSavedSat = f[1]; ColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]); - g.ColorEditLastColor = ColorConvertFloat4ToU32(ImVec4(f[0], f[1], f[2], 0)); + g.ColorEditSavedID = g.ColorEditCurrentID; + g.ColorEditSavedColor = ColorConvertFloat4ToU32(ImVec4(f[0], f[1], f[2], 0)); } if ((flags & ImGuiColorEditFlags_DisplayRGB) && (flags & ImGuiColorEditFlags_InputHSV)) ColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]); @@ -5070,6 +5283,8 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag col[3] = f[3]; } + if (set_current_color_edit_id) + g.ColorEditCurrentID = 0; PopID(); EndGroup(); @@ -5080,7 +5295,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag bool accepted_drag_drop = false; if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F)) { - memcpy((float*)col, payload->Data, sizeof(float) * 3); // Preserve alpha if any //-V512 + memcpy((float*)col, payload->Data, sizeof(float) * 3); // Preserve alpha if any //-V512 //-V1086 value_changed = accepted_drag_drop = true; } if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F)) @@ -5099,7 +5314,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag if (picker_active_window && g.ActiveId != 0 && g.ActiveIdWindow == picker_active_window) g.LastItemData.ID = g.ActiveId; - if (value_changed) + if (value_changed && g.LastItemData.ID != 0) // In case of ID collision, the second EndGroup() won't catch g.ActiveId MarkItemEdited(g.LastItemData.ID); return value_changed; @@ -5143,6 +5358,9 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl g.NextItemData.ClearFlags(); PushID(label); + const bool set_current_color_edit_id = (g.ColorEditCurrentID == 0); + if (set_current_color_edit_id) + g.ColorEditCurrentID = window->IDStack.back(); BeginGroup(); if (!(flags & ImGuiColorEditFlags_NoSidePreview)) @@ -5191,7 +5409,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl float R = col[0], G = col[1], B = col[2]; if (flags & ImGuiColorEditFlags_InputRGB) { - // Hue is lost when converting from greyscale rgb (saturation=0). Restore it. + // Hue is lost when converting from grayscale rgb (saturation=0). Restore it. ColorConvertRGBtoHSV(R, G, B, H, S, V); ColorEditRestoreHS(col, &H, &S, &V); } @@ -5236,7 +5454,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl } } if (!(flags & ImGuiColorEditFlags_NoOptions)) - OpenPopupOnItemClick("context"); + OpenPopupOnItemClick("context", ImGuiPopupFlags_MouseButtonRight); } else if (flags & ImGuiColorEditFlags_PickerHueBar) { @@ -5246,14 +5464,11 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl { S = ImSaturate((io.MousePos.x - picker_pos.x) / (sv_picker_size - 1)); V = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1)); - - // Greatly reduces hue jitter and reset to 0 when hue == 255 and color is rapidly modified using SV square. - if (g.ColorEditLastColor == ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0))) - H = g.ColorEditLastHue; + ColorEditRestoreH(col, &H); // Greatly reduces hue jitter and reset to 0 when hue == 255 and color is rapidly modified using SV square. value_changed = value_changed_sv = true; } if (!(flags & ImGuiColorEditFlags_NoOptions)) - OpenPopupOnItemClick("context"); + OpenPopupOnItemClick("context", ImGuiPopupFlags_MouseButtonRight); // Hue bar logic SetCursorScreenPos(ImVec2(bar0_pos_x, picker_pos.y)); @@ -5324,9 +5539,10 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl if (flags & ImGuiColorEditFlags_InputRGB) { ColorConvertHSVtoRGB(H, S, V, col[0], col[1], col[2]); - g.ColorEditLastHue = H; - g.ColorEditLastSat = S; - g.ColorEditLastColor = ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0)); + g.ColorEditSavedHue = H; + g.ColorEditSavedSat = S; + g.ColorEditSavedID = g.ColorEditCurrentID; + g.ColorEditSavedColor = ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 0)); } else if (flags & ImGuiColorEditFlags_InputHSV) { @@ -5428,7 +5644,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl float sin_hue_angle = ImSin(H * 2.0f * IM_PI); ImVec2 hue_cursor_pos(wheel_center.x + cos_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5f, wheel_center.y + sin_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5f); float hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f; - int hue_cursor_segments = ImClamp((int)(hue_cursor_rad / 1.4f), 9, 32); + int hue_cursor_segments = draw_list->_CalcCircleAutoSegmentCount(hue_cursor_rad); // Lock segment count so the +1 one matches others. draw_list->AddCircleFilled(hue_cursor_pos, hue_cursor_rad, hue_color32, hue_cursor_segments); draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad + 1, col_midgrey, hue_cursor_segments); draw_list->AddCircle(hue_cursor_pos, hue_cursor_rad, col_white, hue_cursor_segments); @@ -5438,13 +5654,10 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl ImVec2 trb = wheel_center + ImRotate(triangle_pb, cos_hue_angle, sin_hue_angle); ImVec2 trc = wheel_center + ImRotate(triangle_pc, cos_hue_angle, sin_hue_angle); ImVec2 uv_white = GetFontTexUvWhitePixel(); - draw_list->PrimReserve(6, 6); + draw_list->PrimReserve(3, 3); draw_list->PrimVtx(tra, uv_white, hue_color32); - draw_list->PrimVtx(trb, uv_white, hue_color32); - draw_list->PrimVtx(trc, uv_white, col_white); - draw_list->PrimVtx(tra, uv_white, 0); draw_list->PrimVtx(trb, uv_white, col_black); - draw_list->PrimVtx(trc, uv_white, 0); + draw_list->PrimVtx(trc, uv_white, col_white); draw_list->AddTriangle(tra, trb, trc, col_midgrey, 1.5f); sv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V)); } @@ -5467,9 +5680,10 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl // Render cursor/preview circle (clamp S/V within 0..1 range because floating points colors may lead HSV values to be out of range) float sv_cursor_rad = value_changed_sv ? 10.0f : 6.0f; - draw_list->AddCircleFilled(sv_cursor_pos, sv_cursor_rad, user_col32_striped_of_alpha, 12); - draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad + 1, col_midgrey, 12); - draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad, col_white, 12); + int sv_cursor_segments = draw_list->_CalcCircleAutoSegmentCount(sv_cursor_rad); // Lock segment count so the +1 one matches others. + draw_list->AddCircleFilled(sv_cursor_pos, sv_cursor_rad, user_col32_striped_of_alpha, sv_cursor_segments); + draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad + 1, col_midgrey, sv_cursor_segments); + draw_list->AddCircle(sv_cursor_pos, sv_cursor_rad, col_white, sv_cursor_segments); // Render alpha bar if (alpha_bar) @@ -5487,9 +5701,11 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl if (value_changed && memcmp(backup_initial_col, col, components * sizeof(float)) == 0) value_changed = false; - if (value_changed) + if (value_changed && g.LastItemData.ID != 0) // In case of ID collision, the second EndGroup() won't catch g.ActiveId MarkItemEdited(g.LastItemData.ID); + if (set_current_color_edit_id) + g.ColorEditCurrentID = 0; PopID(); return value_changed; @@ -5499,7 +5715,7 @@ bool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags fl // FIXME: May want to display/ignore the alpha component in the color display? Yet show it in the tooltip. // 'desc_id' is not called 'label' because we don't display it next to the button, but only in the tooltip. // Note that 'col' may be encoded in HSV if ImGuiColorEditFlags_InputHSV is set. -bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags, ImVec2 size) +bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags, const ImVec2& size_arg) { ImGuiWindow* window = GetCurrentWindow(); if (window->SkipItems) @@ -5507,11 +5723,8 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl ImGuiContext& g = *GImGui; const ImGuiID id = window->GetID(desc_id); - float default_size = GetFrameHeight(); - if (size.x == 0.0f) - size.x = default_size; - if (size.y == 0.0f) - size.y = default_size; + const float default_size = GetFrameHeight(); + const ImVec2 size(size_arg.x == 0.0f ? default_size : size_arg.x, size_arg.y == 0.0f ? default_size : size_arg.y); const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); ItemSize(bb, (size.y >= default_size) ? g.Style.FramePadding.y : 0.0f); if (!ItemAdd(bb, id)) @@ -5606,7 +5819,8 @@ void ImGui::ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags { ImGuiContext& g = *GImGui; - BeginTooltipEx(ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_None); + if (!BeginTooltipEx(ImGuiTooltipFlags_OverridePreviousTooltip, ImGuiWindowFlags_None)) + return; const char* text_end = text ? FindRenderedTextEnd(text, NULL) : text; if (text_end > text) { @@ -5809,9 +6023,9 @@ bool ImGui::TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char if (window->SkipItems) return false; - ImGuiContext& g = *GImGui; - const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); - return TreeNodeBehavior(window->GetID(str_id), flags, g.TempBuffer, label_end); + const char* label, *label_end; + ImFormatStringToTempBufferV(&label, &label_end, fmt, args); + return TreeNodeBehavior(window->GetID(str_id), flags, label, label_end); } bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) @@ -5820,12 +6034,19 @@ bool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char if (window->SkipItems) return false; + const char* label, *label_end; + ImFormatStringToTempBufferV(&label, &label_end, fmt, args); + return TreeNodeBehavior(window->GetID(ptr_id), flags, label, label_end); +} + +void ImGui::TreeNodeSetOpen(ImGuiID id, bool open) +{ ImGuiContext& g = *GImGui; - const char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args); - return TreeNodeBehavior(window->GetID(ptr_id), flags, g.TempBuffer, label_end); + ImGuiStorage* storage = g.CurrentWindow->DC.StateStorage; + storage->SetInt(id, open ? 1 : 0); } -bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags) +bool ImGui::TreeNodeUpdateNextOpen(ImGuiID id, ImGuiTreeNodeFlags flags) { if (flags & ImGuiTreeNodeFlags_Leaf) return true; @@ -5841,7 +6062,7 @@ bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags) if (g.NextItemData.OpenCond & ImGuiCond_Always) { is_open = g.NextItemData.OpenVal; - storage->SetInt(id, is_open); + TreeNodeSetOpen(id, is_open); } else { @@ -5850,7 +6071,7 @@ bool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags) if (stored_value == -1) { is_open = g.NextItemData.OpenVal; - storage->SetInt(id, is_open); + TreeNodeSetOpen(id, is_open); } else { @@ -5916,7 +6137,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l // For this purpose we essentially compare if g.NavIdIsAlive went from 0 to 1 between TreeNode() and TreePop(). // This is currently only support 32 level deep and we are fine with (1 << Depth) overflowing into a zero. const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0; - bool is_open = TreeNodeBehaviorIsOpen(id, flags); + bool is_open = TreeNodeUpdateNextOpen(id, flags); if (is_open && !g.NavIdIsAlive && (flags & ImGuiTreeNodeFlags_NavLeftJumpsBackHere) && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen)) window->DC.TreeJumpToParentOnPopMask |= (1 << window->DC.TreeDepth); @@ -6259,6 +6480,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl // We use NoHoldingActiveID on menus so user can click and _hold_ on a menu then drag to browse child entries ImGuiButtonFlags button_flags = 0; if (flags & ImGuiSelectableFlags_NoHoldingActiveID) { button_flags |= ImGuiButtonFlags_NoHoldingActiveId; } + if (flags & ImGuiSelectableFlags_NoSetKeyOwner) { button_flags |= ImGuiButtonFlags_NoSetKeyOwner; } if (flags & ImGuiSelectableFlags_SelectOnClick) { button_flags |= ImGuiButtonFlags_PressedOnClick; } if (flags & ImGuiSelectableFlags_SelectOnRelease) { button_flags |= ImGuiButtonFlags_PressedOnRelease; } if (flags & ImGuiSelectableFlags_AllowDoubleClick) { button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick; } @@ -6275,7 +6497,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl // - (1) it would require focus scope to be set, need exposing PushFocusScope() or equivalent (e.g. BeginSelection() calling PushFocusScope()) // - (2) usage will fail with clipped items // The multi-select API aim to fix those issues, e.g. may be replaced with a BeginSelection() API. - if ((flags & ImGuiSelectableFlags_SelectOnNav) && g.NavJustMovedToId != 0 && g.NavJustMovedToFocusScopeId == window->DC.NavFocusScopeIdCurrent) + if ((flags & ImGuiSelectableFlags_SelectOnNav) && g.NavJustMovedToId != 0 && g.NavJustMovedToFocusScopeId == g.CurrentFocusScopeId) if (g.NavJustMovedToId == id) selected = pressed = true; @@ -6284,7 +6506,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl { if (!g.NavDisableMouseHover && g.NavWindow == window && g.NavLayer == window->DC.NavLayerCurrent) { - SetNavID(id, window->DC.NavLayerCurrent, window->DC.NavFocusScopeIdCurrent, WindowRectAbsToRel(window, bb)); // (bb == NavRect) + SetNavID(id, window->DC.NavLayerCurrent, g.CurrentFocusScopeId, WindowRectAbsToRel(window, bb)); // (bb == NavRect) g.NavDisableHighlight = true; } } @@ -6299,8 +6521,6 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledSelection; // Render - if (held && (flags & ImGuiSelectableFlags_DrawHoveredWhenHeld)) - hovered = true; if (hovered || selected) { const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header); @@ -6475,7 +6695,7 @@ bool ImGui::ListBox(const char* label, int* current_item, bool (*items_getter)(v // - others https://github.com/ocornut/imgui/wiki/Useful-Extensions //------------------------------------------------------------------------- -int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size) +int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, const ImVec2& size_arg) { ImGuiContext& g = *GImGui; ImGuiWindow* window = GetCurrentWindow(); @@ -6486,10 +6706,7 @@ int ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_get const ImGuiID id = window->GetID(label); const ImVec2 label_size = CalcTextSize(label, NULL, true); - if (frame_size.x == 0.0f) - frame_size.x = CalcItemWidth(); - if (frame_size.y == 0.0f) - frame_size.y = label_size.y + (style.FramePadding.y * 2); + const ImVec2 frame_size = CalcItemSize(size_arg, CalcItemWidth(), label_size.y + style.FramePadding.y * 2.0f); const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size); const ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding); @@ -6749,6 +6966,7 @@ bool ImGui::BeginMenuBar() // We overwrite CursorMaxPos because BeginGroup sets it to CursorPos (essentially the .EmitItem hack in EndMenuBar() would need something analogous here, maybe a BeginGroupEx() with flags). window->DC.CursorPos = window->DC.CursorMaxPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffset.x, bar_rect.Min.y + window->DC.MenuBarOffset.y); window->DC.LayoutType = ImGuiLayoutType_Horizontal; + window->DC.IsSameLine = false; window->DC.NavLayerCurrent = ImGuiNavLayer_Menu; window->DC.MenuBarAppending = true; AlignTextToFramePadding(); @@ -6774,7 +6992,7 @@ void ImGui::EndMenuBar() // To do so we claim focus back, restore NavId and then process the movement request for yet another frame. // This involve a one-frame delay which isn't very problematic in this situation. We could remove it by scoring in advance for multiple window (probably not worth bothering) const ImGuiNavLayer layer = ImGuiNavLayer_Menu; - IM_ASSERT(window->DC.NavLayersActiveMaskNext & (1 << layer)); // Sanity check + IM_ASSERT(window->DC.NavLayersActiveMaskNext & (1 << layer)); // Sanity check (FIXME: Seems unnecessary) FocusWindow(window); SetNavID(window->NavLastIds[layer], layer, 0, window->NavRectRel[layer]); g.NavDisableHighlight = true; // Hide highlight for the current frame so we don't see the intermediary selection. @@ -6792,6 +7010,7 @@ void ImGui::EndMenuBar() g.GroupStack.back().EmitItem = false; EndGroup(); // Restore position on layer 0 window->DC.LayoutType = ImGuiLayoutType_Vertical; + window->DC.IsSameLine = false; window->DC.NavLayerCurrent = ImGuiNavLayer_Main; window->DC.MenuBarAppending = false; } @@ -6875,14 +7094,19 @@ static bool IsRootOfOpenMenuSet() if ((g.OpenPopupStack.Size <= g.BeginPopupStack.Size) || (window->Flags & ImGuiWindowFlags_ChildMenu)) return false; - // Initially we used 'OpenParentId' to differentiate multiple menu sets from each others (e.g. inside menu bar vs loose menu items) based on parent ID. + // Initially we used 'upper_popup->OpenParentId == window->IDStack.back()' to differentiate multiple menu sets from each others + // (e.g. inside menu bar vs loose menu items) based on parent ID. // This would however prevent the use of e.g. PuhsID() user code submitting menus. // Previously this worked between popup and a first child menu because the first child menu always had the _ChildWindow flag, // making hovering on parent popup possible while first child menu was focused - but this was generally a bug with other side effects. // Instead we don't treat Popup specifically (in order to consistently support menu features in them), maybe the first child menu of a Popup - // doesn't have the _ChildWindow flag, and we rely on this IsRootOfOpenMenuSet() check to allow hovering between root window/popup and first chilld menu. + // doesn't have the _ChildWindow flag, and we rely on this IsRootOfOpenMenuSet() check to allow hovering between root window/popup and first child menu. + // In the end, lack of ID check made it so we could no longer differentiate between separate menu sets. To compensate for that, we at least check parent window nav layer. + // This fixes the most common case of menu opening on hover when moving between window content and menu bar. Multiple different menu sets in same nav layer would still + // open on hover, but that should be a lesser problem, because if such menus are close in proximity in window content then it won't feel weird and if they are far apart + // it likely won't be a problem anyone runs into. const ImGuiPopupData* upper_popup = &g.OpenPopupStack[g.BeginPopupStack.Size]; - return (/*upper_popup->OpenParentId == window->IDStack.back() &&*/ upper_popup->Window && (upper_popup->Window->Flags & ImGuiWindowFlags_ChildMenu)); + return (window->DC.NavLayerCurrent == upper_popup->ParentNavLayer && upper_popup->Window && (upper_popup->Window->Flags & ImGuiWindowFlags_ChildMenu)); } bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) @@ -6897,10 +7121,10 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) bool menu_is_open = IsPopupOpen(id, ImGuiPopupFlags_None); // Sub-menus are ChildWindow so that mouse can be hovering across them (otherwise top-most popup menu would steal focus and not allow hovering on parent menu) - // The first menu in a hierarchy isn't so hovering doesn't get accross (otherwise e.g. resizing borders with ImGuiButtonFlags_FlattenChildren would react), but top-most BeginMenu() will bypass that limitation. - ImGuiWindowFlags flags = ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus; + // The first menu in a hierarchy isn't so hovering doesn't get across (otherwise e.g. resizing borders with ImGuiButtonFlags_FlattenChildren would react), but top-most BeginMenu() will bypass that limitation. + ImGuiWindowFlags window_flags = ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNavFocus; if (window->Flags & ImGuiWindowFlags_ChildMenu) - flags |= ImGuiWindowFlags_ChildWindow; + window_flags |= ImGuiWindowFlags_ChildWindow; // If a menu with same the ID was already submitted, we will append to it, matching the behavior of Begin(). // We are relying on a O(N) search - so O(N log N) over the frame - which seems like the most efficient for the expected small amount of BeginMenu() calls per frame. @@ -6908,7 +7132,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) if (g.MenusIdSubmittedThisFrame.contains(id)) { if (menu_is_open) - menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) + menu_is_open = BeginPopupEx(id, window_flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) else g.NextWindowData.ClearFlags(); // we behave like Begin() and need to consume those values return menu_is_open; @@ -6920,10 +7144,10 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) ImVec2 label_size = CalcTextSize(label, NULL, true); // Odd hack to allow hovering across menus of a same menu-set (otherwise we wouldn't be able to hover parent without always being a Child window) + // This is only done for items for the menu set and not the full parent window. const bool menuset_is_open = IsRootOfOpenMenuSet(); - ImGuiWindow* backed_nav_window = g.NavWindow; if (menuset_is_open) - g.NavWindow = window; + PushItemFlag(ImGuiItemFlags_NoWindowHoverableCheck, true); // The reference position stored in popup_pos will be used by Begin() to find a suitable position for the child menu, // However the final position is going to be different! It is chosen by FindBestWindowPosForPopup(). @@ -6934,6 +7158,9 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) BeginDisabled(); const ImGuiMenuColumns* offsets = &window->DC.MenuColumns; bool pressed; + + // We use ImGuiSelectableFlags_NoSetKeyOwner to allow down on one menu item, move, up on another. + const ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_NoSetKeyOwner | ImGuiSelectableFlags_SelectOnClick | ImGuiSelectableFlags_DontClosePopups; if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) { // Menu inside an horizontal menu bar @@ -6944,7 +7171,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y)); float w = label_size.x; ImVec2 text_pos(window->DC.CursorPos.x + offsets->OffsetLabel, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset); - pressed = Selectable("", menu_is_open, ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_SelectOnClick | ImGuiSelectableFlags_DontClosePopups, ImVec2(w, 0.0f)); + pressed = Selectable("", menu_is_open, selectable_flags, ImVec2(w, label_size.y)); RenderText(text_pos, label); PopStyleVar(); window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar(). @@ -6960,7 +7187,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) float min_w = window->DC.MenuColumns.DeclColumns(icon_w, label_size.x, 0.0f, checkmark_w); // Feedback to next frame float extra_w = ImMax(0.0f, GetContentRegionAvail().x - min_w); ImVec2 text_pos(window->DC.CursorPos.x + offsets->OffsetLabel, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset); - pressed = Selectable("", menu_is_open, ImGuiSelectableFlags_NoHoldingActiveID | ImGuiSelectableFlags_SelectOnClick | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, 0.0f)); + pressed = Selectable("", menu_is_open, selectable_flags | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, label_size.y)); RenderText(text_pos, label); if (icon_w > 0.0f) RenderText(pos + ImVec2(offsets->OffsetIcon, 0.0f), icon); @@ -6969,9 +7196,9 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) if (!enabled) EndDisabled(); - const bool hovered = (g.HoveredId == id) && enabled; + const bool hovered = (g.HoveredId == id) && enabled && !g.NavDisableMouseHover; if (menuset_is_open) - g.NavWindow = backed_nav_window; + PopItemFlag(); bool want_open = false; bool want_close = false; @@ -6979,29 +7206,37 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) { // Close menu when not hovering it anymore unless we are moving roughly in the direction of the menu // Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive. - bool moving_toward_other_child_menu = false; - ImGuiWindow* child_menu_window = (g.BeginPopupStack.Size < g.OpenPopupStack.Size && g.OpenPopupStack[g.BeginPopupStack.Size].SourceWindow == window) ? g.OpenPopupStack[g.BeginPopupStack.Size].Window : NULL; - if (g.HoveredWindow == window && child_menu_window != NULL && !(window->Flags & ImGuiWindowFlags_MenuBar)) + bool moving_toward_child_menu = false; + ImGuiPopupData* child_popup = (g.BeginPopupStack.Size < g.OpenPopupStack.Size) ? &g.OpenPopupStack[g.BeginPopupStack.Size] : NULL; // Popup candidate (testing below) + ImGuiWindow* child_menu_window = (child_popup && child_popup->Window && child_popup->Window->ParentWindow == window) ? child_popup->Window : NULL; + if (g.HoveredWindow == window && child_menu_window != NULL) { float ref_unit = g.FontSize; // FIXME-DPI + float child_dir = (window->Pos.x < child_menu_window->Pos.x) ? 1.0f : -1.0f; ImRect next_window_rect = child_menu_window->Rect(); ImVec2 ta = (g.IO.MousePos - g.IO.MouseDelta); - ImVec2 tb = (window->Pos.x < child_menu_window->Pos.x) ? next_window_rect.GetTL() : next_window_rect.GetTR(); - ImVec2 tc = (window->Pos.x < child_menu_window->Pos.x) ? next_window_rect.GetBL() : next_window_rect.GetBR(); + ImVec2 tb = (child_dir > 0.0f) ? next_window_rect.GetTL() : next_window_rect.GetTR(); + ImVec2 tc = (child_dir > 0.0f) ? next_window_rect.GetBL() : next_window_rect.GetBR(); float extra = ImClamp(ImFabs(ta.x - tb.x) * 0.30f, ref_unit * 0.5f, ref_unit * 2.5f); // add a bit of extra slack. - ta.x += (window->Pos.x < child_menu_window->Pos.x) ? -0.5f : +0.5f; // to avoid numerical issues (FIXME: ??) - tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -ref_unit * 8.0f); // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale? + ta.x += child_dir * -0.5f; + tb.x += child_dir * ref_unit; + tc.x += child_dir * ref_unit; + tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -ref_unit * 8.0f); // triangle has maximum height to limit the slope and the bias toward large sub-menus tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +ref_unit * 8.0f); - moving_toward_other_child_menu = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos); - //GetForegroundDrawList()->AddTriangleFilled(ta, tb, tc, moving_toward_other_child_menu ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); // [DEBUG] + moving_toward_child_menu = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos); + //GetForegroundDrawList()->AddTriangleFilled(ta, tb, tc, moving_toward_child_menu ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); // [DEBUG] } - if (menu_is_open && !hovered && g.HoveredWindow == window && g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrame != id && !moving_toward_other_child_menu) + + // The 'HovereWindow == window' check creates an inconsistency (e.g. moving away from menu slowly tends to hit same window, whereas moving away fast does not) + // But we also need to not close the top-menu menu when moving over void. Perhaps we should extend the triangle check to a larger polygon. + // (Remember to test this on BeginPopup("A")->BeginMenu("B") sequence which behaves slightly differently as B isn't a Child of A and hovering isn't shared.) + if (menu_is_open && !hovered && g.HoveredWindow == window && !moving_toward_child_menu && !g.NavDisableMouseHover) want_close = true; // Open if (!menu_is_open && pressed) // Click/activate to open want_open = true; - else if (!menu_is_open && hovered && !moving_toward_other_child_menu) // Hover to open + else if (!menu_is_open && hovered && !moving_toward_child_menu) // Hover to open want_open = true; if (g.NavId == id && g.NavMoveDir == ImGuiDir_Right) // Nav-Right to open { @@ -7036,23 +7271,32 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Openable | (menu_is_open ? ImGuiItemStatusFlags_Opened : 0)); PopID(); - if (!menu_is_open && want_open && g.OpenPopupStack.Size > g.BeginPopupStack.Size) + if (want_open && !menu_is_open && g.OpenPopupStack.Size > g.BeginPopupStack.Size) { - // Don't recycle same menu level in the same frame, first close the other menu and yield for a frame. + // Don't reopen/recycle same menu level in the same frame, first close the other menu and yield for a frame. OpenPopup(label); - return false; } - - menu_is_open |= want_open; - if (want_open) + else if (want_open) + { + menu_is_open = true; OpenPopup(label); + } if (menu_is_open) { - SetNextWindowPos(popup_pos, ImGuiCond_Always); // Note: this is super misleading! The value will serve as reference for FindBestWindowPosForPopup(), not actual pos. + ImGuiLastItemData last_item_in_parent = g.LastItemData; + SetNextWindowPos(popup_pos, ImGuiCond_Always); // Note: misleading: the value will serve as reference for FindBestWindowPosForPopup(), not actual pos. PushStyleVar(ImGuiStyleVar_ChildRounding, style.PopupRounding); // First level will use _PopupRounding, subsequent will use _ChildRounding - menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) + menu_is_open = BeginPopupEx(id, window_flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) PopStyleVar(); + if (menu_is_open) + { + // Restore LastItemData so IsItemXXXX functions can work after BeginMenu()/EndMenu() + // (This fixes using IsItemClicked() and IsItemHovered(), but IsItemHovered() also relies on its support for ImGuiItemFlags_NoWindowHoverableCheck) + g.LastItemData = last_item_in_parent; + if (g.HoveredWindow == window) + g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow; + } } else { @@ -7069,17 +7313,18 @@ bool ImGui::BeginMenu(const char* label, bool enabled) void ImGui::EndMenu() { - // Nav: When a left move request _within our child menu_ failed, close ourselves (the _parent_ menu). - // A menu doesn't close itself because EndMenuBar() wants the catch the last Left<>Right inputs. - // However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction. + // Nav: When a left move request our menu failed, close ourselves. ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; - if (g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical) - if (g.NavWindow && (g.NavWindow->RootWindowForNav->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->RootWindowForNav->ParentWindow == window) - { - ClosePopupToLevel(g.BeginPopupStack.Size, true); - NavMoveRequestCancel(); - } + IM_ASSERT(window->Flags & ImGuiWindowFlags_Popup); // Mismatched BeginMenu()/EndMenu() calls + ImGuiWindow* parent_window = window->ParentWindow; // Should always be != NULL is we passed assert. + if (window->BeginCount == window->BeginCountPreviousFrame) + if (g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet()) + if (g.NavWindow && (g.NavWindow->RootWindowForNav == window) && parent_window->DC.LayoutType == ImGuiLayoutType_Vertical) + { + ClosePopupToLevel(g.BeginPopupStack.Size - 1, true); + NavMoveRequestCancel(); + } EndPopup(); } @@ -7095,10 +7340,10 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut ImVec2 pos = window->DC.CursorPos; ImVec2 label_size = CalcTextSize(label, NULL, true); + // See BeginMenuEx() for comments about this. const bool menuset_is_open = IsRootOfOpenMenuSet(); - ImGuiWindow* backed_nav_window = g.NavWindow; if (menuset_is_open) - g.NavWindow = window; + PushItemFlag(ImGuiItemFlags_NoWindowHoverableCheck, true); // We've been using the equivalent of ImGuiSelectableFlags_SetNavIdOnHover on all Selectable() since early Nav system days (commit 43ee5d73), // but I am unsure whether this should be kept at all. For now moved it to be an opt-in feature used by menus only. @@ -7107,7 +7352,8 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut if (!enabled) BeginDisabled(); - const ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_SelectOnRelease | ImGuiSelectableFlags_SetNavIdOnHover; + // We use ImGuiSelectableFlags_NoSetKeyOwner to allow down on one menu item, move, up on another. + const ImGuiSelectableFlags selectable_flags = ImGuiSelectableFlags_SelectOnRelease | ImGuiSelectableFlags_NoSetKeyOwner | ImGuiSelectableFlags_SetNavIdOnHover; const ImGuiMenuColumns* offsets = &window->DC.MenuColumns; if (window->DC.LayoutType == ImGuiLayoutType_Horizontal) { @@ -7119,7 +7365,8 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y)); pressed = Selectable("", selected, selectable_flags, ImVec2(w, 0.0f)); PopStyleVar(); - RenderText(text_pos, label); + if (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Visible) + RenderText(text_pos, label); window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar(). } else @@ -7132,25 +7379,28 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut float checkmark_w = IM_FLOOR(g.FontSize * 1.20f); float min_w = window->DC.MenuColumns.DeclColumns(icon_w, label_size.x, shortcut_w, checkmark_w); // Feedback for next frame float stretch_w = ImMax(0.0f, GetContentRegionAvail().x - min_w); - pressed = Selectable("", false, selectable_flags | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, 0.0f)); - RenderText(pos + ImVec2(offsets->OffsetLabel, 0.0f), label); - if (icon_w > 0.0f) - RenderText(pos + ImVec2(offsets->OffsetIcon, 0.0f), icon); - if (shortcut_w > 0.0f) + pressed = Selectable("", false, selectable_flags | ImGuiSelectableFlags_SpanAvailWidth, ImVec2(min_w, label_size.y)); + if (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_Visible) { - PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); - RenderText(pos + ImVec2(offsets->OffsetShortcut + stretch_w, 0.0f), shortcut, NULL, false); - PopStyleColor(); + RenderText(pos + ImVec2(offsets->OffsetLabel, 0.0f), label); + if (icon_w > 0.0f) + RenderText(pos + ImVec2(offsets->OffsetIcon, 0.0f), icon); + if (shortcut_w > 0.0f) + { + PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); + RenderText(pos + ImVec2(offsets->OffsetShortcut + stretch_w, 0.0f), shortcut, NULL, false); + PopStyleColor(); + } + if (selected) + RenderCheckMark(window->DrawList, pos + ImVec2(offsets->OffsetMark + stretch_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(ImGuiCol_Text), g.FontSize * 0.866f); } - if (selected) - RenderCheckMark(window->DrawList, pos + ImVec2(offsets->OffsetMark + stretch_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(ImGuiCol_Text), g.FontSize * 0.866f); } IMGUI_TEST_ENGINE_ITEM_INFO(g.LastItemData.ID, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (selected ? ImGuiItemStatusFlags_Checked : 0)); if (!enabled) EndDisabled(); PopID(); if (menuset_is_open) - g.NavWindow = backed_nav_window; + PopItemFlag(); return pressed; } @@ -7181,11 +7431,17 @@ bool ImGui::MenuItem(const char* label, const char* shortcut, bool* p_selected, // - TabBarCalcTabID() [Internal] // - TabBarCalcMaxTabWidth() [Internal] // - TabBarFindTabById() [Internal] +// - TabBarFindTabByOrder() [Internal] +// - TabBarGetCurrentTab() [Internal] +// - TabBarGetTabName() [Internal] // - TabBarRemoveTab() [Internal] // - TabBarCloseTab() [Internal] // - TabBarScrollClamp() [Internal] // - TabBarScrollToTab() [Internal] -// - TabBarQueueChangeTabOrder() [Internal] +// - TabBarQueueFocus() [Internal] +// - TabBarQueueReorder() [Internal] +// - TabBarProcessReorderFromMousePos() [Internal] +// - TabBarProcessReorder() [Internal] // - TabBarScrollingButtons() [Internal] // - TabBarTabListPopupButton() [Internal] //------------------------------------------------------------------------- @@ -7202,7 +7458,7 @@ struct ImGuiTabBarSection namespace ImGui { static void TabBarLayout(ImGuiTabBar* tab_bar); - static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label); + static ImU32 TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, ImGuiWindow* docked_window); static float TabBarCalcMaxTabWidth(); static float TabBarScrollClamp(ImGuiTabBar* tab_bar, float scrolling); static void TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGuiTabBarSection* sections); @@ -7310,6 +7566,7 @@ bool ImGui::BeginTabBarEx(ImGuiTabBar* tab_bar, const ImRect& tab_bar_bb, ImG tab_bar->ItemSpacingY = g.Style.ItemSpacing.y; tab_bar->FramePadding = g.Style.FramePadding; tab_bar->TabsActiveCount = 0; + tab_bar->LastTabItemIdx = -1; tab_bar->BeginCount = 1; // Set cursor pos in a way which only be used in the off-chance the user erroneously submits item before BeginTabItem(): items will overlap @@ -7358,6 +7615,7 @@ void ImGui::EndTabBar() if (tab_bar->BeginCount > 1) window->DC.CursorPos = tab_bar->BackupCursorPos; + tab_bar->LastTabItemIdx = -1; if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0) PopID(); @@ -7365,6 +7623,12 @@ void ImGui::EndTabBar() g.CurrentTabBar = g.CurrentTabBarStack.empty() ? NULL : GetTabBarFromTabBarRef(g.CurrentTabBarStack.back()); } +// Scrolling happens only in the central section (leading/trailing sections are not scrolling) +static float TabBarCalcScrollableWidth(ImGuiTabBar* tab_bar, ImGuiTabBarSection* sections) +{ + return tab_bar->BarRect.GetWidth() - sections[0].Width - sections[2].Width - sections[1].Spacing; +} + // This is called only once a frame before by the first call to ItemTab() // The reason we're not calling it in BeginTabBar() is to leave a chance to the user to call the SetTabItemClosed() functions. static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) @@ -7467,9 +7731,9 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) // Refresh tab width immediately, otherwise changes of style e.g. style.FramePadding.x would noticeably lag in the tab bar. // Additionally, when using TabBarAddTab() to manipulate tab bar order we occasionally insert new tabs that don't have a width yet, // and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window. - const char* tab_name = tab_bar->GetTabName(tab); - const bool has_close_button = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) ? false : true; - tab->ContentWidth = TabItemCalcSize(tab_name, has_close_button).x; + const char* tab_name = TabBarGetTabName(tab_bar, tab); + const bool has_close_button_or_unsaved_marker = (tab->Flags & ImGuiTabItemFlags_NoCloseButton) == 0 || (tab->Flags & ImGuiTabItemFlags_UnsavedDocument); + tab->ContentWidth = (tab->RequestedWidth >= 0.0f) ? tab->RequestedWidth : TabItemCalcSize(tab_name, has_close_button_or_unsaved_marker).x; int section_n = TabItemGetSectionIdx(tab); ImGuiTabBarSection* section = §ions[section_n]; @@ -7478,12 +7742,10 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) // Store data so we can build an array sorted by width if we need to shrink tabs down IM_MSVC_WARNING_SUPPRESS(6385); - int shrink_buffer_index = shrink_buffer_indexes[section_n]++; - g.ShrinkWidthBuffer[shrink_buffer_index].Index = tab_n; - g.ShrinkWidthBuffer[shrink_buffer_index].Width = tab->ContentWidth; - - IM_ASSERT(tab->ContentWidth > 0.0f); - tab->Width = tab->ContentWidth; + ImGuiShrinkWidthItem* shrink_width_item = &g.ShrinkWidthBuffer[shrink_buffer_indexes[section_n]++]; + shrink_width_item->Index = tab_n; + shrink_width_item->Width = shrink_width_item->InitialWidth = tab->ContentWidth; + tab->Width = ImMax(tab->ContentWidth, 1.0f); } // Compute total ideal width (used for e.g. auto-resizing a window) @@ -7513,7 +7775,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) width_excess = (section_0_w + section_2_w) - tab_bar->BarRect.GetWidth(); // Excess used to shrink leading/trailing section // With ImGuiTabBarFlags_FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore - if (width_excess > 0.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible)) + if (width_excess >= 1.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible)) { int shrink_data_count = (central_section_is_visible ? sections[1].TabCount : sections[0].TabCount + sections[2].TabCount); int shrink_data_offset = (central_section_is_visible ? sections[0].TabCount + sections[2].TabCount : 0); @@ -7527,6 +7789,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) if (shrinked_width < 0.0f) continue; + shrinked_width = ImMax(1.0f, shrinked_width); int section_n = TabItemGetSectionIdx(tab); sections[section_n].Width -= (tab->Width - shrinked_width); tab->Width = shrinked_width; @@ -7547,6 +7810,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) { ImGuiTabItem* tab = &tab_bar->Tabs[section_tab_index + tab_n]; tab->Offset = tab_offset; + tab->NameOffset = -1; tab_offset += tab->Width + (tab_n < section->TabCount - 1 ? g.Style.ItemInnerSpacing.x : 0.0f); } tab_bar->WidthAllTabs += ImMax(section->Width + section->Spacing, 0.0f); @@ -7554,6 +7818,9 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) section_tab_index += section->TabCount; } + // Clear name buffers + tab_bar->TabsNames.Buf.resize(0); + // If we have lost the selected tab, select the next most recently active one if (found_selected_tab_id == false) tab_bar->SelectedTabId = 0; @@ -7564,9 +7831,23 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) tab_bar->VisibleTabId = tab_bar->SelectedTabId; tab_bar->VisibleTabWasSubmitted = false; - // Update scrolling + // Apply request requests if (scroll_to_tab_id != 0) TabBarScrollToTab(tab_bar, scroll_to_tab_id, sections); + else if ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyScroll) && IsMouseHoveringRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, true) && IsWindowContentHoverable(g.CurrentWindow)) + { + const float wheel = g.IO.MouseWheelRequestAxisSwap ? g.IO.MouseWheel : g.IO.MouseWheelH; + const ImGuiKey wheel_key = g.IO.MouseWheelRequestAxisSwap ? ImGuiKey_MouseWheelY : ImGuiKey_MouseWheelX; + if (TestKeyOwner(wheel_key, tab_bar->ID) && wheel != 0.0f) + { + const float scroll_step = wheel * TabBarCalcScrollableWidth(tab_bar, sections) / 3.0f; + tab_bar->ScrollingTargetDistToVisibility = 0.0f; + tab_bar->ScrollingTarget = TabBarScrollClamp(tab_bar, tab_bar->ScrollingTarget - scroll_step); + } + SetKeyOwner(wheel_key, tab_bar->ID); + } + + // Update scrolling tab_bar->ScrollingAnim = TabBarScrollClamp(tab_bar, tab_bar->ScrollingAnim); tab_bar->ScrollingTarget = TabBarScrollClamp(tab_bar, tab_bar->ScrollingTarget); if (tab_bar->ScrollingAnim != tab_bar->ScrollingTarget) @@ -7585,10 +7866,6 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) tab_bar->ScrollingRectMinX = tab_bar->BarRect.Min.x + sections[0].Width + sections[0].Spacing; tab_bar->ScrollingRectMaxX = tab_bar->BarRect.Max.x - sections[2].Width - sections[1].Spacing; - // Clear name buffers - if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0) - tab_bar->TabsNames.Buf.resize(0); - // Actual layout in host window (we don't do it in BeginTabBar() so as not to waste an extra frame) ImGuiWindow* window = g.CurrentWindow; window->DC.CursorPos = tab_bar->BarRect.Min; @@ -7596,9 +7873,11 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar) window->DC.IdealMaxPos.x = ImMax(window->DC.IdealMaxPos.x, tab_bar->BarRect.Min.x + tab_bar->WidthAllTabsIdeal); } -// Dockables uses Name/ID in the global namespace. Non-dockable items use the ID stack. -static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label) +// Dockable windows uses Name/ID in the global namespace. Non-dockable items use the ID stack. +static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, ImGuiWindow* docked_window) { + IM_ASSERT(docked_window == NULL); // master branch only + IM_UNUSED(docked_window); if (tab_bar->Flags & ImGuiTabBarFlags_DockNode) { ImGuiID id = ImHashStr(label); @@ -7627,7 +7906,30 @@ ImGuiTabItem* ImGui::TabBarFindTabByID(ImGuiTabBar* tab_bar, ImGuiID tab_id) return NULL; } -// The *TabId fields be already set by the docking system _before_ the actual TabItem was created, so we clear them regardless. +// Order = visible order, not submission order! (which is tab->BeginOrder) +ImGuiTabItem* ImGui::TabBarFindTabByOrder(ImGuiTabBar* tab_bar, int order) +{ + if (order < 0 || order >= tab_bar->Tabs.Size) + return NULL; + return &tab_bar->Tabs[order]; +} + +ImGuiTabItem* ImGui::TabBarGetCurrentTab(ImGuiTabBar* tab_bar) +{ + if (tab_bar->LastTabItemIdx <= 0 || tab_bar->LastTabItemIdx >= tab_bar->Tabs.Size) + return NULL; + return &tab_bar->Tabs[tab_bar->LastTabItemIdx]; +} + +const char* ImGui::TabBarGetTabName(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) +{ + if (tab->NameOffset == -1) + return "N/A"; + IM_ASSERT(tab->NameOffset < tab_bar->TabsNames.Buf.Size); + return tab_bar->TabsNames.Buf.Data + tab->NameOffset; +} + +// The *TabId fields are already set by the docking system _before_ the actual TabItem was created, so we clear them regardless. void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id) { if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id)) @@ -7640,7 +7942,9 @@ void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id) // Called on manual closure attempt void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) { - IM_ASSERT(!(tab->Flags & ImGuiTabItemFlags_Button)); + if (tab->Flags & ImGuiTabItemFlags_Button) + return; // A button appended with TabItemButton(). + if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument)) { // This will remove a frame of lag for selecting another tab on closure. @@ -7656,7 +7960,7 @@ void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) { // Actually select before expecting closure attempt (on an UnsavedDocument tab user is expect to e.g. show a popup) if (tab_bar->VisibleTabId != tab->ID) - tab_bar->NextSelectedTabId = tab->ID; + TabBarQueueFocus(tab_bar, tab); } } @@ -7677,11 +7981,10 @@ static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGui ImGuiContext& g = *GImGui; float margin = g.FontSize * 1.0f; // When to scroll to make Tab N+1 visible always make a bit of N visible to suggest more scrolling area (since we don't have a scrollbar) - int order = tab_bar->GetTabOrder(tab); + int order = TabBarGetTabOrder(tab_bar, tab); // Scrolling happens only in the central section (leading/trailing sections are not scrolling) - // FIXME: This is all confusing. - float scrollable_width = tab_bar->BarRect.GetWidth() - sections[0].Width - sections[2].Width - sections[1].Spacing; + float scrollable_width = TabBarCalcScrollableWidth(tab_bar, sections); // We make all tabs positions all relative Sections[0].Width to make code simpler float tab_x1 = tab->Offset - sections[0].Width + (order > sections[0].TabCount - 1 ? -margin : 0.0f); @@ -7701,7 +8004,12 @@ static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiID tab_id, ImGui } } -void ImGui::TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int offset) +void ImGui::TabBarQueueFocus(ImGuiTabBar* tab_bar, ImGuiTabItem* tab) +{ + tab_bar->NextSelectedTabId = tab->ID; +} + +void ImGui::TabBarQueueReorder(ImGuiTabBar* tab_bar, ImGuiTabItem* tab, int offset) { IM_ASSERT(offset != 0); IM_ASSERT(tab_bar->ReorderRequestTabId == 0); @@ -7709,7 +8017,7 @@ void ImGui::TabBarQueueReorder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, in tab_bar->ReorderRequestOffset = (ImS16)offset; } -void ImGui::TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, const ImGuiTabItem* src_tab, ImVec2 mouse_pos) +void ImGui::TabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar, ImGuiTabItem* src_tab, ImVec2 mouse_pos) { ImGuiContext& g = *GImGui; IM_ASSERT(tab_bar->ReorderRequestTabId == 0); @@ -7752,7 +8060,7 @@ bool ImGui::TabBarProcessReorder(ImGuiTabBar* tab_bar) return false; //IM_ASSERT(tab_bar->Flags & ImGuiTabBarFlags_Reorderable); // <- this may happen when using debug tools - int tab2_order = tab_bar->GetTabOrder(tab1) + tab_bar->ReorderRequestOffset; + int tab2_order = TabBarGetTabOrder(tab_bar, tab1) + tab_bar->ReorderRequestOffset; if (tab2_order < 0 || tab2_order >= tab_bar->Tabs.Size) return false; @@ -7812,7 +8120,7 @@ static ImGuiTabItem* ImGui::TabBarScrollingButtons(ImGuiTabBar* tab_bar) if (select_dir != 0) if (ImGuiTabItem* tab_item = TabBarFindTabByID(tab_bar, tab_bar->SelectedTabId)) { - int selected_order = tab_bar->GetTabOrder(tab_item); + int selected_order = TabBarGetTabOrder(tab_bar, tab_item); int target_order = selected_order + select_dir; // Skip tab item buttons until another tab item is found or end is reached @@ -7864,7 +8172,7 @@ static ImGuiTabItem* ImGui::TabBarTabListPopupButton(ImGuiTabBar* tab_bar) if (tab->Flags & ImGuiTabItemFlags_Button) continue; - const char* tab_name = tab_bar->GetTabName(tab); + const char* tab_name = TabBarGetTabName(tab_bar, tab); if (Selectable(tab_name, tab_bar->SelectedTabId == tab->ID)) tab_to_select = tab; } @@ -7903,7 +8211,7 @@ bool ImGui::BeginTabItem(const char* label, bool* p_open, ImGuiTabItemFlags f } IM_ASSERT(!(flags & ImGuiTabItemFlags_Button)); // BeginTabItem() Can't be used with button flags, use TabItemButton() instead! - bool ret = TabItemEx(tab_bar, label, p_open, flags); + bool ret = TabItemEx(tab_bar, label, p_open, flags, NULL); if (ret && !(flags & ImGuiTabItemFlags_NoPushId)) { ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx]; @@ -7944,29 +8252,32 @@ bool ImGui::TabItemButton(const char* label, ImGuiTabItemFlags flags) IM_ASSERT_USER_ERROR(tab_bar != NULL, "Needs to be called between BeginTabBar() and EndTabBar()!"); return false; } - return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder); + return TabItemEx(tab_bar, label, NULL, flags | ImGuiTabItemFlags_Button | ImGuiTabItemFlags_NoReorder, NULL); } -bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags) +bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags, ImGuiWindow* docked_window) { // Layout whole tab bar if not already done + ImGuiContext& g = *GImGui; if (tab_bar->WantLayout) + { + ImGuiNextItemData backup_next_item_data = g.NextItemData; TabBarLayout(tab_bar); - - ImGuiContext& g = *GImGui; + g.NextItemData = backup_next_item_data; + } ImGuiWindow* window = g.CurrentWindow; if (window->SkipItems) return false; const ImGuiStyle& style = g.Style; - const ImGuiID id = TabBarCalcTabID(tab_bar, label); + const ImGuiID id = TabBarCalcTabID(tab_bar, label, docked_window); // If the user called us with *p_open == false, we early out and don't render. // We make a call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID. IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags); if (p_open && !*p_open) { - ItemAdd(ImRect(), id, NULL, ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus); + ItemAdd(ImRect(), id, NULL, ImGuiItemFlags_NoNav); return false; } @@ -7979,9 +8290,6 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, else if (p_open == NULL) flags |= ImGuiTabItemFlags_NoCloseButton; - // Calculate tab contents size - ImVec2 size = TabItemCalcSize(label, p_open != NULL); - // Acquire tab data ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, id); bool tab_is_new = false; @@ -7990,33 +8298,48 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, tab_bar->Tabs.push_back(ImGuiTabItem()); tab = &tab_bar->Tabs.back(); tab->ID = id; - tab->Width = size.x; - tab_bar->TabsAddedNew = true; - tab_is_new = true; + tab_bar->TabsAddedNew = tab_is_new = true; } tab_bar->LastTabItemIdx = (ImS16)tab_bar->Tabs.index_from_ptr(tab); + + // Calculate tab contents size + ImVec2 size = TabItemCalcSize(label, (p_open != NULL) || (flags & ImGuiTabItemFlags_UnsavedDocument)); + tab->RequestedWidth = -1.0f; + if (g.NextItemData.Flags & ImGuiNextItemDataFlags_HasWidth) + size.x = tab->RequestedWidth = g.NextItemData.Width; + if (tab_is_new) + tab->Width = ImMax(1.0f, size.x); tab->ContentWidth = size.x; tab->BeginOrder = tab_bar->TabsActiveCount++; const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount); const bool tab_bar_focused = (tab_bar->Flags & ImGuiTabBarFlags_IsFocused) != 0; const bool tab_appearing = (tab->LastFrameVisible + 1 < g.FrameCount); + const bool tab_just_unsaved = (flags & ImGuiTabItemFlags_UnsavedDocument) && !(tab->Flags & ImGuiTabItemFlags_UnsavedDocument); const bool is_tab_button = (flags & ImGuiTabItemFlags_Button) != 0; tab->LastFrameVisible = g.FrameCount; tab->Flags = flags; - // Append name with zero-terminator - tab->NameOffset = (ImS32)tab_bar->TabsNames.size(); - tab_bar->TabsNames.append(label, label + strlen(label) + 1); + // Append name _WITH_ the zero-terminator + if (docked_window != NULL) + { + IM_ASSERT(docked_window == NULL); // master branch only + } + else + { + tab->NameOffset = (ImS32)tab_bar->TabsNames.size(); + tab_bar->TabsNames.append(label, label + strlen(label) + 1); + } // Update selected tab - if (tab_appearing && (tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs) && tab_bar->NextSelectedTabId == 0) - if (!tab_bar_appearing || tab_bar->SelectedTabId == 0) - if (!is_tab_button) - tab_bar->NextSelectedTabId = id; // New tabs gets activated - if ((flags & ImGuiTabItemFlags_SetSelected) && (tab_bar->SelectedTabId != id)) // SetSelected can only be passed on explicit tab bar - if (!is_tab_button) - tab_bar->NextSelectedTabId = id; + if (!is_tab_button) + { + if (tab_appearing && (tab_bar->Flags & ImGuiTabBarFlags_AutoSelectNewTabs) && tab_bar->NextSelectedTabId == 0) + if (!tab_bar_appearing || tab_bar->SelectedTabId == 0) + TabBarQueueFocus(tab_bar, tab); // New tabs gets activated + if ((flags & ImGuiTabItemFlags_SetSelected) && (tab_bar->SelectedTabId != id)) // _SetSelected can only be passed on explicit tab bar + TabBarQueueFocus(tab_bar, tab); + } // Lock visibility // (Note: tab_contents_visible != tab_selected... because CTRL+TAB operations may preview some tabs without selecting them!) @@ -8033,7 +8356,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, // and then gets submitted again, the tabs will have 'tab_appearing=true' but 'tab_is_new=false'. if (tab_appearing && (!tab_bar_appearing || tab_is_new)) { - ItemAdd(ImRect(), id, NULL, ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus); + ItemAdd(ImRect(), id, NULL, ImGuiItemFlags_NoNav); if (is_tab_button) return false; return tab_contents_visible; @@ -8079,7 +8402,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, bool hovered, held; bool pressed = ButtonBehavior(bb, id, &hovered, &held, button_flags); if (pressed && !is_tab_button) - tab_bar->NextSelectedTabId = id; + TabBarQueueFocus(tab_bar, tab); // Allow the close button to overlap unless we are dragging (in which case we don't want any overlapping tabs to be hovered) if (g.ActiveId != id) @@ -8120,9 +8443,8 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, // Select with right mouse button. This is so the common idiom for context menu automatically highlight the current widget. const bool hovered_unblocked = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup); - if (hovered_unblocked && (IsMouseClicked(1) || IsMouseReleased(1))) - if (!is_tab_button) - tab_bar->NextSelectedTabId = id; + if (hovered_unblocked && (IsMouseClicked(1) || IsMouseReleased(1)) && !is_tab_button) + TabBarQueueFocus(tab_bar, tab); if (tab_bar->Flags & ImGuiTabBarFlags_NoCloseWithMiddleMouseButton) flags |= ImGuiTabItemFlags_NoCloseWithMiddleMouseButton; @@ -8131,7 +8453,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, const ImGuiID close_button_id = p_open ? GetIDWithSeed("#CLOSE", NULL, id) : 0; bool just_closed; bool text_clipped; - TabItemLabelAndCloseButton(display_draw_list, bb, flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible, &just_closed, &text_clipped); + TabItemLabelAndCloseButton(display_draw_list, bb, tab_just_unsaved ? (flags & ~ImGuiTabItemFlags_UnsavedDocument) : flags, tab_bar->FramePadding, label, id, close_button_id, tab_contents_visible, &just_closed, &text_clipped); if (just_closed && p_open != NULL) { *p_open = false; @@ -8148,9 +8470,10 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, // (We test IsItemHovered() to discard e.g. when another item is active or drag and drop over the tab bar, which g.HoveredId ignores) // FIXME: This is a mess. // FIXME: We may want disabled tab to still display the tooltip? - if (text_clipped && g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > g.TooltipSlowDelay && IsItemHovered()) + if (text_clipped && g.HoveredId == id && !held) if (!(tab_bar->Flags & ImGuiTabBarFlags_NoTooltip) && !(tab->Flags & ImGuiTabItemFlags_NoTooltip)) - SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label); + if (IsItemHovered(ImGuiHoveredFlags_DelayNormal)) + SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label); IM_ASSERT(!is_tab_button || !(tab_bar->SelectedTabId == tab->ID && is_tab_button)); // TabItemButton should not be selected if (is_tab_button) @@ -8168,24 +8491,30 @@ void ImGui::SetTabItemClosed(const char* label) if (is_within_manual_tab_bar) { ImGuiTabBar* tab_bar = g.CurrentTabBar; - ImGuiID tab_id = TabBarCalcTabID(tab_bar, label); + ImGuiID tab_id = TabBarCalcTabID(tab_bar, label, NULL); if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id)) tab->WantClose = true; // Will be processed by next call to TabBarLayout() } } -ImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button) +ImVec2 ImGui::TabItemCalcSize(const char* label, bool has_close_button_or_unsaved_marker) { ImGuiContext& g = *GImGui; ImVec2 label_size = CalcTextSize(label, NULL, true); ImVec2 size = ImVec2(label_size.x + g.Style.FramePadding.x, label_size.y + g.Style.FramePadding.y * 2.0f); - if (has_close_button) + if (has_close_button_or_unsaved_marker) size.x += g.Style.FramePadding.x + (g.Style.ItemInnerSpacing.x + g.FontSize); // We use Y intentionally to fit the close button circle. else size.x += g.Style.FramePadding.x + 1.0f; return ImVec2(ImMin(size.x, TabBarCalcMaxTabWidth()), size.y); } +ImVec2 ImGui::TabItemCalcSize(ImGuiWindow*) +{ + IM_ASSERT(0); // This function exists to facilitate merge with 'docking' branch. + return ImVec2(0.0f, 0.0f); +} + void ImGui::TabItemBackground(ImDrawList* draw_list, const ImRect& bb, ImGuiTabItemFlags flags, ImU32 col) { // While rendering tabs, we trim 1 pixel off the top of our bounding box so they can fit within a regular frame height while looking "detached" from it. diff --git a/Sources/CImGui/imgui/imstb_rectpack.h b/Sources/CImGui/imgui/imstb_rectpack.h index 3958952..f6917e7 100644 --- a/Sources/CImGui/imgui/imstb_rectpack.h +++ b/Sources/CImGui/imgui/imstb_rectpack.h @@ -1,15 +1,19 @@ // [DEAR IMGUI] -// This is a slightly modified version of stb_rect_pack.h 1.00. -// Those changes would need to be pushed into nothings/stb: -// - Added STBRP__CDECL +// This is a slightly modified version of stb_rect_pack.h 1.01. // Grep for [DEAR IMGUI] to find the changes. - -// stb_rect_pack.h - v1.00 - public domain - rectangle packing +// +// stb_rect_pack.h - v1.01 - public domain - rectangle packing // Sean Barrett 2014 // // Useful for e.g. packing rectangular textures into an atlas. // Does not do rotation. // +// Before #including, +// +// #define STB_RECT_PACK_IMPLEMENTATION +// +// in the file that you want to have the implementation. +// // Not necessarily the awesomest packing method, but better than // the totally naive one in stb_truetype (which is primarily what // this is meant to replace). @@ -41,6 +45,7 @@ // // Version history: // +// 1.01 (2021-07-11) always use large rect mode, expose STBRP__MAXVAL in public section // 1.00 (2019-02-25) avoid small space waste; gracefully fail too-wide rectangles // 0.99 (2019-02-07) warning fixes // 0.11 (2017-03-03) return packing success/fail result @@ -81,11 +86,10 @@ typedef struct stbrp_context stbrp_context; typedef struct stbrp_node stbrp_node; typedef struct stbrp_rect stbrp_rect; -#ifdef STBRP_LARGE_RECTS typedef int stbrp_coord; -#else -typedef unsigned short stbrp_coord; -#endif + +#define STBRP__MAXVAL 0x7fffffff +// Mostly for internal use, but this is the maximum supported coordinate value. STBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects); // Assign packed locations to rectangles. The rectangles are of type @@ -213,10 +217,9 @@ struct stbrp_context #define STBRP_ASSERT assert #endif -// [DEAR IMGUI] Added STBRP__CDECL #ifdef _MSC_VER #define STBRP__NOTUSED(v) (void)(v) -#define STBRP__CDECL __cdecl +#define STBRP__CDECL __cdecl #else #define STBRP__NOTUSED(v) (void)sizeof(v) #define STBRP__CDECL @@ -262,9 +265,6 @@ STBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_ou STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes) { int i; -#ifndef STBRP_LARGE_RECTS - STBRP_ASSERT(width <= 0xffff && height <= 0xffff); -#endif for (i=0; i < num_nodes-1; ++i) nodes[i].next = &nodes[i+1]; @@ -283,11 +283,7 @@ STBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, context->extra[0].y = 0; context->extra[0].next = &context->extra[1]; context->extra[1].x = (stbrp_coord) width; -#ifdef STBRP_LARGE_RECTS context->extra[1].y = (1<<30); -#else - context->extra[1].y = 65535; -#endif context->extra[1].next = NULL; } @@ -433,7 +429,7 @@ static stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int widt if (y <= best_y) { if (y < best_y || waste < best_waste || (waste==best_waste && xpos < best_x)) { best_x = xpos; - STBRP_ASSERT(y <= best_y); + //STBRP_ASSERT(y <= best_y); [DEAR IMGUI] best_y = y; best_waste = waste; best = prev; @@ -529,7 +525,6 @@ static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, i return res; } -// [DEAR IMGUI] Added STBRP__CDECL static int STBRP__CDECL rect_height_compare(const void *a, const void *b) { const stbrp_rect *p = (const stbrp_rect *) a; @@ -541,7 +536,6 @@ static int STBRP__CDECL rect_height_compare(const void *a, const void *b) return (p->w > q->w) ? -1 : (p->w < q->w); } -// [DEAR IMGUI] Added STBRP__CDECL static int STBRP__CDECL rect_original_order(const void *a, const void *b) { const stbrp_rect *p = (const stbrp_rect *) a; @@ -549,12 +543,6 @@ static int STBRP__CDECL rect_original_order(const void *a, const void *b) return (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed); } -#ifdef STBRP_LARGE_RECTS -#define STBRP__MAXVAL 0xffffffff -#else -#define STBRP__MAXVAL 0xffff -#endif - STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects) { int i, all_rects_packed = 1; diff --git a/Sources/CImGui/imgui/imstb_textedit.h b/Sources/CImGui/imgui/imstb_textedit.h index 2c635b2..a8a8231 100644 --- a/Sources/CImGui/imgui/imstb_textedit.h +++ b/Sources/CImGui/imgui/imstb_textedit.h @@ -1,10 +1,11 @@ // [DEAR IMGUI] -// This is a slightly modified version of stb_textedit.h 1.13. +// This is a slightly modified version of stb_textedit.h 1.14. // Those changes would need to be pushed into nothings/stb: // - Fix in stb_textedit_discard_redo (see https://github.com/nothings/stb/issues/321) +// - Fix in stb_textedit_find_charpos to handle last line (see https://github.com/ocornut/imgui/issues/6000) // Grep for [DEAR IMGUI] to find the changes. -// stb_textedit.h - v1.13 - public domain - Sean Barrett +// stb_textedit.h - v1.14 - public domain - Sean Barrett // Development of this library was sponsored by RAD Game Tools // // This C header file implements the guts of a multi-line text-editing @@ -35,6 +36,7 @@ // // VERSION HISTORY // +// 1.14 (2021-07-11) page up/down, various fixes // 1.13 (2019-02-07) fix bug in undo size management // 1.12 (2018-01-29) user can change STB_TEXTEDIT_KEYTYPE, fix redo to avoid crash // 1.11 (2017-03-03) fix HOME on last line, dragging off single-line textfield @@ -58,6 +60,7 @@ // Ulf Winklemann: move-by-word in 1.1 // Fabian Giesen: secondary key inputs in 1.5 // Martins Mozeiko: STB_TEXTEDIT_memmove in 1.6 +// Louis Schnellbach: page up/down in 1.14 // // Bugfixes: // Scott Graham @@ -93,8 +96,8 @@ // moderate sizes. The undo system does no memory allocations, so // it grows STB_TexteditState by the worst-case storage which is (in bytes): // -// [4 + 3 * sizeof(STB_TEXTEDIT_POSITIONTYPE)] * STB_TEXTEDIT_UNDOSTATE_COUNT -// + sizeof(STB_TEXTEDIT_CHARTYPE) * STB_TEXTEDIT_UNDOCHAR_COUNT +// [4 + 3 * sizeof(STB_TEXTEDIT_POSITIONTYPE)] * STB_TEXTEDIT_UNDOSTATECOUNT +// + sizeof(STB_TEXTEDIT_CHARTYPE) * STB_TEXTEDIT_UNDOCHARCOUNT // // // Implementation mode: @@ -522,29 +525,14 @@ static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *s int z = STB_TEXTEDIT_STRINGLEN(str); int i=0, first; - if (n == z) { - // if it's at the end, then find the last line -- simpler than trying to - // explicitly handle this case in the regular code - if (single_line) { - STB_TEXTEDIT_LAYOUTROW(&r, str, 0); - find->y = 0; - find->first_char = 0; - find->length = z; - find->height = r.ymax - r.ymin; - find->x = r.x1; - } else { - find->y = 0; - find->x = 0; - find->height = 1; - while (i < z) { - STB_TEXTEDIT_LAYOUTROW(&r, str, i); - prev_start = i; - i += r.num_chars; - } - find->first_char = i; - find->length = 0; - find->prev_first = prev_start; - } + if (n == z && single_line) { + // special case if it's at the end (may not be needed?) + STB_TEXTEDIT_LAYOUTROW(&r, str, 0); + find->y = 0; + find->first_char = 0; + find->length = z; + find->height = r.ymax - r.ymin; + find->x = r.x1; return; } @@ -555,9 +543,13 @@ static void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *s STB_TEXTEDIT_LAYOUTROW(&r, str, i); if (n < i + r.num_chars) break; + if (i + r.num_chars == z && z > 0 && STB_TEXTEDIT_GETCHAR(str, z - 1) != STB_TEXTEDIT_NEWLINE) // [DEAR IMGUI] special handling for last line + break; // [DEAR IMGUI] prev_start = i; i += r.num_chars; find->y += r.baseline_y_delta; + if (i == z) // [DEAR IMGUI] + break; // [DEAR IMGUI] } find->first_char = first = i; @@ -716,10 +708,6 @@ static int stb_textedit_paste_internal(STB_TEXTEDIT_STRING *str, STB_TexteditSta state->has_preferred_x = 0; return 1; } - // [DEAR IMGUI] - //// remove the undo since we didn't actually insert the characters - //if (state->undostate.undo_point) - // --state->undostate.undo_point; // note: paste failure will leave deleted selection, may be restored with an undo (see https://github.com/nothings/stb/issues/734 for details) return 0; } diff --git a/Sources/CImGui/imgui/imstb_truetype.h b/Sources/CImGui/imgui/imstb_truetype.h index 48c2026..35c827e 100644 --- a/Sources/CImGui/imgui/imstb_truetype.h +++ b/Sources/CImGui/imgui/imstb_truetype.h @@ -1,10 +1,19 @@ // [DEAR IMGUI] -// This is a slightly modified version of stb_truetype.h 1.20. +// This is a slightly modified version of stb_truetype.h 1.26. // Mostly fixing for compiler and static analyzer warnings. // Grep for [DEAR IMGUI] to find the changes. -// stb_truetype.h - v1.20 - public domain -// authored from 2009-2016 by Sean Barrett / RAD Game Tools +// stb_truetype.h - v1.26 - public domain +// authored from 2009-2021 by Sean Barrett / RAD Game Tools +// +// ======================================================================= +// +// NO SECURITY GUARANTEE -- DO NOT USE THIS ON UNTRUSTED FONT FILES +// +// This library does no range checking of the offsets found in the file, +// meaning an attacker can use it to read arbitrary memory. +// +// ======================================================================= // // This library processes TrueType files: // parse files @@ -37,11 +46,11 @@ // Daniel Ribeiro Maciel // // Bug/warning reports/fixes: -// "Zer" on mollyrocket Fabian "ryg" Giesen -// Cass Everitt Martins Mozeiko -// stoiko (Haemimont Games) Cap Petschulat -// Brian Hook Omar Cornut -// Walter van Niftrik github:aloucks +// "Zer" on mollyrocket Fabian "ryg" Giesen github:NiLuJe +// Cass Everitt Martins Mozeiko github:aloucks +// stoiko (Haemimont Games) Cap Petschulat github:oyvindjam +// Brian Hook Omar Cornut github:vassvik +// Walter van Niftrik Ryan Griege // David Gow Peter LaValle // David Given Sergey Popov // Ivan-Assen Ivanov Giumo X. Clanjor @@ -49,11 +58,17 @@ // Johan Duparc Thomas Fields // Hou Qiming Derek Vinyard // Rob Loach Cort Stratton -// Kenney Phillis Jr. github:oyvindjam -// Brian Costabile github:vassvik +// Kenney Phillis Jr. Brian Costabile +// Ken Voskuil (kaesve) // // VERSION HISTORY // +// 1.26 (2021-08-28) fix broken rasterizer +// 1.25 (2021-07-11) many fixes +// 1.24 (2020-02-05) fix warning +// 1.23 (2020-02-02) query SVG data for glyphs; query whole kerning table (but only kern not GPOS) +// 1.22 (2019-08-11) minimize missing-glyph duplication; fix kerning if both 'GPOS' and 'kern' are defined +// 1.21 (2019-02-25) fix warning // 1.20 (2019-02-07) PackFontRange skips missing codepoints; GetScaleFontVMetrics() // 1.19 (2018-02-11) GPOS kerning, STBTT_fmod // 1.18 (2018-01-29) add missing function @@ -248,19 +263,6 @@ // recommend it. // // -// SOURCE STATISTICS (based on v0.6c, 2050 LOC) -// -// Documentation & header file 520 LOC \___ 660 LOC documentation -// Sample code 140 LOC / -// Truetype parsing 620 LOC ---- 620 LOC TrueType -// Software rasterization 240 LOC \. -// Curve tessellation 120 LOC \__ 550 LOC Bitmap creation -// Bitmap management 100 LOC / -// Baked bitmap interface 70 LOC / -// Font name matching & access 150 LOC ---- 150 -// C runtime library abstraction 60 LOC ---- 60 -// -// // PERFORMANCE MEASUREMENTS FOR 1.06: // // 32-bit 64-bit @@ -275,8 +277,8 @@ //// SAMPLE PROGRAMS //// // -// Incomplete text-in-3d-api example, which draws quads properly aligned to be lossless -// +// Incomplete text-in-3d-api example, which draws quads properly aligned to be lossless. +// See "tests/truetype_demo_win32.c" for a complete version. #if 0 #define STB_TRUETYPE_IMPLEMENTATION // force following include to generate implementation #include "stb_truetype.h" @@ -302,6 +304,8 @@ void my_stbtt_initfont(void) void my_stbtt_print(float x, float y, char *text) { // assume orthographic projection with units = screen pixels, origin at top left + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, ftex); glBegin(GL_QUADS); @@ -309,10 +313,10 @@ void my_stbtt_print(float x, float y, char *text) if (*text >= 32 && *text < 128) { stbtt_aligned_quad q; stbtt_GetBakedQuad(cdata, 512,512, *text-32, &x,&y,&q,1);//1=opengl & d3d10+,0=d3d9 - glTexCoord2f(q.s0,q.t1); glVertex2f(q.x0,q.y0); - glTexCoord2f(q.s1,q.t1); glVertex2f(q.x1,q.y0); - glTexCoord2f(q.s1,q.t0); glVertex2f(q.x1,q.y1); - glTexCoord2f(q.s0,q.t0); glVertex2f(q.x0,q.y1); + glTexCoord2f(q.s0,q.t0); glVertex2f(q.x0,q.y0); + glTexCoord2f(q.s1,q.t0); glVertex2f(q.x1,q.y0); + glTexCoord2f(q.s1,q.t1); glVertex2f(q.x1,q.y1); + glTexCoord2f(q.s0,q.t1); glVertex2f(q.x0,q.y1); } ++text; } @@ -719,7 +723,7 @@ struct stbtt_fontinfo int numGlyphs; // number of glyphs, needed for range checking - int loca,head,glyf,hhea,hmtx,kern,gpos; // table locations as offset from start of .ttf + int loca,head,glyf,hhea,hmtx,kern,gpos,svg; // table locations as offset from start of .ttf int index_map; // a cmap mapping for our chosen character encoding int indexToLocFormat; // format needed to map from glyph index to glyph @@ -802,6 +806,18 @@ STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, STBTT_DEF int stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1); // as above, but takes one or more glyph indices for greater efficiency +typedef struct stbtt_kerningentry +{ + int glyph1; // use stbtt_FindGlyphIndex + int glyph2; + int advance; +} stbtt_kerningentry; + +STBTT_DEF int stbtt_GetKerningTableLength(const stbtt_fontinfo *info); +STBTT_DEF int stbtt_GetKerningTable(const stbtt_fontinfo *info, stbtt_kerningentry* table, int table_length); +// Retrieves a complete list of all of the kerning pairs provided by the font +// stbtt_GetKerningTable never writes more than table_length entries and returns how many entries it did write. +// The table will be sorted by (a.glyph1 == b.glyph1)?(a.glyph2 < b.glyph2):(a.glyph1 < b.glyph1) ////////////////////////////////////////////////////////////////////////////// // @@ -846,6 +862,12 @@ STBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, s STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *vertices); // frees the data allocated above +STBTT_DEF unsigned char *stbtt_FindSVGDoc(const stbtt_fontinfo *info, int gl); +STBTT_DEF int stbtt_GetCodepointSVG(const stbtt_fontinfo *info, int unicode_codepoint, const char **svg); +STBTT_DEF int stbtt_GetGlyphSVG(const stbtt_fontinfo *info, int gl, const char **svg); +// fills svg with the character's SVG data. +// returns data size or 0 if SVG not found. + ////////////////////////////////////////////////////////////////////////////// // // BITMAP RENDERING @@ -1347,6 +1369,22 @@ static stbtt__buf stbtt__get_subrs(stbtt__buf cff, stbtt__buf fontdict) return stbtt__cff_get_index(&cff); } +// since most people won't use this, find this table the first time it's needed +static int stbtt__get_svg(stbtt_fontinfo *info) +{ + stbtt_uint32 t; + if (info->svg < 0) { + t = stbtt__find_table(info->data, info->fontstart, "SVG "); + if (t) { + stbtt_uint32 offset = ttULONG(info->data + t + 2); + info->svg = t + offset; + } else { + info->svg = 0; + } + } + return info->svg; +} + static int stbtt_InitFont_internal(stbtt_fontinfo *info, unsigned char *data, int fontstart) { stbtt_uint32 cmap, t; @@ -1426,6 +1464,8 @@ static int stbtt_InitFont_internal(stbtt_fontinfo *info, unsigned char *data, in else info->numGlyphs = 0xffff; + info->svg = -1; + // find a cmap encoding table we understand *now* to avoid searching // later. (todo: could make this installable) // the same regardless of glyph. @@ -1509,12 +1549,12 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep search += 2; { - stbtt_uint16 offset, start; + stbtt_uint16 offset, start, last; stbtt_uint16 item = (stbtt_uint16) ((search - endCount) >> 1); - STBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2*item)); start = ttUSHORT(data + index_map + 14 + segcount*2 + 2 + 2*item); - if (unicode_codepoint < start) + last = ttUSHORT(data + endCount + 2*item); + if (unicode_codepoint < start || unicode_codepoint > last) return 0; offset = ttUSHORT(data + index_map + 14 + segcount*6 + 2 + 2*item); @@ -1774,7 +1814,7 @@ static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, s } } num_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx,sy,scx,scy,cx,cy); - } else if (numberOfContours == -1) { + } else if (numberOfContours < 0) { // Compound shapes. int more = 1; stbtt_uint8 *comp = data + g + 10; @@ -1841,7 +1881,7 @@ static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, s if (comp_verts) STBTT_free(comp_verts, info->userdata); return 0; } - if (num_vertices > 0) STBTT_memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex)); //-V595 + if (num_vertices > 0 && vertices) STBTT_memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex)); STBTT_memcpy(tmp+num_vertices, comp_verts, comp_num_verts*sizeof(stbtt_vertex)); if (vertices) STBTT_free(vertices, info->userdata); vertices = tmp; @@ -1851,9 +1891,6 @@ static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, s // More components ? more = flags & (1<<5); } - } else if (numberOfContours < 0) { - // @TODO other compound variations? - STBTT_assert(0); } else { // numberOfCounters == 0, do nothing } @@ -1971,7 +2008,7 @@ static stbtt__buf stbtt__cid_get_glyph_subrs(const stbtt_fontinfo *info, int gly start = end; } } - if (fdselector == -1) stbtt__new_buf(NULL, 0); + if (fdselector == -1) return stbtt__new_buf(NULL, 0); // [DEAR IMGUI] fixed, see #6007 and nothings/stb#1422 return stbtt__get_subrs(info->cff, stbtt__cff_index_get(info->fontdicts, fdselector)); } @@ -2107,7 +2144,7 @@ static int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, st subrs = stbtt__cid_get_glyph_subrs(info, glyph_index); has_subrs = 1; } - // fallthrough + // FALLTHROUGH case 0x1D: // callgsubr if (sp < 1) return STBTT__CSERR("call(g|)subr stack"); v = (int) s[--sp]; @@ -2212,7 +2249,7 @@ static int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, st } break; default: - if (b0 != 255 && b0 != 28 && (b0 < 32 || b0 > 254)) //-V560 + if (b0 != 255 && b0 != 28 && b0 < 32) return STBTT__CSERR("reserved operator"); // push immediate @@ -2282,7 +2319,49 @@ STBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_inde } } -static int stbtt__GetGlyphKernInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2) +STBTT_DEF int stbtt_GetKerningTableLength(const stbtt_fontinfo *info) +{ + stbtt_uint8 *data = info->data + info->kern; + + // we only look at the first table. it must be 'horizontal' and format 0. + if (!info->kern) + return 0; + if (ttUSHORT(data+2) < 1) // number of tables, need at least 1 + return 0; + if (ttUSHORT(data+8) != 1) // horizontal flag must be set in format + return 0; + + return ttUSHORT(data+10); +} + +STBTT_DEF int stbtt_GetKerningTable(const stbtt_fontinfo *info, stbtt_kerningentry* table, int table_length) +{ + stbtt_uint8 *data = info->data + info->kern; + int k, length; + + // we only look at the first table. it must be 'horizontal' and format 0. + if (!info->kern) + return 0; + if (ttUSHORT(data+2) < 1) // number of tables, need at least 1 + return 0; + if (ttUSHORT(data+8) != 1) // horizontal flag must be set in format + return 0; + + length = ttUSHORT(data+10); + if (table_length < length) + length = table_length; + + for (k = 0; k < length; k++) + { + table[k].glyph1 = ttUSHORT(data+18+(k*6)); + table[k].glyph2 = ttUSHORT(data+20+(k*6)); + table[k].advance = ttSHORT(data+22+(k*6)); + } + + return length; +} + +static int stbtt__GetGlyphKernInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2) { stbtt_uint8 *data = info->data + info->kern; stbtt_uint32 needle, straw; @@ -2312,245 +2391,225 @@ static int stbtt__GetGlyphKernInfoAdvance(const stbtt_fontinfo *info, int glyph return 0; } -static stbtt_int32 stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, int glyph) -{ - stbtt_uint16 coverageFormat = ttUSHORT(coverageTable); - switch(coverageFormat) { - case 1: { - stbtt_uint16 glyphCount = ttUSHORT(coverageTable + 2); - - // Binary search. - stbtt_int32 l=0, r=glyphCount-1, m; - int straw, needle=glyph; - while (l <= r) { - stbtt_uint8 *glyphArray = coverageTable + 4; - stbtt_uint16 glyphID; - m = (l + r) >> 1; - glyphID = ttUSHORT(glyphArray + 2 * m); - straw = glyphID; - if (needle < straw) - r = m - 1; - else if (needle > straw) - l = m + 1; - else { - return m; - } +static stbtt_int32 stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, int glyph) +{ + stbtt_uint16 coverageFormat = ttUSHORT(coverageTable); + switch (coverageFormat) { + case 1: { + stbtt_uint16 glyphCount = ttUSHORT(coverageTable + 2); + + // Binary search. + stbtt_int32 l=0, r=glyphCount-1, m; + int straw, needle=glyph; + while (l <= r) { + stbtt_uint8 *glyphArray = coverageTable + 4; + stbtt_uint16 glyphID; + m = (l + r) >> 1; + glyphID = ttUSHORT(glyphArray + 2 * m); + straw = glyphID; + if (needle < straw) + r = m - 1; + else if (needle > straw) + l = m + 1; + else { + return m; } - } break; - - case 2: { - stbtt_uint16 rangeCount = ttUSHORT(coverageTable + 2); - stbtt_uint8 *rangeArray = coverageTable + 4; - - // Binary search. - stbtt_int32 l=0, r=rangeCount-1, m; - int strawStart, strawEnd, needle=glyph; - while (l <= r) { - stbtt_uint8 *rangeRecord; - m = (l + r) >> 1; - rangeRecord = rangeArray + 6 * m; - strawStart = ttUSHORT(rangeRecord); - strawEnd = ttUSHORT(rangeRecord + 2); - if (needle < strawStart) - r = m - 1; - else if (needle > strawEnd) - l = m + 1; - else { - stbtt_uint16 startCoverageIndex = ttUSHORT(rangeRecord + 4); - return startCoverageIndex + glyph - strawStart; - } + } + break; + } + + case 2: { + stbtt_uint16 rangeCount = ttUSHORT(coverageTable + 2); + stbtt_uint8 *rangeArray = coverageTable + 4; + + // Binary search. + stbtt_int32 l=0, r=rangeCount-1, m; + int strawStart, strawEnd, needle=glyph; + while (l <= r) { + stbtt_uint8 *rangeRecord; + m = (l + r) >> 1; + rangeRecord = rangeArray + 6 * m; + strawStart = ttUSHORT(rangeRecord); + strawEnd = ttUSHORT(rangeRecord + 2); + if (needle < strawStart) + r = m - 1; + else if (needle > strawEnd) + l = m + 1; + else { + stbtt_uint16 startCoverageIndex = ttUSHORT(rangeRecord + 4); + return startCoverageIndex + glyph - strawStart; } - } break; + } + break; + } - default: { - // There are no other cases. - STBTT_assert(0); - } break; - } + default: return -1; // unsupported + } - return -1; + return -1; } static stbtt_int32 stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int glyph) { - stbtt_uint16 classDefFormat = ttUSHORT(classDefTable); - switch(classDefFormat) - { - case 1: { - stbtt_uint16 startGlyphID = ttUSHORT(classDefTable + 2); - stbtt_uint16 glyphCount = ttUSHORT(classDefTable + 4); - stbtt_uint8 *classDef1ValueArray = classDefTable + 6; - - if (glyph >= startGlyphID && glyph < startGlyphID + glyphCount) - return (stbtt_int32)ttUSHORT(classDef1ValueArray + 2 * (glyph - startGlyphID)); - - // [DEAR IMGUI] Commented to fix static analyzer warning - //classDefTable = classDef1ValueArray + 2 * glyphCount; - } break; - - case 2: { - stbtt_uint16 classRangeCount = ttUSHORT(classDefTable + 2); - stbtt_uint8 *classRangeRecords = classDefTable + 4; - - // Binary search. - stbtt_int32 l=0, r=classRangeCount-1, m; - int strawStart, strawEnd, needle=glyph; - while (l <= r) { - stbtt_uint8 *classRangeRecord; - m = (l + r) >> 1; - classRangeRecord = classRangeRecords + 6 * m; - strawStart = ttUSHORT(classRangeRecord); - strawEnd = ttUSHORT(classRangeRecord + 2); - if (needle < strawStart) - r = m - 1; - else if (needle > strawEnd) - l = m + 1; - else - return (stbtt_int32)ttUSHORT(classRangeRecord + 4); - } + stbtt_uint16 classDefFormat = ttUSHORT(classDefTable); + switch (classDefFormat) + { + case 1: { + stbtt_uint16 startGlyphID = ttUSHORT(classDefTable + 2); + stbtt_uint16 glyphCount = ttUSHORT(classDefTable + 4); + stbtt_uint8 *classDef1ValueArray = classDefTable + 6; - // [DEAR IMGUI] Commented to fix static analyzer warning - //classDefTable = classRangeRecords + 6 * classRangeCount; - } break; + if (glyph >= startGlyphID && glyph < startGlyphID + glyphCount) + return (stbtt_int32)ttUSHORT(classDef1ValueArray + 2 * (glyph - startGlyphID)); + break; + } - default: { - // There are no other cases. - STBTT_assert(0); - } break; - } + case 2: { + stbtt_uint16 classRangeCount = ttUSHORT(classDefTable + 2); + stbtt_uint8 *classRangeRecords = classDefTable + 4; + + // Binary search. + stbtt_int32 l=0, r=classRangeCount-1, m; + int strawStart, strawEnd, needle=glyph; + while (l <= r) { + stbtt_uint8 *classRangeRecord; + m = (l + r) >> 1; + classRangeRecord = classRangeRecords + 6 * m; + strawStart = ttUSHORT(classRangeRecord); + strawEnd = ttUSHORT(classRangeRecord + 2); + if (needle < strawStart) + r = m - 1; + else if (needle > strawEnd) + l = m + 1; + else + return (stbtt_int32)ttUSHORT(classRangeRecord + 4); + } + break; + } - return -1; + default: + return -1; // Unsupported definition type, return an error. + } + + // "All glyphs not assigned to a class fall into class 0". (OpenType spec) + return 0; } // Define to STBTT_assert(x) if you want to break on unimplemented formats. #define STBTT_GPOS_TODO_assert(x) -static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2) -{ - stbtt_uint16 lookupListOffset; - stbtt_uint8 *lookupList; - stbtt_uint16 lookupCount; - stbtt_uint8 *data; - stbtt_int32 i; - - if (!info->gpos) return 0; - - data = info->data + info->gpos; - - if (ttUSHORT(data+0) != 1) return 0; // Major version 1 - if (ttUSHORT(data+2) != 0) return 0; // Minor version 0 - - lookupListOffset = ttUSHORT(data+8); - lookupList = data + lookupListOffset; - lookupCount = ttUSHORT(lookupList); - - for (i=0; i> 1; - pairValue = pairValueArray + (2 + valueRecordPairSizeInBytes) * m; - secondGlyph = ttUSHORT(pairValue); - straw = secondGlyph; - if (needle < straw) - r = m - 1; - else if (needle > straw) - l = m + 1; - else { - stbtt_int16 xAdvance = ttSHORT(pairValue + 2); - return xAdvance; - } - } - } break; - - case 2: { - stbtt_uint16 valueFormat1 = ttUSHORT(table + 4); - stbtt_uint16 valueFormat2 = ttUSHORT(table + 6); - - stbtt_uint16 classDef1Offset = ttUSHORT(table + 8); - stbtt_uint16 classDef2Offset = ttUSHORT(table + 10); - int glyph1class = stbtt__GetGlyphClass(table + classDef1Offset, glyph1); - int glyph2class = stbtt__GetGlyphClass(table + classDef2Offset, glyph2); - - stbtt_uint16 class1Count = ttUSHORT(table + 12); - stbtt_uint16 class2Count = ttUSHORT(table + 14); - STBTT_assert(glyph1class < class1Count); - STBTT_assert(glyph2class < class2Count); - - // TODO: Support more formats. - STBTT_GPOS_TODO_assert(valueFormat1 == 4); - if (valueFormat1 != 4) return 0; - STBTT_GPOS_TODO_assert(valueFormat2 == 0); - if (valueFormat2 != 0) return 0; - - if (glyph1class >= 0 && glyph1class < class1Count && glyph2class >= 0 && glyph2class < class2Count) { - stbtt_uint8 *class1Records = table + 16; - stbtt_uint8 *class2Records = class1Records + 2 * (glyph1class * class2Count); - stbtt_int16 xAdvance = ttSHORT(class2Records + 2 * glyph2class); - return xAdvance; - } - } break; - - default: { - // There are no other cases. - STBTT_assert(0); - break; - } // [DEAR IMGUI] removed ; - } - } - break; - } // [DEAR IMGUI] removed ; +static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2) +{ + stbtt_uint16 lookupListOffset; + stbtt_uint8 *lookupList; + stbtt_uint16 lookupCount; + stbtt_uint8 *data; + stbtt_int32 i, sti; + + if (!info->gpos) return 0; + + data = info->data + info->gpos; + + if (ttUSHORT(data+0) != 1) return 0; // Major version 1 + if (ttUSHORT(data+2) != 0) return 0; // Minor version 0 + + lookupListOffset = ttUSHORT(data+8); + lookupList = data + lookupListOffset; + lookupCount = ttUSHORT(lookupList); + + for (i=0; i= pairSetCount) return 0; + + needle=glyph2; + r=pairValueCount-1; + l=0; + + // Binary search. + while (l <= r) { + stbtt_uint16 secondGlyph; + stbtt_uint8 *pairValue; + m = (l + r) >> 1; + pairValue = pairValueArray + (2 + valueRecordPairSizeInBytes) * m; + secondGlyph = ttUSHORT(pairValue); + straw = secondGlyph; + if (needle < straw) + r = m - 1; + else if (needle > straw) + l = m + 1; + else { + stbtt_int16 xAdvance = ttSHORT(pairValue + 2); + return xAdvance; + } + } + } else + return 0; + break; + } + + case 2: { + stbtt_uint16 valueFormat1 = ttUSHORT(table + 4); + stbtt_uint16 valueFormat2 = ttUSHORT(table + 6); + if (valueFormat1 == 4 && valueFormat2 == 0) { // Support more formats? + stbtt_uint16 classDef1Offset = ttUSHORT(table + 8); + stbtt_uint16 classDef2Offset = ttUSHORT(table + 10); + int glyph1class = stbtt__GetGlyphClass(table + classDef1Offset, glyph1); + int glyph2class = stbtt__GetGlyphClass(table + classDef2Offset, glyph2); + + stbtt_uint16 class1Count = ttUSHORT(table + 12); + stbtt_uint16 class2Count = ttUSHORT(table + 14); + stbtt_uint8 *class1Records, *class2Records; + stbtt_int16 xAdvance; + + if (glyph1class < 0 || glyph1class >= class1Count) return 0; // malformed + if (glyph2class < 0 || glyph2class >= class2Count) return 0; // malformed + + class1Records = table + 16; + class2Records = class1Records + 2 * (glyph1class * class2Count); + xAdvance = ttSHORT(class2Records + 2 * glyph2class); + return xAdvance; + } else + return 0; + break; + } default: - // TODO: Implement other stuff. - break; - } - } + return 0; // Unsupported position format + } + } + } - return 0; + return 0; } STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int g1, int g2) @@ -2559,8 +2618,7 @@ STBTT_DEF int stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int g1, int if (info->gpos) xAdvance += stbtt__GetGlyphGPOSInfoAdvance(info, g1, g2); - - if (info->kern) + else if (info->kern) xAdvance += stbtt__GetGlyphKernInfoAdvance(info, g1, g2); return xAdvance; @@ -2621,6 +2679,45 @@ STBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *v) STBTT_free(v, info->userdata); } +STBTT_DEF stbtt_uint8 *stbtt_FindSVGDoc(const stbtt_fontinfo *info, int gl) +{ + int i; + stbtt_uint8 *data = info->data; + stbtt_uint8 *svg_doc_list = data + stbtt__get_svg((stbtt_fontinfo *) info); + + int numEntries = ttUSHORT(svg_doc_list); + stbtt_uint8 *svg_docs = svg_doc_list + 2; + + for(i=0; i= ttUSHORT(svg_doc)) && (gl <= ttUSHORT(svg_doc + 2))) + return svg_doc; + } + return 0; +} + +STBTT_DEF int stbtt_GetGlyphSVG(const stbtt_fontinfo *info, int gl, const char **svg) +{ + stbtt_uint8 *data = info->data; + stbtt_uint8 *svg_doc; + + if (info->svg == 0) + return 0; + + svg_doc = stbtt_FindSVGDoc(info, gl); + if (svg_doc != NULL) { + *svg = (char *) data + info->svg + ttULONG(svg_doc + 4); + return ttULONG(svg_doc + 8); + } else { + return 0; + } +} + +STBTT_DEF int stbtt_GetCodepointSVG(const stbtt_fontinfo *info, int unicode_codepoint, const char **svg) +{ + return stbtt_GetGlyphSVG(info, stbtt_FindGlyphIndex(info, unicode_codepoint), svg); +} + ////////////////////////////////////////////////////////////////////////////// // // antialiasing software rasterizer @@ -2970,6 +3067,23 @@ static void stbtt__handle_clipped_edge(float *scanline, int x, stbtt__active_edg } } +static float stbtt__sized_trapezoid_area(float height, float top_width, float bottom_width) +{ + STBTT_assert(top_width >= 0); + STBTT_assert(bottom_width >= 0); + return (top_width + bottom_width) / 2.0f * height; +} + +static float stbtt__position_trapezoid_area(float height, float tx0, float tx1, float bx0, float bx1) +{ + return stbtt__sized_trapezoid_area(height, tx1 - tx0, bx1 - bx0); +} + +static float stbtt__sized_triangle_area(float height, float width) +{ + return height * width / 2; +} + static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill, int len, stbtt__active_edge *e, float y_top) { float y_bottom = y_top+1; @@ -3024,13 +3138,13 @@ static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill, float height; // simple case, only spans one pixel int x = (int) x_top; - height = sy1 - sy0; + height = (sy1 - sy0) * e->direction; STBTT_assert(x >= 0 && x < len); - scanline[x] += e->direction * (1-((x_top - x) + (x_bottom-x))/2) * height; - scanline_fill[x] += e->direction * height; // everything right of this pixel is filled + scanline[x] += stbtt__position_trapezoid_area(height, x_top, x+1.0f, x_bottom, x+1.0f); + scanline_fill[x] += height; // everything right of this pixel is filled } else { int x,x1,x2; - float y_crossing, step, sign, area; + float y_crossing, y_final, step, sign, area; // covers 2+ pixels if (x_top > x_bottom) { // flip scanline vertically; signed area is the same @@ -3042,32 +3156,83 @@ static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill, dx = -dx; dy = -dy; t = x0, x0 = xb, xb = t; - // [DEAR IMGUI] Fix static analyzer warning - (void)dx; // [ImGui: fix static analyzer warning] } + STBTT_assert(dy >= 0); + STBTT_assert(dx >= 0); x1 = (int) x_top; x2 = (int) x_bottom; // compute intersection with y axis at x1+1 - y_crossing = (x1+1 - x0) * dy + y_top; + y_crossing = y_top + dy * (x1+1 - x0); + + // compute intersection with y axis at x2 + y_final = y_top + dy * (x2 - x0); + + // x1 x_top x2 x_bottom + // y_top +------|-----+------------+------------+--------|---+------------+ + // | | | | | | + // | | | | | | + // sy0 | Txxxxx|............|............|............|............| + // y_crossing | *xxxxx.......|............|............|............| + // | | xxxxx..|............|............|............| + // | | /- xx*xxxx........|............|............| + // | | dy < | xxxxxx..|............|............| + // y_final | | \- | xx*xxx.........|............| + // sy1 | | | | xxxxxB...|............| + // | | | | | | + // | | | | | | + // y_bottom +------------+------------+------------+------------+------------+ + // + // goal is to measure the area covered by '.' in each pixel + + // if x2 is right at the right edge of x1, y_crossing can blow up, github #1057 + // @TODO: maybe test against sy1 rather than y_bottom? + if (y_crossing > y_bottom) + y_crossing = y_bottom; sign = e->direction; - // area of the rectangle covered from y0..y_crossing + + // area of the rectangle covered from sy0..y_crossing area = sign * (y_crossing-sy0); - // area of the triangle (x_top,y0), (x+1,y0), (x+1,y_crossing) - scanline[x1] += area * (1-((x_top - x1)+(x1+1-x1))/2); - step = sign * dy; + // area of the triangle (x_top,sy0), (x1+1,sy0), (x1+1,y_crossing) + scanline[x1] += stbtt__sized_triangle_area(area, x1+1 - x_top); + + // check if final y_crossing is blown up; no test case for this + if (y_final > y_bottom) { + int denom = (x2 - (x1+1)); + y_final = y_bottom; + if (denom != 0) { // [DEAR IMGUI] Avoid div by zero (https://github.com/nothings/stb/issues/1316) + dy = (y_final - y_crossing ) / denom; // if denom=0, y_final = y_crossing, so y_final <= y_bottom + } + } + + // in second pixel, area covered by line segment found in first pixel + // is always a rectangle 1 wide * the height of that line segment; this + // is exactly what the variable 'area' stores. it also gets a contribution + // from the line segment within it. the THIRD pixel will get the first + // pixel's rectangle contribution, the second pixel's rectangle contribution, + // and its own contribution. the 'own contribution' is the same in every pixel except + // the leftmost and rightmost, a trapezoid that slides down in each pixel. + // the second pixel's contribution to the third pixel will be the + // rectangle 1 wide times the height change in the second pixel, which is dy. + + step = sign * dy * 1; // dy is dy/dx, change in y for every 1 change in x, + // which multiplied by 1-pixel-width is how much pixel area changes for each step in x + // so the area advances by 'step' every time + for (x = x1+1; x < x2; ++x) { - scanline[x] += area + step/2; + scanline[x] += area + step/2; // area of trapezoid is 1*step/2 area += step; } - y_crossing += dy * (x2 - (x1+1)); - - STBTT_assert(STBTT_fabs(area) <= 1.01f); + STBTT_assert(STBTT_fabs(area) <= 1.01f); // accumulated error from area += step unless we round step down + STBTT_assert(sy1 > y_final-0.01f); - scanline[x2] += area + sign * (1-((x2-x2)+(x_bottom-x2))/2) * (sy1-y_crossing); + // area covered in the last pixel is the rectangle from all the pixels to the left, + // plus the trapezoid filled by the line segment in this pixel all the way to the right edge + scanline[x2] += area + sign * stbtt__position_trapezoid_area(sy1-y_final, (float) x2, x2+1.0f, x_bottom, x2+1.0f); + // the rest of the line is filled based on the total height of the line segment in this pixel scanline_fill[x2] += sign * (sy1-sy0); } } else { @@ -3075,6 +3240,9 @@ static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill, // clipping logic. since this does not match the intended use // of this library, we use a different, very slow brute // force implementation + // note though that this does happen some of the time because + // x_top and x_bottom can be extrapolated at the top & bottom of + // the shape and actually lie outside the bounding box int x; for (x=0; x < len; ++x) { // cases: @@ -3989,6 +4157,7 @@ static float stbtt__oversample_shift(int oversample) STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects) { int i,j,k; + int missing_glyph_added = 0; k=0; for (i=0; i < num_ranges; ++i) { @@ -4000,7 +4169,7 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stb int x0,y0,x1,y1; int codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : ranges[i].array_of_unicode_codepoints[j]; int glyph = stbtt_FindGlyphIndex(info, codepoint); - if (glyph == 0 && spc->skip_missing) { + if (glyph == 0 && (spc->skip_missing || missing_glyph_added)) { rects[k].w = rects[k].h = 0; } else { stbtt_GetGlyphBitmapBoxSubpixel(info,glyph, @@ -4010,6 +4179,8 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stb &x0,&y0,&x1,&y1); rects[k].w = (stbrp_coord) (x1-x0 + spc->padding + spc->h_oversample-1); rects[k].h = (stbrp_coord) (y1-y0 + spc->padding + spc->v_oversample-1); + if (glyph == 0) + missing_glyph_added = 1; } ++k; } @@ -4044,7 +4215,7 @@ STBTT_DEF void stbtt_MakeGlyphBitmapSubpixelPrefilter(const stbtt_fontinfo *info // rects array must be big enough to accommodate all characters in the given ranges STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects) { - int i,j,k, return_value = 1; + int i,j,k, missing_glyph = -1, return_value = 1; // save current values int old_h_over = spc->h_oversample; @@ -4109,6 +4280,13 @@ STBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const bc->yoff = (float) y0 * recip_v + sub_y; bc->xoff2 = (x0 + r->w) * recip_h + sub_x; bc->yoff2 = (y0 + r->h) * recip_v + sub_y; + + if (glyph == 0) + missing_glyph = j; + } else if (spc->skip_missing) { + return_value = 0; + } else if (r->was_packed && r->w == 0 && r->h == 0 && missing_glyph >= 0) { + ranges[i].chardata_for_range[j] = ranges[i].chardata_for_range[missing_glyph]; } else { return_value = 0; // if any fail, report failure } @@ -4132,7 +4310,7 @@ STBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, const unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges) { stbtt_fontinfo info; - int i,j,n, return_value; // [DEAR IMGUI] removed = 1 + int i, j, n, return_value; // [DEAR IMGUI] removed = 1; //stbrp_context *context = (stbrp_context *) spc->pack_info; stbrp_rect *rects; @@ -4301,15 +4479,14 @@ static int stbtt__compute_crossings_x(float x, float y, int nverts, stbtt_vertex float y_frac; int winding = 0; - orig[0] = x; - //orig[1] = y; // [DEAR IMGUI] commented double assignment - // make sure y never passes through a vertex of the shape y_frac = (float) STBTT_fmod(y, 1.0f); if (y_frac < 0.01f) y += 0.01f; else if (y_frac > 0.99f) y -= 0.01f; + + orig[0] = x; orig[1] = y; // test a ray from (-infinity,y) to (x,y) @@ -4371,35 +4548,35 @@ static float stbtt__cuberoot( float x ) return (float) STBTT_pow( x,1.0f/3.0f); } -// x^3 + c*x^2 + b*x + a = 0 +// x^3 + a*x^2 + b*x + c = 0 static int stbtt__solve_cubic(float a, float b, float c, float* r) { - float s = -a / 3; - float p = b - a*a / 3; - float q = a * (2*a*a - 9*b) / 27 + c; + float s = -a / 3; + float p = b - a*a / 3; + float q = a * (2*a*a - 9*b) / 27 + c; float p3 = p*p*p; - float d = q*q + 4*p3 / 27; - if (d >= 0) { - float z = (float) STBTT_sqrt(d); - float u = (-q + z) / 2; - float v = (-q - z) / 2; - u = stbtt__cuberoot(u); - v = stbtt__cuberoot(v); - r[0] = s + u + v; - return 1; - } else { - float u = (float) STBTT_sqrt(-p/3); - float v = (float) STBTT_acos(-STBTT_sqrt(-27/p3) * q / 2) / 3; // p3 must be negative, since d is negative - float m = (float) STBTT_cos(v); + float d = q*q + 4*p3 / 27; + if (d >= 0) { + float z = (float) STBTT_sqrt(d); + float u = (-q + z) / 2; + float v = (-q - z) / 2; + u = stbtt__cuberoot(u); + v = stbtt__cuberoot(v); + r[0] = s + u + v; + return 1; + } else { + float u = (float) STBTT_sqrt(-p/3); + float v = (float) STBTT_acos(-STBTT_sqrt(-27/p3) * q / 2) / 3; // p3 must be negative, since d is negative + float m = (float) STBTT_cos(v); float n = (float) STBTT_cos(v-3.141592/2)*1.732050808f; - r[0] = s + u * 2 * m; - r[1] = s - u * (m + n); - r[2] = s - u * (m - n); + r[0] = s + u * 2 * m; + r[1] = s - u * (m + n); + r[2] = s - u * (m - n); //STBTT_assert( STBTT_fabs(((r[0]+a)*r[0]+b)*r[0]+c) < 0.05f); // these asserts may not be safe at all scales, though they're in bezier t parameter units so maybe? //STBTT_assert( STBTT_fabs(((r[1]+a)*r[1]+b)*r[1]+c) < 0.05f); //STBTT_assert( STBTT_fabs(((r[2]+a)*r[2]+b)*r[2]+c) < 0.05f); - return 3; + return 3; } } @@ -4410,12 +4587,7 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc int w,h; unsigned char *data; - // if one scale is 0, use same scale for both - if (scale_x == 0) scale_x = scale_y; - if (scale_y == 0) { - if (scale_x == 0) return NULL; // if both scales are 0, return NULL - scale_y = scale_x; - } + if (scale == 0) return NULL; stbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale, scale, 0.0f,0.0f, &ix0,&iy0,&ix1,&iy1); @@ -4481,18 +4653,17 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc for (i=0; i < num_verts; ++i) { float x0 = verts[i].x*scale_x, y0 = verts[i].y*scale_y; - // check against every point here rather than inside line/curve primitives -- @TODO: wrong if multiple 'moves' in a row produce a garbage point, and given culling, probably more efficient to do within line/curve - float dist2 = (x0-sx)*(x0-sx) + (y0-sy)*(y0-sy); - if (dist2 < min_dist*min_dist) - min_dist = (float) STBTT_sqrt(dist2); - - if (verts[i].type == STBTT_vline) { + if (verts[i].type == STBTT_vline && precompute[i] != 0.0f) { float x1 = verts[i-1].x*scale_x, y1 = verts[i-1].y*scale_y; + float dist,dist2 = (x0-sx)*(x0-sx) + (y0-sy)*(y0-sy); + if (dist2 < min_dist*min_dist) + min_dist = (float) STBTT_sqrt(dist2); + // coarse culling against bbox //if (sx > STBTT_min(x0,x1)-min_dist && sx < STBTT_max(x0,x1)+min_dist && // sy > STBTT_min(y0,y1)-min_dist && sy < STBTT_max(y0,y1)+min_dist) - float dist = (float) STBTT_fabs((x1-x0)*(y0-sy) - (y1-y0)*(x0-sx)) * precompute[i]; + dist = (float) STBTT_fabs((x1-x0)*(y0-sy) - (y1-y0)*(x0-sx)) * precompute[i]; STBTT_assert(i != 0); if (dist < min_dist) { // check position along line @@ -4519,7 +4690,8 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc float ax = x1-x0, ay = y1-y0; float bx = x0 - 2*x1 + x2, by = y0 - 2*y1 + y2; float mx = x0 - sx, my = y0 - sy; - float res[3],px,py,t,it; + float res[3] = {0.f,0.f,0.f}; + float px,py,t,it,dist2; float a_inv = precompute[i]; if (a_inv == 0.0) { // if a_inv is 0, it's 2nd degree so use quadratic formula float a = 3*(ax*bx + ay*by); @@ -4546,6 +4718,10 @@ STBTT_DEF unsigned char * stbtt_GetGlyphSDF(const stbtt_fontinfo *info, float sc float d = (mx*ax+my*ay) * a_inv; num = stbtt__solve_cubic(b, c, d, res); } + dist2 = (x0-sx)*(x0-sx) + (y0-sy)*(y0-sy); + if (dist2 < min_dist*min_dist) + min_dist = (float) STBTT_sqrt(dist2); + if (num >= 1 && res[0] >= 0.0f && res[0] <= 1.0f) { t = res[0], it = 1.0f - t; px = it*it*x0 + 2*t*it*x1 + t*t*x2; @@ -4805,6 +4981,12 @@ STBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const // FULL VERSION HISTORY // +// 1.25 (2021-07-11) many fixes +// 1.24 (2020-02-05) fix warning +// 1.23 (2020-02-02) query SVG data for glyphs; query whole kerning table (but only kern not GPOS) +// 1.22 (2019-08-11) minimize missing-glyph duplication; fix kerning if both 'GPOS' and 'kern' are defined +// 1.21 (2019-02-25) fix warning +// 1.20 (2019-02-07) PackFontRange skips missing codepoints; GetScaleFontVMetrics() // 1.19 (2018-02-11) OpenType GPOS kerning (horizontal only), STBTT_fmod // 1.18 (2018-01-29) add missing function // 1.17 (2017-07-23) make more arguments const; doc fix diff --git a/Sources/CImGui/include/cimgui.h b/Sources/CImGui/include/cimgui.h index 915c6b1..5688e9d 100644 --- a/Sources/CImGui/include/cimgui.h +++ b/Sources/CImGui/include/cimgui.h @@ -1,5 +1,5 @@ //This file is automatically generated by generator.lua from https://github.com/cimgui/cimgui -//based on imgui.h file version "1.86" from Dear ImGui https://github.com/ocornut/imgui +//based on imgui.h file version "1.89.5" 18950 from Dear ImGui https://github.com/ocornut/imgui //with imgui_internal.h api #ifndef CIMGUI_INCLUDED #define CIMGUI_INCLUDED @@ -39,89 +39,71 @@ typedef unsigned __int64 ImU64; #ifndef CIMGUI_DEFINE_ENUMS_AND_STRUCTS -typedef struct ImGuiTableColumnSettings ImGuiTableColumnSettings; -typedef struct ImGuiTableCellData ImGuiTableCellData; -typedef struct ImGuiStackTool ImGuiStackTool; -typedef struct ImGuiStackLevelInfo ImGuiStackLevelInfo; -typedef struct ImGuiViewportP ImGuiViewportP; -typedef struct ImGuiListClipperData ImGuiListClipperData; -typedef struct ImGuiListClipperRange ImGuiListClipperRange; -typedef struct ImGuiPtrOrIndex ImGuiPtrOrIndex; -typedef struct ImGuiShrinkWidthItem ImGuiShrinkWidthItem; -typedef struct ImGuiWindowStackData ImGuiWindowStackData; -typedef struct ImGuiComboPreviewData ImGuiComboPreviewData; -typedef struct ImGuiDataTypeTempStorage ImGuiDataTypeTempStorage; -typedef struct ImVec2ih ImVec2ih; -typedef struct ImVec1 ImVec1; -typedef struct StbTexteditRow StbTexteditRow; -typedef struct STB_TexteditState STB_TexteditState; -typedef struct StbUndoState StbUndoState; -typedef struct StbUndoRecord StbUndoRecord; -typedef struct ImGuiWindowSettings ImGuiWindowSettings; -typedef struct ImGuiWindowTempData ImGuiWindowTempData; -typedef struct ImGuiWindow ImGuiWindow; -typedef struct ImGuiTableColumnsSettings ImGuiTableColumnsSettings; -typedef struct ImGuiTableSettings ImGuiTableSettings; -typedef struct ImGuiTableTempData ImGuiTableTempData; -typedef struct ImGuiTableColumn ImGuiTableColumn; -typedef struct ImGuiTable ImGuiTable; -typedef struct ImGuiTabItem ImGuiTabItem; -typedef struct ImGuiTabBar ImGuiTabBar; -typedef struct ImGuiStyleMod ImGuiStyleMod; -typedef struct ImGuiStackSizes ImGuiStackSizes; -typedef struct ImGuiSettingsHandler ImGuiSettingsHandler; -typedef struct ImGuiPopupData ImGuiPopupData; -typedef struct ImGuiOldColumns ImGuiOldColumns; -typedef struct ImGuiOldColumnData ImGuiOldColumnData; -typedef struct ImGuiNextItemData ImGuiNextItemData; -typedef struct ImGuiNextWindowData ImGuiNextWindowData; -typedef struct ImGuiMetricsConfig ImGuiMetricsConfig; -typedef struct ImGuiNavItemData ImGuiNavItemData; -typedef struct ImGuiMenuColumns ImGuiMenuColumns; -typedef struct ImGuiLastItemData ImGuiLastItemData; -typedef struct ImGuiInputTextState ImGuiInputTextState; -typedef struct ImGuiGroupData ImGuiGroupData; -typedef struct ImGuiDataTypeInfo ImGuiDataTypeInfo; -typedef struct ImGuiContextHook ImGuiContextHook; -typedef struct ImGuiColorMod ImGuiColorMod; -typedef struct ImDrawDataBuilder ImDrawDataBuilder; -typedef struct ImRect ImRect; -typedef struct ImBitVector ImBitVector; -typedef struct ImFontAtlasCustomRect ImFontAtlasCustomRect; -typedef struct ImDrawCmdHeader ImDrawCmdHeader; -typedef struct ImGuiStoragePair ImGuiStoragePair; -typedef struct ImGuiTextRange ImGuiTextRange; -typedef struct ImVec4 ImVec4; -typedef struct ImVec2 ImVec2; -typedef struct ImGuiViewport ImGuiViewport; -typedef struct ImGuiTextFilter ImGuiTextFilter; -typedef struct ImGuiTextBuffer ImGuiTextBuffer; -typedef struct ImGuiTableColumnSortSpecs ImGuiTableColumnSortSpecs; -typedef struct ImGuiTableSortSpecs ImGuiTableSortSpecs; -typedef struct ImGuiStyle ImGuiStyle; -typedef struct ImGuiStorage ImGuiStorage; -typedef struct ImGuiSizeCallbackData ImGuiSizeCallbackData; -typedef struct ImGuiPayload ImGuiPayload; -typedef struct ImGuiOnceUponAFrame ImGuiOnceUponAFrame; -typedef struct ImGuiListClipper ImGuiListClipper; -typedef struct ImGuiInputTextCallbackData ImGuiInputTextCallbackData; -typedef struct ImGuiIO ImGuiIO; -typedef struct ImGuiContext ImGuiContext; -typedef struct ImColor ImColor; -typedef struct ImFontGlyphRangesBuilder ImFontGlyphRangesBuilder; -typedef struct ImFontGlyph ImFontGlyph; -typedef struct ImFontConfig ImFontConfig; -typedef struct ImFontBuilderIO ImFontBuilderIO; -typedef struct ImFontAtlas ImFontAtlas; -typedef struct ImFont ImFont; -typedef struct ImDrawVert ImDrawVert; -typedef struct ImDrawListSplitter ImDrawListSplitter; -typedef struct ImDrawListSharedData ImDrawListSharedData; -typedef struct ImDrawList ImDrawList; -typedef struct ImDrawData ImDrawData; -typedef struct ImDrawCmd ImDrawCmd; -typedef struct ImDrawChannel ImDrawChannel; +typedef struct ImDrawChannel ImDrawChannel; +typedef struct ImDrawCmd ImDrawCmd; +typedef struct ImDrawData ImDrawData; +typedef struct ImDrawList ImDrawList; +typedef struct ImDrawListSharedData ImDrawListSharedData; +typedef struct ImDrawListSplitter ImDrawListSplitter; +typedef struct ImDrawVert ImDrawVert; +typedef struct ImFont ImFont; +typedef struct ImFontAtlas ImFontAtlas; +typedef struct ImFontBuilderIO ImFontBuilderIO; +typedef struct ImFontConfig ImFontConfig; +typedef struct ImFontGlyph ImFontGlyph; +typedef struct ImFontGlyphRangesBuilder ImFontGlyphRangesBuilder; +typedef struct ImColor ImColor; +typedef struct ImGuiContext ImGuiContext; +typedef struct ImGuiIO ImGuiIO; +typedef struct ImGuiInputTextCallbackData ImGuiInputTextCallbackData; +typedef struct ImGuiKeyData ImGuiKeyData; +typedef struct ImGuiListClipper ImGuiListClipper; +typedef struct ImGuiOnceUponAFrame ImGuiOnceUponAFrame; +typedef struct ImGuiPayload ImGuiPayload; +typedef struct ImGuiPlatformImeData ImGuiPlatformImeData; +typedef struct ImGuiSizeCallbackData ImGuiSizeCallbackData; +typedef struct ImGuiStorage ImGuiStorage; +typedef struct ImGuiStyle ImGuiStyle; +typedef struct ImGuiTableSortSpecs ImGuiTableSortSpecs; +typedef struct ImGuiTableColumnSortSpecs ImGuiTableColumnSortSpecs; +typedef struct ImGuiTextBuffer ImGuiTextBuffer; +typedef struct ImGuiTextFilter ImGuiTextFilter; +typedef struct ImGuiViewport ImGuiViewport; +typedef struct ImBitVector ImBitVector; +typedef struct ImRect ImRect; +typedef struct ImDrawDataBuilder ImDrawDataBuilder; +typedef struct ImGuiColorMod ImGuiColorMod; +typedef struct ImGuiContextHook ImGuiContextHook; +typedef struct ImGuiDataVarInfo ImGuiDataVarInfo; +typedef struct ImGuiDataTypeInfo ImGuiDataTypeInfo; +typedef struct ImGuiGroupData ImGuiGroupData; +typedef struct ImGuiInputTextState ImGuiInputTextState; +typedef struct ImGuiInputTextDeactivateData ImGuiInputTextDeactivateData; +typedef struct ImGuiLastItemData ImGuiLastItemData; +typedef struct ImGuiLocEntry ImGuiLocEntry; +typedef struct ImGuiMenuColumns ImGuiMenuColumns; +typedef struct ImGuiNavItemData ImGuiNavItemData; +typedef struct ImGuiMetricsConfig ImGuiMetricsConfig; +typedef struct ImGuiNextWindowData ImGuiNextWindowData; +typedef struct ImGuiNextItemData ImGuiNextItemData; +typedef struct ImGuiOldColumnData ImGuiOldColumnData; +typedef struct ImGuiOldColumns ImGuiOldColumns; +typedef struct ImGuiPopupData ImGuiPopupData; +typedef struct ImGuiSettingsHandler ImGuiSettingsHandler; +typedef struct ImGuiStackSizes ImGuiStackSizes; +typedef struct ImGuiStyleMod ImGuiStyleMod; +typedef struct ImGuiTabBar ImGuiTabBar; +typedef struct ImGuiTabItem ImGuiTabItem; +typedef struct ImGuiTable ImGuiTable; +typedef struct ImGuiTableColumn ImGuiTableColumn; +typedef struct ImGuiTableInstanceData ImGuiTableInstanceData; +typedef struct ImGuiTableTempData ImGuiTableTempData; +typedef struct ImGuiTableSettings ImGuiTableSettings; +typedef struct ImGuiTableColumnsSettings ImGuiTableColumnsSettings; +typedef struct ImGuiWindow ImGuiWindow; +typedef struct ImGuiWindowTempData ImGuiWindowTempData; +typedef struct ImGuiWindowSettings ImGuiWindowSettings; struct ImDrawChannel; struct ImDrawCmd; struct ImDrawData; @@ -139,9 +121,11 @@ struct ImColor; struct ImGuiContext; struct ImGuiIO; struct ImGuiInputTextCallbackData; +struct ImGuiKeyData; struct ImGuiListClipper; struct ImGuiOnceUponAFrame; struct ImGuiPayload; +struct ImGuiPlatformImeData; struct ImGuiSizeCallbackData; struct ImGuiStorage; struct ImGuiStyle; @@ -154,8 +138,6 @@ typedef int ImGuiCol; typedef int ImGuiCond; typedef int ImGuiDataType; typedef int ImGuiDir; -typedef int ImGuiKey; -typedef int ImGuiNavInput; typedef int ImGuiMouseButton; typedef int ImGuiMouseCursor; typedef int ImGuiSortDirection; @@ -173,7 +155,7 @@ typedef int ImGuiDragDropFlags; typedef int ImGuiFocusedFlags; typedef int ImGuiHoveredFlags; typedef int ImGuiInputTextFlags; -typedef int ImGuiKeyModFlags; +typedef int ImGuiKeyChord; typedef int ImGuiPopupFlags; typedef int ImGuiSelectableFlags; typedef int ImGuiSliderFlags; @@ -194,8 +176,8 @@ typedef signed short ImS16; typedef unsigned short ImU16; typedef signed int ImS32; typedef unsigned int ImU32; -typedef int64_t ImS64; -typedef uint64_t ImU64; +typedef signed long long ImS64; +typedef unsigned long long ImU64; typedef unsigned short ImWchar16; typedef unsigned int ImWchar32; typedef ImWchar16 ImWchar; @@ -203,113 +185,12 @@ typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); typedef void* (*ImGuiMemAllocFunc)(size_t sz, void* user_data); typedef void (*ImGuiMemFreeFunc)(void* ptr, void* user_data); -typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); -struct ImBitVector; -struct ImRect; -struct ImDrawDataBuilder; -struct ImDrawListSharedData; -struct ImGuiColorMod; -struct ImGuiContext; -struct ImGuiContextHook; -struct ImGuiDataTypeInfo; -struct ImGuiGroupData; -struct ImGuiInputTextState; -struct ImGuiLastItemData; -struct ImGuiMenuColumns; -struct ImGuiNavItemData; -struct ImGuiMetricsConfig; -struct ImGuiNextWindowData; -struct ImGuiNextItemData; -struct ImGuiOldColumnData; -struct ImGuiOldColumns; -struct ImGuiPopupData; -struct ImGuiSettingsHandler; -struct ImGuiStackSizes; -struct ImGuiStyleMod; -struct ImGuiTabBar; -struct ImGuiTabItem; -struct ImGuiTable; -struct ImGuiTableColumn; -struct ImGuiTableTempData; -struct ImGuiTableSettings; -struct ImGuiTableColumnsSettings; -struct ImGuiWindow; -struct ImGuiWindowTempData; -struct ImGuiWindowSettings; -typedef int ImGuiLayoutType; -typedef int ImGuiActivateFlags; -typedef int ImGuiItemFlags; -typedef int ImGuiItemStatusFlags; -typedef int ImGuiOldColumnFlags; -typedef int ImGuiNavHighlightFlags; -typedef int ImGuiNavDirSourceFlags; -typedef int ImGuiNavMoveFlags; -typedef int ImGuiNextItemDataFlags; -typedef int ImGuiNextWindowDataFlags; -typedef int ImGuiScrollFlags; -typedef int ImGuiSeparatorFlags; -typedef int ImGuiTextFlags; -typedef int ImGuiTooltipFlags; -typedef void (*ImGuiErrorLogCallback)(void* user_data, const char* fmt, ...); -extern ImGuiContext* GImGui; -typedef FILE* ImFileHandle; -typedef int ImPoolIdx; -typedef void (*ImGuiContextHookCallback)(ImGuiContext* ctx, ImGuiContextHook* hook); -typedef ImS8 ImGuiTableColumnIdx; -typedef ImU8 ImGuiTableDrawChannelIdx; -typedef struct ImVector{int Size;int Capacity;void* Data;} ImVector; -typedef struct ImVector_ImGuiTableSettings {int Size;int Capacity;ImGuiTableSettings* Data;} ImVector_ImGuiTableSettings; -typedef struct ImChunkStream_ImGuiTableSettings {ImVector_ImGuiTableSettings Buf;} ImChunkStream_ImGuiTableSettings; -typedef struct ImVector_ImGuiWindowSettings {int Size;int Capacity;ImGuiWindowSettings* Data;} ImVector_ImGuiWindowSettings; -typedef struct ImChunkStream_ImGuiWindowSettings {ImVector_ImGuiWindowSettings Buf;} ImChunkStream_ImGuiWindowSettings; -typedef struct ImSpan_ImGuiTableCellData {ImGuiTableCellData* Data;ImGuiTableCellData* DataEnd;} ImSpan_ImGuiTableCellData; -typedef struct ImSpan_ImGuiTableColumn {ImGuiTableColumn* Data;ImGuiTableColumn* DataEnd;} ImSpan_ImGuiTableColumn; -typedef struct ImSpan_ImGuiTableColumnIdx {ImGuiTableColumnIdx* Data;ImGuiTableColumnIdx* DataEnd;} ImSpan_ImGuiTableColumnIdx; -typedef struct ImVector_ImDrawChannel {int Size;int Capacity;ImDrawChannel* Data;} ImVector_ImDrawChannel; -typedef struct ImVector_ImDrawCmd {int Size;int Capacity;ImDrawCmd* Data;} ImVector_ImDrawCmd; -typedef struct ImVector_ImDrawIdx {int Size;int Capacity;ImDrawIdx* Data;} ImVector_ImDrawIdx; -typedef struct ImVector_ImDrawListPtr {int Size;int Capacity;ImDrawList** Data;} ImVector_ImDrawListPtr; -typedef struct ImVector_ImDrawVert {int Size;int Capacity;ImDrawVert* Data;} ImVector_ImDrawVert; -typedef struct ImVector_ImFontPtr {int Size;int Capacity;ImFont** Data;} ImVector_ImFontPtr; -typedef struct ImVector_ImFontAtlasCustomRect {int Size;int Capacity;ImFontAtlasCustomRect* Data;} ImVector_ImFontAtlasCustomRect; -typedef struct ImVector_ImFontConfig {int Size;int Capacity;ImFontConfig* Data;} ImVector_ImFontConfig; -typedef struct ImVector_ImFontGlyph {int Size;int Capacity;ImFontGlyph* Data;} ImVector_ImFontGlyph; -typedef struct ImVector_ImGuiColorMod {int Size;int Capacity;ImGuiColorMod* Data;} ImVector_ImGuiColorMod; -typedef struct ImVector_ImGuiContextHook {int Size;int Capacity;ImGuiContextHook* Data;} ImVector_ImGuiContextHook; -typedef struct ImVector_ImGuiGroupData {int Size;int Capacity;ImGuiGroupData* Data;} ImVector_ImGuiGroupData; -typedef struct ImVector_ImGuiID {int Size;int Capacity;ImGuiID* Data;} ImVector_ImGuiID; -typedef struct ImVector_ImGuiItemFlags {int Size;int Capacity;ImGuiItemFlags* Data;} ImVector_ImGuiItemFlags; -typedef struct ImVector_ImGuiListClipperData {int Size;int Capacity;ImGuiListClipperData* Data;} ImVector_ImGuiListClipperData; -typedef struct ImVector_ImGuiListClipperRange {int Size;int Capacity;ImGuiListClipperRange* Data;} ImVector_ImGuiListClipperRange; -typedef struct ImVector_ImGuiOldColumnData {int Size;int Capacity;ImGuiOldColumnData* Data;} ImVector_ImGuiOldColumnData; -typedef struct ImVector_ImGuiOldColumns {int Size;int Capacity;ImGuiOldColumns* Data;} ImVector_ImGuiOldColumns; -typedef struct ImVector_ImGuiPopupData {int Size;int Capacity;ImGuiPopupData* Data;} ImVector_ImGuiPopupData; -typedef struct ImVector_ImGuiPtrOrIndex {int Size;int Capacity;ImGuiPtrOrIndex* Data;} ImVector_ImGuiPtrOrIndex; -typedef struct ImVector_ImGuiSettingsHandler {int Size;int Capacity;ImGuiSettingsHandler* Data;} ImVector_ImGuiSettingsHandler; -typedef struct ImVector_ImGuiShrinkWidthItem {int Size;int Capacity;ImGuiShrinkWidthItem* Data;} ImVector_ImGuiShrinkWidthItem; -typedef struct ImVector_ImGuiStackLevelInfo {int Size;int Capacity;ImGuiStackLevelInfo* Data;} ImVector_ImGuiStackLevelInfo; -typedef struct ImVector_ImGuiStoragePair {int Size;int Capacity;ImGuiStoragePair* Data;} ImVector_ImGuiStoragePair; -typedef struct ImVector_ImGuiStyleMod {int Size;int Capacity;ImGuiStyleMod* Data;} ImVector_ImGuiStyleMod; -typedef struct ImVector_ImGuiTabItem {int Size;int Capacity;ImGuiTabItem* Data;} ImVector_ImGuiTabItem; -typedef struct ImVector_ImGuiTableColumnSortSpecs {int Size;int Capacity;ImGuiTableColumnSortSpecs* Data;} ImVector_ImGuiTableColumnSortSpecs; -typedef struct ImVector_ImGuiTableTempData {int Size;int Capacity;ImGuiTableTempData* Data;} ImVector_ImGuiTableTempData; -typedef struct ImVector_ImGuiTextRange {int Size;int Capacity;ImGuiTextRange* Data;} ImVector_ImGuiTextRange; -typedef struct ImVector_ImGuiViewportPPtr {int Size;int Capacity;ImGuiViewportP** Data;} ImVector_ImGuiViewportPPtr; -typedef struct ImVector_ImGuiWindowPtr {int Size;int Capacity;ImGuiWindow** Data;} ImVector_ImGuiWindowPtr; -typedef struct ImVector_ImGuiWindowStackData {int Size;int Capacity;ImGuiWindowStackData* Data;} ImVector_ImGuiWindowStackData; -typedef struct ImVector_ImTextureID {int Size;int Capacity;ImTextureID* Data;} ImVector_ImTextureID; -typedef struct ImVector_ImU32 {int Size;int Capacity;ImU32* Data;} ImVector_ImU32; -typedef struct ImVector_ImVec2 {int Size;int Capacity;ImVec2* Data;} ImVector_ImVec2; -typedef struct ImVector_ImVec4 {int Size;int Capacity;ImVec4* Data;} ImVector_ImVec4; -typedef struct ImVector_ImWchar {int Size;int Capacity;ImWchar* Data;} ImVector_ImWchar; -typedef struct ImVector_char {int Size;int Capacity;char* Data;} ImVector_char; -typedef struct ImVector_float {int Size;int Capacity;float* Data;} ImVector_float; -typedef struct ImVector_unsigned_char {int Size;int Capacity;unsigned char* Data;} ImVector_unsigned_char; - +typedef struct ImVec2 ImVec2; struct ImVec2 { float x, y; }; +typedef struct ImVec4 ImVec4; struct ImVec4 { float x, y, z, w; @@ -344,7 +225,7 @@ typedef enum { ImGuiWindowFlags_Tooltip = 1 << 25, ImGuiWindowFlags_Popup = 1 << 26, ImGuiWindowFlags_Modal = 1 << 27, - ImGuiWindowFlags_ChildMenu = 1 << 28 + ImGuiWindowFlags_ChildMenu = 1 << 28, }ImGuiWindowFlags_; typedef enum { ImGuiInputTextFlags_None = 0, @@ -367,7 +248,8 @@ typedef enum { ImGuiInputTextFlags_NoUndoRedo = 1 << 16, ImGuiInputTextFlags_CharsScientific = 1 << 17, ImGuiInputTextFlags_CallbackResize = 1 << 18, - ImGuiInputTextFlags_CallbackEdit = 1 << 19 + ImGuiInputTextFlags_CallbackEdit = 1 << 19, + ImGuiInputTextFlags_EscapeClearsAll = 1 << 20, }ImGuiInputTextFlags_; typedef enum { ImGuiTreeNodeFlags_None = 0, @@ -385,7 +267,7 @@ typedef enum { ImGuiTreeNodeFlags_SpanAvailWidth = 1 << 11, ImGuiTreeNodeFlags_SpanFullWidth = 1 << 12, ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 13, - ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog + ImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoTreePushOnOpen | ImGuiTreeNodeFlags_NoAutoOpenOnLog, }ImGuiTreeNodeFlags_; typedef enum { ImGuiPopupFlags_None = 0, @@ -398,7 +280,7 @@ typedef enum { ImGuiPopupFlags_NoOpenOverItems = 1 << 6, ImGuiPopupFlags_AnyPopupId = 1 << 7, ImGuiPopupFlags_AnyPopupLevel = 1 << 8, - ImGuiPopupFlags_AnyPopup = ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel + ImGuiPopupFlags_AnyPopup = ImGuiPopupFlags_AnyPopupId | ImGuiPopupFlags_AnyPopupLevel, }ImGuiPopupFlags_; typedef enum { ImGuiSelectableFlags_None = 0, @@ -406,7 +288,7 @@ typedef enum { ImGuiSelectableFlags_SpanAllColumns = 1 << 1, ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, ImGuiSelectableFlags_Disabled = 1 << 3, - ImGuiSelectableFlags_AllowItemOverlap = 1 << 4 + ImGuiSelectableFlags_AllowItemOverlap = 1 << 4, }ImGuiSelectableFlags_; typedef enum { ImGuiComboFlags_None = 0, @@ -417,7 +299,7 @@ typedef enum { ImGuiComboFlags_HeightLargest = 1 << 4, ImGuiComboFlags_NoArrowButton = 1 << 5, ImGuiComboFlags_NoPreview = 1 << 6, - ImGuiComboFlags_HeightMask_ = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest + ImGuiComboFlags_HeightMask_ = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest, }ImGuiComboFlags_; typedef enum { ImGuiTabBarFlags_None = 0, @@ -430,7 +312,7 @@ typedef enum { ImGuiTabBarFlags_FittingPolicyResizeDown = 1 << 6, ImGuiTabBarFlags_FittingPolicyScroll = 1 << 7, ImGuiTabBarFlags_FittingPolicyMask_ = ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll, - ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyResizeDown + ImGuiTabBarFlags_FittingPolicyDefault_ = ImGuiTabBarFlags_FittingPolicyResizeDown, }ImGuiTabBarFlags_; typedef enum { ImGuiTabItemFlags_None = 0, @@ -441,7 +323,7 @@ typedef enum { ImGuiTabItemFlags_NoTooltip = 1 << 4, ImGuiTabItemFlags_NoReorder = 1 << 5, ImGuiTabItemFlags_Leading = 1 << 6, - ImGuiTabItemFlags_Trailing = 1 << 7 + ImGuiTabItemFlags_Trailing = 1 << 7, }ImGuiTabItemFlags_; typedef enum { ImGuiTableFlags_None = 0, @@ -479,7 +361,7 @@ typedef enum { ImGuiTableFlags_ScrollY = 1 << 25, ImGuiTableFlags_SortMulti = 1 << 26, ImGuiTableFlags_SortTristate = 1 << 27, - ImGuiTableFlags_SizingMask_ = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_SizingStretchSame + ImGuiTableFlags_SizingMask_ = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_SizingStretchSame, }ImGuiTableFlags_; typedef enum { ImGuiTableColumnFlags_None = 0, @@ -508,17 +390,17 @@ typedef enum { ImGuiTableColumnFlags_WidthMask_ = ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_WidthFixed, ImGuiTableColumnFlags_IndentMask_ = ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_IndentDisable, ImGuiTableColumnFlags_StatusMask_ = ImGuiTableColumnFlags_IsEnabled | ImGuiTableColumnFlags_IsVisible | ImGuiTableColumnFlags_IsSorted | ImGuiTableColumnFlags_IsHovered, - ImGuiTableColumnFlags_NoDirectResize_ = 1 << 30 + ImGuiTableColumnFlags_NoDirectResize_ = 1 << 30, }ImGuiTableColumnFlags_; typedef enum { ImGuiTableRowFlags_None = 0, - ImGuiTableRowFlags_Headers = 1 << 0 + ImGuiTableRowFlags_Headers = 1 << 0, }ImGuiTableRowFlags_; typedef enum { ImGuiTableBgTarget_None = 0, ImGuiTableBgTarget_RowBg0 = 1, ImGuiTableBgTarget_RowBg1 = 2, - ImGuiTableBgTarget_CellBg = 3 + ImGuiTableBgTarget_CellBg = 3, }ImGuiTableBgTarget_; typedef enum { ImGuiFocusedFlags_None = 0, @@ -526,7 +408,7 @@ typedef enum { ImGuiFocusedFlags_RootWindow = 1 << 1, ImGuiFocusedFlags_AnyWindow = 1 << 2, ImGuiFocusedFlags_NoPopupHierarchy = 1 << 3, - ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows + ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows, }ImGuiFocusedFlags_; typedef enum { ImGuiHoveredFlags_None = 0, @@ -538,8 +420,12 @@ typedef enum { ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 7, ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 8, ImGuiHoveredFlags_AllowWhenDisabled = 1 << 9, + ImGuiHoveredFlags_NoNavOverride = 1 << 10, ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped, - ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows + ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows, + ImGuiHoveredFlags_DelayNormal = 1 << 11, + ImGuiHoveredFlags_DelayShort = 1 << 12, + ImGuiHoveredFlags_NoSharedDelay = 1 << 13, }ImGuiHoveredFlags_; typedef enum { ImGuiDragDropFlags_None = 0, @@ -552,7 +438,7 @@ typedef enum { ImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10, ImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11, ImGuiDragDropFlags_AcceptNoPreviewTooltip = 1 << 12, - ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect + ImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect, }ImGuiDragDropFlags_; typedef enum { ImGuiDataType_S8, @@ -581,61 +467,166 @@ typedef enum { ImGuiSortDirection_Descending = 2 }ImGuiSortDirection_; typedef enum { - ImGuiKey_Tab, - ImGuiKey_LeftArrow, - ImGuiKey_RightArrow, - ImGuiKey_UpArrow, - ImGuiKey_DownArrow, - ImGuiKey_PageUp, - ImGuiKey_PageDown, - ImGuiKey_Home, - ImGuiKey_End, - ImGuiKey_Insert, - ImGuiKey_Delete, - ImGuiKey_Backspace, - ImGuiKey_Space, - ImGuiKey_Enter, - ImGuiKey_Escape, - ImGuiKey_KeyPadEnter, - ImGuiKey_A, - ImGuiKey_C, - ImGuiKey_V, - ImGuiKey_X, - ImGuiKey_Y, - ImGuiKey_Z, - ImGuiKey_COUNT -}ImGuiKey_; -typedef enum { - ImGuiKeyModFlags_None = 0, - ImGuiKeyModFlags_Ctrl = 1 << 0, - ImGuiKeyModFlags_Shift = 1 << 1, - ImGuiKeyModFlags_Alt = 1 << 2, - ImGuiKeyModFlags_Super = 1 << 3 -}ImGuiKeyModFlags_; -typedef enum { - ImGuiNavInput_Activate, - ImGuiNavInput_Cancel, - ImGuiNavInput_Input, - ImGuiNavInput_Menu, - ImGuiNavInput_DpadLeft, - ImGuiNavInput_DpadRight, - ImGuiNavInput_DpadUp, - ImGuiNavInput_DpadDown, - ImGuiNavInput_LStickLeft, - ImGuiNavInput_LStickRight, - ImGuiNavInput_LStickUp, - ImGuiNavInput_LStickDown, - ImGuiNavInput_FocusPrev, - ImGuiNavInput_FocusNext, - ImGuiNavInput_TweakSlow, - ImGuiNavInput_TweakFast, - ImGuiNavInput_KeyLeft_, - ImGuiNavInput_KeyRight_, - ImGuiNavInput_KeyUp_, - ImGuiNavInput_KeyDown_, +ImGuiKey_None=0, +ImGuiKey_Tab=512, +ImGuiKey_LeftArrow=513, +ImGuiKey_RightArrow=514, +ImGuiKey_UpArrow=515, +ImGuiKey_DownArrow=516, +ImGuiKey_PageUp=517, +ImGuiKey_PageDown=518, +ImGuiKey_Home=519, +ImGuiKey_End=520, +ImGuiKey_Insert=521, +ImGuiKey_Delete=522, +ImGuiKey_Backspace=523, +ImGuiKey_Space=524, +ImGuiKey_Enter=525, +ImGuiKey_Escape=526, +ImGuiKey_LeftCtrl=527, +ImGuiKey_LeftShift=528, +ImGuiKey_LeftAlt=529, +ImGuiKey_LeftSuper=530, +ImGuiKey_RightCtrl=531, +ImGuiKey_RightShift=532, +ImGuiKey_RightAlt=533, +ImGuiKey_RightSuper=534, +ImGuiKey_Menu=535, +ImGuiKey_0=536, +ImGuiKey_1=537, +ImGuiKey_2=538, +ImGuiKey_3=539, +ImGuiKey_4=540, +ImGuiKey_5=541, +ImGuiKey_6=542, +ImGuiKey_7=543, +ImGuiKey_8=544, +ImGuiKey_9=545, +ImGuiKey_A=546, +ImGuiKey_B=547, +ImGuiKey_C=548, +ImGuiKey_D=549, +ImGuiKey_E=550, +ImGuiKey_F=551, +ImGuiKey_G=552, +ImGuiKey_H=553, +ImGuiKey_I=554, +ImGuiKey_J=555, +ImGuiKey_K=556, +ImGuiKey_L=557, +ImGuiKey_M=558, +ImGuiKey_N=559, +ImGuiKey_O=560, +ImGuiKey_P=561, +ImGuiKey_Q=562, +ImGuiKey_R=563, +ImGuiKey_S=564, +ImGuiKey_T=565, +ImGuiKey_U=566, +ImGuiKey_V=567, +ImGuiKey_W=568, +ImGuiKey_X=569, +ImGuiKey_Y=570, +ImGuiKey_Z=571, +ImGuiKey_F1=572, +ImGuiKey_F2=573, +ImGuiKey_F3=574, +ImGuiKey_F4=575, +ImGuiKey_F5=576, +ImGuiKey_F6=577, +ImGuiKey_F7=578, +ImGuiKey_F8=579, +ImGuiKey_F9=580, +ImGuiKey_F10=581, +ImGuiKey_F11=582, +ImGuiKey_F12=583, +ImGuiKey_Apostrophe=584, +ImGuiKey_Comma=585, +ImGuiKey_Minus=586, +ImGuiKey_Period=587, +ImGuiKey_Slash=588, +ImGuiKey_Semicolon=589, +ImGuiKey_Equal=590, +ImGuiKey_LeftBracket=591, +ImGuiKey_Backslash=592, +ImGuiKey_RightBracket=593, +ImGuiKey_GraveAccent=594, +ImGuiKey_CapsLock=595, +ImGuiKey_ScrollLock=596, +ImGuiKey_NumLock=597, +ImGuiKey_PrintScreen=598, +ImGuiKey_Pause=599, +ImGuiKey_Keypad0=600, +ImGuiKey_Keypad1=601, +ImGuiKey_Keypad2=602, +ImGuiKey_Keypad3=603, +ImGuiKey_Keypad4=604, +ImGuiKey_Keypad5=605, +ImGuiKey_Keypad6=606, +ImGuiKey_Keypad7=607, +ImGuiKey_Keypad8=608, +ImGuiKey_Keypad9=609, +ImGuiKey_KeypadDecimal=610, +ImGuiKey_KeypadDivide=611, +ImGuiKey_KeypadMultiply=612, +ImGuiKey_KeypadSubtract=613, +ImGuiKey_KeypadAdd=614, +ImGuiKey_KeypadEnter=615, +ImGuiKey_KeypadEqual=616, +ImGuiKey_GamepadStart=617, +ImGuiKey_GamepadBack=618, +ImGuiKey_GamepadFaceLeft=619, +ImGuiKey_GamepadFaceRight=620, +ImGuiKey_GamepadFaceUp=621, +ImGuiKey_GamepadFaceDown=622, +ImGuiKey_GamepadDpadLeft=623, +ImGuiKey_GamepadDpadRight=624, +ImGuiKey_GamepadDpadUp=625, +ImGuiKey_GamepadDpadDown=626, +ImGuiKey_GamepadL1=627, +ImGuiKey_GamepadR1=628, +ImGuiKey_GamepadL2=629, +ImGuiKey_GamepadR2=630, +ImGuiKey_GamepadL3=631, +ImGuiKey_GamepadR3=632, +ImGuiKey_GamepadLStickLeft=633, +ImGuiKey_GamepadLStickRight=634, +ImGuiKey_GamepadLStickUp=635, +ImGuiKey_GamepadLStickDown=636, +ImGuiKey_GamepadRStickLeft=637, +ImGuiKey_GamepadRStickRight=638, +ImGuiKey_GamepadRStickUp=639, +ImGuiKey_GamepadRStickDown=640, +ImGuiKey_MouseLeft=641, +ImGuiKey_MouseRight=642, +ImGuiKey_MouseMiddle=643, +ImGuiKey_MouseX1=644, +ImGuiKey_MouseX2=645, +ImGuiKey_MouseWheelX=646, +ImGuiKey_MouseWheelY=647, +ImGuiKey_ReservedForModCtrl=648, +ImGuiKey_ReservedForModShift=649, +ImGuiKey_ReservedForModAlt=650, +ImGuiKey_ReservedForModSuper=651, +ImGuiKey_COUNT=652, +ImGuiMod_None=0, +ImGuiMod_Ctrl=1 << 12, +ImGuiMod_Shift=1 << 13, +ImGuiMod_Alt=1 << 14, +ImGuiMod_Super=1 << 15, +ImGuiMod_Shortcut=1 << 11, +ImGuiMod_Mask_=0xF800, +ImGuiKey_NamedKey_BEGIN=512, +ImGuiKey_NamedKey_END=ImGuiKey_COUNT, +ImGuiKey_NamedKey_COUNT=ImGuiKey_NamedKey_END - ImGuiKey_NamedKey_BEGIN, +ImGuiKey_KeysData_SIZE=ImGuiKey_COUNT, +ImGuiKey_KeysData_OFFSET=0, +}ImGuiKey; +typedef enum { + ImGuiNavInput_Activate, ImGuiNavInput_Cancel, ImGuiNavInput_Input, ImGuiNavInput_Menu, ImGuiNavInput_DpadLeft, ImGuiNavInput_DpadRight, ImGuiNavInput_DpadUp, ImGuiNavInput_DpadDown, + ImGuiNavInput_LStickLeft, ImGuiNavInput_LStickRight, ImGuiNavInput_LStickUp, ImGuiNavInput_LStickDown, ImGuiNavInput_FocusPrev, ImGuiNavInput_FocusNext, ImGuiNavInput_TweakSlow, ImGuiNavInput_TweakFast, ImGuiNavInput_COUNT, - ImGuiNavInput_InternalStart_ = ImGuiNavInput_KeyLeft_ -}ImGuiNavInput_; +}ImGuiNavInput; typedef enum { ImGuiConfigFlags_None = 0, ImGuiConfigFlags_NavEnableKeyboard = 1 << 0, @@ -645,14 +636,14 @@ typedef enum { ImGuiConfigFlags_NoMouse = 1 << 4, ImGuiConfigFlags_NoMouseCursorChange = 1 << 5, ImGuiConfigFlags_IsSRGB = 1 << 20, - ImGuiConfigFlags_IsTouchScreen = 1 << 21 + ImGuiConfigFlags_IsTouchScreen = 1 << 21, }ImGuiConfigFlags_; typedef enum { ImGuiBackendFlags_None = 0, ImGuiBackendFlags_HasGamepad = 1 << 0, ImGuiBackendFlags_HasMouseCursors = 1 << 1, ImGuiBackendFlags_HasSetMousePos = 1 << 2, - ImGuiBackendFlags_RendererHasVtxOffset = 1 << 3 + ImGuiBackendFlags_RendererHasVtxOffset = 1 << 3, }ImGuiBackendFlags_; typedef enum { ImGuiCol_Text, @@ -736,6 +727,9 @@ typedef enum { ImGuiStyleVar_TabRounding, ImGuiStyleVar_ButtonTextAlign, ImGuiStyleVar_SelectableTextAlign, + ImGuiStyleVar_SeparatorTextBorderSize, + ImGuiStyleVar_SeparatorTextAlign, + ImGuiStyleVar_SeparatorTextPadding, ImGuiStyleVar_COUNT }ImGuiStyleVar_; typedef enum { @@ -744,7 +738,7 @@ typedef enum { ImGuiButtonFlags_MouseButtonRight = 1 << 1, ImGuiButtonFlags_MouseButtonMiddle = 1 << 2, ImGuiButtonFlags_MouseButtonMask_ = ImGuiButtonFlags_MouseButtonLeft | ImGuiButtonFlags_MouseButtonRight | ImGuiButtonFlags_MouseButtonMiddle, - ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft + ImGuiButtonFlags_MouseButtonDefault_ = ImGuiButtonFlags_MouseButtonLeft, }ImGuiButtonFlags_; typedef enum { ImGuiColorEditFlags_None = 0, @@ -775,7 +769,7 @@ typedef enum { ImGuiColorEditFlags_DisplayMask_ = ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_DisplayHex, ImGuiColorEditFlags_DataTypeMask_ = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_Float, ImGuiColorEditFlags_PickerMask_ = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar, - ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV + ImGuiColorEditFlags_InputMask_ = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_InputHSV, }ImGuiColorEditFlags_; typedef enum { ImGuiSliderFlags_None = 0, @@ -783,7 +777,7 @@ typedef enum { ImGuiSliderFlags_Logarithmic = 1 << 5, ImGuiSliderFlags_NoRoundToFormat = 1 << 6, ImGuiSliderFlags_NoInput = 1 << 7, - ImGuiSliderFlags_InvalidMask_ = 0x7000000F + ImGuiSliderFlags_InvalidMask_ = 0x7000000F, }ImGuiSliderFlags_; typedef enum { ImGuiMouseButton_Left = 0, @@ -804,12 +798,18 @@ typedef enum { ImGuiMouseCursor_NotAllowed, ImGuiMouseCursor_COUNT }ImGuiMouseCursor_; +typedef enum { +ImGuiMouseSource_Mouse=0, +ImGuiMouseSource_TouchScreen=1, +ImGuiMouseSource_Pen=2, +ImGuiMouseSource_COUNT=3, +}ImGuiMouseSource; typedef enum { ImGuiCond_None = 0, ImGuiCond_Always = 1 << 0, ImGuiCond_Once = 1 << 1, ImGuiCond_FirstUseEver = 1 << 2, - ImGuiCond_Appearing = 1 << 3 + ImGuiCond_Appearing = 1 << 3, }ImGuiCond_; struct ImGuiStyle { @@ -845,6 +845,9 @@ struct ImGuiStyle ImGuiDir ColorButtonPosition; ImVec2 ButtonTextAlign; ImVec2 SelectableTextAlign; + float SeparatorTextBorderSize; + ImVec2 SeparatorTextAlign; + ImVec2 SeparatorTextPadding; ImVec2 DisplayWindowPadding; ImVec2 DisplaySafeAreaPadding; float MouseCursorScale; @@ -855,6 +858,15 @@ struct ImGuiStyle float CircleTessellationMaxError; ImVec4 Colors[ImGuiCol_COUNT]; }; +struct ImGuiKeyData +{ + bool Down; + float DownDuration; + float DownDurationPrev; + float AnalogValue; +}; +typedef struct ImVector_ImWchar {int Size;int Capacity;ImWchar* Data;} ImVector_ImWchar; + struct ImGuiIO { ImGuiConfigFlags ConfigFlags; @@ -867,9 +879,10 @@ struct ImGuiIO float MouseDoubleClickTime; float MouseDoubleClickMaxDist; float MouseDragThreshold; - int KeyMap[ImGuiKey_COUNT]; float KeyRepeatDelay; float KeyRepeatRate; + float HoverDelayNormal; + float HoverDelayShort; void* UserData; ImFontAtlas*Fonts; float FontGlobalScale; @@ -878,11 +891,15 @@ struct ImGuiIO ImVec2 DisplayFramebufferScale; bool MouseDrawCursor; bool ConfigMacOSXBehaviors; + bool ConfigInputTrickleEventQueue; bool ConfigInputTextCursorBlink; + bool ConfigInputTextEnterKeepActive; bool ConfigDragClickToInputText; bool ConfigWindowsResizeFromEdges; bool ConfigWindowsMoveFromTitleBarOnly; float ConfigMemoryCompactTimer; + bool ConfigDebugBeginReturnValueOnce; + bool ConfigDebugBeginReturnValueLoop; const char* BackendPlatformName; const char* BackendRendererName; void* BackendPlatformUserData; @@ -891,18 +908,8 @@ struct ImGuiIO const char* (*GetClipboardTextFn)(void* user_data); void (*SetClipboardTextFn)(void* user_data, const char* text); void* ClipboardUserData; - void (*ImeSetInputScreenPosFn)(int x, int y); - void* ImeWindowHandle; - ImVec2 MousePos; - bool MouseDown[5]; - float MouseWheel; - float MouseWheelH; - bool KeyCtrl; - bool KeyShift; - bool KeyAlt; - bool KeySuper; - bool KeysDown[512]; - float NavInputs[ImGuiNavInput_COUNT]; + void (*SetPlatformImeDataFn)(ImGuiViewport* viewport, ImGuiPlatformImeData* data); + void* _UnusedPadding; bool WantCaptureMouse; bool WantCaptureKeyboard; bool WantTextInput; @@ -917,9 +924,22 @@ struct ImGuiIO int MetricsActiveWindows; int MetricsActiveAllocations; ImVec2 MouseDelta; + int KeyMap[ImGuiKey_COUNT]; + bool KeysDown[ImGuiKey_COUNT]; + float NavInputs[ImGuiNavInput_COUNT]; + ImGuiContext* Ctx; + ImVec2 MousePos; + bool MouseDown[5]; + float MouseWheel; + float MouseWheelH; + ImGuiMouseSource MouseSource; + bool KeyCtrl; + bool KeyShift; + bool KeyAlt; + bool KeySuper; + ImGuiKeyChord KeyMods; + ImGuiKeyData KeysData[ImGuiKey_KeysData_SIZE]; bool WantCaptureMouseUnlessPopupClose; - ImGuiKeyModFlags KeyMods; - ImGuiKeyModFlags KeyModsPrev; ImVec2 MousePosPrev; ImVec2 MouseClickedPos[5]; double MouseClickedTime[5]; @@ -930,21 +950,21 @@ struct ImGuiIO bool MouseReleased[5]; bool MouseDownOwned[5]; bool MouseDownOwnedUnlessPopupClose[5]; + bool MouseWheelRequestAxisSwap; float MouseDownDuration[5]; float MouseDownDurationPrev[5]; - ImVec2 MouseDragMaxDistanceAbs[5]; float MouseDragMaxDistanceSqr[5]; - float KeysDownDuration[512]; - float KeysDownDurationPrev[512]; - float NavInputsDownDuration[ImGuiNavInput_COUNT]; - float NavInputsDownDurationPrev[ImGuiNavInput_COUNT]; float PenPressure; bool AppFocusLost; + bool AppAcceptingEvents; + ImS8 BackendUsingLegacyKeyArrays; + bool BackendUsingLegacyNavInputArray; ImWchar16 InputQueueSurrogate; ImVector_ImWchar InputQueueCharacters; }; struct ImGuiInputTextCallbackData { + ImGuiContext* Ctx; ImGuiInputTextFlags EventFlag; ImGuiInputTextFlags Flags; void* UserData; @@ -998,12 +1018,19 @@ struct ImGuiTextRange const char* b; const char* e; }; +typedef struct ImGuiTextRange ImGuiTextRange; + +typedef struct ImVector_ImGuiTextRange {int Size;int Capacity;ImGuiTextRange* Data;} ImVector_ImGuiTextRange; + struct ImGuiTextFilter { char InputBuf[256]; ImVector_ImGuiTextRange Filters; int CountGrep; }; +typedef struct ImGuiTextRange ImGuiTextRange; +typedef struct ImVector_char {int Size;int Capacity;char* Data;} ImVector_char; + struct ImGuiTextBuffer { ImVector_char Buf; @@ -1013,16 +1040,18 @@ struct ImGuiStoragePair ImGuiID key; union { int val_i; float val_f; void* val_p; }; }; +typedef struct ImGuiStoragePair ImGuiStoragePair; + +typedef struct ImVector_ImGuiStoragePair {int Size;int Capacity;ImGuiStoragePair* Data;} ImVector_ImGuiStoragePair; + struct ImGuiStorage { ImVector_ImGuiStoragePair Data; }; -typedef struct ImVector_ImGuiTabBar {int Size;int Capacity;ImGuiTabBar* Data;} ImVector_ImGuiTabBar; -typedef struct ImPool_ImGuiTabBar {ImVector_ImGuiTabBar Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;} ImPool_ImGuiTabBar; -typedef struct ImVector_ImGuiTable {int Size;int Capacity;ImGuiTable* Data;} ImVector_ImGuiTable; -typedef struct ImPool_ImGuiTable {ImVector_ImGuiTable Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;} ImPool_ImGuiTable; +typedef struct ImGuiStoragePair ImGuiStoragePair; struct ImGuiListClipper { + ImGuiContext* Ctx; int DisplayStart; int DisplayEnd; int ItemsCount; @@ -1034,6 +1063,7 @@ struct ImColor { ImVec4 Value; }; +typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); struct ImDrawCmd { ImVec4 ClipRect; @@ -1050,17 +1080,24 @@ struct ImDrawVert ImVec2 uv; ImU32 col; }; +typedef struct ImDrawCmdHeader ImDrawCmdHeader; struct ImDrawCmdHeader { ImVec4 ClipRect; ImTextureID TextureId; unsigned int VtxOffset; }; +typedef struct ImVector_ImDrawCmd {int Size;int Capacity;ImDrawCmd* Data;} ImVector_ImDrawCmd; + +typedef struct ImVector_ImDrawIdx {int Size;int Capacity;ImDrawIdx* Data;} ImVector_ImDrawIdx; + struct ImDrawChannel { ImVector_ImDrawCmd _CmdBuffer; ImVector_ImDrawIdx _IdxBuffer; }; +typedef struct ImVector_ImDrawChannel {int Size;int Capacity;ImDrawChannel* Data;} ImVector_ImDrawChannel; + struct ImDrawListSplitter { int _Current; @@ -1081,15 +1118,23 @@ typedef enum { ImDrawFlags_RoundCornersRight = ImDrawFlags_RoundCornersBottomRight | ImDrawFlags_RoundCornersTopRight, ImDrawFlags_RoundCornersAll = ImDrawFlags_RoundCornersTopLeft | ImDrawFlags_RoundCornersTopRight | ImDrawFlags_RoundCornersBottomLeft | ImDrawFlags_RoundCornersBottomRight, ImDrawFlags_RoundCornersDefault_ = ImDrawFlags_RoundCornersAll, - ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundCornersAll | ImDrawFlags_RoundCornersNone + ImDrawFlags_RoundCornersMask_ = ImDrawFlags_RoundCornersAll | ImDrawFlags_RoundCornersNone, }ImDrawFlags_; typedef enum { ImDrawListFlags_None = 0, ImDrawListFlags_AntiAliasedLines = 1 << 0, ImDrawListFlags_AntiAliasedLinesUseTex = 1 << 1, ImDrawListFlags_AntiAliasedFill = 1 << 2, - ImDrawListFlags_AllowVtxOffset = 1 << 3 + ImDrawListFlags_AllowVtxOffset = 1 << 3, }ImDrawListFlags_; +typedef struct ImVector_ImDrawVert {int Size;int Capacity;ImDrawVert* Data;} ImVector_ImDrawVert; + +typedef struct ImVector_ImVec4 {int Size;int Capacity;ImVec4* Data;} ImVector_ImVec4; + +typedef struct ImVector_ImTextureID {int Size;int Capacity;ImTextureID* Data;} ImVector_ImTextureID; + +typedef struct ImVector_ImVec2 {int Size;int Capacity;ImVec2* Data;} ImVector_ImVec2; + struct ImDrawList { ImVector_ImDrawCmd CmdBuffer; @@ -1097,7 +1142,7 @@ struct ImDrawList ImVector_ImDrawVert VtxBuffer; ImDrawListFlags Flags; unsigned int _VtxCurrentIdx; - const ImDrawListSharedData* _Data; + ImDrawListSharedData* _Data; const char* _OwnerName; ImDrawVert* _VtxWritePtr; ImDrawIdx* _IdxWritePtr; @@ -1150,10 +1195,13 @@ struct ImFontGlyph float X0, Y0, X1, Y1; float U0, V0, U1, V1; }; +typedef struct ImVector_ImU32 {int Size;int Capacity;ImU32* Data;} ImVector_ImU32; + struct ImFontGlyphRangesBuilder { ImVector_ImU32 UsedChars; }; +typedef struct ImFontAtlasCustomRect ImFontAtlasCustomRect; struct ImFontAtlasCustomRect { unsigned short Width, Height; @@ -1167,8 +1215,14 @@ typedef enum { ImFontAtlasFlags_None = 0, ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, ImFontAtlasFlags_NoMouseCursors = 1 << 1, - ImFontAtlasFlags_NoBakedLines = 1 << 2 + ImFontAtlasFlags_NoBakedLines = 1 << 2, }ImFontAtlasFlags_; +typedef struct ImVector_ImFontPtr {int Size;int Capacity;ImFont** Data;} ImVector_ImFontPtr; + +typedef struct ImVector_ImFontAtlasCustomRect {int Size;int Capacity;ImFontAtlasCustomRect* Data;} ImVector_ImFontAtlasCustomRect; + +typedef struct ImVector_ImFontConfig {int Size;int Capacity;ImFontConfig* Data;} ImVector_ImFontConfig; + struct ImFontAtlas { ImFontAtlasFlags Flags; @@ -1176,6 +1230,7 @@ struct ImFontAtlas int TexDesiredWidth; int TexGlyphPadding; bool Locked; + void* UserData; bool TexReady; bool TexPixelsUseColors; unsigned char* TexPixelsAlpha8; @@ -1193,6 +1248,10 @@ struct ImFontAtlas int PackIdMouseCursors; int PackIdLines; }; +typedef struct ImVector_float {int Size;int Capacity;float* Data;} ImVector_float; + +typedef struct ImVector_ImFontGlyph {int Size;int Capacity;ImFontGlyph* Data;} ImVector_ImFontGlyph; + struct ImFont { ImVector_float IndexAdvanceX; @@ -1206,7 +1265,9 @@ struct ImFont short ConfigDataCount; ImWchar FallbackChar; ImWchar EllipsisChar; - ImWchar DotChar; + short EllipsisCharCount; + float EllipsisWidth; + float EllipsisCharStep; bool DirtyLookupTables; float Scale; float Ascent, Descent; @@ -1217,7 +1278,7 @@ typedef enum { ImGuiViewportFlags_None = 0, ImGuiViewportFlags_IsPlatformWindow = 1 << 0, ImGuiViewportFlags_IsPlatformMonitor = 1 << 1, - ImGuiViewportFlags_OwnedByApp = 1 << 2 + ImGuiViewportFlags_OwnedByApp = 1 << 2, }ImGuiViewportFlags_; struct ImGuiViewport { @@ -1226,7 +1287,68 @@ struct ImGuiViewport ImVec2 Size; ImVec2 WorkPos; ImVec2 WorkSize; + void* PlatformHandleRaw; +}; +struct ImGuiPlatformImeData +{ + bool WantVisible; + ImVec2 InputPos; + float InputLineHeight; }; +struct ImBitVector; +struct ImRect; +struct ImDrawDataBuilder; +struct ImDrawListSharedData; +struct ImGuiColorMod; +struct ImGuiContext; +struct ImGuiContextHook; +struct ImGuiDataVarInfo; +struct ImGuiDataTypeInfo; +struct ImGuiGroupData; +struct ImGuiInputTextState; +struct ImGuiInputTextDeactivateData; +struct ImGuiLastItemData; +struct ImGuiLocEntry; +struct ImGuiMenuColumns; +struct ImGuiNavItemData; +struct ImGuiMetricsConfig; +struct ImGuiNextWindowData; +struct ImGuiNextItemData; +struct ImGuiOldColumnData; +struct ImGuiOldColumns; +struct ImGuiPopupData; +struct ImGuiSettingsHandler; +struct ImGuiStackSizes; +struct ImGuiStyleMod; +struct ImGuiTabBar; +struct ImGuiTabItem; +struct ImGuiTable; +struct ImGuiTableColumn; +struct ImGuiTableInstanceData; +struct ImGuiTableTempData; +struct ImGuiTableSettings; +struct ImGuiTableColumnsSettings; +struct ImGuiWindow; +struct ImGuiWindowTempData; +struct ImGuiWindowSettings; +typedef int ImGuiLayoutType; +typedef int ImGuiActivateFlags; +typedef int ImGuiDebugLogFlags; +typedef int ImGuiInputFlags; +typedef int ImGuiItemFlags; +typedef int ImGuiItemStatusFlags; +typedef int ImGuiOldColumnFlags; +typedef int ImGuiNavHighlightFlags; +typedef int ImGuiNavMoveFlags; +typedef int ImGuiNextItemDataFlags; +typedef int ImGuiNextWindowDataFlags; +typedef int ImGuiScrollFlags; +typedef int ImGuiSeparatorFlags; +typedef int ImGuiTextFlags; +typedef int ImGuiTooltipFlags; +typedef void (*ImGuiErrorLogCallback)(void* user_data, const char* fmt, ...); +extern ImGuiContext* GImGui; +typedef struct StbUndoRecord StbUndoRecord; struct StbUndoRecord { int where; @@ -1234,6 +1356,7 @@ struct StbUndoRecord int delete_length; int char_storage; }; +typedef struct StbUndoState StbUndoState; struct StbUndoState { StbUndoRecord undo_rec [99]; @@ -1241,6 +1364,7 @@ struct StbUndoState short undo_point, redo_point; int undo_char_point, redo_char_point; }; +typedef struct STB_TexteditState STB_TexteditState; struct STB_TexteditState { int cursor; @@ -1256,6 +1380,7 @@ struct STB_TexteditState float preferred_x; StbUndoState undostate; }; +typedef struct StbTexteditRow StbTexteditRow; struct StbTexteditRow { float x0,x1; @@ -1263,10 +1388,13 @@ struct StbTexteditRow float ymin,ymax; int num_chars; }; +typedef FILE* ImFileHandle; +typedef struct ImVec1 ImVec1; struct ImVec1 { float x; }; +typedef struct ImVec2ih ImVec2ih; struct ImVec2ih { short x, y; @@ -1276,10 +1404,20 @@ struct ImRect ImVec2 Min; ImVec2 Max; }; +typedef ImU32* ImBitArrayPtr; struct ImBitVector { ImVector_ImU32 Storage; }; +typedef int ImPoolIdx; +typedef struct ImGuiTextIndex ImGuiTextIndex; +typedef struct ImVector_int {int Size;int Capacity;int* Data;} ImVector_int; + +struct ImGuiTextIndex +{ + ImVector_int LineOffsets; + int EndOffset; +}; struct ImDrawListSharedData { ImVec2 TexUvWhitePixel; @@ -1289,11 +1427,14 @@ struct ImDrawListSharedData float CircleSegmentMaxError; ImVec4 ClipRectFullscreen; ImDrawListFlags InitialFlags; + ImVector_ImVec2 TempBuffer; ImVec2 ArcFastVtx[48]; float ArcFastRadiusCutoff; ImU8 CircleSegmentCounts[64]; const ImVec4* TexUvLines; }; +typedef struct ImVector_ImDrawListPtr {int Size;int Capacity;ImDrawList** Data;} ImVector_ImDrawListPtr; + struct ImDrawDataBuilder { ImVector_ImDrawListPtr Layers[2]; @@ -1308,7 +1449,8 @@ typedef enum { ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, ImGuiItemFlags_MixedValue = 1 << 6, ImGuiItemFlags_ReadOnly = 1 << 7, - ImGuiItemFlags_Inputable = 1 << 8 + ImGuiItemFlags_NoWindowHoverableCheck = 1 << 8, + ImGuiItemFlags_Inputable = 1 << 10, }ImGuiItemFlags_; typedef enum { ImGuiItemStatusFlags_None = 0, @@ -1320,12 +1462,13 @@ typedef enum { ImGuiItemStatusFlags_HasDeactivated = 1 << 5, ImGuiItemStatusFlags_Deactivated = 1 << 6, ImGuiItemStatusFlags_HoveredWindow = 1 << 7, - ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8 + ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8, + ImGuiItemStatusFlags_Visible = 1 << 9, }ImGuiItemStatusFlags_; typedef enum { ImGuiInputTextFlags_Multiline = 1 << 26, ImGuiInputTextFlags_NoMarkEdited = 1 << 27, - ImGuiInputTextFlags_MergedItem = 1 << 28 + ImGuiInputTextFlags_MergedItem = 1 << 28, }ImGuiInputTextFlagsPrivate_; typedef enum { ImGuiButtonFlags_PressedOnClick = 1 << 4, @@ -1343,15 +1486,17 @@ typedef enum { ImGuiButtonFlags_NoHoldingActiveId = 1 << 17, ImGuiButtonFlags_NoNavFocus = 1 << 18, ImGuiButtonFlags_NoHoveredOnFocus = 1 << 19, + ImGuiButtonFlags_NoSetKeyOwner = 1 << 20, + ImGuiButtonFlags_NoTestKeyOwner = 1 << 21, ImGuiButtonFlags_PressedOnMask_ = ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickReleaseAnywhere | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_PressedOnDragDropHold, - ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease + ImGuiButtonFlags_PressedOnDefault_ = ImGuiButtonFlags_PressedOnClickRelease, }ImGuiButtonFlagsPrivate_; typedef enum { - ImGuiComboFlags_CustomPreview = 1 << 20 + ImGuiComboFlags_CustomPreview = 1 << 20, }ImGuiComboFlagsPrivate_; typedef enum { ImGuiSliderFlags_Vertical = 1 << 20, - ImGuiSliderFlags_ReadOnly = 1 << 21 + ImGuiSliderFlags_ReadOnly = 1 << 21, }ImGuiSliderFlagsPrivate_; typedef enum { ImGuiSelectableFlags_NoHoldingActiveID = 1 << 20, @@ -1359,26 +1504,26 @@ typedef enum { ImGuiSelectableFlags_SelectOnClick = 1 << 22, ImGuiSelectableFlags_SelectOnRelease = 1 << 23, ImGuiSelectableFlags_SpanAvailWidth = 1 << 24, - ImGuiSelectableFlags_DrawHoveredWhenHeld = 1 << 25, - ImGuiSelectableFlags_SetNavIdOnHover = 1 << 26, - ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 27 + ImGuiSelectableFlags_SetNavIdOnHover = 1 << 25, + ImGuiSelectableFlags_NoPadWithHalfSpacing = 1 << 26, + ImGuiSelectableFlags_NoSetKeyOwner = 1 << 27, }ImGuiSelectableFlagsPrivate_; typedef enum { - ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 20 + ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1 << 20, }ImGuiTreeNodeFlagsPrivate_; typedef enum { ImGuiSeparatorFlags_None = 0, ImGuiSeparatorFlags_Horizontal = 1 << 0, ImGuiSeparatorFlags_Vertical = 1 << 1, - ImGuiSeparatorFlags_SpanAllColumns = 1 << 2 + ImGuiSeparatorFlags_SpanAllColumns = 1 << 2, }ImGuiSeparatorFlags_; typedef enum { ImGuiTextFlags_None = 0, - ImGuiTextFlags_NoWidthForLargeClippedText = 1 << 0 + ImGuiTextFlags_NoWidthForLargeClippedText = 1 << 0, }ImGuiTextFlags_; typedef enum { ImGuiTooltipFlags_None = 0, - ImGuiTooltipFlags_OverridePreviousTooltip = 1 << 0 + ImGuiTooltipFlags_OverridePreviousTooltip = 1 << 0, }ImGuiTooltipFlags_; typedef enum { ImGuiLayoutType_Horizontal = 0, @@ -1389,7 +1534,7 @@ typedef enum { ImGuiLogType_TTY, ImGuiLogType_File, ImGuiLogType_Buffer, - ImGuiLogType_Clipboard + ImGuiLogType_Clipboard, }ImGuiLogType; typedef enum { ImGuiAxis_None = -1, @@ -1398,30 +1543,20 @@ typedef enum { }ImGuiAxis; typedef enum { ImGuiPlotType_Lines, - ImGuiPlotType_Histogram + ImGuiPlotType_Histogram, }ImGuiPlotType; -typedef enum { - ImGuiInputSource_None = 0, - ImGuiInputSource_Mouse, - ImGuiInputSource_Keyboard, - ImGuiInputSource_Gamepad, - ImGuiInputSource_Nav, - ImGuiInputSource_Clipboard, - ImGuiInputSource_COUNT -}ImGuiInputSource; -typedef enum { - ImGuiInputReadMode_Down, - ImGuiInputReadMode_Pressed, - ImGuiInputReadMode_Released, - ImGuiInputReadMode_Repeat, - ImGuiInputReadMode_RepeatSlow, - ImGuiInputReadMode_RepeatFast -}ImGuiInputReadMode; typedef enum { ImGuiPopupPositionPolicy_Default, ImGuiPopupPositionPolicy_ComboBox, - ImGuiPopupPositionPolicy_Tooltip + ImGuiPopupPositionPolicy_Tooltip, }ImGuiPopupPositionPolicy; +struct ImGuiDataVarInfo +{ + ImGuiDataType Type; + ImU32 Count; + ImU32 Offset; +}; +typedef struct ImGuiDataTypeTempStorage ImGuiDataTypeTempStorage; struct ImGuiDataTypeTempStorage { ImU8 Data[8]; @@ -1436,7 +1571,7 @@ struct ImGuiDataTypeInfo typedef enum { ImGuiDataType_String = ImGuiDataType_COUNT + 1, ImGuiDataType_Pointer, - ImGuiDataType_ID + ImGuiDataType_ID, }ImGuiDataTypePrivate_; struct ImGuiColorMod { @@ -1448,6 +1583,7 @@ struct ImGuiStyleMod ImGuiStyleVar VarIdx; union { int BackupInt[2]; float BackupFloat[2]; }; }; +typedef struct ImGuiComboPreviewData ImGuiComboPreviewData; struct ImGuiComboPreviewData { ImRect PreviewRect; @@ -1482,8 +1618,15 @@ struct ImGuiMenuColumns ImU16 OffsetMark; ImU16 Widths[4]; }; +typedef struct ImGuiInputTextDeactivatedState ImGuiInputTextDeactivatedState; +struct ImGuiInputTextDeactivatedState +{ + ImGuiID ID; + ImVector_char TextA; +}; struct ImGuiInputTextState { + ImGuiContext* Ctx; ImGuiID ID; int CurLenW, CurLenA; ImVector_ImWchar TextW; @@ -1503,7 +1646,8 @@ struct ImGuiPopupData { ImGuiID PopupId; ImGuiWindow* Window; - ImGuiWindow* SourceWindow; + ImGuiWindow* BackupNavWindow; + int ParentNavLayer; int OpenFrameCount; ImGuiID OpenParentId; ImVec2 OpenPopupPos; @@ -1518,7 +1662,7 @@ typedef enum { ImGuiNextWindowDataFlags_HasSizeConstraint = 1 << 4, ImGuiNextWindowDataFlags_HasFocus = 1 << 5, ImGuiNextWindowDataFlags_HasBgAlpha = 1 << 6, - ImGuiNextWindowDataFlags_HasScroll = 1 << 7 + ImGuiNextWindowDataFlags_HasScroll = 1 << 7, }ImGuiNextWindowDataFlags_; struct ImGuiNextWindowData { @@ -1541,7 +1685,7 @@ struct ImGuiNextWindowData typedef enum { ImGuiNextItemDataFlags_None = 0, ImGuiNextItemDataFlags_HasWidth = 1 << 0, - ImGuiNextItemDataFlags_HasOpen = 1 << 1 + ImGuiNextItemDataFlags_HasOpen = 1 << 1, }ImGuiNextItemDataFlags_; struct ImGuiNextItemData { @@ -1572,22 +1716,142 @@ struct ImGuiStackSizes short SizeOfBeginPopupStack; short SizeOfDisabledStack; }; +typedef struct ImGuiWindowStackData ImGuiWindowStackData; struct ImGuiWindowStackData { ImGuiWindow* Window; ImGuiLastItemData ParentLastItemDataBackup; ImGuiStackSizes StackSizesOnBegin; }; +typedef struct ImGuiShrinkWidthItem ImGuiShrinkWidthItem; struct ImGuiShrinkWidthItem { int Index; float Width; + float InitialWidth; }; +typedef struct ImGuiPtrOrIndex ImGuiPtrOrIndex; struct ImGuiPtrOrIndex { void* Ptr; int Index; }; +typedef struct ImBitArray_ImGuiKey_NamedKey_COUNT__lessImGuiKey_NamedKey_BEGIN {ImU32 Storage[(ImGuiKey_NamedKey_COUNT+31)>>5];} ImBitArray_ImGuiKey_NamedKey_COUNT__lessImGuiKey_NamedKey_BEGIN; + +typedef ImBitArray_ImGuiKey_NamedKey_COUNT__lessImGuiKey_NamedKey_BEGIN ImBitArrayForNamedKeys; +typedef enum { + ImGuiInputEventType_None = 0, + ImGuiInputEventType_MousePos, + ImGuiInputEventType_MouseWheel, + ImGuiInputEventType_MouseButton, + ImGuiInputEventType_Key, + ImGuiInputEventType_Text, + ImGuiInputEventType_Focus, + ImGuiInputEventType_COUNT +}ImGuiInputEventType; +typedef enum { + ImGuiInputSource_None = 0, + ImGuiInputSource_Mouse, + ImGuiInputSource_Keyboard, + ImGuiInputSource_Gamepad, + ImGuiInputSource_Clipboard, + ImGuiInputSource_COUNT +}ImGuiInputSource; +typedef struct ImGuiInputEventMousePos ImGuiInputEventMousePos; +struct ImGuiInputEventMousePos +{ float PosX, PosY; ImGuiMouseSource MouseSource; +}; +typedef struct ImGuiInputEventMouseWheel ImGuiInputEventMouseWheel; +struct ImGuiInputEventMouseWheel +{ float WheelX, WheelY; ImGuiMouseSource MouseSource; +}; +typedef struct ImGuiInputEventMouseButton ImGuiInputEventMouseButton; +struct ImGuiInputEventMouseButton +{ int Button; bool Down; ImGuiMouseSource MouseSource; +}; +typedef struct ImGuiInputEventKey ImGuiInputEventKey; +struct ImGuiInputEventKey +{ ImGuiKey Key; bool Down; float AnalogValue; +}; +typedef struct ImGuiInputEventText ImGuiInputEventText; +struct ImGuiInputEventText +{ unsigned int Char; +}; +typedef struct ImGuiInputEventAppFocused ImGuiInputEventAppFocused; +struct ImGuiInputEventAppFocused +{ bool Focused; +}; +typedef struct ImGuiInputEvent ImGuiInputEvent; +struct ImGuiInputEvent +{ + ImGuiInputEventType Type; + ImGuiInputSource Source; + ImU32 EventId; + union + { + ImGuiInputEventMousePos MousePos; + ImGuiInputEventMouseWheel MouseWheel; + ImGuiInputEventMouseButton MouseButton; + ImGuiInputEventKey Key; + ImGuiInputEventText Text; + ImGuiInputEventAppFocused AppFocused; + }; + bool AddedByTestEngine; +}; +typedef ImS16 ImGuiKeyRoutingIndex; +typedef struct ImGuiKeyRoutingData ImGuiKeyRoutingData; +struct ImGuiKeyRoutingData +{ + ImGuiKeyRoutingIndex NextEntryIndex; + ImU16 Mods; + ImU8 RoutingNextScore; + ImGuiID RoutingCurr; + ImGuiID RoutingNext; +}; +typedef struct ImGuiKeyRoutingTable ImGuiKeyRoutingTable; +typedef struct ImVector_ImGuiKeyRoutingData {int Size;int Capacity;ImGuiKeyRoutingData* Data;} ImVector_ImGuiKeyRoutingData; + +struct ImGuiKeyRoutingTable +{ + ImGuiKeyRoutingIndex Index[ImGuiKey_NamedKey_COUNT]; + ImVector_ImGuiKeyRoutingData Entries; + ImVector_ImGuiKeyRoutingData EntriesNext; +}; +typedef struct ImGuiKeyOwnerData ImGuiKeyOwnerData; +struct ImGuiKeyOwnerData +{ + ImGuiID OwnerCurr; + ImGuiID OwnerNext; + bool LockThisFrame; + bool LockUntilRelease; +}; +typedef enum { + ImGuiInputFlags_None = 0, + ImGuiInputFlags_Repeat = 1 << 0, + ImGuiInputFlags_RepeatRateDefault = 1 << 1, + ImGuiInputFlags_RepeatRateNavMove = 1 << 2, + ImGuiInputFlags_RepeatRateNavTweak = 1 << 3, + ImGuiInputFlags_RepeatRateMask_ = ImGuiInputFlags_RepeatRateDefault | ImGuiInputFlags_RepeatRateNavMove | ImGuiInputFlags_RepeatRateNavTweak, + ImGuiInputFlags_CondHovered = 1 << 4, + ImGuiInputFlags_CondActive = 1 << 5, + ImGuiInputFlags_CondDefault_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive, + ImGuiInputFlags_CondMask_ = ImGuiInputFlags_CondHovered | ImGuiInputFlags_CondActive, + ImGuiInputFlags_LockThisFrame = 1 << 6, + ImGuiInputFlags_LockUntilRelease = 1 << 7, + ImGuiInputFlags_RouteFocused = 1 << 8, + ImGuiInputFlags_RouteGlobalLow = 1 << 9, + ImGuiInputFlags_RouteGlobal = 1 << 10, + ImGuiInputFlags_RouteGlobalHigh = 1 << 11, + ImGuiInputFlags_RouteMask_ = ImGuiInputFlags_RouteFocused | ImGuiInputFlags_RouteGlobal | ImGuiInputFlags_RouteGlobalLow | ImGuiInputFlags_RouteGlobalHigh, + ImGuiInputFlags_RouteAlways = 1 << 12, + ImGuiInputFlags_RouteUnlessBgFocused= 1 << 13, + ImGuiInputFlags_RouteExtraMask_ = ImGuiInputFlags_RouteAlways | ImGuiInputFlags_RouteUnlessBgFocused, + ImGuiInputFlags_SupportedByIsKeyPressed = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_, + ImGuiInputFlags_SupportedByShortcut = ImGuiInputFlags_Repeat | ImGuiInputFlags_RepeatRateMask_ | ImGuiInputFlags_RouteMask_ | ImGuiInputFlags_RouteExtraMask_, + ImGuiInputFlags_SupportedBySetKeyOwner = ImGuiInputFlags_LockThisFrame | ImGuiInputFlags_LockUntilRelease, + ImGuiInputFlags_SupportedBySetItemKeyOwner = ImGuiInputFlags_SupportedBySetKeyOwner | ImGuiInputFlags_CondMask_, +}ImGuiInputFlags_; +typedef struct ImGuiListClipperRange ImGuiListClipperRange; struct ImGuiListClipperRange { int Min; @@ -1596,6 +1860,9 @@ struct ImGuiListClipperRange ImS8 PosToIndexOffsetMin; ImS8 PosToIndexOffsetMax; }; +typedef struct ImGuiListClipperData ImGuiListClipperData; +typedef struct ImVector_ImGuiListClipperRange {int Size;int Capacity;ImGuiListClipperRange* Data;} ImVector_ImGuiListClipperRange; + struct ImGuiListClipperData { ImGuiListClipper* ListClipper; @@ -1608,7 +1875,7 @@ typedef enum { ImGuiActivateFlags_None = 0, ImGuiActivateFlags_PreferInput = 1 << 0, ImGuiActivateFlags_PreferTweak = 1 << 1, - ImGuiActivateFlags_TryToPreserveState = 1 << 2 + ImGuiActivateFlags_TryToPreserveState = 1 << 2, }ImGuiActivateFlags_; typedef enum { ImGuiScrollFlags_None = 0, @@ -1620,22 +1887,15 @@ typedef enum { ImGuiScrollFlags_AlwaysCenterY = 1 << 5, ImGuiScrollFlags_NoScrollParent = 1 << 6, ImGuiScrollFlags_MaskX_ = ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleCenterX | ImGuiScrollFlags_AlwaysCenterX, - ImGuiScrollFlags_MaskY_ = ImGuiScrollFlags_KeepVisibleEdgeY | ImGuiScrollFlags_KeepVisibleCenterY | ImGuiScrollFlags_AlwaysCenterY + ImGuiScrollFlags_MaskY_ = ImGuiScrollFlags_KeepVisibleEdgeY | ImGuiScrollFlags_KeepVisibleCenterY | ImGuiScrollFlags_AlwaysCenterY, }ImGuiScrollFlags_; typedef enum { ImGuiNavHighlightFlags_None = 0, ImGuiNavHighlightFlags_TypeDefault = 1 << 0, ImGuiNavHighlightFlags_TypeThin = 1 << 1, ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2, - ImGuiNavHighlightFlags_NoRounding = 1 << 3 + ImGuiNavHighlightFlags_NoRounding = 1 << 3, }ImGuiNavHighlightFlags_; -typedef enum { - ImGuiNavDirSourceFlags_None = 0, - ImGuiNavDirSourceFlags_RawKeyboard = 1 << 0, - ImGuiNavDirSourceFlags_Keyboard = 1 << 1, - ImGuiNavDirSourceFlags_PadDPad = 1 << 2, - ImGuiNavDirSourceFlags_PadLStick = 1 << 3 -}ImGuiNavDirSourceFlags_; typedef enum { ImGuiNavMoveFlags_None = 0, ImGuiNavMoveFlags_LoopX = 1 << 0, @@ -1650,7 +1910,7 @@ typedef enum { ImGuiNavMoveFlags_FocusApi = 1 << 9, ImGuiNavMoveFlags_Tabbing = 1 << 10, ImGuiNavMoveFlags_Activate = 1 << 11, - ImGuiNavMoveFlags_DontSetNavHighlight = 1 << 12 + ImGuiNavMoveFlags_DontSetNavHighlight = 1 << 12, }ImGuiNavMoveFlags_; typedef enum { ImGuiNavLayer_Main = 0, @@ -1674,7 +1934,7 @@ typedef enum { ImGuiOldColumnFlags_NoResize = 1 << 1, ImGuiOldColumnFlags_NoPreserveWidths = 1 << 2, ImGuiOldColumnFlags_NoForceWithinWindow = 1 << 3, - ImGuiOldColumnFlags_GrowParentContentsSize = 1 << 4 + ImGuiOldColumnFlags_GrowParentContentsSize = 1 << 4, }ImGuiOldColumnFlags_; struct ImGuiOldColumnData { @@ -1683,6 +1943,8 @@ struct ImGuiOldColumnData ImGuiOldColumnFlags Flags; ImRect ClipRect; }; +typedef struct ImVector_ImGuiOldColumnData {int Size;int Capacity;ImGuiOldColumnData* Data;} ImVector_ImGuiOldColumnData; + struct ImGuiOldColumns { ImGuiID ID; @@ -1701,6 +1963,7 @@ struct ImGuiOldColumns ImVector_ImGuiOldColumnData Columns; ImDrawListSplitter Splitter; }; +typedef struct ImGuiViewportP ImGuiViewportP; struct ImGuiViewportP { ImGuiViewport _ImGuiViewport; @@ -1720,6 +1983,7 @@ struct ImGuiWindowSettings ImVec2ih Size; bool Collapsed; bool WantApply; + bool WantDelete; }; struct ImGuiSettingsHandler { @@ -1733,31 +1997,68 @@ struct ImGuiSettingsHandler void (*WriteAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf); void* UserData; }; +typedef enum { +ImGuiLocKey_TableSizeOne=0, +ImGuiLocKey_TableSizeAllFit=1, +ImGuiLocKey_TableSizeAllDefault=2, +ImGuiLocKey_TableResetOrder=3, +ImGuiLocKey_WindowingMainMenuBar=4, +ImGuiLocKey_WindowingPopup=5, +ImGuiLocKey_WindowingUntitled=6, +ImGuiLocKey_COUNT=7, +}ImGuiLocKey; +struct ImGuiLocEntry +{ + ImGuiLocKey Key; + const char* Text; +}; +typedef enum { + ImGuiDebugLogFlags_None = 0, + ImGuiDebugLogFlags_EventActiveId = 1 << 0, + ImGuiDebugLogFlags_EventFocus = 1 << 1, + ImGuiDebugLogFlags_EventPopup = 1 << 2, + ImGuiDebugLogFlags_EventNav = 1 << 3, + ImGuiDebugLogFlags_EventClipper = 1 << 4, + ImGuiDebugLogFlags_EventSelection = 1 << 5, + ImGuiDebugLogFlags_EventIO = 1 << 6, + ImGuiDebugLogFlags_EventMask_ = ImGuiDebugLogFlags_EventActiveId | ImGuiDebugLogFlags_EventFocus | ImGuiDebugLogFlags_EventPopup | ImGuiDebugLogFlags_EventNav | ImGuiDebugLogFlags_EventClipper | ImGuiDebugLogFlags_EventSelection | ImGuiDebugLogFlags_EventIO, + ImGuiDebugLogFlags_OutputToTTY = 1 << 10, +}ImGuiDebugLogFlags_; struct ImGuiMetricsConfig { + bool ShowDebugLog; bool ShowStackTool; bool ShowWindowsRects; bool ShowWindowsBeginOrder; bool ShowTablesRects; bool ShowDrawCmdMesh; bool ShowDrawCmdBoundingBoxes; + bool ShowAtlasTintedWithTextColor; int ShowWindowsRectsType; int ShowTablesRectsType; }; +typedef struct ImGuiStackLevelInfo ImGuiStackLevelInfo; struct ImGuiStackLevelInfo { ImGuiID ID; ImS8 QueryFrameCount; bool QuerySuccess; - char Desc[58]; + ImGuiDataType DataType : 8; + char Desc[57]; }; +typedef struct ImGuiStackTool ImGuiStackTool; +typedef struct ImVector_ImGuiStackLevelInfo {int Size;int Capacity;ImGuiStackLevelInfo* Data;} ImVector_ImGuiStackLevelInfo; + struct ImGuiStackTool { int LastActiveFrame; int StackLevel; ImGuiID QueryId; ImVector_ImGuiStackLevelInfo Results; + bool CopyToClipboardOnCtrlC; + float CopyToClipboardLastTime; }; +typedef void (*ImGuiContextHookCallback)(ImGuiContext* ctx, ImGuiContextHook* hook); typedef enum { ImGuiContextHookType_NewFramePre, ImGuiContextHookType_NewFramePost, ImGuiContextHookType_EndFramePre, ImGuiContextHookType_EndFramePost, ImGuiContextHookType_RenderPre, ImGuiContextHookType_RenderPost, ImGuiContextHookType_Shutdown, ImGuiContextHookType_PendingRemoval_ }ImGuiContextHookType; struct ImGuiContextHook { @@ -1767,6 +2068,52 @@ struct ImGuiContextHook ImGuiContextHookCallback Callback; void* UserData; }; +typedef struct ImVector_ImGuiInputEvent {int Size;int Capacity;ImGuiInputEvent* Data;} ImVector_ImGuiInputEvent; + +typedef struct ImVector_ImGuiWindowPtr {int Size;int Capacity;ImGuiWindow** Data;} ImVector_ImGuiWindowPtr; + +typedef struct ImVector_ImGuiWindowStackData {int Size;int Capacity;ImGuiWindowStackData* Data;} ImVector_ImGuiWindowStackData; + +typedef struct ImVector_ImGuiColorMod {int Size;int Capacity;ImGuiColorMod* Data;} ImVector_ImGuiColorMod; + +typedef struct ImVector_ImGuiStyleMod {int Size;int Capacity;ImGuiStyleMod* Data;} ImVector_ImGuiStyleMod; + +typedef struct ImVector_ImGuiID {int Size;int Capacity;ImGuiID* Data;} ImVector_ImGuiID; + +typedef struct ImVector_ImGuiItemFlags {int Size;int Capacity;ImGuiItemFlags* Data;} ImVector_ImGuiItemFlags; + +typedef struct ImVector_ImGuiGroupData {int Size;int Capacity;ImGuiGroupData* Data;} ImVector_ImGuiGroupData; + +typedef struct ImVector_ImGuiPopupData {int Size;int Capacity;ImGuiPopupData* Data;} ImVector_ImGuiPopupData; + +typedef struct ImVector_ImGuiViewportPPtr {int Size;int Capacity;ImGuiViewportP** Data;} ImVector_ImGuiViewportPPtr; + +typedef struct ImVector_unsigned_char {int Size;int Capacity;unsigned char* Data;} ImVector_unsigned_char; + +typedef struct ImVector_ImGuiListClipperData {int Size;int Capacity;ImGuiListClipperData* Data;} ImVector_ImGuiListClipperData; + +typedef struct ImVector_ImGuiTableTempData {int Size;int Capacity;ImGuiTableTempData* Data;} ImVector_ImGuiTableTempData; + +typedef struct ImVector_ImGuiTable {int Size;int Capacity;ImGuiTable* Data;} ImVector_ImGuiTable; + +typedef struct ImPool_ImGuiTable {ImVector_ImGuiTable Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;ImPoolIdx AliveCount;} ImPool_ImGuiTable; + +typedef struct ImVector_ImGuiTabBar {int Size;int Capacity;ImGuiTabBar* Data;} ImVector_ImGuiTabBar; + +typedef struct ImPool_ImGuiTabBar {ImVector_ImGuiTabBar Buf;ImGuiStorage Map;ImPoolIdx FreeIdx;ImPoolIdx AliveCount;} ImPool_ImGuiTabBar; + +typedef struct ImVector_ImGuiPtrOrIndex {int Size;int Capacity;ImGuiPtrOrIndex* Data;} ImVector_ImGuiPtrOrIndex; + +typedef struct ImVector_ImGuiShrinkWidthItem {int Size;int Capacity;ImGuiShrinkWidthItem* Data;} ImVector_ImGuiShrinkWidthItem; + +typedef struct ImVector_ImGuiSettingsHandler {int Size;int Capacity;ImGuiSettingsHandler* Data;} ImVector_ImGuiSettingsHandler; + +typedef struct ImChunkStream_ImGuiWindowSettings {ImVector_char Buf;} ImChunkStream_ImGuiWindowSettings; + +typedef struct ImChunkStream_ImGuiTableSettings {ImVector_char Buf;} ImChunkStream_ImGuiTableSettings; + +typedef struct ImVector_ImGuiContextHook {int Size;int Capacity;ImGuiContextHook* Data;} ImVector_ImGuiContextHook; + struct ImGuiContext { bool Initialized; @@ -1787,6 +2134,10 @@ struct ImGuiContext bool GcCompactAll; bool TestEngineHookItems; void* TestEngine; + ImVector_ImGuiInputEvent InputEventsQueue; + ImVector_ImGuiInputEvent InputEventsTrail; + ImGuiMouseSource InputEventsNextMouseSource; + ImU32 InputEventsNextEventId; ImVector_ImGuiWindowPtr Windows; ImVector_ImGuiWindowPtr WindowsFocusOrder; ImVector_ImGuiWindowPtr WindowsTempSortBuffer; @@ -1800,13 +2151,14 @@ struct ImGuiContext ImGuiWindow* MovingWindow; ImGuiWindow* WheelingWindow; ImVec2 WheelingWindowRefMousePos; - float WheelingWindowTimer; + int WheelingWindowStartFrame; + float WheelingWindowReleaseTimer; + ImVec2 WheelingWindowWheelRemainder; + ImVec2 WheelingAxisAvg; ImGuiID DebugHookIdInfo; ImGuiID HoveredId; ImGuiID HoveredIdPreviousFrame; bool HoveredIdAllowOverlap; - bool HoveredIdUsingMouseWheel; - bool HoveredIdPreviousFrameUsingMouseWheel; bool HoveredIdDisabled; float HoveredIdTimer; float HoveredIdNotActiveTimer; @@ -1819,10 +2171,6 @@ struct ImGuiContext bool ActiveIdHasBeenPressedBefore; bool ActiveIdHasBeenEditedBefore; bool ActiveIdHasBeenEditedThisFrame; - bool ActiveIdUsingMouseWheel; - ImU32 ActiveIdUsingNavDirMask; - ImU32 ActiveIdUsingNavInputMask; - ImU64 ActiveIdUsingKeyInputMask; ImVec2 ActiveIdClickOffset; ImGuiWindow* ActiveIdWindow; ImGuiInputSource ActiveIdSource; @@ -1833,7 +2181,14 @@ struct ImGuiContext ImGuiWindow* ActiveIdPreviousFrameWindow; ImGuiID LastActiveId; float LastActiveIdTimer; + ImGuiKeyOwnerData KeysOwnerData[ImGuiKey_NamedKey_COUNT]; + ImGuiKeyRoutingTable KeysRoutingTable; + ImU32 ActiveIdUsingNavDirMask; + bool ActiveIdUsingAllKeyboardKeys; + ImU32 ActiveIdUsingNavInputMask; + ImGuiID CurrentFocusScopeId; ImGuiItemFlags CurrentItemFlags; + ImGuiID DebugLocateId; ImGuiNextItemData NextItemData; ImGuiLastItemData LastItemData; ImGuiNextWindowData NextWindowData; @@ -1853,11 +2208,10 @@ struct ImGuiContext ImGuiID NavActivateId; ImGuiID NavActivateDownId; ImGuiID NavActivatePressedId; - ImGuiID NavActivateInputId; ImGuiActivateFlags NavActivateFlags; ImGuiID NavJustMovedToId; ImGuiID NavJustMovedToFocusScopeId; - ImGuiKeyModFlags NavJustMovedToKeyMods; + ImGuiKeyChord NavJustMovedToKeyMods; ImGuiID NavNextActivateId; ImGuiActivateFlags NavNextActivateFlags; ImGuiInputSource NavInputSource; @@ -1876,7 +2230,7 @@ struct ImGuiContext bool NavMoveForwardToNextFrame; ImGuiNavMoveFlags NavMoveFlags; ImGuiScrollFlags NavMoveScrollFlags; - ImGuiKeyModFlags NavMoveKeyMods; + ImGuiKeyChord NavMoveKeyMods; ImGuiDir NavMoveDir; ImGuiDir NavMoveDirForDebug; ImGuiDir NavMoveClipDir; @@ -1889,12 +2243,16 @@ struct ImGuiContext ImGuiNavItemData NavMoveResultLocalVisible; ImGuiNavItemData NavMoveResultOther; ImGuiNavItemData NavTabbingResultFirst; + ImGuiKeyChord ConfigNavWindowingKeyNext; + ImGuiKeyChord ConfigNavWindowingKeyPrev; ImGuiWindow* NavWindowingTarget; ImGuiWindow* NavWindowingTargetAnim; ImGuiWindow* NavWindowingListWindow; float NavWindowingTimer; float NavWindowingHighlightAlpha; bool NavWindowingToggleLayer; + ImVec2 NavWindowingAccumDeltaPos; + ImVec2 NavWindowingAccumDeltaSize; float DimBgRatio; ImGuiMouseCursor MouseCursor; bool DragDropActive; @@ -1926,16 +2284,24 @@ struct ImGuiContext ImPool_ImGuiTabBar TabBars; ImVector_ImGuiPtrOrIndex CurrentTabBarStack; ImVector_ImGuiShrinkWidthItem ShrinkWidthBuffer; + ImGuiID HoverDelayId; + ImGuiID HoverDelayIdPreviousFrame; + float HoverDelayTimer; + float HoverDelayClearTimer; ImVec2 MouseLastValidPos; ImGuiInputTextState InputTextState; + ImGuiInputTextDeactivatedState InputTextDeactivatedState; ImFont InputTextPasswordFont; ImGuiID TempInputId; ImGuiColorEditFlags ColorEditOptions; - float ColorEditLastHue; - float ColorEditLastSat; - ImU32 ColorEditLastColor; + ImGuiID ColorEditCurrentID; + ImGuiID ColorEditSavedID; + float ColorEditSavedHue; + float ColorEditSavedSat; + ImU32 ColorEditSavedColor; ImVec4 ColorPickerRef; ImGuiComboPreviewData ComboPreviewData; + float SliderGrabClickOffset; float SliderCurrentAccum; bool SliderCurrentAccumDirty; bool DragCurrentAccumDirty; @@ -1945,11 +2311,10 @@ struct ImGuiContext float DisabledAlphaBackup; short DisabledStackSize; short TooltipOverrideCount; - float TooltipSlowDelay; ImVector_char ClipboardHandlerData; ImVector_ImGuiID MenusIdSubmittedThisFrame; - ImVec2 PlatformImePos; - ImVec2 PlatformImeLastPos; + ImGuiPlatformImeData PlatformImeData; + ImGuiPlatformImeData PlatformImeDataPrev; char PlatformLocaleDecimalPoint; bool SettingsLoaded; float SettingsDirtyTimer; @@ -1959,6 +2324,7 @@ struct ImGuiContext ImChunkStream_ImGuiTableSettings SettingsTables; ImVector_ImGuiContextHook Hooks; ImGuiID HookIdNext; + const char* LocalizationTable[ImGuiLocKey_COUNT]; bool LogEnabled; ImGuiLogType LogType; ImFileHandle LogFile; @@ -1970,18 +2336,25 @@ struct ImGuiContext int LogDepthRef; int LogDepthToExpand; int LogDepthToExpandDefault; + ImGuiDebugLogFlags DebugLogFlags; + ImGuiTextBuffer DebugLogBuf; + ImGuiTextIndex DebugLogIndex; + ImU8 DebugLogClipperAutoDisableFrames; + ImU8 DebugLocateFrames; + ImS8 DebugBeginReturnValueCullDepth; bool DebugItemPickerActive; + ImU8 DebugItemPickerMouseButton; ImGuiID DebugItemPickerBreakId; ImGuiMetricsConfig DebugMetricsConfig; ImGuiStackTool DebugStackTool; - float FramerateSecPerFrame[120]; + float FramerateSecPerFrame[60]; int FramerateSecPerFrameIdx; int FramerateSecPerFrameCount; float FramerateSecPerFrameAccum; int WantCaptureMouseNextFrame; int WantCaptureKeyboardNextFrame; int WantTextInputNextFrame; - char TempBuffer[1024 * 3 + 1]; + ImVector_char TempBuffer; }; struct ImGuiWindowTempData { @@ -1994,6 +2367,8 @@ struct ImGuiWindowTempData ImVec2 PrevLineSize; float CurrLineTextBaseOffset; float PrevLineTextBaseOffset; + bool IsSameLine; + bool IsSetPos; ImVec1 Indent; ImVec1 ColumnsOffset; ImVec1 GroupOffset; @@ -2001,7 +2376,6 @@ struct ImGuiWindowTempData ImGuiNavLayer NavLayerCurrent; short NavLayersActiveMask; short NavLayersActiveMaskNext; - ImGuiID NavFocusScopeIdCurrent; bool NavHideHighlightOneFrame; bool NavHasScroll; bool MenuBarAppending; @@ -2020,11 +2394,15 @@ struct ImGuiWindowTempData ImVector_float ItemWidthStack; ImVector_float TextWrapPosStack; }; +typedef struct ImVector_ImGuiOldColumns {int Size;int Capacity;ImGuiOldColumns* Data;} ImVector_ImGuiOldColumns; + struct ImGuiWindow { + ImGuiContext* Ctx; char* Name; ImGuiID ID; ImGuiWindowFlags Flags; + ImGuiViewportP* Viewport; ImVec2 Pos; ImVec2 Size; ImVec2 SizeFull; @@ -2034,6 +2412,9 @@ struct ImGuiWindow ImVec2 WindowPadding; float WindowRounding; float WindowBorderSize; + float DecoOuterSizeX1, DecoOuterSizeY1; + float DecoOuterSizeX2, DecoOuterSizeY2; + float DecoInnerSizeX1, DecoInnerSizeY1; int NameBufLen; ImGuiID MoveId; ImGuiID ChildId; @@ -2057,6 +2438,7 @@ struct ImGuiWindow bool HasCloseButton; signed char ResizeBorderHeld; short BeginCount; + short BeginCountPreviousFrame; short BeginOrderWithinParent; short BeginOrderWithinContext; short FocusOrder; @@ -2103,6 +2485,7 @@ struct ImGuiWindow ImGuiWindow* NavLastChildNavWindow; ImGuiID NavLastIds[ImGuiNavLayer_COUNT]; ImRect NavRectRel[ImGuiNavLayer_COUNT]; + ImGuiID NavRootFocusScopeId; int MemoryDrawListIdxCapacity; int MemoryDrawListVtxCapacity; bool MemoryCompacted; @@ -2110,12 +2493,12 @@ struct ImGuiWindow typedef enum { ImGuiTabBarFlags_DockNode = 1 << 20, ImGuiTabBarFlags_IsFocused = 1 << 21, - ImGuiTabBarFlags_SaveSettings = 1 << 22 + ImGuiTabBarFlags_SaveSettings = 1 << 22, }ImGuiTabBarFlagsPrivate_; typedef enum { ImGuiTabItemFlags_SectionMask_ = ImGuiTabItemFlags_Leading | ImGuiTabItemFlags_Trailing, ImGuiTabItemFlags_NoCloseButton = 1 << 20, - ImGuiTabItemFlags_Button = 1 << 21 + ImGuiTabItemFlags_Button = 1 << 21, }ImGuiTabItemFlagsPrivate_; struct ImGuiTabItem { @@ -2126,11 +2509,14 @@ struct ImGuiTabItem float Offset; float Width; float ContentWidth; + float RequestedWidth; ImS32 NameOffset; ImS16 BeginOrder; ImS16 IndexDuringLayout; bool WantClose; }; +typedef struct ImVector_ImGuiTabItem {int Size;int Capacity;ImGuiTabItem* Data;} ImVector_ImGuiTabItem; + struct ImGuiTabBar { ImVector_ImGuiTabItem Tabs; @@ -2165,6 +2551,8 @@ struct ImGuiTabBar ImVec2 BackupCursorPos; ImGuiTextBuffer TabsNames; }; +typedef ImS16 ImGuiTableColumnIdx; +typedef ImU16 ImGuiTableDrawChannelIdx; struct ImGuiTableColumn { ImGuiTableColumnFlags Flags; @@ -2209,11 +2597,29 @@ struct ImGuiTableColumn ImU8 SortDirectionsAvailMask : 4; ImU8 SortDirectionsAvailList; }; +typedef struct ImGuiTableCellData ImGuiTableCellData; struct ImGuiTableCellData { ImU32 BgColor; ImGuiTableColumnIdx Column; }; +struct ImGuiTableInstanceData +{ + ImGuiID TableInstanceID; + float LastOuterHeight; + float LastFirstRowHeight; + float LastFrozenHeight; +}; +typedef struct ImSpan_ImGuiTableColumn {ImGuiTableColumn* Data;ImGuiTableColumn* DataEnd;} ImSpan_ImGuiTableColumn; + +typedef struct ImSpan_ImGuiTableColumnIdx {ImGuiTableColumnIdx* Data;ImGuiTableColumnIdx* DataEnd;} ImSpan_ImGuiTableColumnIdx; + +typedef struct ImSpan_ImGuiTableCellData {ImGuiTableCellData* Data;ImGuiTableCellData* DataEnd;} ImSpan_ImGuiTableCellData; + +typedef struct ImVector_ImGuiTableInstanceData {int Size;int Capacity;ImGuiTableInstanceData* Data;} ImVector_ImGuiTableInstanceData; + +typedef struct ImVector_ImGuiTableColumnSortSpecs {int Size;int Capacity;ImGuiTableColumnSortSpecs* Data;} ImVector_ImGuiTableColumnSortSpecs; + struct ImGuiTable { ImGuiID ID; @@ -2223,10 +2629,9 @@ struct ImGuiTable ImSpan_ImGuiTableColumn Columns; ImSpan_ImGuiTableColumnIdx DisplayOrderToIndex; ImSpan_ImGuiTableCellData RowCellData; - ImU64 EnabledMaskByDisplayOrder; - ImU64 EnabledMaskByIndex; - ImU64 VisibleMaskByIndex; - ImU64 RequestOutputMaskByIndex; + ImBitArrayPtr EnabledMaskByDisplayOrder; + ImBitArrayPtr EnabledMaskByIndex; + ImBitArrayPtr VisibleMaskByIndex; ImGuiTableFlags SettingsLoadedFlags; int SettingsOffset; int LastFrameActive; @@ -2255,11 +2660,10 @@ struct ImGuiTable float CellPaddingY; float CellSpacingX1; float CellSpacingX2; - float LastOuterHeight; - float LastFirstRowHeight; float InnerWidth; float ColumnsGivenWidth; float ColumnsAutoFitWidth; + float ColumnsStretchSumWeights; float ResizedColumnNextWidth; float ResizeLockMinContentsX2; float RefScale; @@ -2276,6 +2680,8 @@ struct ImGuiTable ImGuiWindow* InnerWindow; ImGuiTextBuffer ColumnsNames; ImDrawListSplitter* DrawSplitter; + ImGuiTableInstanceData InstanceDataFirst; + ImVector_ImGuiTableInstanceData InstanceDataExtra; ImGuiTableColumnSortSpecs SortSpecsSingle; ImVector_ImGuiTableColumnSortSpecs SortSpecsMulti; ImGuiTableSortSpecs SortSpecs; @@ -2317,6 +2723,8 @@ struct ImGuiTable bool IsResetDisplayOrderRequest; bool IsUnfrozenRows; bool IsDefaultSizingPolicy; + bool HasScrollbarYCurr; + bool HasScrollbarYPrev; bool MemoryCompacted; bool HostSkipItems; }; @@ -2335,6 +2743,7 @@ struct ImGuiTableTempData float HostBackupItemWidth; int HostBackupItemWidthStackSize; }; +typedef struct ImGuiTableColumnSettings ImGuiTableColumnSettings; struct ImGuiTableColumnSettings { float WidthOrWeight; @@ -2392,7 +2801,9 @@ typedef ImVector ImVector_ImGuiColorMod; typedef ImVector ImVector_ImGuiContextHook; typedef ImVector ImVector_ImGuiGroupData; typedef ImVector ImVector_ImGuiID; +typedef ImVector ImVector_ImGuiInputEvent; typedef ImVector ImVector_ImGuiItemFlags; +typedef ImVector ImVector_ImGuiKeyRoutingData; typedef ImVector ImVector_ImGuiListClipperData; typedef ImVector ImVector_ImGuiListClipperRange; typedef ImVector ImVector_ImGuiOldColumnData; @@ -2406,6 +2817,7 @@ typedef ImVector ImVector_ImGuiStoragePair; typedef ImVector ImVector_ImGuiStyleMod; typedef ImVector ImVector_ImGuiTabItem; typedef ImVector ImVector_ImGuiTableColumnSortSpecs; +typedef ImVector ImVector_ImGuiTableInstanceData; typedef ImVector ImVector_ImGuiTableTempData; typedef ImVector ImVector_ImGuiTextRange; typedef ImVector ImVector_ImGuiViewportPPtr; @@ -2418,6 +2830,7 @@ typedef ImVector ImVector_ImVec4; typedef ImVector ImVector_ImWchar; typedef ImVector ImVector_char; typedef ImVector ImVector_float; +typedef ImVector ImVector_int; typedef ImVector ImVector_unsigned_char; #endif //CIMGUI_DEFINE_ENUMS_AND_STRUCTS CIMGUI_API ImVec2* ImVec2_ImVec2_Nil(void); @@ -2438,6 +2851,7 @@ CIMGUI_API void igRender(void); CIMGUI_API ImDrawData* igGetDrawData(void); CIMGUI_API void igShowDemoWindow(bool* p_open); CIMGUI_API void igShowMetricsWindow(bool* p_open); +CIMGUI_API void igShowDebugLogWindow(bool* p_open); CIMGUI_API void igShowStackToolWindow(bool* p_open); CIMGUI_API void igShowAboutWindow(bool* p_open); CIMGUI_API void igShowStyleEditor(ImGuiStyle* ref); @@ -2468,6 +2882,7 @@ CIMGUI_API void igSetNextWindowSizeConstraints(const ImVec2 size_min,const ImVec CIMGUI_API void igSetNextWindowContentSize(const ImVec2 size); CIMGUI_API void igSetNextWindowCollapsed(bool collapsed,ImGuiCond cond); CIMGUI_API void igSetNextWindowFocus(void); +CIMGUI_API void igSetNextWindowScroll(const ImVec2 scroll); CIMGUI_API void igSetNextWindowBgAlpha(float alpha); CIMGUI_API void igSetWindowPos_Vec2(const ImVec2 pos,ImGuiCond cond); CIMGUI_API void igSetWindowSize_Vec2(const ImVec2 size,ImGuiCond cond); @@ -2500,8 +2915,8 @@ CIMGUI_API void igPopStyleColor(int count); CIMGUI_API void igPushStyleVar_Float(ImGuiStyleVar idx,float val); CIMGUI_API void igPushStyleVar_Vec2(ImGuiStyleVar idx,const ImVec2 val); CIMGUI_API void igPopStyleVar(int count); -CIMGUI_API void igPushAllowKeyboardFocus(bool allow_keyboard_focus); -CIMGUI_API void igPopAllowKeyboardFocus(void); +CIMGUI_API void igPushTabStop(bool tab_stop); +CIMGUI_API void igPopTabStop(void); CIMGUI_API void igPushButtonRepeat(bool repeat); CIMGUI_API void igPopButtonRepeat(void); CIMGUI_API void igPushItemWidth(float item_width); @@ -2561,12 +2976,11 @@ CIMGUI_API void igLabelText(const char* label,const char* fmt,...); CIMGUI_API void igLabelTextV(const char* label,const char* fmt,va_list args); CIMGUI_API void igBulletText(const char* fmt,...); CIMGUI_API void igBulletTextV(const char* fmt,va_list args); +CIMGUI_API void igSeparatorText(const char* label); CIMGUI_API bool igButton(const char* label,const ImVec2 size); CIMGUI_API bool igSmallButton(const char* label); CIMGUI_API bool igInvisibleButton(const char* str_id,const ImVec2 size,ImGuiButtonFlags flags); CIMGUI_API bool igArrowButton(const char* str_id,ImGuiDir dir); -CIMGUI_API void igImage(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 tint_col,const ImVec4 border_col); -CIMGUI_API bool igImageButton(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,int frame_padding,const ImVec4 bg_col,const ImVec4 tint_col); CIMGUI_API bool igCheckbox(const char* label,bool* v); CIMGUI_API bool igCheckboxFlags_IntPtr(const char* label,int* flags,int flags_value); CIMGUI_API bool igCheckboxFlags_UintPtr(const char* label,unsigned int* flags,unsigned int flags_value); @@ -2574,6 +2988,8 @@ CIMGUI_API bool igRadioButton_Bool(const char* label,bool active); CIMGUI_API bool igRadioButton_IntPtr(const char* label,int* v,int v_button); CIMGUI_API void igProgressBar(float fraction,const ImVec2 size_arg,const char* overlay); CIMGUI_API void igBullet(void); +CIMGUI_API void igImage(ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 tint_col,const ImVec4 border_col); +CIMGUI_API bool igImageButton(const char* str_id,ImTextureID user_texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 bg_col,const ImVec4 tint_col); CIMGUI_API bool igBeginCombo(const char* label,const char* preview_value,ImGuiComboFlags flags); CIMGUI_API void igEndCombo(void); CIMGUI_API bool igCombo_Str_arr(const char* label,int* current_item,const char* const items[],int items_count,int popup_max_height_in_items); @@ -2623,7 +3039,7 @@ CIMGUI_API bool igColorEdit3(const char* label,float col[3],ImGuiColorEditFlags CIMGUI_API bool igColorEdit4(const char* label,float col[4],ImGuiColorEditFlags flags); CIMGUI_API bool igColorPicker3(const char* label,float col[3],ImGuiColorEditFlags flags); CIMGUI_API bool igColorPicker4(const char* label,float col[4],ImGuiColorEditFlags flags,const float* ref_col); -CIMGUI_API bool igColorButton(const char* desc_id,const ImVec4 col,ImGuiColorEditFlags flags,ImVec2 size); +CIMGUI_API bool igColorButton(const char* desc_id,const ImVec4 col,ImGuiColorEditFlags flags,const ImVec2 size); CIMGUI_API void igSetColorEditOptions(ImGuiColorEditFlags flags); CIMGUI_API bool igTreeNode_Str(const char* label); CIMGUI_API bool igTreeNode_StrStr(const char* str_id,const char* fmt,...); @@ -2664,7 +3080,7 @@ CIMGUI_API bool igBeginMenu(const char* label,bool enabled); CIMGUI_API void igEndMenu(void); CIMGUI_API bool igMenuItem_Bool(const char* label,const char* shortcut,bool selected,bool enabled); CIMGUI_API bool igMenuItem_BoolPtr(const char* label,const char* shortcut,bool* p_selected,bool enabled); -CIMGUI_API void igBeginTooltip(void); +CIMGUI_API bool igBeginTooltip(void); CIMGUI_API void igEndTooltip(void); CIMGUI_API void igSetTooltip(const char* fmt,...); CIMGUI_API void igSetTooltipV(const char* fmt,va_list args); @@ -2742,17 +3158,18 @@ CIMGUI_API bool igIsItemToggledOpen(void); CIMGUI_API bool igIsAnyItemHovered(void); CIMGUI_API bool igIsAnyItemActive(void); CIMGUI_API bool igIsAnyItemFocused(void); +CIMGUI_API ImGuiID igGetItemID(void); CIMGUI_API void igGetItemRectMin(ImVec2 *pOut); CIMGUI_API void igGetItemRectMax(ImVec2 *pOut); CIMGUI_API void igGetItemRectSize(ImVec2 *pOut); CIMGUI_API void igSetItemAllowOverlap(void); CIMGUI_API ImGuiViewport* igGetMainViewport(void); +CIMGUI_API ImDrawList* igGetBackgroundDrawList_Nil(void); +CIMGUI_API ImDrawList* igGetForegroundDrawList_Nil(void); CIMGUI_API bool igIsRectVisible_Nil(const ImVec2 size); CIMGUI_API bool igIsRectVisible_Vec2(const ImVec2 rect_min,const ImVec2 rect_max); CIMGUI_API double igGetTime(void); CIMGUI_API int igGetFrameCount(void); -CIMGUI_API ImDrawList* igGetBackgroundDrawList_Nil(void); -CIMGUI_API ImDrawList* igGetForegroundDrawList_Nil(void); CIMGUI_API ImDrawListSharedData* igGetDrawListSharedData(void); CIMGUI_API const char* igGetStyleColorName(ImGuiCol idx); CIMGUI_API void igSetStateStorage(ImGuiStorage* storage); @@ -2764,15 +3181,15 @@ CIMGUI_API void igColorConvertU32ToFloat4(ImVec4 *pOut,ImU32 in); CIMGUI_API ImU32 igColorConvertFloat4ToU32(const ImVec4 in); CIMGUI_API void igColorConvertRGBtoHSV(float r,float g,float b,float* out_h,float* out_s,float* out_v); CIMGUI_API void igColorConvertHSVtoRGB(float h,float s,float v,float* out_r,float* out_g,float* out_b); -CIMGUI_API int igGetKeyIndex(ImGuiKey imgui_key); -CIMGUI_API bool igIsKeyDown(int user_key_index); -CIMGUI_API bool igIsKeyPressed(int user_key_index,bool repeat); -CIMGUI_API bool igIsKeyReleased(int user_key_index); -CIMGUI_API int igGetKeyPressedAmount(int key_index,float repeat_delay,float rate); -CIMGUI_API void igCaptureKeyboardFromApp(bool want_capture_keyboard_value); -CIMGUI_API bool igIsMouseDown(ImGuiMouseButton button); -CIMGUI_API bool igIsMouseClicked(ImGuiMouseButton button,bool repeat); -CIMGUI_API bool igIsMouseReleased(ImGuiMouseButton button); +CIMGUI_API bool igIsKeyDown_Nil(ImGuiKey key); +CIMGUI_API bool igIsKeyPressed_Bool(ImGuiKey key,bool repeat); +CIMGUI_API bool igIsKeyReleased_Nil(ImGuiKey key); +CIMGUI_API int igGetKeyPressedAmount(ImGuiKey key,float repeat_delay,float rate); +CIMGUI_API const char* igGetKeyName(ImGuiKey key); +CIMGUI_API void igSetNextFrameWantCaptureKeyboard(bool want_capture_keyboard); +CIMGUI_API bool igIsMouseDown_Nil(ImGuiMouseButton button); +CIMGUI_API bool igIsMouseClicked_Bool(ImGuiMouseButton button,bool repeat); +CIMGUI_API bool igIsMouseReleased_Nil(ImGuiMouseButton button); CIMGUI_API bool igIsMouseDoubleClicked(ImGuiMouseButton button); CIMGUI_API int igGetMouseClickedCount(ImGuiMouseButton button); CIMGUI_API bool igIsMouseHoveringRect(const ImVec2 r_min,const ImVec2 r_max,bool clip); @@ -2785,13 +3202,14 @@ CIMGUI_API void igGetMouseDragDelta(ImVec2 *pOut,ImGuiMouseButton button,float l CIMGUI_API void igResetMouseDragDelta(ImGuiMouseButton button); CIMGUI_API ImGuiMouseCursor igGetMouseCursor(void); CIMGUI_API void igSetMouseCursor(ImGuiMouseCursor cursor_type); -CIMGUI_API void igCaptureMouseFromApp(bool want_capture_mouse_value); +CIMGUI_API void igSetNextFrameWantCaptureMouse(bool want_capture_mouse); CIMGUI_API const char* igGetClipboardText(void); CIMGUI_API void igSetClipboardText(const char* text); CIMGUI_API void igLoadIniSettingsFromDisk(const char* ini_filename); CIMGUI_API void igLoadIniSettingsFromMemory(const char* ini_data,size_t ini_size); CIMGUI_API void igSaveIniSettingsToDisk(const char* ini_filename); CIMGUI_API const char* igSaveIniSettingsToMemory(size_t* out_ini_size); +CIMGUI_API void igDebugTextEncoding(const char* text); CIMGUI_API bool igDebugCheckVersionAndDataLayout(const char* version_str,size_t sz_io,size_t sz_style,size_t sz_vec2,size_t sz_vec4,size_t sz_drawvert,size_t sz_drawidx); CIMGUI_API void igSetAllocatorFunctions(ImGuiMemAllocFunc alloc_func,ImGuiMemFreeFunc free_func,void* user_data); CIMGUI_API void igGetAllocatorFunctions(ImGuiMemAllocFunc* p_alloc_func,ImGuiMemFreeFunc* p_free_func,void** p_user_data); @@ -2800,10 +3218,18 @@ CIMGUI_API void igMemFree(void* ptr); CIMGUI_API ImGuiStyle* ImGuiStyle_ImGuiStyle(void); CIMGUI_API void ImGuiStyle_destroy(ImGuiStyle* self); CIMGUI_API void ImGuiStyle_ScaleAllSizes(ImGuiStyle* self,float scale_factor); +CIMGUI_API void ImGuiIO_AddKeyEvent(ImGuiIO* self,ImGuiKey key,bool down); +CIMGUI_API void ImGuiIO_AddKeyAnalogEvent(ImGuiIO* self,ImGuiKey key,bool down,float v); +CIMGUI_API void ImGuiIO_AddMousePosEvent(ImGuiIO* self,float x,float y); +CIMGUI_API void ImGuiIO_AddMouseButtonEvent(ImGuiIO* self,int button,bool down); +CIMGUI_API void ImGuiIO_AddMouseWheelEvent(ImGuiIO* self,float wheel_x,float wheel_y); +CIMGUI_API void ImGuiIO_AddMouseSourceEvent(ImGuiIO* self,ImGuiMouseSource source); +CIMGUI_API void ImGuiIO_AddFocusEvent(ImGuiIO* self,bool focused); CIMGUI_API void ImGuiIO_AddInputCharacter(ImGuiIO* self,unsigned int c); CIMGUI_API void ImGuiIO_AddInputCharacterUTF16(ImGuiIO* self,ImWchar16 c); CIMGUI_API void ImGuiIO_AddInputCharactersUTF8(ImGuiIO* self,const char* str); -CIMGUI_API void ImGuiIO_AddFocusEvent(ImGuiIO* self,bool focused); +CIMGUI_API void ImGuiIO_SetKeyEventNativeData(ImGuiIO* self,ImGuiKey key,int native_keycode,int native_scancode,int native_legacy_index); +CIMGUI_API void ImGuiIO_SetAppAcceptingEvents(ImGuiIO* self,bool accepting_events); CIMGUI_API void ImGuiIO_ClearInputCharacters(ImGuiIO* self); CIMGUI_API void ImGuiIO_ClearInputKeys(ImGuiIO* self); CIMGUI_API ImGuiIO* ImGuiIO_ImGuiIO(void); @@ -2877,10 +3303,10 @@ CIMGUI_API bool ImGuiListClipper_Step(ImGuiListClipper* self); CIMGUI_API void ImGuiListClipper_ForceDisplayRangeByIndices(ImGuiListClipper* self,int item_min,int item_max); CIMGUI_API ImColor* ImColor_ImColor_Nil(void); CIMGUI_API void ImColor_destroy(ImColor* self); -CIMGUI_API ImColor* ImColor_ImColor_Int(int r,int g,int b,int a); -CIMGUI_API ImColor* ImColor_ImColor_U32(ImU32 rgba); CIMGUI_API ImColor* ImColor_ImColor_Float(float r,float g,float b,float a); CIMGUI_API ImColor* ImColor_ImColor_Vec4(const ImVec4 col); +CIMGUI_API ImColor* ImColor_ImColor_Int(int r,int g,int b,int a); +CIMGUI_API ImColor* ImColor_ImColor_U32(ImU32 rgba); CIMGUI_API void ImColor_SetHSV(ImColor* self,float h,float s,float v,float a); CIMGUI_API void ImColor_HSV(ImColor *pOut,float h,float s,float v,float a); CIMGUI_API ImDrawCmd* ImDrawCmd_ImDrawCmd(void); @@ -2893,9 +3319,9 @@ CIMGUI_API void ImDrawListSplitter_ClearFreeMemory(ImDrawListSplitter* self); CIMGUI_API void ImDrawListSplitter_Split(ImDrawListSplitter* self,ImDrawList* draw_list,int count); CIMGUI_API void ImDrawListSplitter_Merge(ImDrawListSplitter* self,ImDrawList* draw_list); CIMGUI_API void ImDrawListSplitter_SetCurrentChannel(ImDrawListSplitter* self,ImDrawList* draw_list,int channel_idx); -CIMGUI_API ImDrawList* ImDrawList_ImDrawList(const ImDrawListSharedData* shared_data); +CIMGUI_API ImDrawList* ImDrawList_ImDrawList(ImDrawListSharedData* shared_data); CIMGUI_API void ImDrawList_destroy(ImDrawList* self); -CIMGUI_API void ImDrawList_PushClipRect(ImDrawList* self,ImVec2 clip_rect_min,ImVec2 clip_rect_max,bool intersect_with_current_clip_rect); +CIMGUI_API void ImDrawList_PushClipRect(ImDrawList* self,const ImVec2 clip_rect_min,const ImVec2 clip_rect_max,bool intersect_with_current_clip_rect); CIMGUI_API void ImDrawList_PushClipRectFullScreen(ImDrawList* self); CIMGUI_API void ImDrawList_PopClipRect(ImDrawList* self); CIMGUI_API void ImDrawList_PushTextureID(ImDrawList* self,ImTextureID texture_id); @@ -2994,6 +3420,7 @@ CIMGUI_API void ImFontAtlas_GetTexDataAsRGBA32(ImFontAtlas* self,unsigned char** CIMGUI_API bool ImFontAtlas_IsBuilt(ImFontAtlas* self); CIMGUI_API void ImFontAtlas_SetTexID(ImFontAtlas* self,ImTextureID id); CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesDefault(ImFontAtlas* self); +CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesGreek(ImFontAtlas* self); CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesKorean(ImFontAtlas* self); CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesJapanese(ImFontAtlas* self); CIMGUI_API const ImWchar* ImFontAtlas_GetGlyphRangesChineseFull(ImFontAtlas* self); @@ -3015,8 +3442,8 @@ CIMGUI_API bool ImFont_IsLoaded(ImFont* self); CIMGUI_API const char* ImFont_GetDebugName(ImFont* self); CIMGUI_API void ImFont_CalcTextSizeA(ImVec2 *pOut,ImFont* self,float size,float max_width,float wrap_width,const char* text_begin,const char* text_end,const char** remaining); CIMGUI_API const char* ImFont_CalcWordWrapPositionA(ImFont* self,float scale,const char* text,const char* text_end,float wrap_width); -CIMGUI_API void ImFont_RenderChar(ImFont* self,ImDrawList* draw_list,float size,ImVec2 pos,ImU32 col,ImWchar c); -CIMGUI_API void ImFont_RenderText(ImFont* self,ImDrawList* draw_list,float size,ImVec2 pos,ImU32 col,const ImVec4 clip_rect,const char* text_begin,const char* text_end,float wrap_width,bool cpu_fine_clip); +CIMGUI_API void ImFont_RenderChar(ImFont* self,ImDrawList* draw_list,float size,const ImVec2 pos,ImU32 col,ImWchar c); +CIMGUI_API void ImFont_RenderText(ImFont* self,ImDrawList* draw_list,float size,const ImVec2 pos,ImU32 col,const ImVec4 clip_rect,const char* text_begin,const char* text_end,float wrap_width,bool cpu_fine_clip); CIMGUI_API void ImFont_BuildLookupTable(ImFont* self); CIMGUI_API void ImFont_ClearOutputData(ImFont* self); CIMGUI_API void ImFont_GrowIndex(ImFont* self,int new_size); @@ -3028,8 +3455,11 @@ CIMGUI_API ImGuiViewport* ImGuiViewport_ImGuiViewport(void); CIMGUI_API void ImGuiViewport_destroy(ImGuiViewport* self); CIMGUI_API void ImGuiViewport_GetCenter(ImVec2 *pOut,ImGuiViewport* self); CIMGUI_API void ImGuiViewport_GetWorkCenter(ImVec2 *pOut,ImGuiViewport* self); -CIMGUI_API ImGuiID igImHashData(const void* data,size_t data_size,ImU32 seed); -CIMGUI_API ImGuiID igImHashStr(const char* data,size_t data_size,ImU32 seed); +CIMGUI_API ImGuiPlatformImeData* ImGuiPlatformImeData_ImGuiPlatformImeData(void); +CIMGUI_API void ImGuiPlatformImeData_destroy(ImGuiPlatformImeData* self); +CIMGUI_API ImGuiKey igGetKeyIndex(ImGuiKey key); +CIMGUI_API ImGuiID igImHashData(const void* data,size_t data_size,ImGuiID seed); +CIMGUI_API ImGuiID igImHashStr(const char* data,size_t data_size,ImGuiID seed); CIMGUI_API void igImQsort(void* base,size_t count,size_t size_of_element,int(*compare_func)(void const*,void const*)); CIMGUI_API ImU32 igImAlphaBlendColors(ImU32 col_a,ImU32 col_b); CIMGUI_API bool igImIsPowerOfTwo_Int(int v); @@ -3047,14 +3477,19 @@ CIMGUI_API const ImWchar* igImStrbolW(const ImWchar* buf_mid_line,const ImWchar* CIMGUI_API const char* igImStristr(const char* haystack,const char* haystack_end,const char* needle,const char* needle_end); CIMGUI_API void igImStrTrimBlanks(char* str); CIMGUI_API const char* igImStrSkipBlank(const char* str); +CIMGUI_API char igImToUpper(char c); +CIMGUI_API bool igImCharIsBlankA(char c); +CIMGUI_API bool igImCharIsBlankW(unsigned int c); CIMGUI_API int igImFormatString(char* buf,size_t buf_size,const char* fmt,...); CIMGUI_API int igImFormatStringV(char* buf,size_t buf_size,const char* fmt,va_list args); +CIMGUI_API void igImFormatStringToTempBuffer(const char** out_buf,const char** out_buf_end,const char* fmt,...); +CIMGUI_API void igImFormatStringToTempBufferV(const char** out_buf,const char** out_buf_end,const char* fmt,va_list args); CIMGUI_API const char* igImParseFormatFindStart(const char* format); CIMGUI_API const char* igImParseFormatFindEnd(const char* format); CIMGUI_API const char* igImParseFormatTrimDecorations(const char* format,char* buf,size_t buf_size); +CIMGUI_API void igImParseFormatSanitizeForPrinting(const char* fmt_in,char* fmt_out,size_t fmt_out_size); +CIMGUI_API const char* igImParseFormatSanitizeForScanning(const char* fmt_in,char* fmt_out,size_t fmt_out_size); CIMGUI_API int igImParseFormatPrecision(const char* format,int default_value); -CIMGUI_API bool igImCharIsBlankA(char c); -CIMGUI_API bool igImCharIsBlankW(unsigned int c); CIMGUI_API const char* igImTextCharToUtf8(char out_buf[5],unsigned int c); CIMGUI_API int igImTextStrToUtf8(char* out_buf,int out_buf_size,const ImWchar* in_text,const ImWchar* in_text_end); CIMGUI_API int igImTextCharFromUtf8(unsigned int* out_char,const char* in_text,const char* in_text_end); @@ -3090,14 +3525,16 @@ CIMGUI_API float igImLengthSqr_Vec2(const ImVec2 lhs); CIMGUI_API float igImLengthSqr_Vec4(const ImVec4 lhs); CIMGUI_API float igImInvLength(const ImVec2 lhs,float fail_value); CIMGUI_API float igImFloor_Float(float f); -CIMGUI_API float igImFloorSigned(float f); +CIMGUI_API float igImFloorSigned_Float(float f); CIMGUI_API void igImFloor_Vec2(ImVec2 *pOut,const ImVec2 v); +CIMGUI_API void igImFloorSigned_Vec2(ImVec2 *pOut,const ImVec2 v); CIMGUI_API int igImModPositive(int a,int b); CIMGUI_API float igImDot(const ImVec2 a,const ImVec2 b); CIMGUI_API void igImRotate(ImVec2 *pOut,const ImVec2 v,float cos_a,float sin_a); CIMGUI_API float igImLinearSweep(float current,float target,float speed); CIMGUI_API void igImMul(ImVec2 *pOut,const ImVec2 lhs,const ImVec2 rhs); CIMGUI_API bool igImIsFloatAboveGuaranteedIntegerPrecision(float f); +CIMGUI_API float igImExponentialMovingAverage(float avg,float sample,int n); CIMGUI_API void igImBezierCubicCalc(ImVec2 *pOut,const ImVec2 p1,const ImVec2 p2,const ImVec2 p3,const ImVec2 p4,float t); CIMGUI_API void igImBezierCubicClosestPoint(ImVec2 *pOut,const ImVec2 p1,const ImVec2 p2,const ImVec2 p3,const ImVec2 p4,const ImVec2 p,int num_segments); CIMGUI_API void igImBezierCubicClosestPointCasteljau(ImVec2 *pOut,const ImVec2 p1,const ImVec2 p2,const ImVec2 p3,const ImVec2 p4,const ImVec2 p,float tess_tol); @@ -3144,6 +3581,8 @@ CIMGUI_API void ImRect_ClipWithFull(ImRect* self,const ImRect r); CIMGUI_API void ImRect_Floor(ImRect* self); CIMGUI_API bool ImRect_IsInverted(ImRect* self); CIMGUI_API void ImRect_ToVec4(ImVec4 *pOut,ImRect* self); +CIMGUI_API size_t igImBitArrayGetStorageSizeInBytes(int bitcount); +CIMGUI_API void igImBitArrayClearAllBits(ImU32* arr,int bitcount); CIMGUI_API bool igImBitArrayTestBit(const ImU32* arr,int n); CIMGUI_API void igImBitArrayClearBit(ImU32* arr,int n); CIMGUI_API void igImBitArraySetBit(ImU32* arr,int n); @@ -3153,6 +3592,11 @@ CIMGUI_API void ImBitVector_Clear(ImBitVector* self); CIMGUI_API bool ImBitVector_TestBit(ImBitVector* self,int n); CIMGUI_API void ImBitVector_SetBit(ImBitVector* self,int n); CIMGUI_API void ImBitVector_ClearBit(ImBitVector* self,int n); +CIMGUI_API void ImGuiTextIndex_clear(ImGuiTextIndex* self); +CIMGUI_API int ImGuiTextIndex_size(ImGuiTextIndex* self); +CIMGUI_API const char* ImGuiTextIndex_get_line_begin(ImGuiTextIndex* self,const char* base,int n); +CIMGUI_API const char* ImGuiTextIndex_get_line_end(ImGuiTextIndex* self,const char* base,int n); +CIMGUI_API void ImGuiTextIndex_append(ImGuiTextIndex* self,const char* base,int old_size,int new_size); CIMGUI_API ImDrawListSharedData* ImDrawListSharedData_ImDrawListSharedData(void); CIMGUI_API void ImDrawListSharedData_destroy(ImDrawListSharedData* self); CIMGUI_API void ImDrawListSharedData_SetCircleTessellationMaxError(ImDrawListSharedData* self,float max_error); @@ -3160,6 +3604,7 @@ CIMGUI_API void ImDrawDataBuilder_Clear(ImDrawDataBuilder* self); CIMGUI_API void ImDrawDataBuilder_ClearFreeMemory(ImDrawDataBuilder* self); CIMGUI_API int ImDrawDataBuilder_GetDrawListCount(ImDrawDataBuilder* self); CIMGUI_API void ImDrawDataBuilder_FlattenIntoSingleLayer(ImDrawDataBuilder* self); +CIMGUI_API void* ImGuiDataVarInfo_GetVarPtr(ImGuiDataVarInfo* self,void* parent); CIMGUI_API ImGuiStyleMod* ImGuiStyleMod_ImGuiStyleMod_Int(ImGuiStyleVar idx,int v); CIMGUI_API void ImGuiStyleMod_destroy(ImGuiStyleMod* self); CIMGUI_API ImGuiStyleMod* ImGuiStyleMod_ImGuiStyleMod_Float(ImGuiStyleVar idx,float v); @@ -3171,6 +3616,9 @@ CIMGUI_API void ImGuiMenuColumns_destroy(ImGuiMenuColumns* self); CIMGUI_API void ImGuiMenuColumns_Update(ImGuiMenuColumns* self,float spacing,bool window_reappearing); CIMGUI_API float ImGuiMenuColumns_DeclColumns(ImGuiMenuColumns* self,float w_icon,float w_label,float w_shortcut,float w_mark); CIMGUI_API void ImGuiMenuColumns_CalcNextTotalWidth(ImGuiMenuColumns* self,bool update_offsets); +CIMGUI_API ImGuiInputTextDeactivatedState* ImGuiInputTextDeactivatedState_ImGuiInputTextDeactivatedState(void); +CIMGUI_API void ImGuiInputTextDeactivatedState_destroy(ImGuiInputTextDeactivatedState* self); +CIMGUI_API void ImGuiInputTextDeactivatedState_ClearFreeMemory(ImGuiInputTextDeactivatedState* self); CIMGUI_API ImGuiInputTextState* ImGuiInputTextState_ImGuiInputTextState(void); CIMGUI_API void ImGuiInputTextState_destroy(ImGuiInputTextState* self); CIMGUI_API void ImGuiInputTextState_ClearText(ImGuiInputTextState* self); @@ -3198,11 +3646,20 @@ CIMGUI_API ImGuiLastItemData* ImGuiLastItemData_ImGuiLastItemData(void); CIMGUI_API void ImGuiLastItemData_destroy(ImGuiLastItemData* self); CIMGUI_API ImGuiStackSizes* ImGuiStackSizes_ImGuiStackSizes(void); CIMGUI_API void ImGuiStackSizes_destroy(ImGuiStackSizes* self); -CIMGUI_API void ImGuiStackSizes_SetToCurrentState(ImGuiStackSizes* self); -CIMGUI_API void ImGuiStackSizes_CompareWithCurrentState(ImGuiStackSizes* self); +CIMGUI_API void ImGuiStackSizes_SetToContextState(ImGuiStackSizes* self,ImGuiContext* ctx); +CIMGUI_API void ImGuiStackSizes_CompareWithContextState(ImGuiStackSizes* self,ImGuiContext* ctx); CIMGUI_API ImGuiPtrOrIndex* ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(void* ptr); CIMGUI_API void ImGuiPtrOrIndex_destroy(ImGuiPtrOrIndex* self); CIMGUI_API ImGuiPtrOrIndex* ImGuiPtrOrIndex_ImGuiPtrOrIndex_Int(int index); +CIMGUI_API ImGuiInputEvent* ImGuiInputEvent_ImGuiInputEvent(void); +CIMGUI_API void ImGuiInputEvent_destroy(ImGuiInputEvent* self); +CIMGUI_API ImGuiKeyRoutingData* ImGuiKeyRoutingData_ImGuiKeyRoutingData(void); +CIMGUI_API void ImGuiKeyRoutingData_destroy(ImGuiKeyRoutingData* self); +CIMGUI_API ImGuiKeyRoutingTable* ImGuiKeyRoutingTable_ImGuiKeyRoutingTable(void); +CIMGUI_API void ImGuiKeyRoutingTable_destroy(ImGuiKeyRoutingTable* self); +CIMGUI_API void ImGuiKeyRoutingTable_Clear(ImGuiKeyRoutingTable* self); +CIMGUI_API ImGuiKeyOwnerData* ImGuiKeyOwnerData_ImGuiKeyOwnerData(void); +CIMGUI_API void ImGuiKeyOwnerData_destroy(ImGuiKeyOwnerData* self); CIMGUI_API ImGuiListClipperRange ImGuiListClipperRange_FromIndices(int min,int max); CIMGUI_API ImGuiListClipperRange ImGuiListClipperRange_FromPositions(float y1,float y2,int off_min,int off_max); CIMGUI_API ImGuiListClipperData* ImGuiListClipperData_ImGuiListClipperData(void); @@ -3228,8 +3685,6 @@ CIMGUI_API void ImGuiWindowSettings_destroy(ImGuiWindowSettings* self); CIMGUI_API char* ImGuiWindowSettings_GetName(ImGuiWindowSettings* self); CIMGUI_API ImGuiSettingsHandler* ImGuiSettingsHandler_ImGuiSettingsHandler(void); CIMGUI_API void ImGuiSettingsHandler_destroy(ImGuiSettingsHandler* self); -CIMGUI_API ImGuiMetricsConfig* ImGuiMetricsConfig_ImGuiMetricsConfig(void); -CIMGUI_API void ImGuiMetricsConfig_destroy(ImGuiMetricsConfig* self); CIMGUI_API ImGuiStackLevelInfo* ImGuiStackLevelInfo_ImGuiStackLevelInfo(void); CIMGUI_API void ImGuiStackLevelInfo_destroy(ImGuiStackLevelInfo* self); CIMGUI_API ImGuiStackTool* ImGuiStackTool_ImGuiStackTool(void); @@ -3243,9 +3698,6 @@ CIMGUI_API void ImGuiWindow_destroy(ImGuiWindow* self); CIMGUI_API ImGuiID ImGuiWindow_GetID_Str(ImGuiWindow* self,const char* str,const char* str_end); CIMGUI_API ImGuiID ImGuiWindow_GetID_Ptr(ImGuiWindow* self,const void* ptr); CIMGUI_API ImGuiID ImGuiWindow_GetID_Int(ImGuiWindow* self,int n); -CIMGUI_API ImGuiID ImGuiWindow_GetIDNoKeepAlive_Str(ImGuiWindow* self,const char* str,const char* str_end); -CIMGUI_API ImGuiID ImGuiWindow_GetIDNoKeepAlive_Ptr(ImGuiWindow* self,const void* ptr); -CIMGUI_API ImGuiID ImGuiWindow_GetIDNoKeepAlive_Int(ImGuiWindow* self,int n); CIMGUI_API ImGuiID ImGuiWindow_GetIDFromRectangle(ImGuiWindow* self,const ImRect r_abs); CIMGUI_API void ImGuiWindow_Rect(ImRect *pOut,ImGuiWindow* self); CIMGUI_API float ImGuiWindow_CalcFontSize(ImGuiWindow* self); @@ -3257,10 +3709,10 @@ CIMGUI_API ImGuiTabItem* ImGuiTabItem_ImGuiTabItem(void); CIMGUI_API void ImGuiTabItem_destroy(ImGuiTabItem* self); CIMGUI_API ImGuiTabBar* ImGuiTabBar_ImGuiTabBar(void); CIMGUI_API void ImGuiTabBar_destroy(ImGuiTabBar* self); -CIMGUI_API int ImGuiTabBar_GetTabOrder(ImGuiTabBar* self,const ImGuiTabItem* tab); -CIMGUI_API const char* ImGuiTabBar_GetTabName(ImGuiTabBar* self,const ImGuiTabItem* tab); CIMGUI_API ImGuiTableColumn* ImGuiTableColumn_ImGuiTableColumn(void); CIMGUI_API void ImGuiTableColumn_destroy(ImGuiTableColumn* self); +CIMGUI_API ImGuiTableInstanceData* ImGuiTableInstanceData_ImGuiTableInstanceData(void); +CIMGUI_API void ImGuiTableInstanceData_destroy(ImGuiTableInstanceData* self); CIMGUI_API ImGuiTable* ImGuiTable_ImGuiTable(void); CIMGUI_API void ImGuiTable_destroy(ImGuiTable* self); CIMGUI_API ImGuiTableTempData* ImGuiTableTempData_ImGuiTableTempData(void); @@ -3284,6 +3736,7 @@ CIMGUI_API void igSetWindowPos_WindowPtr(ImGuiWindow* window,const ImVec2 pos,Im CIMGUI_API void igSetWindowSize_WindowPtr(ImGuiWindow* window,const ImVec2 size,ImGuiCond cond); CIMGUI_API void igSetWindowCollapsed_WindowPtr(ImGuiWindow* window,bool collapsed,ImGuiCond cond); CIMGUI_API void igSetWindowHitTestHole(ImGuiWindow* window,const ImVec2 pos,const ImVec2 size); +CIMGUI_API void igSetWindowHiddendAndSkipItemsForCurrentFrame(ImGuiWindow* window); CIMGUI_API void igWindowRectAbsToRel(ImRect *pOut,ImGuiWindow* window,const ImRect r); CIMGUI_API void igWindowRectRelToAbs(ImRect *pOut,ImGuiWindow* window,const ImRect r); CIMGUI_API void igFocusWindow(ImGuiWindow* window); @@ -3299,8 +3752,9 @@ CIMGUI_API ImFont* igGetDefaultFont(void); CIMGUI_API ImDrawList* igGetForegroundDrawList_WindowPtr(ImGuiWindow* window); CIMGUI_API ImDrawList* igGetBackgroundDrawList_ViewportPtr(ImGuiViewport* viewport); CIMGUI_API ImDrawList* igGetForegroundDrawList_ViewportPtr(ImGuiViewport* viewport); -CIMGUI_API void igInitialize(ImGuiContext* context); -CIMGUI_API void igShutdown(ImGuiContext* context); +CIMGUI_API void igInitialize(void); +CIMGUI_API void igShutdown(void); +CIMGUI_API void igUpdateInputEvents(bool trickle_fast_inputs); CIMGUI_API void igUpdateHoveredWindowAndCaptureFlags(void); CIMGUI_API void igStartMouseMovingWindow(ImGuiWindow* window); CIMGUI_API void igUpdateMouseMovingWindowNewFrame(void); @@ -3308,14 +3762,19 @@ CIMGUI_API void igUpdateMouseMovingWindowEndFrame(void); CIMGUI_API ImGuiID igAddContextHook(ImGuiContext* context,const ImGuiContextHook* hook); CIMGUI_API void igRemoveContextHook(ImGuiContext* context,ImGuiID hook_to_remove); CIMGUI_API void igCallContextHooks(ImGuiContext* context,ImGuiContextHookType type); +CIMGUI_API void igSetWindowViewport(ImGuiWindow* window,ImGuiViewportP* viewport); CIMGUI_API void igMarkIniSettingsDirty_Nil(void); CIMGUI_API void igMarkIniSettingsDirty_WindowPtr(ImGuiWindow* window); CIMGUI_API void igClearIniSettings(void); -CIMGUI_API ImGuiWindowSettings* igCreateNewWindowSettings(const char* name); -CIMGUI_API ImGuiWindowSettings* igFindWindowSettings(ImGuiID id); -CIMGUI_API ImGuiWindowSettings* igFindOrCreateWindowSettings(const char* name); +CIMGUI_API void igAddSettingsHandler(const ImGuiSettingsHandler* handler); +CIMGUI_API void igRemoveSettingsHandler(const char* type_name); CIMGUI_API ImGuiSettingsHandler* igFindSettingsHandler(const char* type_name); -CIMGUI_API void igSetNextWindowScroll(const ImVec2 scroll); +CIMGUI_API ImGuiWindowSettings* igCreateNewWindowSettings(const char* name); +CIMGUI_API ImGuiWindowSettings* igFindWindowSettingsByID(ImGuiID id); +CIMGUI_API ImGuiWindowSettings* igFindWindowSettingsByWindow(ImGuiWindow* window); +CIMGUI_API void igClearWindowSettings(const char* name); +CIMGUI_API void igLocalizeRegisterEntries(const ImGuiLocEntry* entries,int count); +CIMGUI_API const char* igLocalizeGetMsg(ImGuiLocKey key); CIMGUI_API void igSetScrollX_WindowPtr(ImGuiWindow* window,float scroll_x); CIMGUI_API void igSetScrollY_WindowPtr(ImGuiWindow* window,float scroll_y); CIMGUI_API void igSetScrollFromPosX_WindowPtr(ImGuiWindow* window,float local_x,float center_x_ratio); @@ -3324,7 +3783,6 @@ CIMGUI_API void igScrollToItem(ImGuiScrollFlags flags); CIMGUI_API void igScrollToRect(ImGuiWindow* window,const ImRect rect,ImGuiScrollFlags flags); CIMGUI_API void igScrollToRectEx(ImVec2 *pOut,ImGuiWindow* window,const ImRect rect,ImGuiScrollFlags flags); CIMGUI_API void igScrollToBringRectIntoView(ImGuiWindow* window,const ImRect rect); -CIMGUI_API ImGuiID igGetItemID(void); CIMGUI_API ImGuiItemStatusFlags igGetItemStatusFlags(void); CIMGUI_API ImGuiItemFlags igGetItemFlags(void); CIMGUI_API ImGuiID igGetActiveID(void); @@ -3337,11 +3795,13 @@ CIMGUI_API void igSetHoveredID(ImGuiID id); CIMGUI_API void igKeepAliveID(ImGuiID id); CIMGUI_API void igMarkItemEdited(ImGuiID id); CIMGUI_API void igPushOverrideID(ImGuiID id); -CIMGUI_API ImGuiID igGetIDWithSeed(const char* str_id_begin,const char* str_id_end,ImGuiID seed); +CIMGUI_API ImGuiID igGetIDWithSeed_Str(const char* str_id_begin,const char* str_id_end,ImGuiID seed); +CIMGUI_API ImGuiID igGetIDWithSeed_Int(int n,ImGuiID seed); CIMGUI_API void igItemSize_Vec2(const ImVec2 size,float text_baseline_y); CIMGUI_API void igItemSize_Rect(const ImRect bb,float text_baseline_y); CIMGUI_API bool igItemAdd(const ImRect bb,ImGuiID id,const ImRect* nav_bb,ImGuiItemFlags extra_flags); CIMGUI_API bool igItemHoverable(const ImRect bb,ImGuiID id); +CIMGUI_API bool igIsWindowContentHoverable(ImGuiWindow* window,ImGuiHoveredFlags flags); CIMGUI_API bool igIsClippedEx(const ImRect bb,ImGuiID id); CIMGUI_API void igSetLastItemData(ImGuiID item_id,ImGuiItemFlags in_flags,ImGuiItemStatusFlags status_flags,const ImRect item_rect); CIMGUI_API void igCalcItemSize(ImVec2 *pOut,ImVec2 size,float default_w,float default_h); @@ -3352,6 +3812,7 @@ CIMGUI_API void igGetContentRegionMaxAbs(ImVec2 *pOut); CIMGUI_API void igShrinkWidths(ImGuiShrinkWidthItem* items,int count,float width_excess); CIMGUI_API void igPushItemFlag(ImGuiItemFlags option,bool enabled); CIMGUI_API void igPopItemFlag(void); +CIMGUI_API const ImGuiDataVarInfo* igGetStyleVarInfo(ImGuiStyleVar idx); CIMGUI_API void igLogBegin(ImGuiLogType type,int auto_open_depth); CIMGUI_API void igLogToBuffer(int auto_open_depth); CIMGUI_API void igLogRenderedText(const ImVec2* ref_pos,const char* text,const char* text_end); @@ -3363,7 +3824,7 @@ CIMGUI_API void igClosePopupsOverWindow(ImGuiWindow* ref_window,bool restore_foc CIMGUI_API void igClosePopupsExceptModals(void); CIMGUI_API bool igIsPopupOpen_ID(ImGuiID id,ImGuiPopupFlags popup_flags); CIMGUI_API bool igBeginPopupEx(ImGuiID id,ImGuiWindowFlags extra_flags); -CIMGUI_API void igBeginTooltipEx(ImGuiTooltipFlags tooltip_flags,ImGuiWindowFlags extra_window_flags); +CIMGUI_API bool igBeginTooltipEx(ImGuiTooltipFlags tooltip_flags,ImGuiWindowFlags extra_window_flags); CIMGUI_API void igGetPopupAllowedExtentRect(ImRect *pOut,ImGuiWindow* window); CIMGUI_API ImGuiWindow* igGetTopMostPopupModal(void); CIMGUI_API ImGuiWindow* igGetTopMostAndVisiblePopupModal(void); @@ -3384,28 +3845,53 @@ CIMGUI_API void igNavMoveRequestResolveWithLastItem(ImGuiNavItemData* result); CIMGUI_API void igNavMoveRequestCancel(void); CIMGUI_API void igNavMoveRequestApplyResult(void); CIMGUI_API void igNavMoveRequestTryWrapping(ImGuiWindow* window,ImGuiNavMoveFlags move_flags); -CIMGUI_API float igGetNavInputAmount(ImGuiNavInput n,ImGuiInputReadMode mode); -CIMGUI_API void igGetNavInputAmount2d(ImVec2 *pOut,ImGuiNavDirSourceFlags dir_sources,ImGuiInputReadMode mode,float slow_factor,float fast_factor); -CIMGUI_API int igCalcTypematicRepeatAmount(float t0,float t1,float repeat_delay,float repeat_rate); CIMGUI_API void igActivateItem(ImGuiID id); +CIMGUI_API void igSetNavWindow(ImGuiWindow* window); CIMGUI_API void igSetNavID(ImGuiID id,ImGuiNavLayer nav_layer,ImGuiID focus_scope_id,const ImRect rect_rel); +CIMGUI_API bool igIsNamedKey(ImGuiKey key); +CIMGUI_API bool igIsNamedKeyOrModKey(ImGuiKey key); +CIMGUI_API bool igIsLegacyKey(ImGuiKey key); +CIMGUI_API bool igIsKeyboardKey(ImGuiKey key); +CIMGUI_API bool igIsGamepadKey(ImGuiKey key); +CIMGUI_API bool igIsMouseKey(ImGuiKey key); +CIMGUI_API bool igIsAliasKey(ImGuiKey key); +CIMGUI_API ImGuiKeyChord igConvertShortcutMod(ImGuiKeyChord key_chord); +CIMGUI_API ImGuiKey igConvertSingleModFlagToKey(ImGuiContext* ctx,ImGuiKey key); +CIMGUI_API ImGuiKeyData* igGetKeyData_ContextPtr(ImGuiContext* ctx,ImGuiKey key); +CIMGUI_API ImGuiKeyData* igGetKeyData_Key(ImGuiKey key); +CIMGUI_API void igGetKeyChordName(ImGuiKeyChord key_chord,char* out_buf,int out_buf_size); +CIMGUI_API ImGuiKey igMouseButtonToKey(ImGuiMouseButton button); +CIMGUI_API bool igIsMouseDragPastThreshold(ImGuiMouseButton button,float lock_threshold); +CIMGUI_API void igGetKeyMagnitude2d(ImVec2 *pOut,ImGuiKey key_left,ImGuiKey key_right,ImGuiKey key_up,ImGuiKey key_down); +CIMGUI_API float igGetNavTweakPressedAmount(ImGuiAxis axis); +CIMGUI_API int igCalcTypematicRepeatAmount(float t0,float t1,float repeat_delay,float repeat_rate); +CIMGUI_API void igGetTypematicRepeatRate(ImGuiInputFlags flags,float* repeat_delay,float* repeat_rate); +CIMGUI_API void igSetActiveIdUsingAllKeyboardKeys(void); +CIMGUI_API bool igIsActiveIdUsingNavDir(ImGuiDir dir); +CIMGUI_API ImGuiID igGetKeyOwner(ImGuiKey key); +CIMGUI_API void igSetKeyOwner(ImGuiKey key,ImGuiID owner_id,ImGuiInputFlags flags); +CIMGUI_API void igSetKeyOwnersForKeyChord(ImGuiKeyChord key,ImGuiID owner_id,ImGuiInputFlags flags); +CIMGUI_API void igSetItemKeyOwner(ImGuiKey key,ImGuiInputFlags flags); +CIMGUI_API bool igTestKeyOwner(ImGuiKey key,ImGuiID owner_id); +CIMGUI_API ImGuiKeyOwnerData* igGetKeyOwnerData(ImGuiContext* ctx,ImGuiKey key); +CIMGUI_API bool igIsKeyDown_ID(ImGuiKey key,ImGuiID owner_id); +CIMGUI_API bool igIsKeyPressed_ID(ImGuiKey key,ImGuiID owner_id,ImGuiInputFlags flags); +CIMGUI_API bool igIsKeyReleased_ID(ImGuiKey key,ImGuiID owner_id); +CIMGUI_API bool igIsMouseDown_ID(ImGuiMouseButton button,ImGuiID owner_id); +CIMGUI_API bool igIsMouseClicked_ID(ImGuiMouseButton button,ImGuiID owner_id,ImGuiInputFlags flags); +CIMGUI_API bool igIsMouseReleased_ID(ImGuiMouseButton button,ImGuiID owner_id); +CIMGUI_API bool igShortcut(ImGuiKeyChord key_chord,ImGuiID owner_id,ImGuiInputFlags flags); +CIMGUI_API bool igSetShortcutRouting(ImGuiKeyChord key_chord,ImGuiID owner_id,ImGuiInputFlags flags); +CIMGUI_API bool igTestShortcutRouting(ImGuiKeyChord key_chord,ImGuiID owner_id); +CIMGUI_API ImGuiKeyRoutingData* igGetShortcutRoutingData(ImGuiKeyChord key_chord); CIMGUI_API void igPushFocusScope(ImGuiID id); CIMGUI_API void igPopFocusScope(void); -CIMGUI_API ImGuiID igGetFocusedFocusScope(void); -CIMGUI_API ImGuiID igGetFocusScope(void); -CIMGUI_API void igSetItemUsingMouseWheel(void); -CIMGUI_API void igSetActiveIdUsingNavAndKeys(void); -CIMGUI_API bool igIsActiveIdUsingNavDir(ImGuiDir dir); -CIMGUI_API bool igIsActiveIdUsingNavInput(ImGuiNavInput input); -CIMGUI_API bool igIsActiveIdUsingKey(ImGuiKey key); -CIMGUI_API bool igIsMouseDragPastThreshold(ImGuiMouseButton button,float lock_threshold); -CIMGUI_API bool igIsKeyPressedMap(ImGuiKey key,bool repeat); -CIMGUI_API bool igIsNavInputDown(ImGuiNavInput n); -CIMGUI_API bool igIsNavInputTest(ImGuiNavInput n,ImGuiInputReadMode rm); -CIMGUI_API ImGuiKeyModFlags igGetMergedKeyModFlags(void); +CIMGUI_API ImGuiID igGetCurrentFocusScope(void); +CIMGUI_API bool igIsDragDropActive(void); CIMGUI_API bool igBeginDragDropTargetCustom(const ImRect bb,ImGuiID id); CIMGUI_API void igClearDragDrop(void); CIMGUI_API bool igIsDragDropPayloadBeingAccepted(void); +CIMGUI_API void igRenderDragDropTargetRect(const ImRect bb); CIMGUI_API void igSetWindowClipRectBeforeSetChannel(ImGuiWindow* window,const ImRect clip_rect); CIMGUI_API void igBeginColumns(const char* str_id,int count,ImGuiOldColumnFlags flags); CIMGUI_API void igEndColumns(void); @@ -3434,7 +3920,10 @@ CIMGUI_API void igTableUpdateBorders(ImGuiTable* table); CIMGUI_API void igTableUpdateColumnsWeightFromWidth(ImGuiTable* table); CIMGUI_API void igTableDrawBorders(ImGuiTable* table); CIMGUI_API void igTableDrawContextMenu(ImGuiTable* table); +CIMGUI_API bool igTableBeginContextMenuPopup(ImGuiTable* table); CIMGUI_API void igTableMergeDrawChannels(ImGuiTable* table); +CIMGUI_API ImGuiTableInstanceData* igTableGetInstanceData(ImGuiTable* table,int instance_no); +CIMGUI_API ImGuiID igTableGetInstanceID(ImGuiTable* table,int instance_no); CIMGUI_API void igTableSortSpecsSanitize(ImGuiTable* table); CIMGUI_API void igTableSortSpecsBuild(ImGuiTable* table); CIMGUI_API ImGuiSortDirection igTableGetColumnNextSortDirection(ImGuiTableColumn* column); @@ -3446,7 +3935,7 @@ CIMGUI_API void igTableBeginCell(ImGuiTable* table,int column_n); CIMGUI_API void igTableEndCell(ImGuiTable* table); CIMGUI_API void igTableGetCellBgRect(ImRect *pOut,const ImGuiTable* table,int column_n); CIMGUI_API const char* igTableGetColumnName_TablePtr(const ImGuiTable* table,int column_n); -CIMGUI_API ImGuiID igTableGetColumnResizeID(const ImGuiTable* table,int column_n,int instance_no); +CIMGUI_API ImGuiID igTableGetColumnResizeID(ImGuiTable* table,int column_n,int instance_no); CIMGUI_API float igTableGetMaxColumnWidth(const ImGuiTable* table,int column_n); CIMGUI_API void igTableSetColumnWidthAutoSingle(ImGuiTable* table,int column_n); CIMGUI_API void igTableSetColumnWidthAutoAll(ImGuiTable* table); @@ -3458,18 +3947,25 @@ CIMGUI_API void igTableLoadSettings(ImGuiTable* table); CIMGUI_API void igTableSaveSettings(ImGuiTable* table); CIMGUI_API void igTableResetSettings(ImGuiTable* table); CIMGUI_API ImGuiTableSettings* igTableGetBoundSettings(ImGuiTable* table); -CIMGUI_API void igTableSettingsInstallHandler(ImGuiContext* context); +CIMGUI_API void igTableSettingsAddSettingsHandler(void); CIMGUI_API ImGuiTableSettings* igTableSettingsCreate(ImGuiID id,int columns_count); CIMGUI_API ImGuiTableSettings* igTableSettingsFindByID(ImGuiID id); +CIMGUI_API ImGuiTabBar* igGetCurrentTabBar(void); CIMGUI_API bool igBeginTabBarEx(ImGuiTabBar* tab_bar,const ImRect bb,ImGuiTabBarFlags flags); CIMGUI_API ImGuiTabItem* igTabBarFindTabByID(ImGuiTabBar* tab_bar,ImGuiID tab_id); +CIMGUI_API ImGuiTabItem* igTabBarFindTabByOrder(ImGuiTabBar* tab_bar,int order); +CIMGUI_API ImGuiTabItem* igTabBarGetCurrentTab(ImGuiTabBar* tab_bar); +CIMGUI_API int igTabBarGetTabOrder(ImGuiTabBar* tab_bar,ImGuiTabItem* tab); +CIMGUI_API const char* igTabBarGetTabName(ImGuiTabBar* tab_bar,ImGuiTabItem* tab); CIMGUI_API void igTabBarRemoveTab(ImGuiTabBar* tab_bar,ImGuiID tab_id); CIMGUI_API void igTabBarCloseTab(ImGuiTabBar* tab_bar,ImGuiTabItem* tab); -CIMGUI_API void igTabBarQueueReorder(ImGuiTabBar* tab_bar,const ImGuiTabItem* tab,int offset); -CIMGUI_API void igTabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar,const ImGuiTabItem* tab,ImVec2 mouse_pos); +CIMGUI_API void igTabBarQueueFocus(ImGuiTabBar* tab_bar,ImGuiTabItem* tab); +CIMGUI_API void igTabBarQueueReorder(ImGuiTabBar* tab_bar,ImGuiTabItem* tab,int offset); +CIMGUI_API void igTabBarQueueReorderFromMousePos(ImGuiTabBar* tab_bar,ImGuiTabItem* tab,ImVec2 mouse_pos); CIMGUI_API bool igTabBarProcessReorder(ImGuiTabBar* tab_bar); -CIMGUI_API bool igTabItemEx(ImGuiTabBar* tab_bar,const char* label,bool* p_open,ImGuiTabItemFlags flags); -CIMGUI_API void igTabItemCalcSize(ImVec2 *pOut,const char* label,bool has_close_button); +CIMGUI_API bool igTabItemEx(ImGuiTabBar* tab_bar,const char* label,bool* p_open,ImGuiTabItemFlags flags,ImGuiWindow* docked_window); +CIMGUI_API void igTabItemCalcSize_Str(ImVec2 *pOut,const char* label,bool has_close_button_or_unsaved_marker); +CIMGUI_API void igTabItemCalcSize_WindowPtr(ImVec2 *pOut,ImGuiWindow* window); CIMGUI_API void igTabItemBackground(ImDrawList* draw_list,const ImRect bb,ImGuiTabItemFlags flags,ImU32 col); CIMGUI_API void igTabItemLabelAndCloseButton(ImDrawList* draw_list,const ImRect bb,ImGuiTabItemFlags flags,ImVec2 frame_padding,const char* label,ImGuiID tab_id,ImGuiID close_button_id,bool is_contents_visible,bool* out_just_closed,bool* out_text_clipped); CIMGUI_API void igRenderText(ImVec2 pos,const char* text,const char* text_end,bool hide_text_after_hash); @@ -3482,42 +3978,45 @@ CIMGUI_API void igRenderFrameBorder(ImVec2 p_min,ImVec2 p_max,float rounding); CIMGUI_API void igRenderColorRectWithAlphaCheckerboard(ImDrawList* draw_list,ImVec2 p_min,ImVec2 p_max,ImU32 fill_col,float grid_step,ImVec2 grid_off,float rounding,ImDrawFlags flags); CIMGUI_API void igRenderNavHighlight(const ImRect bb,ImGuiID id,ImGuiNavHighlightFlags flags); CIMGUI_API const char* igFindRenderedTextEnd(const char* text,const char* text_end); +CIMGUI_API void igRenderMouseCursor(ImVec2 pos,float scale,ImGuiMouseCursor mouse_cursor,ImU32 col_fill,ImU32 col_border,ImU32 col_shadow); CIMGUI_API void igRenderArrow(ImDrawList* draw_list,ImVec2 pos,ImU32 col,ImGuiDir dir,float scale); CIMGUI_API void igRenderBullet(ImDrawList* draw_list,ImVec2 pos,ImU32 col); CIMGUI_API void igRenderCheckMark(ImDrawList* draw_list,ImVec2 pos,ImU32 col,float sz); -CIMGUI_API void igRenderMouseCursor(ImDrawList* draw_list,ImVec2 pos,float scale,ImGuiMouseCursor mouse_cursor,ImU32 col_fill,ImU32 col_border,ImU32 col_shadow); CIMGUI_API void igRenderArrowPointingAt(ImDrawList* draw_list,ImVec2 pos,ImVec2 half_sz,ImGuiDir direction,ImU32 col); CIMGUI_API void igRenderRectFilledRangeH(ImDrawList* draw_list,const ImRect rect,ImU32 col,float x_start_norm,float x_end_norm,float rounding); -CIMGUI_API void igRenderRectFilledWithHole(ImDrawList* draw_list,ImRect outer,ImRect inner,ImU32 col,float rounding); +CIMGUI_API void igRenderRectFilledWithHole(ImDrawList* draw_list,const ImRect outer,const ImRect inner,ImU32 col,float rounding); CIMGUI_API void igTextEx(const char* text,const char* text_end,ImGuiTextFlags flags); CIMGUI_API bool igButtonEx(const char* label,const ImVec2 size_arg,ImGuiButtonFlags flags); +CIMGUI_API bool igArrowButtonEx(const char* str_id,ImGuiDir dir,ImVec2 size_arg,ImGuiButtonFlags flags); +CIMGUI_API bool igImageButtonEx(ImGuiID id,ImTextureID texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec4 bg_col,const ImVec4 tint_col,ImGuiButtonFlags flags); +CIMGUI_API void igSeparatorEx(ImGuiSeparatorFlags flags); +CIMGUI_API void igSeparatorTextEx(ImGuiID id,const char* label,const char* label_end,float extra_width); +CIMGUI_API bool igCheckboxFlags_S64Ptr(const char* label,ImS64* flags,ImS64 flags_value); +CIMGUI_API bool igCheckboxFlags_U64Ptr(const char* label,ImU64* flags,ImU64 flags_value); CIMGUI_API bool igCloseButton(ImGuiID id,const ImVec2 pos); CIMGUI_API bool igCollapseButton(ImGuiID id,const ImVec2 pos); -CIMGUI_API bool igArrowButtonEx(const char* str_id,ImGuiDir dir,ImVec2 size_arg,ImGuiButtonFlags flags); CIMGUI_API void igScrollbar(ImGuiAxis axis); CIMGUI_API bool igScrollbarEx(const ImRect bb,ImGuiID id,ImGuiAxis axis,ImS64* p_scroll_v,ImS64 avail_v,ImS64 contents_v,ImDrawFlags flags); -CIMGUI_API bool igImageButtonEx(ImGuiID id,ImTextureID texture_id,const ImVec2 size,const ImVec2 uv0,const ImVec2 uv1,const ImVec2 padding,const ImVec4 bg_col,const ImVec4 tint_col); CIMGUI_API void igGetWindowScrollbarRect(ImRect *pOut,ImGuiWindow* window,ImGuiAxis axis); CIMGUI_API ImGuiID igGetWindowScrollbarID(ImGuiWindow* window,ImGuiAxis axis); CIMGUI_API ImGuiID igGetWindowResizeCornerID(ImGuiWindow* window,int n); CIMGUI_API ImGuiID igGetWindowResizeBorderID(ImGuiWindow* window,ImGuiDir dir); -CIMGUI_API void igSeparatorEx(ImGuiSeparatorFlags flags); -CIMGUI_API bool igCheckboxFlags_S64Ptr(const char* label,ImS64* flags,ImS64 flags_value); -CIMGUI_API bool igCheckboxFlags_U64Ptr(const char* label,ImU64* flags,ImU64 flags_value); CIMGUI_API bool igButtonBehavior(const ImRect bb,ImGuiID id,bool* out_hovered,bool* out_held,ImGuiButtonFlags flags); CIMGUI_API bool igDragBehavior(ImGuiID id,ImGuiDataType data_type,void* p_v,float v_speed,const void* p_min,const void* p_max,const char* format,ImGuiSliderFlags flags); CIMGUI_API bool igSliderBehavior(const ImRect bb,ImGuiID id,ImGuiDataType data_type,void* p_v,const void* p_min,const void* p_max,const char* format,ImGuiSliderFlags flags,ImRect* out_grab_bb); -CIMGUI_API bool igSplitterBehavior(const ImRect bb,ImGuiID id,ImGuiAxis axis,float* size1,float* size2,float min_size1,float min_size2,float hover_extend,float hover_visibility_delay); +CIMGUI_API bool igSplitterBehavior(const ImRect bb,ImGuiID id,ImGuiAxis axis,float* size1,float* size2,float min_size1,float min_size2,float hover_extend,float hover_visibility_delay,ImU32 bg_col); CIMGUI_API bool igTreeNodeBehavior(ImGuiID id,ImGuiTreeNodeFlags flags,const char* label,const char* label_end); -CIMGUI_API bool igTreeNodeBehaviorIsOpen(ImGuiID id,ImGuiTreeNodeFlags flags); CIMGUI_API void igTreePushOverrideID(ImGuiID id); +CIMGUI_API void igTreeNodeSetOpen(ImGuiID id,bool open); +CIMGUI_API bool igTreeNodeUpdateNextOpen(ImGuiID id,ImGuiTreeNodeFlags flags); CIMGUI_API const ImGuiDataTypeInfo* igDataTypeGetInfo(ImGuiDataType data_type); CIMGUI_API int igDataTypeFormatString(char* buf,int buf_size,ImGuiDataType data_type,const void* p_data,const char* format); CIMGUI_API void igDataTypeApplyOp(ImGuiDataType data_type,int op,void* output,const void* arg_1,const void* arg_2); -CIMGUI_API bool igDataTypeApplyOpFromText(const char* buf,const char* initial_value_buf,ImGuiDataType data_type,void* p_data,const char* format); +CIMGUI_API bool igDataTypeApplyFromText(const char* buf,ImGuiDataType data_type,void* p_data,const char* format); CIMGUI_API int igDataTypeCompare(ImGuiDataType data_type,const void* arg_1,const void* arg_2); CIMGUI_API bool igDataTypeClamp(ImGuiDataType data_type,void* p_data,const void* p_min,const void* p_max); CIMGUI_API bool igInputTextEx(const char* label,const char* hint,char* buf,int buf_size,const ImVec2 size_arg,ImGuiInputTextFlags flags,ImGuiInputTextCallback callback,void* user_data); +CIMGUI_API void igInputTextDeactivateHook(ImGuiID id); CIMGUI_API bool igTempInputText(const ImRect bb,ImGuiID id,const char* label,char* buf,int buf_size,ImGuiInputTextFlags flags); CIMGUI_API bool igTempInputScalar(const ImRect bb,ImGuiID id,const char* label,ImGuiDataType data_type,void* p_data,const char* format,const void* p_clamp_min,const void* p_clamp_max); CIMGUI_API bool igTempInputIsActive(ImGuiID id); @@ -3525,14 +4024,20 @@ CIMGUI_API ImGuiInputTextState* igGetInputTextState(ImGuiID id); CIMGUI_API void igColorTooltip(const char* text,const float* col,ImGuiColorEditFlags flags); CIMGUI_API void igColorEditOptionsPopup(const float* col,ImGuiColorEditFlags flags); CIMGUI_API void igColorPickerOptionsPopup(const float* ref_col,ImGuiColorEditFlags flags); -CIMGUI_API int igPlotEx(ImGuiPlotType plot_type,const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,ImVec2 frame_size); +CIMGUI_API int igPlotEx(ImGuiPlotType plot_type,const char* label,float(*values_getter)(void* data,int idx),void* data,int values_count,int values_offset,const char* overlay_text,float scale_min,float scale_max,const ImVec2 size_arg); CIMGUI_API void igShadeVertsLinearColorGradientKeepAlpha(ImDrawList* draw_list,int vert_start_idx,int vert_end_idx,ImVec2 gradient_p0,ImVec2 gradient_p1,ImU32 col0,ImU32 col1); CIMGUI_API void igShadeVertsLinearUV(ImDrawList* draw_list,int vert_start_idx,int vert_end_idx,const ImVec2 a,const ImVec2 b,const ImVec2 uv_a,const ImVec2 uv_b,bool clamp); CIMGUI_API void igGcCompactTransientMiscBuffers(void); CIMGUI_API void igGcCompactTransientWindowBuffers(ImGuiWindow* window); CIMGUI_API void igGcAwakeTransientWindowBuffers(ImGuiWindow* window); +CIMGUI_API void igDebugLog(const char* fmt,...); +CIMGUI_API void igDebugLogV(const char* fmt,va_list args); CIMGUI_API void igErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback,void* user_data); CIMGUI_API void igErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback,void* user_data); +CIMGUI_API void igErrorCheckUsingSetCursorPosToExtendParentBoundaries(void); +CIMGUI_API void igDebugLocateItem(ImGuiID target_id); +CIMGUI_API void igDebugLocateItemOnHover(ImGuiID target_id); +CIMGUI_API void igDebugLocateItemResolveWithLastItem(void); CIMGUI_API void igDebugDrawItemRect(ImU32 col); CIMGUI_API void igDebugStartItemPicker(void); CIMGUI_API void igShowFontAtlas(ImFontAtlas* atlas); @@ -3541,16 +4046,20 @@ CIMGUI_API void igDebugNodeColumns(ImGuiOldColumns* columns); CIMGUI_API void igDebugNodeDrawList(ImGuiWindow* window,const ImDrawList* draw_list,const char* label); CIMGUI_API void igDebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list,const ImDrawList* draw_list,const ImDrawCmd* draw_cmd,bool show_mesh,bool show_aabb); CIMGUI_API void igDebugNodeFont(ImFont* font); +CIMGUI_API void igDebugNodeFontGlyph(ImFont* font,const ImFontGlyph* glyph); CIMGUI_API void igDebugNodeStorage(ImGuiStorage* storage,const char* label); CIMGUI_API void igDebugNodeTabBar(ImGuiTabBar* tab_bar,const char* label); CIMGUI_API void igDebugNodeTable(ImGuiTable* table); CIMGUI_API void igDebugNodeTableSettings(ImGuiTableSettings* settings); +CIMGUI_API void igDebugNodeInputTextState(ImGuiInputTextState* state); CIMGUI_API void igDebugNodeWindow(ImGuiWindow* window,const char* label); CIMGUI_API void igDebugNodeWindowSettings(ImGuiWindowSettings* settings); CIMGUI_API void igDebugNodeWindowsList(ImVector_ImGuiWindowPtr* windows,const char* label); CIMGUI_API void igDebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows,int windows_size,ImGuiWindow* parent_in_begin_stack); CIMGUI_API void igDebugNodeViewport(ImGuiViewportP* viewport); +CIMGUI_API void igDebugRenderKeyboardPreview(ImDrawList* draw_list); CIMGUI_API void igDebugRenderViewportThumbnail(ImDrawList* draw_list,ImGuiViewportP* viewport,const ImRect bb); +CIMGUI_API bool igIsKeyPressedMap(ImGuiKey key,bool repeat); CIMGUI_API const ImFontBuilderIO* igImFontAtlasGetBuilderForStbTruetype(void); CIMGUI_API void igImFontAtlasBuildInit(ImFontAtlas* atlas); CIMGUI_API void igImFontAtlasBuildSetupFont(ImFontAtlas* atlas,ImFont* font,ImFontConfig* font_config,float ascent,float descent); @@ -3568,12 +4077,12 @@ CIMGUI_API void igLogText(CONST char *fmt, ...); //no appendfV CIMGUI_API void ImGuiTextBuffer_appendf(struct ImGuiTextBuffer *buffer, const char *fmt, ...); //for getting FLT_MAX in bindings -CIMGUI_API float igGET_FLT_MAX(); +CIMGUI_API float igGET_FLT_MAX(void); //for getting FLT_MIN in bindings -CIMGUI_API float igGET_FLT_MIN(); +CIMGUI_API float igGET_FLT_MIN(void); -CIMGUI_API ImVector_ImWchar* ImVector_ImWchar_create(); +CIMGUI_API ImVector_ImWchar* ImVector_ImWchar_create(void); CIMGUI_API void ImVector_ImWchar_destroy(ImVector_ImWchar* self); CIMGUI_API void ImVector_ImWchar_Init(ImVector_ImWchar* p); CIMGUI_API void ImVector_ImWchar_UnInit(ImVector_ImWchar* p); diff --git a/Sources/Demos/Metal/imgui_impl_osx.swift b/Sources/Demos/Metal/imgui_impl_osx.swift index f627ec3..190cef1 100644 --- a/Sources/Demos/Metal/imgui_impl_osx.swift +++ b/Sources/Demos/Metal/imgui_impl_osx.swift @@ -67,7 +67,7 @@ func ImGui_ImplOSX_Init(_ view: NSView) -> Bool { keyMap[Int(ImGuiKey_Space.rawValue)] = ImGuiKey(kVK_Space) keyMap[Int(ImGuiKey_Enter.rawValue)] = ImGuiKey(kVK_Return) keyMap[Int(ImGuiKey_Escape.rawValue)] = ImGuiKey(kVK_Escape) - keyMap[Int(ImGuiKey_KeyPadEnter.rawValue)] = ImGuiKey(kVK_ANSI_KeypadEnter) + keyMap[Int(ImGuiKey_KeypadEnter.rawValue)] = ImGuiKey(kVK_ANSI_KeypadEnter) keyMap[Int(ImGuiKey_A.rawValue)] = ImGuiKey(kVK_ANSI_A) keyMap[Int(ImGuiKey_C.rawValue)] = ImGuiKey(kVK_ANSI_C) keyMap[Int(ImGuiKey_V.rawValue)] = ImGuiKey(kVK_ANSI_V) @@ -486,3 +486,9 @@ class ImFocusObserver: NSObject { resetKeys() } } + +private extension ImGuiKey { + init(_ int: Int) { + self.init(rawValue: UInt32(int)) + } +} diff --git a/Sources/ImGui/ImGui+Definitions.swift b/Sources/ImGui/ImGui+Definitions.swift index 6e92a5e..c0c60a2 100644 --- a/Sources/ImGui/ImGui+Definitions.swift +++ b/Sources/ImGui/ImGui+Definitions.swift @@ -42,10 +42,18 @@ public typealias ImSpanAllocator = OpaquePointer igImBezierQuadraticCalc(pOut, p1, p2, p3, t) } +@inlinable public func ImBitArrayClearAllBits(_ arr: UnsafeMutablePointer!, _ bitcount: Int32) { + igImBitArrayClearAllBits(arr, bitcount) +} + @inlinable public func ImBitArrayClearBit(_ arr: UnsafeMutablePointer!, _ n: Int32) { igImBitArrayClearBit(arr, n) } +@inlinable public func ImBitArrayGetStorageSizeInBytes(_ bitcount: Int32) -> Int { + igImBitArrayGetStorageSizeInBytes(bitcount) +} + @inlinable public func ImBitArraySetBit(_ arr: UnsafeMutablePointer!, _ n: Int32) { igImBitArraySetBit(arr, n) } @@ -414,6 +422,10 @@ public typealias ImSpanAllocator = OpaquePointer ImDrawList__TryMergeDrawCmds(this) } +@inlinable public func ImExponentialMovingAverage(_ avg: Float, _ sample: Float, _ n: Int32) -> Float { + igImExponentialMovingAverage(avg, sample, n) +} + @inlinable @discardableResult public func ImFileClose(_ file: ImFileHandle) -> Bool { igImFileClose(file) } @@ -455,7 +467,11 @@ public typealias ImSpanAllocator = OpaquePointer } @inlinable public func ImFloorSigned(_ f: Float) -> Float { - igImFloorSigned(f) + igImFloorSigned_Float(f) +} + +@inlinable public func ImFloorSigned(_ pOut: UnsafeMutablePointer!, _ v: ImVec2) { + igImFloorSigned_Vec2(pOut, v) } @inlinable public func ImFontAddGlyph(_ this: UnsafeMutablePointer!, _ src_cfg: UnsafePointer!, _ c: ImWchar, _ x0: Float, _ y0: Float, _ x1: Float, _ y1: Float, _ u0: Float, _ v0: Float, _ u1: Float, _ v1: Float, _ advance_x: Float) { @@ -582,6 +598,10 @@ public typealias ImSpanAllocator = OpaquePointer ImFontAtlas_GetGlyphRangesDefault(this) } +@inlinable public func ImFontAtlasGetGlyphRangesGreek(_ this: UnsafeMutablePointer!) -> UnsafePointer! { + ImFontAtlas_GetGlyphRangesGreek(this) +} + @inlinable public func ImFontAtlasGetGlyphRangesJapanese(_ this: UnsafeMutablePointer!) -> UnsafePointer! { ImFontAtlas_GetGlyphRangesJapanese(this) } @@ -738,6 +758,10 @@ public typealias ImSpanAllocator = OpaquePointer igAddContextHook(context, hook) } +@inlinable public func ImGuiAddSettingsHandler(_ handler: UnsafePointer!) { + igAddSettingsHandler(handler) +} + @inlinable public func ImGuiAlignTextToFramePadding() { igAlignTextToFramePadding() } @@ -912,11 +936,11 @@ public typealias ImSpanAllocator = OpaquePointer } } -@inlinable public func ImGuiBeginTooltip() { +@inlinable @discardableResult public func ImGuiBeginTooltip() -> Bool { igBeginTooltip() } -@inlinable public func ImGuiBeginTooltipEx(_ tooltip_flags: ImGuiTooltipFlags, _ extra_window_flags: ImGuiWindowFlags) { +@inlinable @discardableResult public func ImGuiBeginTooltipEx(_ tooltip_flags: ImGuiTooltipFlags, _ extra_window_flags: ImGuiWindowFlags) -> Bool { igBeginTooltipEx(tooltip_flags, extra_window_flags) } @@ -1002,14 +1026,6 @@ public typealias ImSpanAllocator = OpaquePointer igCallContextHooks(context, type) } -@inlinable public func ImGuiCaptureKeyboardFromApp(_ want_capture_keyboard_value: Bool) { - igCaptureKeyboardFromApp(want_capture_keyboard_value) -} - -@inlinable public func ImGuiCaptureMouseFromApp(_ want_capture_mouse_value: Bool) { - igCaptureMouseFromApp(want_capture_mouse_value) -} - @inlinable @discardableResult public func ImGuiCheckbox(_ label: String? = nil, _ v: UnsafeMutablePointer!) -> Bool { label.withOptionalCString { labelPtr in igCheckbox(labelPtr, v) @@ -1052,6 +1068,12 @@ public typealias ImSpanAllocator = OpaquePointer igClearIniSettings() } +@inlinable public func ImGuiClearWindowSettings(_ name: String? = nil) { + name.withOptionalCString { namePtr in + igClearWindowSettings(namePtr) + } +} + @inlinable @discardableResult public func ImGuiCloseButton(_ id: ImGuiID, _ pos: ImVec2) -> Bool { igCloseButton(id, pos) } @@ -1186,6 +1208,14 @@ public typealias ImSpanAllocator = OpaquePointer } } +@inlinable public func ImGuiConvertShortcutMod(_ key_chord: ImGuiKeyChord) -> ImGuiKeyChord { + igConvertShortcutMod(key_chord) +} + +@inlinable public func ImGuiConvertSingleModFlagToKey(_ ctx: UnsafeMutablePointer!, _ key: ImGuiKey) -> ImGuiKey { + igConvertSingleModFlagToKey(ctx, key) +} + @inlinable public func ImGuiCreateContext(_ shared_font_atlas: UnsafeMutablePointer!) -> UnsafeMutablePointer! { igCreateContext(shared_font_atlas) } @@ -1196,20 +1226,18 @@ public typealias ImSpanAllocator = OpaquePointer } } -@inlinable public func ImGuiDataTypeApplyOp(_ data_type: ImGuiDataType, _ op: Int32, _ output: UnsafeMutableRawPointer!, _ arg_1: UnsafeRawPointer!, _ arg_2: UnsafeRawPointer!) { - igDataTypeApplyOp(data_type, op, output, arg_1, arg_2) -} - -@inlinable @discardableResult public func ImGuiDataTypeApplyOpFromText(_ buf: String? = nil, _ initial_value_buf: String? = nil, _ data_type: ImGuiDataType, _ p_data: UnsafeMutableRawPointer!, _ format: String? = nil) -> Bool { +@inlinable @discardableResult public func ImGuiDataTypeApplyFromText(_ buf: String? = nil, _ data_type: ImGuiDataType, _ p_data: UnsafeMutableRawPointer!, _ format: String? = nil) -> Bool { buf.withOptionalCString { bufPtr in - initial_value_buf.withOptionalCString { initial_value_bufPtr in - format.withOptionalCString { formatPtr in - igDataTypeApplyOpFromText(bufPtr, initial_value_bufPtr, data_type, p_data, formatPtr) - } + format.withOptionalCString { formatPtr in + igDataTypeApplyFromText(bufPtr, data_type, p_data, formatPtr) } } } +@inlinable public func ImGuiDataTypeApplyOp(_ data_type: ImGuiDataType, _ op: Int32, _ output: UnsafeMutableRawPointer!, _ arg_1: UnsafeRawPointer!, _ arg_2: UnsafeRawPointer!) { + igDataTypeApplyOp(data_type, op, output, arg_1, arg_2) +} + @inlinable @discardableResult public func ImGuiDataTypeClamp(_ data_type: ImGuiDataType, _ p_data: UnsafeMutableRawPointer!, _ p_min: UnsafeRawPointer!, _ p_max: UnsafeRawPointer!) -> Bool { igDataTypeClamp(data_type, p_data, p_min, p_max) } @@ -1230,6 +1258,10 @@ public typealias ImSpanAllocator = OpaquePointer igDataTypeGetInfo(data_type) } +@inlinable public func ImGuiDataVarInfoGetVarPtr(_ this: UnsafeMutablePointer!, _ parent: UnsafeMutableRawPointer!) -> UnsafeMutableRawPointer! { + ImGuiDataVarInfo_GetVarPtr(this, parent) +} + @inlinable @discardableResult public func ImGuiDebugCheckVersionAndDataLayout(_ version_str: String? = nil, _ sz_io: Int, _ sz_style: Int, _ sz_vec2: Int, _ sz_vec4: Int, _ sz_drawvert: Int, _ sz_drawidx: Int) -> Bool { version_str.withOptionalCString { version_strPtr in igDebugCheckVersionAndDataLayout(version_strPtr, sz_io, sz_style, sz_vec2, sz_vec4, sz_drawvert, sz_drawidx) @@ -1244,6 +1276,26 @@ public typealias ImSpanAllocator = OpaquePointer igDebugHookIdInfo(id, data_type, data_id, data_id_end) } +@inlinable public func ImGuiDebugLocateItem(_ target_id: ImGuiID) { + igDebugLocateItem(target_id) +} + +@inlinable public func ImGuiDebugLocateItemOnHover(_ target_id: ImGuiID) { + igDebugLocateItemOnHover(target_id) +} + +@inlinable public func ImGuiDebugLocateItemResolveWithLastItem() { + igDebugLocateItemResolveWithLastItem() +} + +@inlinable public func ImGuiDebugLogV(_ fmt: String? = nil, _ args: CVarArg...) { + fmt.withOptionalCString { fmtPtr in + withVaList(args) { varArgsPtr in + igDebugLogV(fmtPtr, varArgsPtr) + } + } +} + @inlinable public func ImGuiDebugNodeColumns(_ columns: UnsafeMutablePointer!) { igDebugNodeColumns(columns) } @@ -1262,6 +1314,14 @@ public typealias ImSpanAllocator = OpaquePointer igDebugNodeFont(font) } +@inlinable public func ImGuiDebugNodeFontGlyph(_ font: UnsafeMutablePointer!, _ glyph: UnsafePointer!) { + igDebugNodeFontGlyph(font, glyph) +} + +@inlinable public func ImGuiDebugNodeInputTextState(_ state: UnsafeMutablePointer!) { + igDebugNodeInputTextState(state) +} + @inlinable public func ImGuiDebugNodeStorage(_ storage: UnsafeMutablePointer!, _ label: String? = nil) { label.withOptionalCString { labelPtr in igDebugNodeStorage(storage, labelPtr) @@ -1302,6 +1362,10 @@ public typealias ImSpanAllocator = OpaquePointer } } +@inlinable public func ImGuiDebugRenderKeyboardPreview(_ draw_list: UnsafeMutablePointer!) { + igDebugRenderKeyboardPreview(draw_list) +} + @inlinable public func ImGuiDebugRenderViewportThumbnail(_ draw_list: UnsafeMutablePointer!, _ viewport: UnsafeMutablePointer!, _ bb: ImRect) { igDebugRenderViewportThumbnail(draw_list, viewport, bb) } @@ -1310,6 +1374,12 @@ public typealias ImSpanAllocator = OpaquePointer igDebugStartItemPicker() } +@inlinable public func ImGuiDebugTextEncoding(_ text: String? = nil) { + text.withOptionalCString { textPtr in + igDebugTextEncoding(textPtr) + } +} + @inlinable public func ImGuiDestroyContext(_ ctx: UnsafeMutablePointer!) { igDestroyContext(ctx) } @@ -1532,6 +1602,10 @@ public typealias ImSpanAllocator = OpaquePointer igErrorCheckEndWindowRecover(log_callback, user_data) } +@inlinable public func ImGuiErrorCheckUsingSetCursorPosToExtendParentBoundaries() { + igErrorCheckUsingSetCursorPosToExtendParentBoundaries() +} + @inlinable public func ImGuiFindBestWindowPosForPopup(_ pOut: UnsafeMutablePointer!, _ window: UnsafeMutablePointer!) { igFindBestWindowPosForPopup(pOut, window) } @@ -1548,12 +1622,6 @@ public typealias ImSpanAllocator = OpaquePointer igFindOrCreateColumns(window, id) } -@inlinable public func ImGuiFindOrCreateWindowSettings(_ name: String? = nil) -> UnsafeMutablePointer! { - name.withOptionalCString { namePtr in - igFindOrCreateWindowSettings(namePtr) - } -} - @inlinable public func ImGuiFindRenderedTextEnd(_ text: String? = nil, _ text_end: String? = nil) -> String? { text.withOptionalCString { textPtr in text_end.withOptionalCString { text_endPtr in @@ -1582,8 +1650,12 @@ public typealias ImSpanAllocator = OpaquePointer igFindWindowDisplayIndex(window) } -@inlinable public func ImGuiFindWindowSettings(_ id: ImGuiID) -> UnsafeMutablePointer! { - igFindWindowSettings(id) +@inlinable public func ImGuiFindWindowSettingsByID(_ id: ImGuiID) -> UnsafeMutablePointer! { + igFindWindowSettingsByID(id) +} + +@inlinable public func ImGuiFindWindowSettingsByWindow(_ window: UnsafeMutablePointer!) -> UnsafeMutablePointer! { + igFindWindowSettingsByWindow(window) } @inlinable public func ImGuiFocusTopMostWindowUnderOne(_ under_this_window: UnsafeMutablePointer!, _ ignore_window: UnsafeMutablePointer!) { @@ -1680,6 +1752,14 @@ public typealias ImSpanAllocator = OpaquePointer igGetCurrentContext() } +@inlinable public func ImGuiGetCurrentFocusScope() -> ImGuiID { + igGetCurrentFocusScope() +} + +@inlinable public func ImGuiGetCurrentTabBar() -> UnsafeMutablePointer! { + igGetCurrentTabBar() +} + @inlinable public func ImGuiGetCurrentTable() -> UnsafeMutablePointer! { igGetCurrentTable() } @@ -1732,14 +1812,6 @@ public typealias ImSpanAllocator = OpaquePointer igGetFocusID() } -@inlinable public func ImGuiGetFocusScope() -> ImGuiID { - igGetFocusScope() -} - -@inlinable public func ImGuiGetFocusedFocusScope() -> ImGuiID { - igGetFocusedFocusScope() -} - @inlinable public func ImGuiGetFont() -> UnsafeMutablePointer! { igGetFont() } @@ -1801,11 +1873,15 @@ public typealias ImSpanAllocator = OpaquePointer @inlinable public func ImGuiGetIDWithSeed(_ str_id_begin: String? = nil, _ str_id_end: String? = nil, _ seed: ImGuiID) -> ImGuiID { str_id_begin.withOptionalCString { str_id_beginPtr in str_id_end.withOptionalCString { str_id_endPtr in - igGetIDWithSeed(str_id_beginPtr, str_id_endPtr, seed) + igGetIDWithSeed_Str(str_id_beginPtr, str_id_endPtr, seed) } } } +@inlinable public func ImGuiGetIDWithSeed(_ n: Int32, _ seed: ImGuiID) -> ImGuiID { + igGetIDWithSeed_Int(n, seed) +} + @inlinable public func ImGuiGetIO() -> UnsafeMutablePointer! { igGetIO() } @@ -1838,20 +1914,46 @@ public typealias ImSpanAllocator = OpaquePointer igGetItemStatusFlags() } -@inlinable public func ImGuiGetKeyIndex(_ imgui_key: ImGuiKey) -> Int32 { - igGetKeyIndex(imgui_key) +@inlinable public func ImGuiGetKeyChordName(_ key_chord: ImGuiKeyChord, _ out_buf: inout String?, _ out_buf_size: Int32) { + out_buf.withOptionalCString { out_bufPtr in + igGetKeyChordName(key_chord, UnsafeMutablePointer(mutating: out_bufPtr), out_buf_size) + } } -@inlinable public func ImGuiGetKeyPressedAmount(_ key_index: Int32, _ repeat_delay: Float, _ rate: Float) -> Int32 { - igGetKeyPressedAmount(key_index, repeat_delay, rate) +@inlinable public func ImGuiGetKeyData(_ ctx: UnsafeMutablePointer!, _ key: ImGuiKey) -> UnsafeMutablePointer! { + igGetKeyData_ContextPtr(ctx, key) } -@inlinable public func ImGuiGetMainViewport() -> UnsafeMutablePointer! { - igGetMainViewport() +@inlinable public func ImGuiGetKeyData(_ key: ImGuiKey) -> UnsafeMutablePointer! { + igGetKeyData_Key(key) +} + +@inlinable public func ImGuiGetKeyIndex(_ key: ImGuiKey) -> ImGuiKey { + igGetKeyIndex(key) +} + +@inlinable public func ImGuiGetKeyMagnitude2d(_ pOut: UnsafeMutablePointer!, _ key_left: ImGuiKey, _ key_right: ImGuiKey, _ key_up: ImGuiKey, _ key_down: ImGuiKey) { + igGetKeyMagnitude2d(pOut, key_left, key_right, key_up, key_down) } -@inlinable public func ImGuiGetMergedKeyModFlags() -> ImGuiKeyModFlags { - igGetMergedKeyModFlags() +@inlinable public func ImGuiGetKeyName(_ key: ImGuiKey) -> String? { + String(cString: igGetKeyName(key)) +} + +@inlinable public func ImGuiGetKeyOwner(_ key: ImGuiKey) -> ImGuiID { + igGetKeyOwner(key) +} + +@inlinable public func ImGuiGetKeyOwnerData(_ ctx: UnsafeMutablePointer!, _ key: ImGuiKey) -> UnsafeMutablePointer! { + igGetKeyOwnerData(ctx, key) +} + +@inlinable public func ImGuiGetKeyPressedAmount(_ key: ImGuiKey, _ repeat_delay: Float, _ rate: Float) -> Int32 { + igGetKeyPressedAmount(key, repeat_delay, rate) +} + +@inlinable public func ImGuiGetMainViewport() -> UnsafeMutablePointer! { + igGetMainViewport() } @inlinable public func ImGuiGetMouseClickedCount(_ button: ImGuiMouseButton) -> Int32 { @@ -1874,12 +1976,8 @@ public typealias ImSpanAllocator = OpaquePointer igGetMousePosOnOpeningCurrentPopup(pOut) } -@inlinable public func ImGuiGetNavInputAmount(_ n: ImGuiNavInput, _ mode: ImGuiInputReadMode) -> Float { - igGetNavInputAmount(n, mode) -} - -@inlinable public func ImGuiGetNavInputAmount2d(_ pOut: UnsafeMutablePointer!, _ dir_sources: ImGuiNavDirSourceFlags, _ mode: ImGuiInputReadMode, _ slow_factor: Float, _ fast_factor: Float) { - igGetNavInputAmount2d(pOut, dir_sources, mode, slow_factor, fast_factor) +@inlinable public func ImGuiGetNavTweakPressedAmount(_ axis: ImGuiAxis) -> Float { + igGetNavTweakPressedAmount(axis) } @inlinable public func ImGuiGetPopupAllowedExtentRect(_ pOut: UnsafeMutablePointer!, _ window: UnsafeMutablePointer!) { @@ -1902,6 +2000,10 @@ public typealias ImSpanAllocator = OpaquePointer igGetScrollY() } +@inlinable public func ImGuiGetShortcutRoutingData(_ key_chord: ImGuiKeyChord) -> UnsafeMutablePointer! { + igGetShortcutRoutingData(key_chord) +} + @inlinable public func ImGuiGetStateStorage() -> UnsafeMutablePointer! { igGetStateStorage() } @@ -1918,6 +2020,10 @@ public typealias ImSpanAllocator = OpaquePointer igGetStyleColorVec4(idx) } +@inlinable public func ImGuiGetStyleVarInfo(_ idx: ImGuiStyleVar) -> UnsafePointer! { + igGetStyleVarInfo(idx) +} + @inlinable public func ImGuiGetTextLineHeight() -> Float { igGetTextLineHeight() } @@ -1942,6 +2048,10 @@ public typealias ImSpanAllocator = OpaquePointer igGetTreeNodeToLabelSpacing() } +@inlinable public func ImGuiGetTypematicRepeatRate(_ flags: ImGuiInputFlags, _ repeat_delay: UnsafeMutablePointer!, _ repeat_rate: UnsafeMutablePointer!) { + igGetTypematicRepeatRate(flags, repeat_delay, repeat_rate) +} + @inlinable public func ImGuiGetVersion() -> String? { String(cString: igGetVersion()) } @@ -2008,6 +2118,30 @@ public typealias ImSpanAllocator = OpaquePointer } } +@inlinable public func ImGuiIOAddKeyAnalogEvent(_ this: UnsafeMutablePointer!, _ key: ImGuiKey, _ down: Bool, _ v: Float) { + ImGuiIO_AddKeyAnalogEvent(this, key, down, v) +} + +@inlinable public func ImGuiIOAddKeyEvent(_ this: UnsafeMutablePointer!, _ key: ImGuiKey, _ down: Bool) { + ImGuiIO_AddKeyEvent(this, key, down) +} + +@inlinable public func ImGuiIOAddMouseButtonEvent(_ this: UnsafeMutablePointer!, _ button: Int32, _ down: Bool) { + ImGuiIO_AddMouseButtonEvent(this, button, down) +} + +@inlinable public func ImGuiIOAddMousePosEvent(_ this: UnsafeMutablePointer!, _ x: Float, _ y: Float) { + ImGuiIO_AddMousePosEvent(this, x, y) +} + +@inlinable public func ImGuiIOAddMouseSourceEvent(_ this: UnsafeMutablePointer!, _ source: ImGuiMouseSource) { + ImGuiIO_AddMouseSourceEvent(this, source) +} + +@inlinable public func ImGuiIOAddMouseWheelEvent(_ this: UnsafeMutablePointer!, _ wheel_x: Float, _ wheel_y: Float) { + ImGuiIO_AddMouseWheelEvent(this, wheel_x, wheel_y) +} + @inlinable public func ImGuiIOClearInputCharacters(_ this: UnsafeMutablePointer!) { ImGuiIO_ClearInputCharacters(this) } @@ -2016,24 +2150,34 @@ public typealias ImSpanAllocator = OpaquePointer ImGuiIO_ClearInputKeys(this) } +@inlinable public func ImGuiIOSetAppAcceptingEvents(_ this: UnsafeMutablePointer!, _ accepting_events: Bool) { + ImGuiIO_SetAppAcceptingEvents(this, accepting_events) +} + +@inlinable public func ImGuiIOSetKeyEventNativeData(_ this: UnsafeMutablePointer!, _ key: ImGuiKey, _ native_keycode: Int32, _ native_scancode: Int32, _ native_legacy_index: Int32) { + ImGuiIO_SetKeyEventNativeData(this, key, native_keycode, native_scancode, native_legacy_index) +} + @inlinable public func ImGuiImage(_ user_texture_id: ImTextureID, _ size: ImVec2, _ uv0: ImVec2, _ uv1: ImVec2, _ tint_col: ImVec4, _ border_col: ImVec4) { igImage(user_texture_id, size, uv0, uv1, tint_col, border_col) } -@inlinable @discardableResult public func ImGuiImageButton(_ user_texture_id: ImTextureID, _ size: ImVec2, _ uv0: ImVec2, _ uv1: ImVec2, _ frame_padding: Int32, _ bg_col: ImVec4, _ tint_col: ImVec4) -> Bool { - igImageButton(user_texture_id, size, uv0, uv1, frame_padding, bg_col, tint_col) +@inlinable @discardableResult public func ImGuiImageButton(_ str_id: String? = nil, _ user_texture_id: ImTextureID, _ size: ImVec2, _ uv0: ImVec2, _ uv1: ImVec2, _ bg_col: ImVec4, _ tint_col: ImVec4) -> Bool { + str_id.withOptionalCString { str_idPtr in + igImageButton(str_idPtr, user_texture_id, size, uv0, uv1, bg_col, tint_col) + } } -@inlinable @discardableResult public func ImGuiImageButtonEx(_ id: ImGuiID, _ texture_id: ImTextureID, _ size: ImVec2, _ uv0: ImVec2, _ uv1: ImVec2, _ padding: ImVec2, _ bg_col: ImVec4, _ tint_col: ImVec4) -> Bool { - igImageButtonEx(id, texture_id, size, uv0, uv1, padding, bg_col, tint_col) +@inlinable @discardableResult public func ImGuiImageButtonEx(_ id: ImGuiID, _ texture_id: ImTextureID, _ size: ImVec2, _ uv0: ImVec2, _ uv1: ImVec2, _ bg_col: ImVec4, _ tint_col: ImVec4, _ flags: ImGuiButtonFlags) -> Bool { + igImageButtonEx(id, texture_id, size, uv0, uv1, bg_col, tint_col, flags) } @inlinable public func ImGuiIndent(_ indent_w: Float) { igIndent(indent_w) } -@inlinable public func ImGuiInitialize(_ context: UnsafeMutablePointer!) { - igInitialize(context) +@inlinable public func ImGuiInitialize() { + igInitialize() } @inlinable @discardableResult public func ImGuiInputDouble(_ label: String? = nil, _ v: UnsafeMutablePointer!, _ step: Double, _ step_fast: Double, _ format: String? = nil, _ flags: ImGuiInputTextFlags) -> Bool { @@ -2172,6 +2316,14 @@ public typealias ImSpanAllocator = OpaquePointer ImGuiInputTextCallbackData_SelectAll(this) } +@inlinable public func ImGuiInputTextDeactivateHook(_ id: ImGuiID) { + igInputTextDeactivateHook(id) +} + +@inlinable public func ImGuiInputTextDeactivatedStateClearFreeMemory(_ this: UnsafeMutablePointer!) { + ImGuiInputTextDeactivatedState_ClearFreeMemory(this) +} + @inlinable @discardableResult public func ImGuiInputTextEx(_ label: String? = nil, _ hint: String? = nil, _ buf: inout String?, _ buf_size: Int32, _ size_arg: ImVec2, _ flags: ImGuiInputTextFlags, _ callback: @escaping ImGuiInputTextCallback, _ user_data: UnsafeMutableRawPointer!) -> Bool { label.withOptionalCString { labelPtr in hint.withOptionalCString { hintPtr in @@ -2258,16 +2410,12 @@ public typealias ImSpanAllocator = OpaquePointer } } -@inlinable @discardableResult public func ImGuiIsActiveIdUsingKey(_ key: ImGuiKey) -> Bool { - igIsActiveIdUsingKey(key) -} - @inlinable @discardableResult public func ImGuiIsActiveIdUsingNavDir(_ dir: ImGuiDir) -> Bool { igIsActiveIdUsingNavDir(dir) } -@inlinable @discardableResult public func ImGuiIsActiveIdUsingNavInput(_ input: ImGuiNavInput) -> Bool { - igIsActiveIdUsingNavInput(input) +@inlinable @discardableResult public func ImGuiIsAliasKey(_ key: ImGuiKey) -> Bool { + igIsAliasKey(key) } @inlinable @discardableResult public func ImGuiIsAnyItemActive() -> Bool { @@ -2290,10 +2438,18 @@ public typealias ImSpanAllocator = OpaquePointer igIsClippedEx(bb, id) } +@inlinable @discardableResult public func ImGuiIsDragDropActive() -> Bool { + igIsDragDropActive() +} + @inlinable @discardableResult public func ImGuiIsDragDropPayloadBeingAccepted() -> Bool { igIsDragDropPayloadBeingAccepted() } +@inlinable @discardableResult public func ImGuiIsGamepadKey(_ key: ImGuiKey) -> Bool { + igIsGamepadKey(key) +} + @inlinable @discardableResult public func ImGuiIsItemActivated() -> Bool { igIsItemActivated() } @@ -2338,24 +2494,48 @@ public typealias ImSpanAllocator = OpaquePointer igIsItemVisible() } -@inlinable @discardableResult public func ImGuiIsKeyDown(_ user_key_index: Int32) -> Bool { - igIsKeyDown(user_key_index) +@inlinable @discardableResult public func ImGuiIsKeyDown(_ key: ImGuiKey) -> Bool { + igIsKeyDown_Nil(key) +} + +@inlinable @discardableResult public func ImGuiIsKeyDown(_ key: ImGuiKey, _ owner_id: ImGuiID) -> Bool { + igIsKeyDown_ID(key, owner_id) } -@inlinable @discardableResult public func ImGuiIsKeyPressed(_ user_key_index: Int32, _ repeat: Bool) -> Bool { - igIsKeyPressed(user_key_index, `repeat`) +@inlinable @discardableResult public func ImGuiIsKeyPressed(_ key: ImGuiKey, _ repeat: Bool) -> Bool { + igIsKeyPressed_Bool(key, `repeat`) +} + +@inlinable @discardableResult public func ImGuiIsKeyPressed(_ key: ImGuiKey, _ owner_id: ImGuiID, _ flags: ImGuiInputFlags) -> Bool { + igIsKeyPressed_ID(key, owner_id, flags) } @inlinable @discardableResult public func ImGuiIsKeyPressedMap(_ key: ImGuiKey, _ repeat: Bool) -> Bool { igIsKeyPressedMap(key, `repeat`) } -@inlinable @discardableResult public func ImGuiIsKeyReleased(_ user_key_index: Int32) -> Bool { - igIsKeyReleased(user_key_index) +@inlinable @discardableResult public func ImGuiIsKeyReleased(_ key: ImGuiKey) -> Bool { + igIsKeyReleased_Nil(key) +} + +@inlinable @discardableResult public func ImGuiIsKeyReleased(_ key: ImGuiKey, _ owner_id: ImGuiID) -> Bool { + igIsKeyReleased_ID(key, owner_id) +} + +@inlinable @discardableResult public func ImGuiIsKeyboardKey(_ key: ImGuiKey) -> Bool { + igIsKeyboardKey(key) +} + +@inlinable @discardableResult public func ImGuiIsLegacyKey(_ key: ImGuiKey) -> Bool { + igIsLegacyKey(key) } @inlinable @discardableResult public func ImGuiIsMouseClicked(_ button: ImGuiMouseButton, _ repeat: Bool) -> Bool { - igIsMouseClicked(button, `repeat`) + igIsMouseClicked_Bool(button, `repeat`) +} + +@inlinable @discardableResult public func ImGuiIsMouseClicked(_ button: ImGuiMouseButton, _ owner_id: ImGuiID, _ flags: ImGuiInputFlags) -> Bool { + igIsMouseClicked_ID(button, owner_id, flags) } @inlinable @discardableResult public func ImGuiIsMouseDoubleClicked(_ button: ImGuiMouseButton) -> Bool { @@ -2363,7 +2543,11 @@ public typealias ImSpanAllocator = OpaquePointer } @inlinable @discardableResult public func ImGuiIsMouseDown(_ button: ImGuiMouseButton) -> Bool { - igIsMouseDown(button) + igIsMouseDown_Nil(button) +} + +@inlinable @discardableResult public func ImGuiIsMouseDown(_ button: ImGuiMouseButton, _ owner_id: ImGuiID) -> Bool { + igIsMouseDown_ID(button, owner_id) } @inlinable @discardableResult public func ImGuiIsMouseDragPastThreshold(_ button: ImGuiMouseButton, _ lock_threshold: Float) -> Bool { @@ -2378,20 +2562,28 @@ public typealias ImSpanAllocator = OpaquePointer igIsMouseHoveringRect(r_min, r_max, clip) } +@inlinable @discardableResult public func ImGuiIsMouseKey(_ key: ImGuiKey) -> Bool { + igIsMouseKey(key) +} + @inlinable @discardableResult public func ImGuiIsMousePosValid(_ mouse_pos: UnsafePointer!) -> Bool { igIsMousePosValid(mouse_pos) } @inlinable @discardableResult public func ImGuiIsMouseReleased(_ button: ImGuiMouseButton) -> Bool { - igIsMouseReleased(button) + igIsMouseReleased_Nil(button) } -@inlinable @discardableResult public func ImGuiIsNavInputDown(_ n: ImGuiNavInput) -> Bool { - igIsNavInputDown(n) +@inlinable @discardableResult public func ImGuiIsMouseReleased(_ button: ImGuiMouseButton, _ owner_id: ImGuiID) -> Bool { + igIsMouseReleased_ID(button, owner_id) } -@inlinable @discardableResult public func ImGuiIsNavInputTest(_ n: ImGuiNavInput, _ rm: ImGuiInputReadMode) -> Bool { - igIsNavInputTest(n, rm) +@inlinable @discardableResult public func ImGuiIsNamedKey(_ key: ImGuiKey) -> Bool { + igIsNamedKey(key) +} + +@inlinable @discardableResult public func ImGuiIsNamedKeyOrModKey(_ key: ImGuiKey) -> Bool { + igIsNamedKeyOrModKey(key) } @inlinable @discardableResult public func ImGuiIsPopupOpen(_ str_id: String? = nil, _ flags: ImGuiPopupFlags) -> Bool { @@ -2428,6 +2620,10 @@ public typealias ImSpanAllocator = OpaquePointer igIsWindowCollapsed() } +@inlinable @discardableResult public func ImGuiIsWindowContentHoverable(_ window: UnsafeMutablePointer!, _ flags: ImGuiHoveredFlags) -> Bool { + igIsWindowContentHoverable(window, flags) +} + @inlinable @discardableResult public func ImGuiIsWindowFocused(_ flags: ImGuiFocusedFlags) -> Bool { igIsWindowFocused(flags) } @@ -2464,6 +2660,10 @@ public typealias ImSpanAllocator = OpaquePointer igKeepAliveID(id) } +@inlinable public func ImGuiKeyRoutingTableClear(_ this: UnsafeMutablePointer!) { + ImGuiKeyRoutingTable_Clear(this) +} + @inlinable public func ImGuiLabelTextV(_ label: String? = nil, _ fmt: String? = nil, _ args: CVarArg...) { label.withOptionalCString { labelPtr in fmt.withOptionalCString { fmtPtr in @@ -2522,6 +2722,14 @@ public typealias ImSpanAllocator = OpaquePointer } } +@inlinable public func ImGuiLocalizeGetMsg(_ key: ImGuiLocKey) -> String? { + String(cString: igLocalizeGetMsg(key)) +} + +@inlinable public func ImGuiLocalizeRegisterEntries(_ entries: UnsafePointer!, _ count: Int32) { + igLocalizeRegisterEntries(entries, count) +} + @inlinable public func ImGuiLogBegin(_ type: ImGuiLogType, _ auto_open_depth: Int32) { igLogBegin(type, auto_open_depth) } @@ -2634,6 +2842,10 @@ public typealias ImSpanAllocator = OpaquePointer } } +@inlinable public func ImGuiMouseButtonToKey(_ button: ImGuiMouseButton) -> ImGuiKey { + igMouseButtonToKey(button) +} + @inlinable public func ImGuiNavInitRequestApplyResult() { igNavInitRequestApplyResult() } @@ -2748,10 +2960,6 @@ public typealias ImSpanAllocator = OpaquePointer } } -@inlinable public func ImGuiPopAllowKeyboardFocus() { - igPopAllowKeyboardFocus() -} - @inlinable public func ImGuiPopButtonRepeat() { igPopButtonRepeat() } @@ -2792,6 +3000,10 @@ public typealias ImSpanAllocator = OpaquePointer igPopStyleVar(count) } +@inlinable public func ImGuiPopTabStop() { + igPopTabStop() +} + @inlinable public func ImGuiPopTextWrapPos() { igPopTextWrapPos() } @@ -2802,10 +3014,6 @@ public typealias ImSpanAllocator = OpaquePointer } } -@inlinable public func ImGuiPushAllowKeyboardFocus(_ allow_keyboard_focus: Bool) { - igPushAllowKeyboardFocus(allow_keyboard_focus) -} - @inlinable public func ImGuiPushButtonRepeat(_ repeat: Bool) { igPushButtonRepeat(`repeat`) } @@ -2884,6 +3092,10 @@ public typealias ImSpanAllocator = OpaquePointer igPushStyleVar_Vec2(idx, val) } +@inlinable public func ImGuiPushTabStop(_ tab_stop: Bool) { + igPushTabStop(tab_stop) +} + @inlinable public func ImGuiPushTextWrapPos(_ wrap_local_pos_x: Float) { igPushTextWrapPos(wrap_local_pos_x) } @@ -2904,6 +3116,12 @@ public typealias ImSpanAllocator = OpaquePointer igRemoveContextHook(context, hook_to_remove) } +@inlinable public func ImGuiRemoveSettingsHandler(_ type_name: String? = nil) { + type_name.withOptionalCString { type_namePtr in + igRemoveSettingsHandler(type_namePtr) + } +} + @inlinable public func ImGuiRender() { igRender() } @@ -2928,6 +3146,10 @@ public typealias ImSpanAllocator = OpaquePointer igRenderColorRectWithAlphaCheckerboard(draw_list, p_min, p_max, fill_col, grid_step, grid_off, rounding, flags) } +@inlinable public func ImGuiRenderDragDropTargetRect(_ bb: ImRect) { + igRenderDragDropTargetRect(bb) +} + @inlinable public func ImGuiRenderFrame(_ p_min: ImVec2, _ p_max: ImVec2, _ fill_col: ImU32, _ border: Bool, _ rounding: Float) { igRenderFrame(p_min, p_max, fill_col, border, rounding) } @@ -2936,8 +3158,8 @@ public typealias ImSpanAllocator = OpaquePointer igRenderFrameBorder(p_min, p_max, rounding) } -@inlinable public func ImGuiRenderMouseCursor(_ draw_list: UnsafeMutablePointer!, _ pos: ImVec2, _ scale: Float, _ mouse_cursor: ImGuiMouseCursor, _ col_fill: ImU32, _ col_border: ImU32, _ col_shadow: ImU32) { - igRenderMouseCursor(draw_list, pos, scale, mouse_cursor, col_fill, col_border, col_shadow) +@inlinable public func ImGuiRenderMouseCursor(_ pos: ImVec2, _ scale: Float, _ mouse_cursor: ImGuiMouseCursor, _ col_fill: ImU32, _ col_border: ImU32, _ col_shadow: ImU32) { + igRenderMouseCursor(pos, scale, mouse_cursor, col_fill, col_border, col_shadow) } @inlinable public func ImGuiRenderNavHighlight(_ bb: ImRect, _ id: ImGuiID, _ flags: ImGuiNavHighlightFlags) { @@ -3054,12 +3276,26 @@ public typealias ImSpanAllocator = OpaquePointer igSeparatorEx(flags) } +@inlinable public func ImGuiSeparatorText(_ label: String? = nil) { + label.withOptionalCString { labelPtr in + igSeparatorText(labelPtr) + } +} + +@inlinable public func ImGuiSeparatorTextEx(_ id: ImGuiID, _ label: String? = nil, _ label_end: String? = nil, _ extra_width: Float) { + label.withOptionalCString { labelPtr in + label_end.withOptionalCString { label_endPtr in + igSeparatorTextEx(id, labelPtr, label_endPtr, extra_width) + } + } +} + @inlinable public func ImGuiSetActiveID(_ id: ImGuiID, _ window: UnsafeMutablePointer!) { igSetActiveID(id, window) } -@inlinable public func ImGuiSetActiveIdUsingNavAndKeys() { - igSetActiveIdUsingNavAndKeys() +@inlinable public func ImGuiSetActiveIdUsingAllKeyboardKeys() { + igSetActiveIdUsingAllKeyboardKeys() } @inlinable public func ImGuiSetClipboardText(_ text: String? = nil) { @@ -3126,8 +3362,16 @@ public typealias ImSpanAllocator = OpaquePointer igSetItemDefaultFocus() } -@inlinable public func ImGuiSetItemUsingMouseWheel() { - igSetItemUsingMouseWheel() +@inlinable public func ImGuiSetItemKeyOwner(_ key: ImGuiKey, _ flags: ImGuiInputFlags) { + igSetItemKeyOwner(key, flags) +} + +@inlinable public func ImGuiSetKeyOwner(_ key: ImGuiKey, _ owner_id: ImGuiID, _ flags: ImGuiInputFlags) { + igSetKeyOwner(key, owner_id, flags) +} + +@inlinable public func ImGuiSetKeyOwnersForKeyChord(_ key: ImGuiKeyChord, _ owner_id: ImGuiID, _ flags: ImGuiInputFlags) { + igSetKeyOwnersForKeyChord(key, owner_id, flags) } @inlinable public func ImGuiSetKeyboardFocusHere(_ offset: Int32) { @@ -3146,6 +3390,18 @@ public typealias ImSpanAllocator = OpaquePointer igSetNavID(id, nav_layer, focus_scope_id, rect_rel) } +@inlinable public func ImGuiSetNavWindow(_ window: UnsafeMutablePointer!) { + igSetNavWindow(window) +} + +@inlinable public func ImGuiSetNextFrameWantCaptureKeyboard(_ want_capture_keyboard: Bool) { + igSetNextFrameWantCaptureKeyboard(want_capture_keyboard) +} + +@inlinable public func ImGuiSetNextFrameWantCaptureMouse(_ want_capture_mouse: Bool) { + igSetNextFrameWantCaptureMouse(want_capture_mouse) +} + @inlinable public func ImGuiSetNextItemOpen(_ is_open: Bool, _ cond: ImGuiCond) { igSetNextItemOpen(is_open, cond) } @@ -3226,6 +3482,10 @@ public typealias ImSpanAllocator = OpaquePointer igSetScrollY_WindowPtr(window, scroll_y) } +@inlinable @discardableResult public func ImGuiSetShortcutRouting(_ key_chord: ImGuiKeyChord, _ owner_id: ImGuiID, _ flags: ImGuiInputFlags) -> Bool { + igSetShortcutRouting(key_chord, owner_id, flags) +} + @inlinable public func ImGuiSetStateStorage(_ storage: UnsafeMutablePointer!) { igSetStateStorage(storage) } @@ -3276,6 +3536,10 @@ public typealias ImSpanAllocator = OpaquePointer igSetWindowFontScale(scale) } +@inlinable public func ImGuiSetWindowHiddendAndSkipItemsForCurrentFrame(_ window: UnsafeMutablePointer!) { + igSetWindowHiddendAndSkipItemsForCurrentFrame(window) +} + @inlinable public func ImGuiSetWindowHitTestHole(_ window: UnsafeMutablePointer!, _ pos: ImVec2, _ size: ImVec2) { igSetWindowHitTestHole(window, pos, size) } @@ -3308,6 +3572,10 @@ public typealias ImSpanAllocator = OpaquePointer igSetWindowSize_WindowPtr(window, size, cond) } +@inlinable public func ImGuiSetWindowViewport(_ window: UnsafeMutablePointer!, _ viewport: UnsafeMutablePointer!) { + igSetWindowViewport(window, viewport) +} + @inlinable public func ImGuiShadeVertsLinearColorGradientKeepAlpha(_ draw_list: UnsafeMutablePointer!, _ vert_start_idx: Int32, _ vert_end_idx: Int32, _ gradient_p0: ImVec2, _ gradient_p1: ImVec2, _ col0: ImU32, _ col1: ImU32) { igShadeVertsLinearColorGradientKeepAlpha(draw_list, vert_start_idx, vert_end_idx, gradient_p0, gradient_p1, col0, col1) } @@ -3316,10 +3584,18 @@ public typealias ImSpanAllocator = OpaquePointer igShadeVertsLinearUV(draw_list, vert_start_idx, vert_end_idx, a, b, uv_a, uv_b, clamp) } +@inlinable @discardableResult public func ImGuiShortcut(_ key_chord: ImGuiKeyChord, _ owner_id: ImGuiID, _ flags: ImGuiInputFlags) -> Bool { + igShortcut(key_chord, owner_id, flags) +} + @inlinable public func ImGuiShowAboutWindow(_ p_open: UnsafeMutablePointer!) { igShowAboutWindow(p_open) } +@inlinable public func ImGuiShowDebugLogWindow(_ p_open: UnsafeMutablePointer!) { + igShowDebugLogWindow(p_open) +} + @inlinable public func ImGuiShowDemoWindow(_ p_open: UnsafeMutablePointer!) { igShowDemoWindow(p_open) } @@ -3360,8 +3636,8 @@ public typealias ImSpanAllocator = OpaquePointer igShrinkWidths(items, count, width_excess) } -@inlinable public func ImGuiShutdown(_ context: UnsafeMutablePointer!) { - igShutdown(context) +@inlinable public func ImGuiShutdown() { + igShutdown() } @inlinable @discardableResult public func ImGuiSliderAngle(_ label: String? = nil, _ v_rad: UnsafeMutablePointer!, _ v_degrees_min: Float, _ v_degrees_max: Float, _ format: String? = nil, _ flags: ImGuiSliderFlags) -> Bool { @@ -3492,16 +3768,16 @@ public typealias ImSpanAllocator = OpaquePointer igSpacing() } -@inlinable @discardableResult public func ImGuiSplitterBehavior(_ bb: ImRect, _ id: ImGuiID, _ axis: ImGuiAxis, _ size1: UnsafeMutablePointer!, _ size2: UnsafeMutablePointer!, _ min_size1: Float, _ min_size2: Float, _ hover_extend: Float, _ hover_visibility_delay: Float) -> Bool { - igSplitterBehavior(bb, id, axis, size1, size2, min_size1, min_size2, hover_extend, hover_visibility_delay) +@inlinable @discardableResult public func ImGuiSplitterBehavior(_ bb: ImRect, _ id: ImGuiID, _ axis: ImGuiAxis, _ size1: UnsafeMutablePointer!, _ size2: UnsafeMutablePointer!, _ min_size1: Float, _ min_size2: Float, _ hover_extend: Float, _ hover_visibility_delay: Float, _ bg_col: ImU32) -> Bool { + igSplitterBehavior(bb, id, axis, size1, size2, min_size1, min_size2, hover_extend, hover_visibility_delay, bg_col) } -@inlinable public func ImGuiStackSizesCompareWithCurrentState(_ this: UnsafeMutablePointer!) { - ImGuiStackSizes_CompareWithCurrentState(this) +@inlinable public func ImGuiStackSizesCompareWithContextState(_ this: UnsafeMutablePointer!, _ ctx: UnsafeMutablePointer!) { + ImGuiStackSizes_CompareWithContextState(this, ctx) } -@inlinable public func ImGuiStackSizesSetToCurrentState(_ this: UnsafeMutablePointer!) { - ImGuiStackSizes_SetToCurrentState(this) +@inlinable public func ImGuiStackSizesSetToContextState(_ this: UnsafeMutablePointer!, _ ctx: UnsafeMutablePointer!) { + ImGuiStackSizes_SetToContextState(this, ctx) } @inlinable public func ImGuiStartMouseMovingWindow(_ window: UnsafeMutablePointer!) { @@ -3588,23 +3864,35 @@ public typealias ImSpanAllocator = OpaquePointer igTabBarFindTabByID(tab_bar, tab_id) } -@inlinable public func ImGuiTabBarGetTabName(_ this: UnsafeMutablePointer!, _ tab: UnsafePointer!) -> String? { - String(cString: ImGuiTabBar_GetTabName(this, tab)) +@inlinable public func ImGuiTabBarFindTabByOrder(_ tab_bar: UnsafeMutablePointer!, _ order: Int32) -> UnsafeMutablePointer! { + igTabBarFindTabByOrder(tab_bar, order) +} + +@inlinable public func ImGuiTabBarGetCurrentTab(_ tab_bar: UnsafeMutablePointer!) -> UnsafeMutablePointer! { + igTabBarGetCurrentTab(tab_bar) } -@inlinable public func ImGuiTabBarGetTabOrder(_ this: UnsafeMutablePointer!, _ tab: UnsafePointer!) -> Int32 { - ImGuiTabBar_GetTabOrder(this, tab) +@inlinable public func ImGuiTabBarGetTabName(_ tab_bar: UnsafeMutablePointer!, _ tab: UnsafeMutablePointer!) -> String? { + String(cString: igTabBarGetTabName(tab_bar, tab)) +} + +@inlinable public func ImGuiTabBarGetTabOrder(_ tab_bar: UnsafeMutablePointer!, _ tab: UnsafeMutablePointer!) -> Int32 { + igTabBarGetTabOrder(tab_bar, tab) } @inlinable @discardableResult public func ImGuiTabBarProcessReorder(_ tab_bar: UnsafeMutablePointer!) -> Bool { igTabBarProcessReorder(tab_bar) } -@inlinable public func ImGuiTabBarQueueReorder(_ tab_bar: UnsafeMutablePointer!, _ tab: UnsafePointer!, _ offset: Int32) { +@inlinable public func ImGuiTabBarQueueFocus(_ tab_bar: UnsafeMutablePointer!, _ tab: UnsafeMutablePointer!) { + igTabBarQueueFocus(tab_bar, tab) +} + +@inlinable public func ImGuiTabBarQueueReorder(_ tab_bar: UnsafeMutablePointer!, _ tab: UnsafeMutablePointer!, _ offset: Int32) { igTabBarQueueReorder(tab_bar, tab, offset) } -@inlinable public func ImGuiTabBarQueueReorderFromMousePos(_ tab_bar: UnsafeMutablePointer!, _ tab: UnsafePointer!, _ mouse_pos: ImVec2) { +@inlinable public func ImGuiTabBarQueueReorderFromMousePos(_ tab_bar: UnsafeMutablePointer!, _ tab: UnsafeMutablePointer!, _ mouse_pos: ImVec2) { igTabBarQueueReorderFromMousePos(tab_bar, tab, mouse_pos) } @@ -3622,15 +3910,19 @@ public typealias ImSpanAllocator = OpaquePointer } } -@inlinable public func ImGuiTabItemCalcSize(_ pOut: UnsafeMutablePointer!, _ label: String? = nil, _ has_close_button: Bool) { +@inlinable public func ImGuiTabItemCalcSize(_ pOut: UnsafeMutablePointer!, _ label: String? = nil, _ has_close_button_or_unsaved_marker: Bool) { label.withOptionalCString { labelPtr in - igTabItemCalcSize(pOut, labelPtr, has_close_button) + igTabItemCalcSize_Str(pOut, labelPtr, has_close_button_or_unsaved_marker) } } -@inlinable @discardableResult public func ImGuiTabItemEx(_ tab_bar: UnsafeMutablePointer!, _ label: String? = nil, _ p_open: UnsafeMutablePointer!, _ flags: ImGuiTabItemFlags) -> Bool { +@inlinable public func ImGuiTabItemCalcSize(_ pOut: UnsafeMutablePointer!, _ window: UnsafeMutablePointer!) { + igTabItemCalcSize_WindowPtr(pOut, window) +} + +@inlinable @discardableResult public func ImGuiTabItemEx(_ tab_bar: UnsafeMutablePointer!, _ label: String? = nil, _ p_open: UnsafeMutablePointer!, _ flags: ImGuiTabItemFlags, _ docked_window: UnsafeMutablePointer!) -> Bool { label.withOptionalCString { labelPtr in - igTabItemEx(tab_bar, labelPtr, p_open, flags) + igTabItemEx(tab_bar, labelPtr, p_open, flags, docked_window) } } @@ -3648,6 +3940,10 @@ public typealias ImSpanAllocator = OpaquePointer igTableBeginCell(table, column_n) } +@inlinable @discardableResult public func ImGuiTableBeginContextMenuPopup(_ table: UnsafeMutablePointer!) -> Bool { + igTableBeginContextMenuPopup(table) +} + @inlinable public func ImGuiTableBeginInitMemory(_ table: UnsafeMutablePointer!, _ columns_count: Int32) { igTableBeginInitMemory(table, columns_count) } @@ -3724,7 +4020,7 @@ public typealias ImSpanAllocator = OpaquePointer igTableGetColumnNextSortDirection(column) } -@inlinable public func ImGuiTableGetColumnResizeID(_ table: UnsafePointer!, _ column_n: Int32, _ instance_no: Int32) -> ImGuiID { +@inlinable public func ImGuiTableGetColumnResizeID(_ table: UnsafeMutablePointer!, _ column_n: Int32, _ instance_no: Int32) -> ImGuiID { igTableGetColumnResizeID(table, column_n, instance_no) } @@ -3740,6 +4036,14 @@ public typealias ImSpanAllocator = OpaquePointer igTableGetHoveredColumn() } +@inlinable public func ImGuiTableGetInstanceData(_ table: UnsafeMutablePointer!, _ instance_no: Int32) -> UnsafeMutablePointer! { + igTableGetInstanceData(table, instance_no) +} + +@inlinable public func ImGuiTableGetInstanceID(_ table: UnsafeMutablePointer!, _ instance_no: Int32) -> ImGuiID { + igTableGetInstanceID(table, instance_no) +} + @inlinable public func ImGuiTableGetMaxColumnWidth(_ table: UnsafePointer!, _ column_n: Int32) -> Float { igTableGetMaxColumnWidth(table, column_n) } @@ -3830,6 +4134,10 @@ public typealias ImSpanAllocator = OpaquePointer igTableSetColumnWidthAutoSingle(table, column_n) } +@inlinable public func ImGuiTableSettingsAddSettingsHandler() { + igTableSettingsAddSettingsHandler() +} + @inlinable public func ImGuiTableSettingsCreate(_ id: ImGuiID, _ columns_count: Int32) -> UnsafeMutablePointer! { igTableSettingsCreate(id, columns_count) } @@ -3842,10 +4150,6 @@ public typealias ImSpanAllocator = OpaquePointer ImGuiTableSettings_GetColumnSettings(this) } -@inlinable public func ImGuiTableSettingsInstallHandler(_ context: UnsafeMutablePointer!) { - igTableSettingsInstallHandler(context) -} - @inlinable public func ImGuiTableSetupColumn(_ label: String? = nil, _ flags: ImGuiTableColumnFlags, _ init_width_or_weight: Float, _ user_id: ImGuiID) { label.withOptionalCString { labelPtr in igTableSetupColumn(labelPtr, flags, init_width_or_weight, user_id) @@ -3900,6 +4204,14 @@ public typealias ImSpanAllocator = OpaquePointer } } +@inlinable @discardableResult public func ImGuiTestKeyOwner(_ key: ImGuiKey, _ owner_id: ImGuiID) -> Bool { + igTestKeyOwner(key, owner_id) +} + +@inlinable @discardableResult public func ImGuiTestShortcutRouting(_ key_chord: ImGuiKeyChord, _ owner_id: ImGuiID) -> Bool { + igTestShortcutRouting(key_chord, owner_id) +} + @inlinable public func ImGuiTextBufferappend(_ this: UnsafeMutablePointer!, _ str: String? = nil, _ str_end: String? = nil) { str.withOptionalCString { strPtr in str_end.withOptionalCString { str_endPtr in @@ -3994,6 +4306,32 @@ public typealias ImSpanAllocator = OpaquePointer } } +@inlinable public func ImGuiTextIndexappend(_ this: UnsafeMutablePointer!, _ base: String? = nil, _ old_size: Int32, _ new_size: Int32) { + base.withOptionalCString { basePtr in + ImGuiTextIndex_append(this, basePtr, old_size, new_size) + } +} + +@inlinable public func ImGuiTextIndexclear(_ this: UnsafeMutablePointer!) { + ImGuiTextIndex_clear(this) +} + +@inlinable public func ImGuiTextIndexgetlinebegin(_ this: UnsafeMutablePointer!, _ base: String? = nil, _ n: Int32) -> String? { + base.withOptionalCString { basePtr in + String(cString: ImGuiTextIndex_get_line_begin(this, basePtr, n)) + } +} + +@inlinable public func ImGuiTextIndexgetlineend(_ this: UnsafeMutablePointer!, _ base: String? = nil, _ n: Int32) -> String? { + base.withOptionalCString { basePtr in + String(cString: ImGuiTextIndex_get_line_end(this, basePtr, n)) + } +} + +@inlinable public func ImGuiTextIndexsize(_ this: UnsafeMutablePointer!) -> Int32 { + ImGuiTextIndex_size(this) +} + @inlinable @discardableResult public func ImGuiTextRangeempty(_ this: UnsafeMutablePointer!) -> Bool { ImGuiTextRange_empty(this) } @@ -4040,10 +4378,6 @@ public typealias ImSpanAllocator = OpaquePointer } } -@inlinable @discardableResult public func ImGuiTreeNodeBehaviorIsOpen(_ id: ImGuiID, _ flags: ImGuiTreeNodeFlags) -> Bool { - igTreeNodeBehaviorIsOpen(id, flags) -} - @inlinable @discardableResult public func ImGuiTreeNodeEx(_ label: String? = nil, _ flags: ImGuiTreeNodeFlags) -> Bool { label.withOptionalCString { labelPtr in igTreeNodeEx_Str(labelPtr, flags) @@ -4068,6 +4402,14 @@ public typealias ImSpanAllocator = OpaquePointer } } +@inlinable public func ImGuiTreeNodeSetOpen(_ id: ImGuiID, _ open: Bool) { + igTreeNodeSetOpen(id, open) +} + +@inlinable @discardableResult public func ImGuiTreeNodeUpdateNextOpen(_ id: ImGuiID, _ flags: ImGuiTreeNodeFlags) -> Bool { + igTreeNodeUpdateNextOpen(id, flags) +} + @inlinable @discardableResult public func ImGuiTreeNodeV(_ str_id: String? = nil, _ fmt: String? = nil, _ args: CVarArg...) -> Bool { str_id.withOptionalCString { str_idPtr in fmt.withOptionalCString { fmtPtr in @@ -4112,6 +4454,10 @@ public typealias ImSpanAllocator = OpaquePointer igUpdateHoveredWindowAndCaptureFlags() } +@inlinable public func ImGuiUpdateInputEvents(_ trickle_fast_inputs: Bool) { + igUpdateInputEvents(trickle_fast_inputs) +} + @inlinable public func ImGuiUpdateMouseMovingWindowEndFrame() { igUpdateMouseMovingWindowEndFrame() } @@ -4230,22 +4576,6 @@ public typealias ImSpanAllocator = OpaquePointer ImGuiWindow_GetIDFromRectangle(this, r_abs) } -@inlinable public func ImGuiWindowGetIDNoKeepAlive(_ this: UnsafeMutablePointer!, _ str: String? = nil, _ str_end: String? = nil) -> ImGuiID { - str.withOptionalCString { strPtr in - str_end.withOptionalCString { str_endPtr in - ImGuiWindow_GetIDNoKeepAlive_Str(this, strPtr, str_endPtr) - } - } -} - -@inlinable public func ImGuiWindowGetIDNoKeepAlive(_ this: UnsafeMutablePointer!, _ ptr: UnsafeRawPointer!) -> ImGuiID { - ImGuiWindow_GetIDNoKeepAlive_Ptr(this, ptr) -} - -@inlinable public func ImGuiWindowGetIDNoKeepAlive(_ this: UnsafeMutablePointer!, _ n: Int32) -> ImGuiID { - ImGuiWindow_GetIDNoKeepAlive_Int(this, n) -} - @inlinable public func ImGuiWindowMenuBarHeight(_ this: UnsafeMutablePointer!) -> Float { ImGuiWindow_MenuBarHeight(this) } @@ -4278,11 +4608,11 @@ public typealias ImSpanAllocator = OpaquePointer ImGuiWindow_TitleBarRect(pOut, this) } -@inlinable public func ImHashData(_ data: UnsafeRawPointer!, _ data_size: Int, _ seed: ImU32) -> ImGuiID { +@inlinable public func ImHashData(_ data: UnsafeRawPointer!, _ data_size: Int, _ seed: ImGuiID) -> ImGuiID { igImHashData(data, data_size, seed) } -@inlinable public func ImHashStr(_ data: String? = nil, _ data_size: Int, _ seed: ImU32) -> ImGuiID { +@inlinable public func ImHashStr(_ data: String? = nil, _ data_size: Int, _ seed: ImGuiID) -> ImGuiID { data.withOptionalCString { dataPtr in igImHashStr(dataPtr, data_size, seed) } @@ -4374,6 +4704,22 @@ public typealias ImSpanAllocator = OpaquePointer } } +@inlinable public func ImParseFormatSanitizeForPrinting(_ fmt_in: String? = nil, _ fmt_out: inout String?, _ fmt_out_size: Int) { + fmt_in.withOptionalCString { fmt_inPtr in + fmt_out.withOptionalCString { fmt_outPtr in + igImParseFormatSanitizeForPrinting(fmt_inPtr, UnsafeMutablePointer(mutating: fmt_outPtr), fmt_out_size) + } + } +} + +@inlinable public func ImParseFormatSanitizeForScanning(_ fmt_in: String? = nil, _ fmt_out: inout String?, _ fmt_out_size: Int) -> String? { + fmt_in.withOptionalCString { fmt_inPtr in + fmt_out.withOptionalCString { fmt_outPtr in + String(cString: igImParseFormatSanitizeForScanning(fmt_inPtr, UnsafeMutablePointer(mutating: fmt_outPtr), fmt_out_size)) + } + } +} + @inlinable public func ImParseFormatTrimDecorations(_ format: String? = nil, _ buf: inout String?, _ buf_size: Int) -> String? { format.withOptionalCString { formatPtr in buf.withOptionalCString { bufPtr in @@ -4636,6 +4982,10 @@ public typealias ImSpanAllocator = OpaquePointer } } +@inlinable public func ImToUpper(_ c: CChar) -> CChar { + igImToUpper(c) +} + @inlinable public func ImTriangleArea(_ a: ImVec2, _ b: ImVec2, _ c: ImVec2) -> Float { igImTriangleArea(a, b, c) } diff --git a/patch_fix_ifdefs.diff b/patch_fix_ifdefs.diff index 4d5cf4b..8c55b39 100644 --- a/patch_fix_ifdefs.diff +++ b/patch_fix_ifdefs.diff @@ -1,14 +1,5 @@ -From 6854310a3d0332c2c697882891b8d0ed89688184 Mon Sep 17 00:00:00 2001 -From: Christian Treffs -Date: Thu, 8 Jul 2021 19:48:59 +0200 -Subject: [PATCH] Fix ifdefs - ---- - Sources/CImGui/include/cimgui.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - diff --git a/Sources/CImGui/include/cimgui.h b/Sources/CImGui/include/cimgui.h -index 47ec48b..38136d5 100644 +index 5688e9d..699bce8 100644 --- a/Sources/CImGui/include/cimgui.h +++ b/Sources/CImGui/include/cimgui.h @@ -38,7 +38,7 @@ typedef unsigned __int64 ImU64; @@ -17,10 +8,10 @@ index 47ec48b..38136d5 100644 -#ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS +#ifndef CIMGUI_DEFINE_ENUMS_AND_STRUCTS - typedef struct ImGuiTableColumnSettings ImGuiTableColumnSettings; - typedef struct ImGuiTableCellData ImGuiTableCellData; - typedef struct ImGuiStackTool ImGuiStackTool; -@@ -2240,7 +2240,7 @@ struct SDL_Window; + + typedef struct ImDrawChannel ImDrawChannel; + typedef struct ImDrawCmd ImDrawCmd; +@@ -2774,7 +2774,7 @@ struct SDL_Window; typedef union SDL_Event SDL_Event; #endif // CIMGUI_DEFINE_ENUMS_AND_STRUCTS @@ -29,6 +20,3 @@ index 47ec48b..38136d5 100644 typedef struct ImGuiStorage::ImGuiStoragePair ImGuiStoragePair; typedef struct ImGuiTextFilter::ImGuiTextRange ImGuiTextRange; typedef ImStb::STB_TexteditState STB_TexteditState; --- -2.31.0 -