#pragma once #include "common.hpp" #include "widgets/basewidget.hpp" #include #include #include #include namespace chatterino { namespace widgets { class Notebook; class SplitContainer; class NotebookTab : public BaseWidget { Q_OBJECT const std::string uuid; const std::string settingRoot; public: explicit NotebookTab(Notebook *_notebook, const std::string &_uuid); void updateSize(); SplitContainer *page; QString getTitle() const; void setTitle(const QString &newTitle); bool isSelected() const; void setSelected(bool value); void setHighlightState(HighlightState style); void moveAnimated(QPoint pos, bool animated = true); QRect getDesiredRect() const; void hideTabXChanged(bool); protected: virtual void themeRefreshEvent() override; virtual void paintEvent(QPaintEvent *) override; virtual void mousePressEvent(QMouseEvent *event) override; virtual void mouseReleaseEvent(QMouseEvent *event) override; virtual void enterEvent(QEvent *) override; virtual void leaveEvent(QEvent *) override; virtual void dragEnterEvent(QDragEnterEvent *event) override; virtual void mouseMoveEvent(QMouseEvent *event) override; private: std::vector managedConnections; QPropertyAnimation positionChangedAnimation; bool positionChangedAnimationRunning = false; QPoint positionAnimationDesiredPoint; Notebook *notebook; pajlada::Settings::Setting title; public: pajlada::Settings::Setting useDefaultBehaviour; private: bool selected = false; bool mouseOver = false; bool mouseDown = false; bool mouseOverX = false; bool mouseDownX = false; HighlightState highlightState = HighlightState::None; QMenu menu; QRect getXRect() { float scale = this->getScale(); return QRect(this->width() - static_cast(20 * scale), static_cast(4 * scale), static_cast(16 * scale), static_cast(16 * scale)); } }; } // namespace widgets } // namespace chatterino