/* 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 class PeerData; namespace Window { class SessionController; } // namespace Window namespace Data { struct ChatTheme; } // namespace Data namespace Ui { class RpWidget; class PlainShadow; class VerticalLayout; class ChooseThemeController final { public: ChooseThemeController( not_null parent, not_null window, not_null peer); ~ChooseThemeController(); [[nodiscard]] bool shouldBeShown() const; [[nodiscard]] rpl::producer shouldBeShownValue() const; [[nodiscard]] int height() const; void hide(); void show(); void raise(); void setFocus(); [[nodiscard]] rpl::lifetime &lifetime(); private: struct Entry; void init(rpl::producer outer); void initButtons(); void initList(); void fill(const std::vector &themes); void close(); void clearCurrentBackgroundState(); void paintEntry(QPainter &p, const Entry &entry); [[nodiscard]] Entry *findChosen(); [[nodiscard]] const Entry *findChosen() const; const not_null _controller; const not_null _peer; const std::unique_ptr _wrap; const std::unique_ptr _topShadow; const not_null _content; const not_null _inner; std::vector _entries; QString _pressed; QString _chosen; rpl::variable _shouldBeShown = false; rpl::variable _forceHidden = false; rpl::variable _dark = false; rpl::lifetime _cachingLifetime; }; } // namespace Ui