2016-11-09 13:40:51 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-11-09 13:40:51 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-11-09 13:40:51 +00:00
|
|
|
*/
|
2016-10-12 19:34:25 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-09-13 17:01:23 +00:00
|
|
|
#include "ui/rp_widget.h"
|
2016-11-09 13:40:51 +00:00
|
|
|
|
2017-09-30 18:26:45 +00:00
|
|
|
namespace style {
|
|
|
|
struct Shadow;
|
|
|
|
} // namespace style
|
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
namespace Ui {
|
|
|
|
|
2017-09-13 17:01:23 +00:00
|
|
|
class PlainShadow : public RpWidget {
|
2016-10-12 19:34:25 +00:00
|
|
|
public:
|
2017-09-30 18:26:45 +00:00
|
|
|
PlainShadow(QWidget *parent);
|
|
|
|
PlainShadow(QWidget *parent, style::color color);
|
2016-10-12 19:34:25 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *e) override {
|
2017-09-13 17:01:23 +00:00
|
|
|
Painter(this).fillRect(e->rect(), _color);
|
2016-10-12 19:34:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2016-12-23 13:21:01 +00:00
|
|
|
style::color _color;
|
2016-10-12 19:34:25 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-11-09 13:40:51 +00:00
|
|
|
class Shadow : public TWidget {
|
|
|
|
public:
|
2017-12-26 12:41:48 +00:00
|
|
|
Shadow(
|
|
|
|
QWidget *parent,
|
|
|
|
const style::Shadow &st,
|
|
|
|
RectParts sides = RectPart::AllSides)
|
|
|
|
: TWidget(parent)
|
2016-11-09 13:40:51 +00:00
|
|
|
, _st(st)
|
|
|
|
, _sides(sides) {
|
|
|
|
}
|
|
|
|
|
2017-12-26 12:41:48 +00:00
|
|
|
static void paint(
|
|
|
|
Painter &p,
|
|
|
|
const QRect &box,
|
|
|
|
int outerWidth,
|
|
|
|
const style::Shadow &st,
|
|
|
|
RectParts sides = RectPart::AllSides);
|
|
|
|
|
|
|
|
static QPixmap grab(
|
|
|
|
not_null<TWidget*> target,
|
|
|
|
const style::Shadow &shadow,
|
|
|
|
RectParts sides = RectPart::AllSides);
|
2016-12-13 17:07:56 +00:00
|
|
|
|
2016-11-09 13:40:51 +00:00
|
|
|
protected:
|
2017-09-30 18:26:45 +00:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2016-11-09 13:40:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const style::Shadow &_st;
|
2017-05-24 12:20:50 +00:00
|
|
|
RectParts _sides;
|
2016-11-09 13:40:51 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
} // namespace Ui
|