mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Merge branch 'master' into viewport
# Conflicts: # imgui.cpp
This commit is contained in:
commit
23b67e6ff5
@ -43,7 +43,7 @@ Other Changes:
|
||||
|
||||
- ArrowButton: Fixed to honor PushButtonRepeat() setting (and internals' ImGuiItemFlags_ButtonRepeat).
|
||||
- ArrowButton: Setup current line text baseline so that ArrowButton() + SameLine() + Text() are aligned properly.
|
||||
- Nav: Added a CTRL+TAB window list and changed the highlight system accordingly. This is designed to allow CTRL+TAB between Tabs in the future.
|
||||
- Nav: Added a CTRL+TAB window list and changed the highlight system accordingly. This is designed to allow CTRL+TAB between Tabs in the future. (#787)
|
||||
- Window: Allow menu and popups windows from ignoring the style.WindowMinSize values so short menus/popups are not padded. (#1909)
|
||||
- Window: Added global io.OptResizeWindowsFromEdges option to enable resizing windows from their edges and from the lower-left corner. (#1495)
|
||||
- Drag and Drop: Fixed an incorrect assert when dropping a source that is submitted after the target (bug introduced with 1.62 changes
|
||||
@ -57,6 +57,7 @@ Other Changes:
|
||||
- Fixed a include build issue for Cygwin in non-POSIX (Win32) mode. (#1917, #1319, #276)
|
||||
- OS/Windows: Fixed missing ImmReleaseContext() call in the default Win32 IME handler. (#1932) [@vby]
|
||||
- Demo: Added basic Drag and Drop demo. (#143)
|
||||
- Demo: Clarified the use of IsItemHovered()/IsItemActive() right after being in the "Active, Focused, Hovered & Focused Tests" section.
|
||||
- Examples: Tweaked the main.cpp of each example.
|
||||
- Examples: Metal: Added Metal rendering backend. (#1929, #1873) [@warrenm]
|
||||
- Examples: OSX: Added early raw OSX platform backend. (#1873) [@pagghiu, @itamago, @ocornut]
|
||||
|
27
imgui.cpp
27
imgui.cpp
@ -805,7 +805,9 @@
|
||||
#endif
|
||||
|
||||
#include "imgui.h"
|
||||
#ifndef IMGUI_DEFINE_MATH_OPERATORS
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#endif
|
||||
#include "imgui_internal.h"
|
||||
|
||||
#include <ctype.h> // toupper, isprint
|
||||
@ -3243,11 +3245,7 @@ static const char* GetFallbackWindowNameForWindowingList(ImGuiWindow* window)
|
||||
void ImGui::NavUpdateWindowingList()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (!g.NavWindowingTarget)
|
||||
{
|
||||
g.NavWindowingList = NULL;
|
||||
return;
|
||||
}
|
||||
IM_ASSERT(g.NavWindowingTarget != NULL);
|
||||
|
||||
if (g.NavWindowingList == NULL)
|
||||
g.NavWindowingList = FindWindowByName("###NavWindowingList");
|
||||
@ -4919,6 +4917,12 @@ void ImGui::EndFrame()
|
||||
g.PlatformImePosViewport = NULL;
|
||||
}
|
||||
|
||||
// Hide implicit "Debug" window if it hasn't been used
|
||||
IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls, did you forget to call end on g.CurrentWindow->Name?
|
||||
if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed)
|
||||
g.CurrentWindow->Active = false;
|
||||
End();
|
||||
|
||||
// Draw modal whitening background on _other_ viewports than the one the modal is one
|
||||
ImGuiWindow* modal_window = GetFrontMostPopupModal();
|
||||
const bool dim_bg_for_modal = (modal_window != NULL);
|
||||
@ -4938,16 +4942,13 @@ void ImGui::EndFrame()
|
||||
draw_list->AddRectFilled(viewport->Pos, viewport->Pos + viewport->Size, dim_bg_col);
|
||||
}
|
||||
|
||||
NavUpdateWindowingList();
|
||||
|
||||
// Hide implicit "Debug" window if it hasn't been used
|
||||
IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls, did you forget to call end on g.CurrentWindow->Name?
|
||||
if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed)
|
||||
g.CurrentWindow->Active = false;
|
||||
End();
|
||||
// Show CTRL+TAB list
|
||||
if (g.NavWindowingTarget)
|
||||
NavUpdateWindowingList();
|
||||
|
||||
SetCurrentViewport(NULL, NULL);
|
||||
|
||||
// Initiate moving window
|
||||
if (g.ActiveId == 0 && g.HoveredId == 0)
|
||||
{
|
||||
if (!g.NavWindow || !g.NavWindow->Appearing) // Unless we just made a window/popup appear
|
||||
@ -5037,7 +5038,7 @@ void ImGui::Render()
|
||||
g.Viewports[n]->DrawDataBuilder.Clear();
|
||||
ImGuiWindow* windows_to_render_front_most[2];
|
||||
windows_to_render_front_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindow : NULL;
|
||||
windows_to_render_front_most[1] = (g.NavWindowingList);
|
||||
windows_to_render_front_most[1] = g.NavWindowingTarget ? g.NavWindowingList : NULL;
|
||||
for (int n = 0; n != g.Windows.Size; n++)
|
||||
{
|
||||
ImGuiWindow* window = g.Windows[n];
|
||||
|
@ -1351,6 +1351,25 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
if (embed_all_inside_a_child_window)
|
||||
EndChild();
|
||||
|
||||
// Calling IsItemHovered() after begin returns the hovered status of the title bar.
|
||||
// This is useful in particular if you want to create a context menu (with BeginPopupContextItem) associated to the title bar of a window.
|
||||
static bool test_window = false;
|
||||
ImGui::Checkbox("Hovered/Active tests after Begin() for title bar testing", &test_window);
|
||||
if (test_window)
|
||||
{
|
||||
ImGui::Begin("Title bar Hovered/Active tests", &test_window);
|
||||
if (ImGui::BeginPopupContextItem()) // <-- This is using IsItemHovered()
|
||||
{
|
||||
if (ImGui::MenuItem("Close")) { test_window = false; }
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::Text(
|
||||
"IsItemHovered() after begin = %d (== is title bar hovered)\n"
|
||||
"IsItemActive() after begin = %d (== is window being clicked/moved)\n",
|
||||
ImGui::IsItemHovered(), ImGui::IsItemActive());
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,9 @@
|
||||
#endif
|
||||
|
||||
#include "imgui.h"
|
||||
#ifndef IMGUI_DEFINE_MATH_OPERATORS
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#endif
|
||||
#include "imgui_internal.h"
|
||||
|
||||
#include <stdio.h> // vsnprintf, sscanf, printf
|
||||
|
Loading…
Reference in New Issue
Block a user