mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_glfw.cpp # backends/imgui_impl_glfw.h # imgui.cpp # imgui_internal.h
This commit is contained in:
commit
3109131a88
10 changed files with 137 additions and 68 deletions
73
imgui.cpp
73
imgui.cpp
|
|
@ -400,6 +400,17 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
|||
- likewise io.MousePos and GetMousePos() will use OS coordinates.
|
||||
If you query mouse positions to interact with non-imgui coordinates you will need to offset them, e.g. subtract GetWindowViewport()->Pos.
|
||||
|
||||
- 2025/11/06 (1.92.5) - BeginChild: commented out some legacy names which were obsoleted in 1.90.0 (Nov 2023), 1.90.9 (July 2024), 1.91.1 (August 2024):
|
||||
- ImGuiChildFlags_Border --> ImGuiChildFlags_Borders
|
||||
- ImGuiWindowFlags_NavFlattened --> ImGuiChildFlags_NavFlattened (moved to ImGuiChildFlags). BeginChild(name, size, 0, ImGuiWindowFlags_NavFlattened) --> BeginChild(name, size, ImGuiChildFlags_NavFlattened, 0)
|
||||
- ImGuiWindowFlags_AlwaysUseWindowPadding --> ImGuiChildFlags_AlwaysUseWindowPadding (moved to ImGuiChildFlags). BeginChild(name, size, 0, ImGuiWindowFlags_AlwaysUseWindowPadding) --> BeginChild(name, size, ImGuiChildFlags_AlwaysUseWindowPadding, 0)
|
||||
- 2025/11/06 (1.92.5) - Keys: commented out legacy names which were obsoleted in 1.89.0 (August 2022):
|
||||
- ImGuiKey_ModCtrl --> ImGuiMod_Ctrl
|
||||
- ImGuiKey_ModShift --> ImGuiMod_Shift
|
||||
- ImGuiKey_ModAlt --> ImGuiMod_Alt
|
||||
- ImGuiKey_ModSuper --> ImGuiMod_Super
|
||||
- 2025/11/06 (1.92.5) - IO: commented out legacy io.ClearInputCharacters() obsoleted in 1.89.8 (Aug 2023). Calling io.ClearInputKeys() is enough.
|
||||
- 2025/11/06 (1.92.5) - Commented out legacy SetItemAllowOverlap() obsoleted in 1.89.7: this never worked right. Use SetNextItemAllowOverlap() _before_ item instead.
|
||||
- 2025/10/14 (1.92.4) - TreeNode, Selectable, Clipper: commented out legacy names which were obsoleted in 1.89.7 (July 2023) and 1.89.9 (Sept 2023);
|
||||
- ImGuiTreeNodeFlags_AllowItemOverlap --> ImGuiTreeNodeFlags_AllowOverlap
|
||||
- ImGuiSelectableFlags_AllowItemOverlap --> ImGuiSelectableFlags_AllowOverlap
|
||||
|
|
@ -1465,6 +1476,9 @@ ImGuiStyle::ImGuiStyle()
|
|||
TreeLinesFlags = ImGuiTreeNodeFlags_DrawLinesNone;
|
||||
TreeLinesSize = 1.0f; // Thickness of outlines when using ImGuiTreeNodeFlags_DrawLines.
|
||||
TreeLinesRounding = 0.0f; // Radius of lines connecting child nodes to the vertical line.
|
||||
DragDropTargetRounding = 0.0f; // Radius of the drag and drop target frame.
|
||||
DragDropTargetBorderSize = 2.0f; // Thickness of the drag and drop target border.
|
||||
DragDropTargetPadding = 3.0f; // Size to expand the drag and drop target from actual target item size.
|
||||
ColorButtonPosition = ImGuiDir_Right; // Side of the color button in the ColorEdit4 widget (left/right). Defaults to ImGuiDir_Right.
|
||||
ButtonTextAlign = ImVec2(0.5f,0.5f);// Alignment of button text when button is larger than text.
|
||||
SelectableTextAlign = ImVec2(0.0f,0.0f);// Alignment of selectable text. Defaults to (0.0f, 0.0f) (top-left aligned). It's generally important to keep this left-aligned if you want to lay multiple items on a same line.
|
||||
|
|
@ -1531,6 +1545,9 @@ void ImGuiStyle::ScaleAllSizes(float scale_factor)
|
|||
TabCloseButtonMinWidthUnselected = (TabCloseButtonMinWidthUnselected > 0.0f && TabCloseButtonMinWidthUnselected != FLT_MAX) ? ImTrunc(TabCloseButtonMinWidthUnselected * scale_factor) : TabCloseButtonMinWidthUnselected;
|
||||
TabBarOverlineSize = ImTrunc(TabBarOverlineSize * scale_factor);
|
||||
TreeLinesRounding = ImTrunc(TreeLinesRounding * scale_factor);
|
||||
DragDropTargetRounding = ImTrunc(DragDropTargetRounding * scale_factor);
|
||||
DragDropTargetBorderSize = ImTrunc(DragDropTargetBorderSize * scale_factor);
|
||||
DragDropTargetPadding = ImTrunc(DragDropTargetPadding * scale_factor);
|
||||
SeparatorTextPadding = ImTrunc(SeparatorTextPadding * scale_factor);
|
||||
DockingSeparatorSize = ImTrunc(DockingSeparatorSize * scale_factor);
|
||||
DisplayWindowPadding = ImTrunc(DisplayWindowPadding * scale_factor);
|
||||
|
|
@ -1744,15 +1761,6 @@ void ImGuiIO::ClearInputMouse()
|
|||
MouseWheel = MouseWheelH = 0.0f;
|
||||
}
|
||||
|
||||
// Removed this as it is ambiguous/misleading and generally incorrect to use with the existence of a higher-level input queue.
|
||||
// Current frame character buffer is now also cleared by ClearInputKeys().
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
void ImGuiIO::ClearInputCharacters()
|
||||
{
|
||||
InputQueueCharacters.resize(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static ImGuiInputEvent* FindLatestInputEvent(ImGuiContext* ctx, ImGuiInputEventType type, int arg = -1)
|
||||
{
|
||||
ImGuiContext& g = *ctx;
|
||||
|
|
@ -3785,6 +3793,7 @@ const char* ImGui::GetStyleColorName(ImGuiCol idx)
|
|||
case ImGuiCol_TextSelectedBg: return "TextSelectedBg";
|
||||
case ImGuiCol_TreeLines: return "TreeLines";
|
||||
case ImGuiCol_DragDropTarget: return "DragDropTarget";
|
||||
case ImGuiCol_DragDropTargetBg: return "DragDropTargetBg";
|
||||
case ImGuiCol_UnsavedMarker: return "UnsavedMarker";
|
||||
case ImGuiCol_NavCursor: return "NavCursor";
|
||||
case ImGuiCol_NavWindowingHighlight: return "NavWindowingHighlight";
|
||||
|
|
@ -4265,7 +4274,7 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
|||
DragDropMouseButton = -1;
|
||||
DragDropTargetId = 0;
|
||||
DragDropTargetFullViewport = 0;
|
||||
DragDropAcceptFlags = ImGuiDragDropFlags_None;
|
||||
DragDropAcceptFlagsCurr = DragDropAcceptFlagsPrev = ImGuiDragDropFlags_None;
|
||||
DragDropAcceptIdCurrRectSurface = 0.0f;
|
||||
DragDropAcceptIdPrev = DragDropAcceptIdCurr = 0;
|
||||
DragDropAcceptFrameCount = -1;
|
||||
|
|
@ -5713,6 +5722,8 @@ void ImGui::NewFrame()
|
|||
// Drag and drop
|
||||
g.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr;
|
||||
g.DragDropAcceptIdCurr = 0;
|
||||
g.DragDropAcceptFlagsPrev = g.DragDropAcceptFlagsCurr;
|
||||
g.DragDropAcceptFlagsCurr = ImGuiDragDropFlags_None;
|
||||
g.DragDropAcceptIdCurrRectSurface = FLT_MAX;
|
||||
g.DragDropWithinSource = false;
|
||||
g.DragDropWithinTarget = false;
|
||||
|
|
@ -6500,16 +6511,16 @@ void ImGui::SetNextItemAllowOverlap()
|
|||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority.
|
||||
// FIXME-LEGACY: Use SetNextItemAllowOverlap() *before* your item instead.
|
||||
void ImGui::SetItemAllowOverlap()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiID id = g.LastItemData.ID;
|
||||
if (g.HoveredId == id)
|
||||
g.HoveredIdAllowOverlap = true;
|
||||
if (g.ActiveId == id) // Before we made this obsolete, most calls to SetItemAllowOverlap() used to avoid this path by testing g.ActiveId != id.
|
||||
g.ActiveIdAllowOverlap = true;
|
||||
}
|
||||
// Use SetNextItemAllowOverlap() *before* your item instead of calling this!
|
||||
//void ImGui::SetItemAllowOverlap()
|
||||
//{
|
||||
// ImGuiContext& g = *GImGui;
|
||||
// ImGuiID id = g.LastItemData.ID;
|
||||
// if (g.HoveredId == id)
|
||||
// g.HoveredIdAllowOverlap = true;
|
||||
// if (g.ActiveId == id) // Before we made this obsolete, most calls to SetItemAllowOverlap() used to avoid this path by testing g.ActiveId != id.
|
||||
// g.ActiveIdAllowOverlap = true;
|
||||
//}
|
||||
#endif
|
||||
|
||||
// This is a shortcut for not taking ownership of 100+ keys, frequently used by drag operations.
|
||||
|
|
@ -6577,10 +6588,10 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, I
|
|||
IM_ASSERT((child_flags & (ImGuiChildFlags_AutoResizeX | ImGuiChildFlags_AutoResizeY)) != 0 && "Must use ImGuiChildFlags_AutoResizeX or ImGuiChildFlags_AutoResizeY with ImGuiChildFlags_AlwaysAutoResize!");
|
||||
}
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
if (window_flags & ImGuiWindowFlags_AlwaysUseWindowPadding)
|
||||
child_flags |= ImGuiChildFlags_AlwaysUseWindowPadding;
|
||||
if (window_flags & ImGuiWindowFlags_NavFlattened)
|
||||
child_flags |= ImGuiChildFlags_NavFlattened;
|
||||
//if (window_flags & ImGuiWindowFlags_AlwaysUseWindowPadding)
|
||||
// child_flags |= ImGuiChildFlags_AlwaysUseWindowPadding;
|
||||
//if (window_flags & ImGuiWindowFlags_NavFlattened)
|
||||
// child_flags |= ImGuiChildFlags_NavFlattened;
|
||||
#endif
|
||||
if (child_flags & ImGuiChildFlags_AutoResizeX)
|
||||
child_flags &= ~ImGuiChildFlags_ResizeX;
|
||||
|
|
@ -8486,7 +8497,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||
// Set default BgClickFlags
|
||||
// This is set at the end of this function, so UpdateManualResize()/ClampWindowPos() may use last-frame value if overriden by user code.
|
||||
// FIXME: The general intent is that we will later expose config options to default to enable scrolling + select scrolling mouse button.
|
||||
window->BgClickFlags = g.IO.ConfigWindowsMoveFromTitleBarOnly ? ImGuiWindowBgClickFlags_None : ImGuiWindowBgClickFlags_Move;
|
||||
window->BgClickFlags = (flags & ImGuiWindowFlags_ChildWindow) ? parent_window->BgClickFlags : (g.IO.ConfigWindowsMoveFromTitleBarOnly ? ImGuiWindowBgClickFlags_None : ImGuiWindowBgClickFlags_Move);
|
||||
|
||||
// We fill last item data based on Title Bar/Tab, in order for IsItemHovered() and IsItemActive() to be usable after Begin().
|
||||
// This is useful to allow creating context menus on title bar only, etc.
|
||||
|
|
@ -15266,7 +15277,7 @@ void ImGui::ClearDragDrop()
|
|||
IMGUI_DEBUG_LOG_ACTIVEID("[dragdrop] ClearDragDrop()\n");
|
||||
g.DragDropActive = false;
|
||||
g.DragDropPayload.Clear();
|
||||
g.DragDropAcceptFlags = ImGuiDragDropFlags_None;
|
||||
g.DragDropAcceptFlagsCurr = ImGuiDragDropFlags_None;
|
||||
g.DragDropAcceptIdCurr = g.DragDropAcceptIdPrev = 0;
|
||||
g.DragDropAcceptIdCurrRectSurface = FLT_MAX;
|
||||
g.DragDropAcceptFrameCount = -1;
|
||||
|
|
@ -15395,7 +15406,7 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
|||
// Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit)
|
||||
// We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents.
|
||||
bool ret;
|
||||
if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
|
||||
if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlagsPrev & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
|
||||
ret = BeginTooltipHidden();
|
||||
else
|
||||
ret = BeginTooltip();
|
||||
|
|
@ -15576,7 +15587,7 @@ const ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDrop
|
|||
if (r_surface > g.DragDropAcceptIdCurrRectSurface)
|
||||
return NULL;
|
||||
|
||||
g.DragDropAcceptFlags = flags;
|
||||
g.DragDropAcceptFlagsCurr = flags;
|
||||
g.DragDropAcceptIdCurr = g.DragDropTargetId;
|
||||
g.DragDropAcceptIdCurrRectSurface = r_surface;
|
||||
//IMGUI_DEBUG_LOG("AcceptDragDropPayload(): %08X: accept\n", g.DragDropTargetId);
|
||||
|
|
@ -15618,7 +15629,7 @@ void ImGui::RenderDragDropTargetRectForItem(const ImRect& bb)
|
|||
ImGuiWindow* window = g.CurrentWindow;
|
||||
ImRect bb_display = bb;
|
||||
bb_display.ClipWith(g.DragDropTargetClipRect); // Clip THEN expand so we have a way to visualize that target is not entirely visible.
|
||||
bb_display.Expand(3.5f);
|
||||
bb_display.Expand(g.Style.DragDropTargetPadding);
|
||||
bool push_clip_rect = !window->ClipRect.Contains(bb_display);
|
||||
if (push_clip_rect)
|
||||
window->DrawList->PushClipRectFullScreen();
|
||||
|
|
@ -15629,7 +15640,9 @@ void ImGui::RenderDragDropTargetRectForItem(const ImRect& bb)
|
|||
|
||||
void ImGui::RenderDragDropTargetRectEx(ImDrawList* draw_list, const ImRect& bb)
|
||||
{
|
||||
draw_list->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_DragDropTarget), 0.0f, 0, 2.0f); // FIXME-DPI
|
||||
ImGuiContext& g = *GImGui;
|
||||
draw_list->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_DragDropTargetBg), g.Style.DragDropTargetRounding, 0);
|
||||
draw_list->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_DragDropTarget), g.Style.DragDropTargetRounding, 0, g.Style.DragDropTargetBorderSize);
|
||||
}
|
||||
|
||||
const ImGuiPayload* ImGui::GetDragDropPayload()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue