mirror of
https://github.com/ocornut/imgui.git
synced 2026-02-01 03:30:06 +00:00
Merge branch 'master' into docking
This commit is contained in:
commit
ae8688974b
11 changed files with 115 additions and 60 deletions
17
imgui.cpp
17
imgui.cpp
|
|
@ -3770,7 +3770,8 @@ 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);
|
||||
if (mouse_cursor <= ImGuiMouseCursor_None || mouse_cursor >= ImGuiMouseCursor_COUNT) // We intentionally accept out of bound values.
|
||||
mouse_cursor = ImGuiMouseCursor_Arrow;
|
||||
ImFontAtlas* font_atlas = g.DrawListSharedData.Font->ContainerAtlas;
|
||||
for (ImGuiViewportP* viewport : g.Viewports)
|
||||
{
|
||||
|
|
@ -4438,7 +4439,7 @@ bool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flag
|
|||
|
||||
// Display shortcut (only works with mouse)
|
||||
// (ImGuiItemStatusFlags_HasShortcut in LastItemData denotes we want a tooltip)
|
||||
if (id == g.LastItemData.ID && (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasShortcut))
|
||||
if (id == g.LastItemData.ID && (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasShortcut) && g.ActiveId != id)
|
||||
if (IsItemHovered(ImGuiHoveredFlags_ForTooltip | ImGuiHoveredFlags_DelayNormal))
|
||||
SetTooltip("%s", GetKeyChordName(g.LastItemData.Shortcut));
|
||||
}
|
||||
|
|
@ -6497,7 +6498,7 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& si
|
|||
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)
|
||||
g.MouseCursor = (resize_grip_n & 1) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE;
|
||||
SetMouseCursor((resize_grip_n & 1) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE);
|
||||
|
||||
if (held && g.IO.MouseDoubleClicked[0])
|
||||
{
|
||||
|
|
@ -6543,7 +6544,7 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& si
|
|||
if (hovered && g.HoveredIdTimer <= WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER)
|
||||
hovered = false;
|
||||
if (hovered || held)
|
||||
g.MouseCursor = (axis == ImGuiAxis_X) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS;
|
||||
SetMouseCursor((axis == ImGuiAxis_X) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS);
|
||||
if (held && g.IO.MouseDoubleClicked[0])
|
||||
{
|
||||
// Double-clicking bottom or right border auto-fit on this axis
|
||||
|
|
@ -7374,9 +7375,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||
// 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) && !window->DockIsActive)
|
||||
{
|
||||
// We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed), so verify that we don't have items over the title bar.
|
||||
// We don't use a regular button+id to test for double-click on title bar (mostly due to legacy reason, could be fixed),
|
||||
// so verify that we don't have items over the title bar.
|
||||
ImRect title_bar_rect = window->TitleBarRect();
|
||||
if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max))
|
||||
if (g.HoveredWindow == window && g.HoveredId == 0 && g.HoveredIdPreviousFrame == 0 && g.ActiveId == 0 && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max))
|
||||
if (g.IO.MouseClickedCount[0] == 2 && GetKeyOwner(ImGuiKey_MouseLeft) == ImGuiKeyOwner_NoOwner)
|
||||
window->WantCollapseToggle = true;
|
||||
if (window->WantCollapseToggle)
|
||||
|
|
@ -9915,6 +9917,9 @@ ImGuiMouseCursor ImGui::GetMouseCursor()
|
|||
return g.MouseCursor;
|
||||
}
|
||||
|
||||
// We intentionally accept values of ImGuiMouseCursor that are outside our bounds, in case users needs to hack-in a custom cursor value.
|
||||
// Custom cursors may be handled by custom backends. If you are using a standard backend and want to hack in a custom cursor, you may
|
||||
// handle it before the backend _NewFrame() call and temporarily set ImGuiConfigFlags_NoMouseCursorChange during the backend _NewFrame() call.
|
||||
void ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue