mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 07:40:22 +01:00
Merge branch 'master' into navigation
# Conflicts: # imgui.cpp # imgui.h
This commit is contained in:
commit
c4e6d622c1
@ -45,7 +45,7 @@ Binaries/Demo
|
||||
-------------
|
||||
|
||||
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
|
||||
- [imgui-demo-binaries-20171013.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20171013.zip) (Windows binaries, Dear ImGui 1.52 WIP built 2017/10/13, 5 executables)
|
||||
- [imgui-demo-binaries-20171226.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20171226.zip) (Windows binaries, Dear ImGui 1.53 built 2017/12/26, 5 executables)
|
||||
|
||||
Bindings
|
||||
--------
|
||||
@ -60,6 +60,7 @@ Languages:
|
||||
- ChaiScript: https://github.com/JuJuBoSc/imgui-chaiscript
|
||||
- D (DerelictImgui): https://github.com/Extrawurst/DerelictImgui
|
||||
- Go (go-imgui): https://github.com/Armored-Dragon/go-imgui
|
||||
- Haxe/hxcpp (linc_imgui): https://github.com/Aidan63/linc_imgui
|
||||
- Lua: https://github.com/patrickriordan/imgui_lua_bindings
|
||||
- Odin: https://github.com/ThisDrunkDane/odin-dear_imgui
|
||||
- Pascal (imgui-pas): https://github.com/dpethes/imgui-pas
|
||||
|
41
imgui.cpp
41
imgui.cpp
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.53
|
||||
// dear imgui, v1.54 WIP
|
||||
// (main code and documentation)
|
||||
|
||||
// ** EXPERIMENTAL GAMEPAD/KEYBOARD NAVIGATION BRANCH
|
||||
@ -3721,7 +3721,7 @@ void ImGui::EndFrame()
|
||||
IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls
|
||||
if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed)
|
||||
g.CurrentWindow->Active = false;
|
||||
ImGui::End();
|
||||
End();
|
||||
|
||||
if (g.ActiveId == 0 && g.HoveredId == 0)
|
||||
{
|
||||
@ -4579,7 +4579,7 @@ void ImGui::BeginTooltip()
|
||||
void ImGui::EndTooltip()
|
||||
{
|
||||
IM_ASSERT(GetCurrentWindowRead()->Flags & ImGuiWindowFlags_Tooltip); // Mismatched BeginTooltip()/EndTooltip() calls
|
||||
ImGui::End();
|
||||
End();
|
||||
}
|
||||
|
||||
// Mark popup as open (toggle toward open state).
|
||||
@ -4751,7 +4751,7 @@ bool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags ext
|
||||
}
|
||||
|
||||
// Center modal windows by default
|
||||
if ((window->SetWindowPosAllowFlags & g.SetNextWindowPosCond) == 0)
|
||||
if (g.SetNextWindowPosCond == 0)
|
||||
SetNextWindowPos(g.IO.DisplaySize * 0.5f, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
|
||||
|
||||
ImGuiWindowFlags flags = extra_flags|ImGuiWindowFlags_Popup|ImGuiWindowFlags_Modal|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoSavedSettings;
|
||||
@ -4903,7 +4903,7 @@ void ImGui::EndChild()
|
||||
IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() callss
|
||||
if (window->BeginCount > 1)
|
||||
{
|
||||
ImGui::End();
|
||||
End();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4913,7 +4913,7 @@ void ImGui::EndChild()
|
||||
sz.x = ImMax(4.0f, sz.x);
|
||||
if (window->AutoFitChildAxises & (1 << ImGuiAxis_Y))
|
||||
sz.y = ImMax(4.0f, sz.y);
|
||||
ImGui::End();
|
||||
End();
|
||||
|
||||
ImGuiWindow* parent_window = GetCurrentWindow();
|
||||
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
|
||||
@ -7743,7 +7743,8 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
||||
// - OpenOnArrow .................... single-click on arrow to open
|
||||
// - OpenOnDoubleClick|OpenOnArrow .. single-click on arrow or double-click anywhere to open
|
||||
ImGuiButtonFlags button_flags = ImGuiButtonFlags_NoKeyModifiers | ((flags & ImGuiTreeNodeFlags_AllowItemOverlap) ? ImGuiButtonFlags_AllowItemOverlap : 0);
|
||||
button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;
|
||||
if (!(flags & ImGuiTreeNodeFlags_Leaf))
|
||||
button_flags |= ImGuiButtonFlags_PressedOnDragDropHold;
|
||||
if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
|
||||
button_flags |= ImGuiButtonFlags_PressedOnDoubleClick | ((flags & ImGuiTreeNodeFlags_OpenOnArrow) ? ImGuiButtonFlags_PressedOnClickRelease : 0);
|
||||
|
||||
@ -10337,14 +10338,15 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
|
||||
|
||||
// Peak into expected window size so we can position it
|
||||
if (ImGuiWindow* popup_window = FindWindowByName(name))
|
||||
{
|
||||
ImVec2 size_contents = CalcSizeContents(popup_window);
|
||||
ImVec2 size_expected = CalcSizeAfterConstraint(popup_window, CalcSizeAutoFit(popup_window, size_contents));
|
||||
if (flags & ImGuiComboFlags_PopupAlignLeft)
|
||||
popup_window->AutoPosLastDirection = ImGuiDir_Left;
|
||||
ImVec2 pos = FindBestWindowPosForPopup(frame_bb.GetBL(), size_expected, &popup_window->AutoPosLastDirection, frame_bb, ImGuiPopupPositionPolicy_ComboBox);
|
||||
SetNextWindowPos(pos);
|
||||
}
|
||||
if (popup_window->WasActive)
|
||||
{
|
||||
ImVec2 size_contents = CalcSizeContents(popup_window);
|
||||
ImVec2 size_expected = CalcSizeAfterConstraint(popup_window, CalcSizeAutoFit(popup_window, size_contents));
|
||||
if (flags & ImGuiComboFlags_PopupAlignLeft)
|
||||
popup_window->AutoPosLastDirection = ImGuiDir_Left;
|
||||
ImVec2 pos = FindBestWindowPosForPopup(frame_bb.GetBL(), size_expected, &popup_window->AutoPosLastDirection, frame_bb, ImGuiPopupPositionPolicy_ComboBox);
|
||||
SetNextWindowPos(pos);
|
||||
}
|
||||
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings;
|
||||
if (!Begin(name, NULL, window_flags))
|
||||
@ -10755,7 +10757,7 @@ bool ImGui::BeginMenuBar()
|
||||
// We remove 1 worth of rounding to Max.x to that text in long menus don't tend to display over the lower-right rounded area, which looks particularly glitchy.
|
||||
ImRect bar_rect = window->MenuBarRect();
|
||||
ImRect clip_rect(ImFloor(bar_rect.Min.x + 0.5f), ImFloor(bar_rect.Min.y + window->WindowBorderSize + 0.5f), ImFloor(ImMax(bar_rect.Min.x, bar_rect.Max.x - window->WindowRounding) + 0.5f), ImFloor(bar_rect.Max.y + 0.5f));
|
||||
clip_rect.ClipWith(window->Rect());
|
||||
clip_rect.ClipWith(window->WindowRectClipped);
|
||||
PushClipRect(clip_rect.Min, clip_rect.Max, false);
|
||||
|
||||
window->DC.CursorPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffsetX, bar_rect.Min.y);// + g.Style.FramePadding.y);
|
||||
@ -12653,6 +12655,12 @@ void ImGui::EndDragDropTarget()
|
||||
IM_ASSERT(g.DragDropActive);
|
||||
}
|
||||
|
||||
bool ImGui::IsDragDropActive()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
return g.DragDropActive;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// PLATFORM DEPENDENT HELPERS
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -12905,6 +12913,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
ImGui::Text("NavUsable: %d, NavActive: %d", g.IO.NavUsable, g.IO.NavActive);
|
||||
ImGui::Text("NavActivateId: 0x%08X, NavInputId: 0x%08X", g.NavActivateId, g.NavInputId);
|
||||
ImGui::Text("NavDisableHighlight: %d, NavDisableMouseHover: %d", g.NavDisableHighlight, g.NavDisableMouseHover);
|
||||
ImGui::Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
5
imgui.h
5
imgui.h
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.53
|
||||
// dear imgui, v1.54 WIP
|
||||
// (headers)
|
||||
|
||||
// See imgui.cpp file for documentation.
|
||||
@ -16,7 +16,7 @@
|
||||
#include <stddef.h> // ptrdiff_t, NULL
|
||||
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
||||
|
||||
#define IMGUI_VERSION "1.53"
|
||||
#define IMGUI_VERSION "1.54 WIP"
|
||||
#define IMGUI_HAS_NAV // navigation branch
|
||||
|
||||
// Define attributes of all API symbols declarations, e.g. for DLL under Windows.
|
||||
@ -436,6 +436,7 @@ namespace ImGui
|
||||
IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive an item. 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.
|
||||
IMGUI_API void EndDragDropTarget();
|
||||
IMGUI_API bool IsDragDropActive();
|
||||
|
||||
// Clipping
|
||||
IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.53
|
||||
// dear imgui, v1.54 WIP
|
||||
// (demo code)
|
||||
|
||||
// Message to the person tempted to delete this file when integrating ImGui into their code base:
|
||||
@ -2403,6 +2403,7 @@ static void ShowExampleAppFixedOverlay(bool* p_open)
|
||||
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 (p_open && ImGui::MenuItem("Close")) *p_open = false;
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::End();
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.53
|
||||
// dear imgui, v1.54 WIP
|
||||
// (drawing and font code)
|
||||
|
||||
// Contains implementation for
|
||||
|
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.53
|
||||
// dear imgui, v1.54 WIP
|
||||
// (internals)
|
||||
|
||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||
|
Loading…
Reference in New Issue
Block a user