You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nheko/include/ui/RippleOverlay.h

59 lines
1.1 KiB

#pragma once
8 years ago
#include <QPainterPath>
#include "OverlayWidget.h"
class Ripple;
class RippleOverlay : public OverlayWidget
{
Q_OBJECT
8 years ago
public:
explicit RippleOverlay(QWidget *parent = 0);
~RippleOverlay();
8 years ago
void addRipple(Ripple *ripple);
void addRipple(const QPoint &position, qreal radius = 300);
8 years ago
void removeRipple(Ripple *ripple);
8 years ago
inline void setClipping(bool enable);
inline bool hasClipping() const;
8 years ago
inline void setClipPath(const QPainterPath &path);
8 years ago
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
8 years ago
private:
Q_DISABLE_COPY(RippleOverlay)
8 years ago
void paintRipple(QPainter *painter, Ripple *ripple);
8 years ago
QList<Ripple *> ripples_;
QPainterPath clip_path_;
bool use_clip_;
8 years ago
};
inline void
RippleOverlay::setClipping(bool enable)
8 years ago
{
use_clip_ = enable;
update();
8 years ago
}
inline bool
RippleOverlay::hasClipping() const
8 years ago
{
return use_clip_;
8 years ago
}
inline void
RippleOverlay::setClipPath(const QPainterPath &path)
8 years ago
{
clip_path_ = path;
update();
8 years ago
}