tdesktop/Telegram/SourceFiles/history/view/history_view_service_message.h

73 lines
1.7 KiB
C
Raw Normal View History

2016-05-31 09:46:31 +00:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
2016-05-31 09:46:31 +00:00
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
2016-05-31 09:46:31 +00:00
*/
#pragma once
#include "history/view/history_view_element.h"
class HistoryService;
2018-01-09 17:08:31 +00:00
namespace HistoryView {
2016-05-31 09:46:31 +00:00
class Service : public Element {
public:
Service(not_null<HistoryService*> data, Context context);
void draw(
Painter &p,
QRect clip,
TextSelection selection,
TimeMs ms) const override;
bool hasPoint(QPoint point) const override;
HistoryTextState getState(
QPoint point,
HistoryStateRequest request) const override;
void updatePressed(QPoint point) override;
private:
not_null<HistoryService*> message() const;
QRect countGeometry() const;
QSize performCountOptimalSize() override;
QSize performCountCurrentSize(int newWidth) override;
};
int WideChatWidth();
struct PaintContext {
2016-12-01 19:20:33 +00:00
PaintContext(TimeMs ms, const QRect &clip, TextSelection selection)
: ms(ms)
, clip(clip)
, selection(selection) {
}
2016-12-01 19:20:33 +00:00
TimeMs ms;
const QRect &clip;
TextSelection selection;
};
2016-05-31 09:46:31 +00:00
class ServiceMessagePainter {
public:
static void paintDate(Painter &p, const QDateTime &date, int y, int w);
static void paintDate(Painter &p, const QString &dateText, int dateTextWidth, int y, int w);
2016-07-08 10:06:41 +00:00
static void paintBubble(Painter &p, int x, int y, int w, int h);
static void paintComplexBubble(Painter &p, int left, int width, const Text &text, const QRect &textRect);
private:
static QVector<int> countLineWidths(const Text &text, const QRect &textRect);
};
void paintEmpty(Painter &p, int width, int height);
void serviceColorsUpdated();
2018-01-09 17:08:31 +00:00
} // namespace HistoryView