mirror of
https://github.com/ocornut/imgui.git
synced 2025-02-16 10:42:35 +01:00
Combo: Horizontally offset items using WindowPadding instead of Indent, for consistency.
This commit is contained in:
parent
773d484009
commit
91e39e72a3
13
imgui.cpp
13
imgui.cpp
@ -10875,27 +10875,24 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
|
|||||||
SetNextWindowPos(pos);
|
SetNextWindowPos(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Horizontally align ourselves with the framed text
|
||||||
|
PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.FramePadding.x, style.WindowPadding.y));
|
||||||
|
|
||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings;
|
ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings;
|
||||||
if (!Begin(name, NULL, window_flags))
|
if (!Begin(name, NULL, window_flags))
|
||||||
{
|
{
|
||||||
EndPopup();
|
EndPopup();
|
||||||
|
PopStyleVar();
|
||||||
IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above
|
IM_ASSERT(0); // This should never happen as we tested for IsPopupOpen() above
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontally align ourselves with the framed text
|
|
||||||
if (style.FramePadding.x != style.WindowPadding.x)
|
|
||||||
Indent(style.FramePadding.x - style.WindowPadding.x);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::EndCombo()
|
void ImGui::EndCombo()
|
||||||
{
|
{
|
||||||
const ImGuiStyle& style = GImGui->Style;
|
|
||||||
if (style.FramePadding.x != style.WindowPadding.x)
|
|
||||||
Unindent(style.FramePadding.x - style.WindowPadding.x);
|
|
||||||
EndPopup();
|
EndPopup();
|
||||||
|
PopStyleVar();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Old API, prefer using BeginCombo() nowadays if you can.
|
// Old API, prefer using BeginCombo() nowadays if you can.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user