/* 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 "ui/rp_widget.h" #include "info/info_wrap_widget.h" #include "dialogs/dialogs_key.h" #include "window/section_memento.h" #include "base/object_ptr.h" namespace Storage { enum class SharedMediaType : signed char; } // namespace Storage namespace Data { class ForumTopic; } // namespace Data namespace Ui { class ScrollArea; struct ScrollToRequest; } // namespace Ui namespace Info { namespace Settings { struct Tag; } // namespace Settings namespace Downloads { struct Tag; } // namespace Downloads class ContentMemento; class WrapWidget; class Memento final : public Window::SectionMemento { public: explicit Memento(not_null peer); Memento(not_null peer, Section section); explicit Memento(not_null topic); Memento(not_null topic, Section section); Memento(Settings::Tag settings, Section section); Memento(not_null poll, FullMsgId contextId); explicit Memento(std::vector> stack); object_ptr createWidget( QWidget *parent, not_null controller, Window::Column column, const QRect &geometry) override; object_ptr createLayer( not_null controller, const QRect &geometry) override; rpl::producer<> removeRequests() const override { return _removeRequests.events(); } int stackSize() const { return int(_stack.size()); } std::vector> takeStack(); not_null content() { Expects(!_stack.empty()); return _stack.back().get(); } static Section DefaultSection(not_null peer); static std::shared_ptr Default(not_null peer); ~Memento(); private: static std::vector> DefaultStack( not_null peer, Section section); static std::vector> DefaultStack( not_null topic, Section section); static std::vector> DefaultStack( Settings::Tag settings, Section section); static std::vector> DefaultStack( not_null poll, FullMsgId contextId); static std::shared_ptr DefaultContent( not_null peer, Section section); static std::shared_ptr DefaultContent( not_null topic, Section section); std::vector> _stack; rpl::event_stream<> _removeRequests; rpl::lifetime _lifetime; }; class MoveMemento final : public Window::SectionMemento { public: MoveMemento(object_ptr content); object_ptr createWidget( QWidget *parent, not_null controller, Window::Column column, const QRect &geometry) override; object_ptr createLayer( not_null controller, const QRect &geometry) override; bool instant() const override { return true; } object_ptr takeContent( QWidget *parent, Wrap wrap); private: object_ptr _content; }; } // namespace Info