mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-24 00:26:36 +00:00
Demo: Clarified the use of IsItemHovered()/IsItemActive() right after being in the "Active, Focused, Hovered & Focused Tests" section. This will be of more importance with the introduction of tabs.
This commit is contained in:
parent
d3be9185b3
commit
0c207b7bc9
@ -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]
|
||||
|
@ -1350,6 +1350,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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user