mirror of https://github.com/ocornut/imgui
Combo() adding frame padding inside the combo box.
This commit is contained in:
parent
dc52938627
commit
f3967f1183
|
@ -1277,7 +1277,7 @@ public:
|
|||
float CalcFontSize() const { return GImGui->FontBaseSize * FontWindowScale; }
|
||||
float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0 : CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f; }
|
||||
ImRect TitleBarRect() const { return ImRect(Pos, Pos + ImVec2(SizeFull.x, TitleBarHeight())); }
|
||||
ImVec2 WindowPadding() const { return ((Flags & ImGuiWindowFlags_ChildWindow) && !(Flags & ImGuiWindowFlags_ShowBorders)) ? ImVec2(0,0) : GImGui->Style.WindowPadding; }
|
||||
ImVec2 WindowPadding() const { return ((Flags & ImGuiWindowFlags_ChildWindow) && !(Flags & ImGuiWindowFlags_ShowBorders) && !(Flags & ImGuiWindowFlags_ComboBox)) ? ImVec2(0,0) : GImGui->Style.WindowPadding; }
|
||||
ImU32 Color(ImGuiCol idx, float a=1.f) const { ImVec4 c = GImGui->Style.Colors[idx]; c.w *= GImGui->Style.Alpha * a; return ImGui::ColorConvertFloat4ToU32(c); }
|
||||
ImU32 Color(const ImVec4& col) const { ImVec4 c = col; c.w *= GImGui->Style.Alpha; return ImGui::ColorConvertFloat4ToU32(c); }
|
||||
};
|
||||
|
@ -6708,11 +6708,12 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
|
|||
|
||||
const ImVec2 backup_pos = ImGui::GetCursorPos();
|
||||
const float popup_off_x = 0.0f;//style.ItemInnerSpacing.x;
|
||||
const float popup_height = (label_size.y + style.ItemSpacing.y) * ImMin(items_count, height_in_items) + style.WindowPadding.y;
|
||||
const float popup_height = (label_size.y + style.ItemSpacing.y) * ImMin(items_count, height_in_items) + (style.FramePadding.y * 3);
|
||||
const ImRect popup_rect(ImVec2(frame_bb.Min.x+popup_off_x, frame_bb.Max.y), ImVec2(frame_bb.Max.x+popup_off_x, frame_bb.Max.y + popup_height));
|
||||
ImGui::SetCursorPos(popup_rect.Min - window->Pos);
|
||||
|
||||
const ImGuiWindowFlags flags = ImGuiWindowFlags_ComboBox | ((window->Flags & ImGuiWindowFlags_ShowBorders) ? ImGuiWindowFlags_ShowBorders : 0);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);
|
||||
ImGui::BeginChild("#ComboBox", popup_rect.GetSize(), false, flags);
|
||||
ImGui::Spacing();
|
||||
|
||||
|
@ -6740,6 +6741,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
|
|||
ImGui::PopID();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::SetCursorPos(backup_pos);
|
||||
|
||||
if (!combo_item_active && g.ActiveId != 0)
|
||||
|
|
Loading…
Reference in New Issue