2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-12-26 12:30:32 +01:00
|
|
|
#include "common.hpp"
|
2017-08-13 16:10:53 +02:00
|
|
|
#include "widgets/basewidget.hpp"
|
|
|
|
|
2017-08-13 16:52:16 +02:00
|
|
|
#include <QMenu>
|
2017-01-22 12:46:35 +01:00
|
|
|
#include <QPropertyAnimation>
|
2017-12-22 14:44:31 +01:00
|
|
|
#include <pajlada/settings/setting.hpp>
|
2017-12-17 03:37:46 +01:00
|
|
|
#include <pajlada/signals/connection.hpp>
|
2016-12-29 17:31:07 +01:00
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
|
|
|
|
2018-05-23 04:22:17 +02:00
|
|
|
#define NOTEBOOK_TAB_HEIGHT 28
|
|
|
|
|
|
|
|
// class Notebook;
|
2018-04-18 09:12:29 +02:00
|
|
|
class Notebook2;
|
2017-11-12 17:21:50 +01:00
|
|
|
class SplitContainer;
|
2016-12-29 18:02:13 +01:00
|
|
|
|
2018-04-18 09:12:29 +02:00
|
|
|
class NotebookTab2 : public BaseWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit NotebookTab2(Notebook2 *_notebook);
|
|
|
|
|
|
|
|
void updateSize();
|
|
|
|
|
|
|
|
QWidget *page;
|
|
|
|
|
|
|
|
const 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<pajlada::Signals::ScopedConnection> managedConnections;
|
|
|
|
|
|
|
|
QPropertyAnimation positionChangedAnimation;
|
|
|
|
bool positionChangedAnimationRunning = false;
|
|
|
|
QPoint positionAnimationDesiredPoint;
|
|
|
|
|
|
|
|
Notebook2 *notebook;
|
|
|
|
|
|
|
|
QString title;
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool useDefaultTitle = true;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool selected = false;
|
|
|
|
bool mouseOver = false;
|
|
|
|
bool mouseDown = false;
|
|
|
|
bool mouseOverX = false;
|
|
|
|
bool mouseDownX = false;
|
|
|
|
|
2018-05-23 04:22:17 +02:00
|
|
|
bool hasXButton();
|
|
|
|
bool shouldDrawXButton();
|
2017-01-22 05:58:23 +01:00
|
|
|
|
2017-12-26 12:05:14 +01:00
|
|
|
HighlightState highlightState = HighlightState::None;
|
2017-01-22 05:58:23 +01:00
|
|
|
|
2017-08-13 16:52:16 +02:00
|
|
|
QMenu menu;
|
|
|
|
|
2018-05-23 04:22:17 +02:00
|
|
|
QRect getXRect();
|
2016-12-29 17:31:07 +01:00
|
|
|
};
|
2017-01-28 22:35:23 +01:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|