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

135 lines
2.8 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;
namespace Ui {
class ChatStyle;
struct CornersPixmaps;
} // namespace Ui
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<ElementDelegate*> delegate,
not_null<HistoryService*> data,
Element *replacing);
2018-02-16 17:59:35 +00:00
int marginTop() const override;
int marginBottom() const override;
2018-01-30 13:17:50 +00:00
bool isHidden() const override;
void draw(Painter &p, const PaintContext &context) const override;
PointState pointState(QPoint point) const override;
TextState textState(
QPoint point,
StateRequest request) const override;
void updatePressed(QPoint point) override;
TextForMimeData selectedText(TextSelection selection) const override;
TextSelection adjustSelection(
TextSelection selection,
TextSelectType type) const override;
private:
not_null<HistoryService*> message() const;
QRect countGeometry() const;
QSize performCountOptimalSize() override;
QSize performCountCurrentSize(int newWidth) override;
};
int WideChatWidth();
class ServiceMessagePainter {
public:
static void PaintDate(
Painter &p,
not_null<const Ui::ChatStyle*> st,
const QDateTime &date,
int y,
int w,
bool chatWide);
static void PaintDate(
Painter &p,
not_null<const Ui::ChatStyle*> st,
const QString &dateText,
int y,
int w,
bool chatWide);
static void PaintDate(
Painter &p,
not_null<const Ui::ChatStyle*> st,
const QString &dateText,
int dateTextWidth,
int y,
int w,
bool chatWide);
static void PaintDate(
Painter &p,
const style::color &bg,
const Ui::CornersPixmaps &corners,
const style::color &fg,
const QString &dateText,
int dateTextWidth,
int y,
int w,
bool chatWide);
static void PaintBubble(
Painter &p,
not_null<const Ui::ChatStyle*> st,
QRect rect);
static void PaintBubble(
Painter &p,
const style::color &bg,
const Ui::CornersPixmaps &corners,
QRect rect);
2016-07-08 10:06:41 +00:00
static void PaintComplexBubble(
Painter &p,
not_null<const Ui::ChatStyle*> st,
int left,
int width,
const Ui::Text::String &text,
const QRect &textRect);
private:
static QVector<int> CountLineWidths(
const Ui::Text::String &text,
const QRect &textRect);
};
2019-01-18 08:11:15 +00:00
class EmptyPainter {
public:
explicit EmptyPainter(not_null<History*> history);
void paint(
Painter &p,
not_null<const Ui::ChatStyle*> st,
int width,
int height);
2019-01-18 08:11:15 +00:00
private:
void fillAboutGroup();
not_null<History*> _history;
2019-06-12 13:26:04 +00:00
Ui::Text::String _header = { st::msgMinWidth };
Ui::Text::String _text = { st::msgMinWidth };
std::vector<Ui::Text::String> _phrases;
2019-01-18 08:11:15 +00:00
};
2018-01-09 17:08:31 +00:00
} // namespace HistoryView