mirror-chatterino2/src/widgets/helper/NotebookButton.hpp

44 lines
925 B
C++
Raw Normal View History

#pragma once
2016-12-30 12:19:31 +01:00
2018-11-23 17:51:55 +01:00
#include "widgets/helper/Button.hpp"
2017-04-12 17:46:44 +02:00
2016-12-30 12:20:26 +01:00
#include <QWidget>
2016-12-30 12:19:31 +01:00
2017-01-18 21:30:23 +01:00
namespace chatterino {
class Notebook;
2018-08-08 15:35:54 +02:00
class NotebookButton : public Button
2016-12-30 12:19:31 +01:00
{
2016-12-30 12:20:26 +01:00
Q_OBJECT
2017-04-12 17:46:44 +02:00
2016-12-30 12:19:31 +01:00
public:
enum Icon { None, Plus, User, Settings };
2016-12-30 12:20:26 +01:00
explicit NotebookButton(Notebook *parent);
2016-12-30 12:20:26 +01:00
2018-07-06 19:23:47 +02:00
void setIcon(Icon icon);
Icon getIcon() const;
2016-12-30 12:20:26 +01:00
2017-04-12 17:46:44 +02:00
protected:
2018-07-06 17:11:37 +02:00
virtual void themeChangedEvent() override;
2018-01-24 22:09:26 +01:00
virtual void paintEvent(QPaintEvent *) override;
virtual void mouseReleaseEvent(QMouseEvent *) override;
virtual void dragEnterEvent(QDragEnterEvent *) override;
virtual void dragLeaveEvent(QDragLeaveEvent *) override;
virtual void dropEvent(QDropEvent *) override;
2016-12-30 12:20:26 +01:00
virtual void hideEvent(QHideEvent *) override;
virtual void showEvent(QShowEvent *) override;
2017-01-01 18:43:52 +01:00
signals:
void leftClicked();
2017-01-01 18:43:52 +01:00
2016-12-30 12:20:26 +01:00
private:
Notebook *parent_ = nullptr;
2018-06-06 10:46:23 +02:00
QPoint mousePos_;
Icon icon_ = None;
2016-12-30 12:19:31 +01:00
};
2017-04-14 17:47:28 +02:00
} // namespace chatterino