mirror of
https://github.com/ocornut/imgui.git
synced 2026-03-25 18:10:58 +00:00
Merge branch 'master' into navigation
This commit is contained in:
21
imgui.cpp
21
imgui.cpp
@@ -714,7 +714,6 @@ namespace ImGui
|
||||
static void NavUpdate();
|
||||
static void NavUpdateWindowing();
|
||||
static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id);
|
||||
static void ClearDragDrop();
|
||||
static void FocusPreviousWindow();
|
||||
}
|
||||
|
||||
@@ -1869,7 +1868,6 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
||||
ID = ImHash(name, 0);
|
||||
IDStack.push_back(ID);
|
||||
Flags = 0;
|
||||
OrderWithinParent = 0;
|
||||
PosFloat = Pos = ImVec2(0.0f, 0.0f);
|
||||
Size = SizeFull = ImVec2(0.0f, 0.0f);
|
||||
SizeContents = SizeContentsExplicit = ImVec2(0.0f, 0.0f);
|
||||
@@ -1890,6 +1888,8 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
||||
SkipItems = false;
|
||||
Appearing = false;
|
||||
CloseButton = false;
|
||||
BeginOrderWithinParent = -1;
|
||||
BeginOrderWithinContext = -1;
|
||||
BeginCount = 0;
|
||||
PopupId = 0;
|
||||
AutoFitFramesX = AutoFitFramesY = -1;
|
||||
@@ -3066,6 +3066,7 @@ void ImGui::NewFrame()
|
||||
g.Time += g.IO.DeltaTime;
|
||||
g.FrameCount += 1;
|
||||
g.TooltipOverrideCount = 0;
|
||||
g.WindowsActiveCount = 0;
|
||||
g.OverlayDrawList.Clear();
|
||||
g.OverlayDrawList.PushTextureID(g.IO.Fonts->TexID);
|
||||
g.OverlayDrawList.PushClipRectFullScreen();
|
||||
@@ -3589,7 +3590,7 @@ static int ChildWindowComparer(const void* lhs, const void* rhs)
|
||||
return d;
|
||||
if (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip))
|
||||
return d;
|
||||
return (a->OrderWithinParent - b->OrderWithinParent);
|
||||
return (a->BeginOrderWithinParent - b->BeginOrderWithinParent);
|
||||
}
|
||||
|
||||
static void AddWindowToSortedBuffer(ImVector<ImGuiWindow*>& out_sorted_windows, ImGuiWindow* window)
|
||||
@@ -5354,7 +5355,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
// window->RootNavWindow = window->RootNavWindow->ParentWindow;
|
||||
|
||||
window->Active = true;
|
||||
window->OrderWithinParent = 0;
|
||||
window->BeginOrderWithinParent = 0;
|
||||
window->BeginOrderWithinContext = g.WindowsActiveCount++;
|
||||
window->BeginCount = 0;
|
||||
window->ClipRect = ImVec4(-FLT_MAX,-FLT_MAX,+FLT_MAX,+FLT_MAX);
|
||||
window->LastFrameActive = current_frame;
|
||||
@@ -5477,7 +5479,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
// Position child window
|
||||
if (flags & ImGuiWindowFlags_ChildWindow)
|
||||
{
|
||||
window->OrderWithinParent = parent_window->DC.ChildWindows.Size;
|
||||
window->BeginOrderWithinParent = parent_window->DC.ChildWindows.Size;
|
||||
parent_window->DC.ChildWindows.push_back(window);
|
||||
}
|
||||
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api)
|
||||
@@ -7834,7 +7836,6 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags
|
||||
ImGuiContext& g = *GImGui;
|
||||
float button_sz = g.FontSize * 0.5f;
|
||||
ImGuiItemHoveredDataBackup last_item_backup;
|
||||
last_item_backup.Backup();
|
||||
if (CloseButton(window->GetID((void*)(intptr_t)(id+1)), ImVec2(ImMin(window->DC.LastItemRect.Max.x, window->ClipRect.Max.x) - g.Style.FramePadding.x - button_sz, window->DC.LastItemRect.Min.y + g.Style.FramePadding.y + button_sz), button_sz))
|
||||
*p_open = false;
|
||||
last_item_backup.Restore();
|
||||
@@ -12321,7 +12322,7 @@ void ImGui::Value(const char* prefix, float v, const char* float_format)
|
||||
// DRAG AND DROP
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static void ImGui::ClearDragDrop()
|
||||
void ImGui::ClearDragDrop()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.DragDropActive = false;
|
||||
@@ -12510,6 +12511,12 @@ bool ImGui::BeginDragDropTarget()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImGui::IsDragDropPayloadBeingAccepted()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
return g.DragDropActive && g.DragDropAcceptIdPrev != 0;
|
||||
}
|
||||
|
||||
const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
Reference in New Issue
Block a user