diff --git a/Telegram/SourceFiles/ui/grouped_layout_geometry.cpp b/Telegram/SourceFiles/ui/grouped_layout_geometry.cpp new file mode 100644 index 0000000000..a3425318f3 --- /dev/null +++ b/Telegram/SourceFiles/ui/grouped_layout_geometry.cpp @@ -0,0 +1,28 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#include "ui/grouped_layout_geometry.h" + +#include "ui/grouped_layout.h" + +namespace Ui { + +std::vector LayoutMediaGroupGeometry( + const std::vector &sizes, + int maxWidth, + int minWidth, + int spacing) { + const auto layout = LayoutMediaGroup(sizes, maxWidth, minWidth, spacing); + auto result = std::vector(); + result.reserve(layout.size()); + for (const auto &part : layout) { + result.push_back(part.geometry); + } + return result; +} + +} // namespace Ui diff --git a/Telegram/SourceFiles/ui/grouped_layout_geometry.h b/Telegram/SourceFiles/ui/grouped_layout_geometry.h new file mode 100644 index 0000000000..de0650e27b --- /dev/null +++ b/Telegram/SourceFiles/ui/grouped_layout_geometry.h @@ -0,0 +1,22 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once + +#include + +namespace Ui { + +// LayoutMediaGroup without the per-item sides, so that targets which do +// not link lib_ui, like td_export, can use the same album geometry. +[[nodiscard]] std::vector LayoutMediaGroupGeometry( + const std::vector &sizes, + int maxWidth, + int minWidth, + int spacing); + +} // namespace Ui diff --git a/Telegram/cmake/td_ui.cmake b/Telegram/cmake/td_ui.cmake index 2058f6030e..ae9a7f7da4 100644 --- a/Telegram/cmake/td_ui.cmake +++ b/Telegram/cmake/td_ui.cmake @@ -636,6 +636,8 @@ PRIVATE ui/empty_userpic.h ui/grouped_layout.cpp ui/grouped_layout.h + ui/grouped_layout_geometry.cpp + ui/grouped_layout_geometry.h ui/new_badges.cpp ui/new_badges.h ui/peer/color_sample.cpp