mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Combos: Changed the combo popup to use a different id to also using a context menu with the default item id. (#4167)
This commit is contained in:
parent
c708299ca9
commit
029c83c73e
@ -73,6 +73,8 @@ Other Changes:
|
|||||||
is used. (#4155, #4156) [@michael-swan]
|
is used. (#4155, #4156) [@michael-swan]
|
||||||
- LabelText: Fixed clipping of multi-line value text when label is single-line. (#4004)
|
- LabelText: Fixed clipping of multi-line value text when label is single-line. (#4004)
|
||||||
- LabelText: Fixed vertical alignment of single-line value text when label is multi-line. (#4004)
|
- LabelText: Fixed vertical alignment of single-line value text when label is multi-line. (#4004)
|
||||||
|
- Combos: Changed the combo popup to use a different id to also using a context menu with the default item id.
|
||||||
|
Fixed using BeginPopupContextItem() with no parameter. (#4167)
|
||||||
- Popups: Added 'OpenPopup(ImGuiID id)' overload to facilitate calling from nested stacks. (#3993, #331) [@zlash]
|
- Popups: Added 'OpenPopup(ImGuiID id)' overload to facilitate calling from nested stacks. (#3993, #331) [@zlash]
|
||||||
- Tweak computation of io.Framerate so it is less biased toward high-values in the first 120 frames. (#4138)
|
- Tweak computation of io.Framerate so it is less biased toward high-values in the first 120 frames. (#4138)
|
||||||
- Optimization: Disabling some of MSVC most aggressive Debug runtime checks for some simple/low-level functions
|
- Optimization: Disabling some of MSVC most aggressive Debug runtime checks for some simple/low-level functions
|
||||||
|
18
imgui.cpp
18
imgui.cpp
@ -4106,20 +4106,20 @@ void ImGui::UpdateDebugToolItemPicker()
|
|||||||
if (g.DebugItemPickerActive)
|
if (g.DebugItemPickerActive)
|
||||||
{
|
{
|
||||||
const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
|
const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
|
||||||
ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);
|
SetMouseCursor(ImGuiMouseCursor_Hand);
|
||||||
if (ImGui::IsKeyPressedMap(ImGuiKey_Escape))
|
if (IsKeyPressedMap(ImGuiKey_Escape))
|
||||||
g.DebugItemPickerActive = false;
|
g.DebugItemPickerActive = false;
|
||||||
if (ImGui::IsMouseClicked(0) && hovered_id)
|
if (IsMouseClicked(0) && hovered_id)
|
||||||
{
|
{
|
||||||
g.DebugItemPickerBreakId = hovered_id;
|
g.DebugItemPickerBreakId = hovered_id;
|
||||||
g.DebugItemPickerActive = false;
|
g.DebugItemPickerActive = false;
|
||||||
}
|
}
|
||||||
ImGui::SetNextWindowBgAlpha(0.60f);
|
SetNextWindowBgAlpha(0.60f);
|
||||||
ImGui::BeginTooltip();
|
BeginTooltip();
|
||||||
ImGui::Text("HoveredId: 0x%08X", hovered_id);
|
Text("HoveredId: 0x%08X", hovered_id);
|
||||||
ImGui::Text("Press ESC to abort picking.");
|
Text("Press ESC to abort picking.");
|
||||||
ImGui::TextColored(GetStyleColorVec4(hovered_id ? ImGuiCol_Text : ImGuiCol_TextDisabled), "Click to break in debugger!");
|
TextColored(GetStyleColorVec4(hovered_id ? ImGuiCol_Text : ImGuiCol_TextDisabled), "Click to break in debugger!");
|
||||||
ImGui::EndTooltip();
|
EndTooltip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
imgui.h
2
imgui.h
@ -61,7 +61,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.83 WIP"
|
#define IMGUI_VERSION "1.83 WIP"
|
||||||
#define IMGUI_VERSION_NUM 18210
|
#define IMGUI_VERSION_NUM 18211
|
||||||
#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
|
||||||
|
|
||||||
|
@ -1578,7 +1578,9 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
|
|||||||
|
|
||||||
bool hovered, held;
|
bool hovered, held;
|
||||||
bool pressed = ButtonBehavior(frame_bb, id, &hovered, &held);
|
bool pressed = ButtonBehavior(frame_bb, id, &hovered, &held);
|
||||||
bool popup_open = IsPopupOpen(id, ImGuiPopupFlags_None);
|
|
||||||
|
const ImGuiID popup_id = ImHashStr("##ComboPopup", 0, id);
|
||||||
|
bool popup_open = IsPopupOpen(popup_id, ImGuiPopupFlags_None);
|
||||||
|
|
||||||
const ImU32 frame_col = GetColorU32(hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
|
const ImU32 frame_col = GetColorU32(hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);
|
||||||
const float value_x2 = ImMax(frame_bb.Min.x, frame_bb.Max.x - arrow_size);
|
const float value_x2 = ImMax(frame_bb.Min.x, frame_bb.Max.x - arrow_size);
|
||||||
@ -1608,7 +1610,7 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
|
|||||||
{
|
{
|
||||||
if (window->DC.NavLayerCurrent == 0)
|
if (window->DC.NavLayerCurrent == 0)
|
||||||
window->NavLastIds[0] = id;
|
window->NavLastIds[0] = id;
|
||||||
OpenPopupEx(id, ImGuiPopupFlags_None);
|
OpenPopupEx(popup_id, ImGuiPopupFlags_None);
|
||||||
popup_open = true;
|
popup_open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user