2016-05-31 09:46:31 +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-05-31 09:46:31 +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-05-31 09:46:31 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2018-01-11 19:33:26 +00:00
|
|
|
#include "history/view/history_view_element.h"
|
|
|
|
|
2022-12-14 12:15:46 +00:00
|
|
|
class HistoryItem;
|
2017-06-22 15:11:41 +00:00
|
|
|
|
2021-09-03 10:17:07 +00:00
|
|
|
namespace Ui {
|
|
|
|
class ChatStyle;
|
|
|
|
struct CornersPixmaps;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2022-10-25 16:40:26 +00:00
|
|
|
namespace Data {
|
|
|
|
class ForumTopic;
|
|
|
|
} // namespace Data
|
|
|
|
|
|
|
|
namespace Info::Profile {
|
|
|
|
class TopicIconView;
|
|
|
|
} // namespace Info::Profile
|
|
|
|
|
2018-01-09 17:08:31 +00:00
|
|
|
namespace HistoryView {
|
2016-05-31 09:46:31 +00:00
|
|
|
|
2022-09-21 14:55:27 +00:00
|
|
|
class Service final : public Element {
|
2018-01-11 19:33:26 +00:00
|
|
|
public:
|
2018-01-19 17:10:58 +00:00
|
|
|
Service(
|
|
|
|
not_null<ElementDelegate*> delegate,
|
2022-12-14 12:15:46 +00:00
|
|
|
not_null<HistoryItem*> data,
|
2020-06-16 16:53:44 +00:00
|
|
|
Element *replacing);
|
2018-01-11 19:33:26 +00:00
|
|
|
|
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;
|
2021-08-19 14:22:12 +00:00
|
|
|
void draw(Painter &p, const PaintContext &context) const override;
|
2018-01-27 13:59:24 +00:00
|
|
|
PointState pointState(QPoint point) const override;
|
|
|
|
TextState textState(
|
2018-01-13 12:45:11 +00:00
|
|
|
QPoint point,
|
2018-01-27 13:59:24 +00:00
|
|
|
StateRequest request) const override;
|
2018-01-13 12:45:11 +00:00
|
|
|
void updatePressed(QPoint point) override;
|
2019-04-08 15:10:06 +00:00
|
|
|
TextForMimeData selectedText(TextSelection selection) const override;
|
2023-10-31 18:37:59 +00:00
|
|
|
SelectedQuote selectedQuote(TextSelection selection) const override;
|
2023-10-24 09:46:43 +00:00
|
|
|
TextSelection selectionFromQuote(
|
2023-11-10 09:27:47 +00:00
|
|
|
const SelectedQuote "e) const override;
|
2018-01-14 16:02:25 +00:00
|
|
|
TextSelection adjustSelection(
|
|
|
|
TextSelection selection,
|
|
|
|
TextSelectType type) const override;
|
2018-01-13 12:45:11 +00:00
|
|
|
|
2022-02-08 02:46:02 +00:00
|
|
|
QRect innerGeometry() const override;
|
|
|
|
|
2023-11-21 09:31:38 +00:00
|
|
|
bool consumeHorizontalScroll(QPoint position, int delta) override;
|
|
|
|
|
2018-01-11 19:33:26 +00:00
|
|
|
private:
|
2022-12-14 12:15:46 +00:00
|
|
|
[[nodiscard]] QRect countGeometry() const;
|
2018-01-13 12:45:11 +00:00
|
|
|
|
|
|
|
QSize performCountOptimalSize() override;
|
|
|
|
QSize performCountCurrentSize(int newWidth) override;
|
|
|
|
|
2018-01-11 19:33:26 +00:00
|
|
|
};
|
|
|
|
|
2017-05-17 12:38:42 +00:00
|
|
|
int WideChatWidth();
|
|
|
|
|
2016-06-09 11:51:24 +00:00
|
|
|
class ServiceMessagePainter {
|
|
|
|
public:
|
2021-09-03 10:17:07 +00:00
|
|
|
static void PaintDate(
|
2021-05-31 15:45:59 +00:00
|
|
|
Painter &p,
|
2021-09-03 10:17:07 +00:00
|
|
|
not_null<const Ui::ChatStyle*> st,
|
2021-05-31 15:45:59 +00:00
|
|
|
const QDateTime &date,
|
|
|
|
int y,
|
|
|
|
int w,
|
2021-09-03 10:17:07 +00:00
|
|
|
bool chatWide);
|
|
|
|
static void PaintDate(
|
2021-05-31 15:45:59 +00:00
|
|
|
Painter &p,
|
2021-09-03 10:17:07 +00:00
|
|
|
not_null<const Ui::ChatStyle*> st,
|
2021-05-31 15:45:59 +00:00
|
|
|
const QString &dateText,
|
|
|
|
int y,
|
|
|
|
int w,
|
2021-09-03 10:17:07 +00:00
|
|
|
bool chatWide);
|
|
|
|
static void PaintDate(
|
2021-05-31 15:45:59 +00:00
|
|
|
Painter &p,
|
2021-09-03 10:17:07 +00:00
|
|
|
not_null<const Ui::ChatStyle*> st,
|
2021-05-31 15:45:59 +00:00
|
|
|
const QString &dateText,
|
|
|
|
int dateTextWidth,
|
|
|
|
int y,
|
|
|
|
int w,
|
2021-09-03 10:17:07 +00:00
|
|
|
bool chatWide);
|
|
|
|
static void PaintDate(
|
2021-05-31 15:45:59 +00:00
|
|
|
Painter &p,
|
2021-09-03 10:17:07 +00:00
|
|
|
const style::color &bg,
|
|
|
|
const Ui::CornersPixmaps &corners,
|
|
|
|
const style::color &fg,
|
|
|
|
const QString &dateText,
|
|
|
|
int dateTextWidth,
|
2021-05-31 15:45:59 +00:00
|
|
|
int y,
|
|
|
|
int w,
|
2021-09-03 10:17:07 +00:00
|
|
|
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
|
|
|
|
2021-09-03 10:17:07 +00:00
|
|
|
static void PaintComplexBubble(
|
2021-05-31 15:45:59 +00:00
|
|
|
Painter &p,
|
2021-09-03 10:17:07 +00:00
|
|
|
not_null<const Ui::ChatStyle*> st,
|
2021-05-31 15:45:59 +00:00
|
|
|
int left,
|
|
|
|
int width,
|
|
|
|
const Ui::Text::String &text,
|
2021-09-03 10:17:07 +00:00
|
|
|
const QRect &textRect);
|
2018-01-13 12:45:11 +00:00
|
|
|
|
|
|
|
private:
|
2023-10-03 13:50:33 +00:00
|
|
|
static std::vector<int> CountLineWidths(
|
2021-09-03 10:17:07 +00:00
|
|
|
const Ui::Text::String &text,
|
|
|
|
const QRect &textRect);
|
2016-06-09 11:51:24 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2019-01-18 08:11:15 +00:00
|
|
|
class EmptyPainter {
|
|
|
|
public:
|
|
|
|
explicit EmptyPainter(not_null<History*> history);
|
2022-10-25 16:40:26 +00:00
|
|
|
EmptyPainter(
|
|
|
|
not_null<Data::ForumTopic*> topic,
|
|
|
|
Fn<bool()> paused,
|
|
|
|
Fn<void()> update);
|
|
|
|
~EmptyPainter();
|
2019-01-18 08:11:15 +00:00
|
|
|
|
2021-09-03 10:17:07 +00:00
|
|
|
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();
|
2022-10-25 16:40:26 +00:00
|
|
|
void fillAboutTopic();
|
2019-01-18 08:11:15 +00:00
|
|
|
|
|
|
|
not_null<History*> _history;
|
2022-10-25 16:40:26 +00:00
|
|
|
Data::ForumTopic *_topic = nullptr;
|
|
|
|
std::unique_ptr<Info::Profile::TopicIconView> _icon;
|
2022-09-30 07:25:02 +00:00
|
|
|
Ui::Text::String _header;
|
|
|
|
Ui::Text::String _text;
|
2019-06-12 13:26:04 +00:00
|
|
|
std::vector<Ui::Text::String> _phrases;
|
2019-01-18 08:11:15 +00:00
|
|
|
|
2022-10-25 16:40:26 +00:00
|
|
|
rpl::lifetime _lifetime;
|
|
|
|
|
2019-01-18 08:11:15 +00:00
|
|
|
};
|
2016-10-22 18:58:25 +00:00
|
|
|
|
2018-01-09 17:08:31 +00:00
|
|
|
} // namespace HistoryView
|