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
|
|
|
|
};
|
|
|
|
|
|
|
|
NotebookTab(Notebook *m_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 &
|
|
|
|
text() const
|
|
|
|
{
|
|
|
|
return m_text;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
setText(const QString &text)
|
|
|
|
{
|
|
|
|
m_text = text;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
selected()
|
|
|
|
{
|
|
|
|
return m_selected;
|
|
|
|
}
|
2016-12-30 18:00:25 +01:00
|
|
|
|
2017-01-15 16:38:30 +01:00
|
|
|
void
|
|
|
|
setSelected(bool value)
|
|
|
|
{
|
|
|
|
m_selected = value;
|
|
|
|
repaint();
|
|
|
|
}
|
2017-01-01 02:30:42 +01:00
|
|
|
|
2017-01-15 16:38:30 +01:00
|
|
|
HighlightStyle
|
|
|
|
highlightStyle() const
|
|
|
|
{
|
|
|
|
return m_highlightStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
setHighlightStyle(HighlightStyle style)
|
|
|
|
{
|
|
|
|
m_highlightStyle = style;
|
|
|
|
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-15 16:38:30 +01:00
|
|
|
Notebook *m_notebook;
|
|
|
|
|
|
|
|
QString m_text;
|
2016-12-30 12:20:26 +01:00
|
|
|
|
2017-01-15 16:38:30 +01:00
|
|
|
bool m_selected;
|
|
|
|
bool m_mouseOver;
|
|
|
|
bool m_mouseDown;
|
|
|
|
HighlightStyle m_highlightStyle;
|
2016-12-29 17:31:07 +01:00
|
|
|
};
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
#endif // NOTEBOOKTAB_H
|