mirror-chatterino2/notebooktab.h

86 lines
1.4 KiB
C
Raw Normal View History

2016-12-29 17:31:07 +01:00
#ifndef NOTEBOOKTAB_H
#define NOTEBOOKTAB_H
2017-01-15 16:38:30 +01:00
#include <QWidget>
2016-12-29 17:31:07 +01:00
2016-12-29 18:02:13 +01:00
class Notebook;
2016-12-30 18:00:25 +01:00
class NotebookPage;
2016-12-29 18:02:13 +01:00
2016-12-29 17:31:07 +01:00
class NotebookTab : public QWidget
{
2017-01-11 18:52:09 +01:00
Q_OBJECT
2016-12-29 17:31:07 +01:00
public:
2017-01-15 16:38:30 +01:00
enum HighlightStyle {
HighlightNone,
HighlightHighlighted,
HighlightNewMessage
};
2017-01-18 04:33:30 +01:00
NotebookTab(Notebook *notebook);
2016-12-30 12:20:26 +01:00
2016-12-30 18:00:25 +01:00
void calcSize();
2017-01-11 18:52:09 +01:00
NotebookPage *page;
2016-12-30 18:00:25 +01:00
2017-01-15 16:38:30 +01:00
const QString &
2017-01-18 04:33:30 +01:00
getText() const
2017-01-15 16:38:30 +01:00
{
2017-01-18 04:33:30 +01:00
return this->text;
2017-01-15 16:38:30 +01:00
}
void
setText(const QString &text)
{
2017-01-18 04:33:30 +01:00
this->text = text;
2017-01-15 16:38:30 +01:00
}
bool
2017-01-18 04:33:30 +01:00
getSelected()
2017-01-15 16:38:30 +01:00
{
2017-01-18 04:33:30 +01:00
return this->selected;
2017-01-15 16:38:30 +01:00
}
2016-12-30 18:00:25 +01:00
2017-01-15 16:38:30 +01:00
void
setSelected(bool value)
{
2017-01-18 04:33:30 +01:00
this->selected = value;
2017-01-15 16:38:30 +01:00
repaint();
}
2017-01-01 02:30:42 +01:00
2017-01-15 16:38:30 +01:00
HighlightStyle
2017-01-18 04:33:30 +01:00
getHighlightStyle() const
2017-01-15 16:38:30 +01:00
{
2017-01-18 04:33:30 +01:00
return this->highlightStyle;
2017-01-15 16:38:30 +01:00
}
void
setHighlightStyle(HighlightStyle style)
{
2017-01-18 04:33:30 +01:00
this->highlightStyle = style;
2017-01-15 16:38:30 +01:00
repaint();
}
2017-01-01 02:30:42 +01:00
2016-12-30 12:20:26 +01:00
protected:
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
void enterEvent(QEvent *) Q_DECL_OVERRIDE;
void leaveEvent(QEvent *) Q_DECL_OVERRIDE;
2017-01-01 02:30:42 +01:00
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
2016-12-29 17:31:07 +01:00
private:
2017-01-18 04:33:30 +01:00
Notebook *notebook;
2017-01-15 16:38:30 +01:00
2017-01-18 04:33:30 +01:00
QString text;
2016-12-30 12:20:26 +01:00
2017-01-18 04:33:30 +01:00
bool selected;
bool mouseOver;
bool mouseDown;
HighlightStyle highlightStyle;
2016-12-29 17:31:07 +01:00
};
2017-01-11 18:52:09 +01:00
#endif // NOTEBOOKTAB_H