/* 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 "ui/round_rect.h" #include "base/object_ptr.h" namespace Main { class Session; } // namespace Main namespace Ui { class VerticalLayout; class FlatLabel; class SettingsButton; class AbstractButton; } // namespace Ui namespace Window { class SessionController; } // namespace Window namespace style { struct SettingsButton; } // namespace style namespace Settings { enum class Type { Main, Information, Notifications, PrivacySecurity, Sessions, Advanced, Chat, Folders, Calls, Experimental, }; using Button = Ui::SettingsButton; class Section : public Ui::RpWidget { public: using RpWidget::RpWidget; virtual rpl::producer sectionShowOther() { return nullptr; } virtual void sectionSaveChanges(FnMut done) { done(); } }; inline constexpr auto kIconRed = 1; inline constexpr auto kIconGreen = 2; inline constexpr auto kIconLightOrange = 3; inline constexpr auto kIconLightBlue = 4; inline constexpr auto kIconDarkBlue = 5; inline constexpr auto kIconPurple = 6; inline constexpr auto kIconDarkOrange = 8; inline constexpr auto kIconGray = 9; enum class IconType { Rounded, Round, }; struct IconDescriptor { const style::icon *icon = nullptr; int color = 0; // settingsIconBg{color}, 9 for settingsIconBgArchive. IconType type = IconType::Rounded; const style::color *background = nullptr; explicit operator bool() const { return (icon != nullptr); } }; class Icon final { public: explicit Icon(IconDescriptor descriptor); void paint(QPainter &p, QPoint position) const; void paint(QPainter &p, int x, int y) const; [[nodiscard]] int width() const; [[nodiscard]] int height() const; [[nodiscard]] QSize size() const; private: not_null _icon; std::optional _background; }; object_ptr
CreateSection( Type type, not_null parent, not_null controller); void AddSkip(not_null container); void AddSkip(not_null container, int skip); void AddDivider(not_null container); void AddDividerText( not_null container, rpl::producer text); void AddButtonIcon( not_null button, const style::SettingsButton &st, IconDescriptor &&descriptor); object_ptr