mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
7df7da70cb
Remove unused constructor of messages::Message Fixed LimitedQueueSnapshot _-prefixes Changed LimitedQueueSnapshot's usage of int to std::size_t ColorScheme is no longer a singleton Created a "BaseWidget" class which is pretty much a QWidget except it has a reference of ColorScheme since most widgets will need a reference to the style they should use. BaseWidget can be implemented either with a BaseWidget parent (which will copy the ColorScheme reference from the parent) or with a normal QWidget parent and an explicit ColorScheme reference. Save main window geometry on close Fix font changing in the Settings Dialog Update settings library version
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "widgets/basewidget.hpp"
|
|
|
|
#include <QMouseEvent>
|
|
#include <QPainter>
|
|
#include <QPoint>
|
|
#include <QTimer>
|
|
#include <QWidget>
|
|
|
|
namespace chatterino {
|
|
namespace widgets {
|
|
|
|
class FancyButton : public BaseWidget
|
|
{
|
|
struct ClickEffect {
|
|
double progress = 0.0;
|
|
QPoint position;
|
|
|
|
ClickEffect(QPoint _position)
|
|
: position(_position)
|
|
{
|
|
}
|
|
};
|
|
|
|
public:
|
|
FancyButton(BaseWidget *parent);
|
|
|
|
void setMouseEffectColor(QColor color);
|
|
|
|
protected:
|
|
virtual void paintEvent(QPaintEvent *) override;
|
|
virtual void enterEvent(QEvent *) override;
|
|
virtual void leaveEvent(QEvent *) override;
|
|
virtual void mousePressEvent(QMouseEvent *event) override;
|
|
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
|
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
|
|
|
void fancyPaint(QPainter &painter);
|
|
|
|
private:
|
|
bool selected = false;
|
|
bool mouseOver = false;
|
|
bool mouseDown = false;
|
|
QPoint mousePos;
|
|
double hoverMultiplier = 0.0;
|
|
QTimer effectTimer;
|
|
std::vector<ClickEffect> clickEffects;
|
|
QColor mouseEffectColor = {255, 255, 255};
|
|
|
|
void onMouseEffectTimeout();
|
|
};
|
|
|
|
} // namespace widgets
|
|
} // namespace chatterino
|