mirror of
https://github.com/ocornut/imgui.git
synced 2026-08-03 22:28:48 +00:00
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_sdl3.cpp # backends/imgui_impl_vulkan.cpp # imgui.cpp
This commit is contained in:
28
imgui.cpp
28
imgui.cpp
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.90 WIP
|
||||
// dear imgui, v1.90.0
|
||||
// (main code and documentation)
|
||||
|
||||
// Help:
|
||||
@@ -358,7 +358,7 @@ CODE
|
||||
|
||||
To decide whether to dispatch mouse/keyboard inputs to Dear ImGui to the rest of your application,
|
||||
you should read the 'io.WantCaptureMouse', 'io.WantCaptureKeyboard' and 'io.WantTextInput' flags!
|
||||
Please read the FAQ and example applications for details about this!
|
||||
Please read the FAQ entry "How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?" about this.
|
||||
|
||||
|
||||
HOW A SIMPLE RENDERING FUNCTION MAY LOOK LIKE
|
||||
@@ -5612,6 +5612,9 @@ bool ImGui::IsItemToggledSelection()
|
||||
return (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_ToggledSelection) ? true : false;
|
||||
}
|
||||
|
||||
// IMPORTANT: If you are trying to check whether your mouse should be dispatched to Dear ImGui or to your underlying app,
|
||||
// you should not use this function! Use the 'io.WantCaptureMouse' boolean for that!
|
||||
// Refer to FAQ entry "How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?" for details.
|
||||
bool ImGui::IsAnyItemHovered()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
@@ -5769,10 +5772,13 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, I
|
||||
SetNextWindowSize(size);
|
||||
|
||||
// Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value.
|
||||
// FIXME: 2023/11/14: commented out shorted version. We had an issue with multiple ### in child window path names, which the trailing hash helped workaround.
|
||||
// e.g. "ParentName###ParentIdentifier/ChildName###ChildIdentifier" would get hashed incorrectly by ImHashStr(), trailing _%08X somehow fixes it.
|
||||
const char* temp_window_name;
|
||||
if (name && parent_window->IDStack.back() == parent_window->ID)
|
||||
/*if (name && parent_window->IDStack.back() == parent_window->ID)
|
||||
ImFormatStringToTempBuffer(&temp_window_name, NULL, "%s/%s", parent_window->Name, name); // May omit ID if in root of ID stack
|
||||
else if (name)
|
||||
else*/
|
||||
if (name)
|
||||
ImFormatStringToTempBuffer(&temp_window_name, NULL, "%s/%s_%08X", parent_window->Name, name, id);
|
||||
else
|
||||
ImFormatStringToTempBuffer(&temp_window_name, NULL, "%s/%08X", parent_window->Name, id);
|
||||
@@ -5986,6 +5992,7 @@ static ImGuiWindow* GetWindowForTitleAndMenuHeight(ImGuiWindow* window)
|
||||
static inline ImVec2 CalcWindowMinSize(ImGuiWindow* window)
|
||||
{
|
||||
// Popups, menus and childs bypass style.WindowMinSize by default, but we give then a non-zero minimum size to facilitate understanding problematic cases (e.g. empty popups)
|
||||
// FIXME: the if/else could probably be removed, "reduce artifacts" section for all windows.
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImVec2 size_min;
|
||||
if (window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_ChildWindow))
|
||||
@@ -5996,7 +6003,8 @@ static inline ImVec2 CalcWindowMinSize(ImGuiWindow* window)
|
||||
else
|
||||
{
|
||||
ImGuiWindow* window_for_height = GetWindowForTitleAndMenuHeight(window);
|
||||
size_min = g.Style.WindowMinSize;
|
||||
size_min.x = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.x : 4.0f;
|
||||
size_min.y = ((window->Flags & ImGuiWindowFlags_AlwaysAutoResize) == 0) ? g.Style.WindowMinSize.x : 4.0f;
|
||||
size_min.y = ImMax(size_min.y, window_for_height->TitleBarHeight() + window_for_height->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows
|
||||
}
|
||||
return size_min;
|
||||
@@ -6008,7 +6016,7 @@ static ImVec2 CalcWindowSizeAfterConstraint(ImGuiWindow* window, const ImVec2& s
|
||||
ImVec2 new_size = size_desired;
|
||||
if (g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSizeConstraint)
|
||||
{
|
||||
// Using -1,-1 on either X/Y axis to preserve the current size.
|
||||
// See comments in SetNextWindowSizeConstraints() for details about setting size_min an size_max.
|
||||
ImRect cr = g.NextWindowData.SizeConstraintRect;
|
||||
new_size.x = (cr.Min.x >= 0 && cr.Max.x >= 0) ? ImClamp(new_size.x, cr.Min.x, cr.Max.x) : window->SizeFull.x;
|
||||
new_size.y = (cr.Min.y >= 0 && cr.Max.y >= 0) ? ImClamp(new_size.y, cr.Min.y, cr.Max.y) : window->SizeFull.y;
|
||||
@@ -8011,6 +8019,10 @@ bool ImGui::IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_b
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is current window hovered and hoverable (e.g. not blocked by a popup/modal)? See ImGuiHoveredFlags_ for options.
|
||||
// IMPORTANT: If you are trying to check whether your mouse should be dispatched to Dear ImGui or to your underlying app,
|
||||
// you should not use this function! Use the 'io.WantCaptureMouse' boolean for that!
|
||||
// Refer to FAQ entry "How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?" for details.
|
||||
bool ImGui::IsWindowHovered(ImGuiHoveredFlags flags)
|
||||
{
|
||||
IM_ASSERT((flags & ~ImGuiHoveredFlags_AllowedMaskForIsWindowHovered) == 0 && "Invalid flags for IsWindowHovered()!");
|
||||
@@ -8286,6 +8298,10 @@ void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiCond cond)
|
||||
g.NextWindowData.SizeCond = cond ? cond : ImGuiCond_Always;
|
||||
}
|
||||
|
||||
// For each axis:
|
||||
// - Use 0.0f as min or FLT_MAX as max if you don't want limits, e.g. size_min = (500.0f, 0.0f), size_max = (FLT_MAX, FLT_MAX) sets a minimum width.
|
||||
// - Use -1 for both min and max of same axis to preserve current size which itself is a constraint.
|
||||
// - See "Demo->Examples->Constrained-resizing window" for examples.
|
||||
void ImGui::SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback, void* custom_callback_user_data)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
||||
Reference in New Issue
Block a user