/* 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 "base/object_ptr.h" #include "ui/rect_part.h" namespace Ui { class VerticalLayout; class FlatLabel; class RpWidget; } // namespace Ui namespace Info::Profile { struct SectionSeparator { enum class Kind { None, Plain, Text }; Kind kind = Kind::None; rpl::producer text; Fn)> textSetup; [[nodiscard]] static SectionSeparator None(); [[nodiscard]] static SectionSeparator Plain(); [[nodiscard]] static SectionSeparator Text( rpl::producer text, Fn)> setup = nullptr); }; struct Section { object_ptr widget = { nullptr }; rpl::producer shown; SectionSeparator trailing; bool embedsLeadingSeparator = false; }; class SectionStack final { public: explicit SectionStack(not_null layout); void add(Section section); void addPlainSeparator(); void finalize(); [[nodiscard]] int count() const; [[nodiscard]] not_null layout() const; private: [[nodiscard]] rpl::producer nextVisibleIsNonEmbedding( int afterIndex) const; [[nodiscard]] rpl::producer anyShownAtOrBefore(int index) const; [[nodiscard]] rpl::producer anyShownAfter(int index) const; [[nodiscard]] rpl::producer anyShownInRange( int from, int toInclusive) const; [[nodiscard]] rpl::producer computePlainMarkerCandidate( int position) const; void addPlainMarkerSlot( int markerIndex, not_null>*> candidates, bool suppressedByText); void addTextSeparatorSlot(int sectionIndex, SectionSeparator &trailing); const not_null _layout; std::vector
_sections; std::vector _plainMarkerAfter; bool _finalized = false; }; } // namespace Info::Profile