mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-20 14:56:35 +00:00
Merge branch 'master' into docking
# Conflicts: # imgui.cpp # imgui.h
This commit is contained in:
commit
c58fb46411
@ -124,7 +124,14 @@ Other Changes:
|
|||||||
to common idioms (e.g. passing .data(), .data() + .size() from a null string). (#3615)
|
to common idioms (e.g. passing .data(), .data() + .size() from a null string). (#3615)
|
||||||
- Nav: Fixed toggling menu layer with Alt or exiting menu layer with Esc not moving mouse when
|
- Nav: Fixed toggling menu layer with Alt or exiting menu layer with Esc not moving mouse when
|
||||||
the NavEnableSetMousePos config flag is set.
|
the NavEnableSetMousePos config flag is set.
|
||||||
- Menus: adjust closing logic to accomodate for varying font size and dpi.
|
- Nav: Fixed a few widgets from not setting reference keyboard/gamepad navigation ID when
|
||||||
|
activated with mouse. More specifically: BeginTabItem(), the scrolling arrows of BeginTabBar(),
|
||||||
|
the arrow section of TreeNode(), the +/- buttons of InputInt()/InputFloat(), Selectable() with
|
||||||
|
ImGuiSelectableFlags_SelectOnRelease. More generally: any direct use of ButtonBehavior() with
|
||||||
|
the PressedOnClick/PressedOnDoubleClick/PressedOnRelease button policy.
|
||||||
|
- Menus: Fixed vertical alignments of MenuItem() calls within a menu bar. (broken in 1.84). (#4538)
|
||||||
|
- Menus: Adjust closing logic to accomodate for varying font size and dpi.
|
||||||
|
- Menus: Fixed crash when navigating left inside a child window inside a sub-menu. (#4510).
|
||||||
- Drag and Drop: Fixed using BeginDragDropSource() inside a BeginChild() that returned false. (#4515)
|
- Drag and Drop: Fixed using BeginDragDropSource() inside a BeginChild() that returned false. (#4515)
|
||||||
- PlotHistogram: Fixed zero-line position when manually specifying min<0 and max>0. (#4349) [@filippocrocchini]
|
- PlotHistogram: Fixed zero-line position when manually specifying min<0 and max>0. (#4349) [@filippocrocchini]
|
||||||
- IO: Added 'io.WantCaptureMouseUnlessPopupClose' alternative to `io.WantCaptureMouse'. (#4480)
|
- IO: Added 'io.WantCaptureMouseUnlessPopupClose' alternative to `io.WantCaptureMouse'. (#4480)
|
||||||
|
2
imgui.h
2
imgui.h
@ -65,7 +65,7 @@ Index of this file:
|
|||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.85 WIP"
|
#define IMGUI_VERSION "1.85 WIP"
|
||||||
#define IMGUI_VERSION_NUM 18412
|
#define IMGUI_VERSION_NUM 18414
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
||||||
|
@ -396,6 +396,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::MenuItem("Documents", NULL, &show_app_documents);
|
ImGui::MenuItem("Documents", NULL, &show_app_documents);
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
//if (ImGui::MenuItem("MenuItem")) {} // You can also use MenuItem() inside a menu bar!
|
||||||
if (ImGui::BeginMenu("Tools"))
|
if (ImGui::BeginMenu("Tools"))
|
||||||
{
|
{
|
||||||
ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics);
|
ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics);
|
||||||
|
@ -1170,7 +1170,7 @@ void ImGui::TableUpdateBorders(ImGuiTable* table)
|
|||||||
KeepAliveID(column_id);
|
KeepAliveID(column_id);
|
||||||
|
|
||||||
bool hovered = false, held = false;
|
bool hovered = false, held = false;
|
||||||
bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);
|
bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_NoNavFocus);
|
||||||
if (pressed && IsMouseDoubleClicked(0))
|
if (pressed && IsMouseDoubleClicked(0))
|
||||||
{
|
{
|
||||||
TableSetColumnWidthAutoSingle(table, column_n);
|
TableSetColumnWidthAutoSingle(table, column_n);
|
||||||
|
@ -571,6 +571,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
else
|
else
|
||||||
SetActiveID(id, window); // Hold on ID
|
SetActiveID(id, window); // Hold on ID
|
||||||
|
if (!(flags & ImGuiButtonFlags_NoNavFocus))
|
||||||
|
SetFocusID(id, window);
|
||||||
g.ActiveIdMouseButton = mouse_button_clicked;
|
g.ActiveIdMouseButton = mouse_button_clicked;
|
||||||
FocusWindow(window);
|
FocusWindow(window);
|
||||||
}
|
}
|
||||||
@ -581,6 +583,8 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|||||||
const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay;
|
const bool has_repeated_at_least_once = (flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[mouse_button_released] >= g.IO.KeyRepeatDelay;
|
||||||
if (!has_repeated_at_least_once)
|
if (!has_repeated_at_least_once)
|
||||||
pressed = true;
|
pressed = true;
|
||||||
|
if (!(flags & ImGuiButtonFlags_NoNavFocus))
|
||||||
|
SetFocusID(id, window);
|
||||||
ClearActiveID();
|
ClearActiveID();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6860,7 +6864,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Menu inside a menu
|
// Menu inside a regular/vertical menu
|
||||||
// (In a typical menu window where all items are BeginMenu() or MenuItem() calls, extra_w will always be 0.0f.
|
// (In a typical menu window where all items are BeginMenu() or MenuItem() calls, extra_w will always be 0.0f.
|
||||||
// Only when they are other items sticking out we're going to add spacing, yet only register minimum width into the layout system.
|
// Only when they are other items sticking out we're going to add spacing, yet only register minimum width into the layout system.
|
||||||
popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);
|
popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);
|
||||||
@ -6981,11 +6985,12 @@ void ImGui::EndMenu()
|
|||||||
// However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction.
|
// However, it means that with the current code, a BeginMenu() from outside another menu or a menu-bar won't be closable with the Left direction.
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
if (g.NavWindow && g.NavWindow->ParentWindow == window && g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)
|
if (g.NavMoveDir == ImGuiDir_Left && NavMoveRequestButNoResultYet() && window->DC.LayoutType == ImGuiLayoutType_Vertical)
|
||||||
{
|
if (g.NavWindow && (g.NavWindow->RootWindowForNav->Flags & ImGuiWindowFlags_Popup) && g.NavWindow->RootWindowForNav->ParentWindow == window)
|
||||||
ClosePopupToLevel(g.BeginPopupStack.Size, true);
|
{
|
||||||
NavMoveRequestCancel();
|
ClosePopupToLevel(g.BeginPopupStack.Size, true);
|
||||||
}
|
NavMoveRequestCancel();
|
||||||
|
}
|
||||||
|
|
||||||
EndPopup();
|
EndPopup();
|
||||||
}
|
}
|
||||||
@ -7015,10 +7020,11 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut
|
|||||||
// Note that in this situation: we don't render the shortcut, we render a highlight instead of the selected tick mark.
|
// Note that in this situation: we don't render the shortcut, we render a highlight instead of the selected tick mark.
|
||||||
float w = label_size.x;
|
float w = label_size.x;
|
||||||
window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * 0.5f);
|
window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * 0.5f);
|
||||||
|
ImVec2 text_pos(window->DC.CursorPos.x + offsets->OffsetLabel, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);
|
||||||
PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));
|
PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));
|
||||||
pressed = Selectable("", selected, flags, ImVec2(w, 0.0f));
|
pressed = Selectable("", selected, flags, ImVec2(w, 0.0f));
|
||||||
PopStyleVar();
|
PopStyleVar();
|
||||||
RenderText(pos + ImVec2(offsets->OffsetLabel, 0.0f), label);
|
RenderText(text_pos, label);
|
||||||
window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().
|
window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user