/* 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/timer.h" #include "base/object_ptr.h" #include "base/binary_guard.h" #include "ui/rp_widget.h" #include "ui/layers/layer_widget.h" namespace Ui { class IconButton; class FlatLabel; class UserpicButton; class PopupMenu; class ScrollArea; class VerticalLayout; class VerticalLayoutReorder; class RippleButton; class PlainShadow; class SettingsButton; template class SlideWrap; } // namespace Ui namespace Main { class Account; } // namespace Main namespace Window { class SessionController; class MainMenu final : public Ui::LayerWidget { public: MainMenu(QWidget *parent, not_null controller); void parentResized() override; protected: void paintEvent(QPaintEvent *e) override; void resizeEvent(QResizeEvent *e) override; void doSetInnerFocus() override { setFocus(); } private: class ToggleAccountsButton; class ResetScaleButton; void setupUserpicButton(); void setupAccounts(); void setupAccountsToggle(); [[nodiscard]] auto setupAddAccount( not_null container) -> not_null*>; void setupArchive(); void setupMenu(); void rebuildAccounts(); void updateControlsGeometry(); void updateInnerControlsGeometry(); void updatePhone(); void initResetScaleButton(); void toggleAccounts(); const not_null _controller; object_ptr _userpicButton; object_ptr _toggleAccounts; object_ptr _resetScaleButton = { nullptr }; object_ptr _scroll; not_null _inner; base::flat_map< not_null, base::unique_qptr> _watched; not_null _topShadowSkip; not_null*> _accounts; Ui::SlideWrap *_addAccount = nullptr; not_null*> _shadow; not_null _menu; not_null _footer; not_null _telegram; not_null _version; QPointer _nightThemeToggle; rpl::event_stream _nightThemeSwitches; base::Timer _nightThemeSwitch; base::unique_qptr _contextMenu; std::unique_ptr _reorder; int _reordering = 0; base::binary_guard _accountSwitchGuard; QString _phoneText; }; struct OthersUnreadState { int count = 0; bool allMuted = false; }; [[nodiscard]] OthersUnreadState OtherAccountsUnreadStateCurrent(); [[nodiscard]] rpl::producer OtherAccountsUnreadState(); } // namespace Window