/* 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" namespace Ui { struct SubTabsOptions { QString selected; bool centered = false; }; struct SubTabsTab { QString id; TextWithEntities text; friend inline bool operator==( const SubTabsTab &, const SubTabsTab &) = default; }; class SubTabs : public RpWidget { public: using Options = SubTabsOptions; using Tab = SubTabsTab; explicit SubTabs( QWidget *parent, Options options = {}, std::vector tabs = {}, Text::MarkedContext context = {}); void setTabs( std::vector tabs, Text::MarkedContext context = {}); void setActiveTab(const QString &id); [[nodiscard]] rpl::producer activated() const; [[nodiscard]] rpl::producer contextMenuRequests() const; private: struct Button { Tab tab; QRect geometry; Text::String text; bool active = false; }; int resizeGetHeight(int newWidth) override; void wheelEvent(QWheelEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override; void mousePressEvent(QMouseEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override; void contextMenuEvent(QContextMenuEvent *e) override; void paintEvent(QPaintEvent *e) override; bool eventHook(QEvent *e) override; void setSelected(int index); void setActive(int index); [[nodiscard]] QPoint scroll() const; std::vector