2016-04-09 22:45:55 +04:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-04-09 22:45:55 +04:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-04-09 22:45:55 +04:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2021-10-01 14:57:24 +04:00
|
|
|
namespace Ui {
|
|
|
|
} // namespace Ui
|
2016-04-09 22:45:55 +04:00
|
|
|
|
2022-09-29 11:52:18 +04:00
|
|
|
namespace Data {
|
|
|
|
class Forum;
|
|
|
|
class Folder;
|
|
|
|
} // namespace Data
|
|
|
|
|
2021-10-01 14:57:24 +04:00
|
|
|
namespace Dialogs {
|
2016-04-09 22:45:55 +04:00
|
|
|
class Row;
|
|
|
|
class FakeRow;
|
2019-06-17 16:37:29 +02:00
|
|
|
class BasicRow;
|
2021-10-01 14:57:24 +04:00
|
|
|
} // namespace Dialogs
|
2016-04-09 22:45:55 +04:00
|
|
|
|
2021-10-01 14:57:24 +04:00
|
|
|
namespace Dialogs::Ui {
|
|
|
|
|
|
|
|
using namespace ::Ui;
|
2016-04-09 22:45:55 +04:00
|
|
|
|
2022-08-09 14:12:19 +03:00
|
|
|
class VideoUserpic;
|
|
|
|
|
2022-09-29 11:52:18 +04:00
|
|
|
struct PaintContext {
|
|
|
|
Data::Folder *folder = nullptr;
|
|
|
|
Data::Forum *forum = nullptr;
|
|
|
|
FilterId filter = 0;
|
|
|
|
crl::time now = 0;
|
|
|
|
int width = 0;
|
|
|
|
bool active = false;
|
|
|
|
bool selected = false;
|
|
|
|
bool paused = false;
|
|
|
|
bool search = false;
|
|
|
|
bool narrow = false;
|
|
|
|
bool displayUnreadInfo = false;
|
|
|
|
};
|
|
|
|
|
2017-11-05 15:21:30 +04:00
|
|
|
const style::icon *ChatTypeIcon(
|
2018-02-22 16:50:56 +03:00
|
|
|
not_null<PeerData*> peer,
|
2022-09-29 11:52:18 +04:00
|
|
|
const PaintContext &context = {});
|
2016-09-30 15:52:03 +03:00
|
|
|
|
2016-04-09 22:45:55 +04:00
|
|
|
class RowPainter {
|
|
|
|
public:
|
2022-09-29 11:52:18 +04:00
|
|
|
static void Paint(
|
2017-11-05 15:21:30 +04:00
|
|
|
Painter &p,
|
2018-01-05 18:57:18 +03:00
|
|
|
not_null<const Row*> row,
|
2022-05-16 15:38:35 +04:00
|
|
|
VideoUserpic *videoUserpic,
|
2022-09-29 11:52:18 +04:00
|
|
|
const PaintContext &context);
|
|
|
|
static void Paint(
|
2017-11-05 15:21:30 +04:00
|
|
|
Painter &p,
|
2018-01-05 18:57:18 +03:00
|
|
|
not_null<const FakeRow*> row,
|
2022-09-29 11:52:18 +04:00
|
|
|
const PaintContext &context);
|
|
|
|
static QRect SendActionAnimationRect(
|
2021-08-30 20:38:11 +03:00
|
|
|
int animationLeft,
|
2017-11-05 15:21:30 +04:00
|
|
|
int animationWidth,
|
|
|
|
int animationHeight,
|
|
|
|
int fullWidth,
|
|
|
|
bool textUpdated);
|
2016-04-09 22:45:55 +04:00
|
|
|
};
|
|
|
|
|
2019-05-03 14:55:44 +04:00
|
|
|
void PaintCollapsedRow(
|
2017-11-05 15:21:30 +04:00
|
|
|
Painter &p,
|
2019-06-17 16:37:29 +02:00
|
|
|
const BasicRow &row,
|
2019-05-03 17:02:00 +04:00
|
|
|
Data::Folder *folder,
|
2019-05-03 14:55:44 +04:00
|
|
|
const QString &text,
|
|
|
|
int unread,
|
2017-11-05 15:21:30 +04:00
|
|
|
int fullWidth,
|
2019-04-16 13:29:21 +04:00
|
|
|
bool selected);
|
2016-04-11 14:59:01 +04:00
|
|
|
|
2022-09-29 11:52:18 +04:00
|
|
|
enum class UnreadBadgeSize {
|
|
|
|
Dialogs,
|
|
|
|
MainMenu,
|
|
|
|
HistoryToDown,
|
|
|
|
StickersPanel,
|
|
|
|
StickersBox,
|
|
|
|
TouchBar,
|
|
|
|
ReactionInDialogs,
|
2016-06-21 18:58:07 +03:00
|
|
|
|
2022-09-29 11:52:18 +04:00
|
|
|
kCount,
|
2016-06-21 18:58:07 +03:00
|
|
|
};
|
|
|
|
struct UnreadBadgeStyle {
|
|
|
|
UnreadBadgeStyle();
|
|
|
|
|
2020-06-23 17:29:02 +04:00
|
|
|
style::align align = style::al_right;
|
|
|
|
bool active = false;
|
|
|
|
bool selected = false;
|
|
|
|
bool muted = false;
|
2016-11-22 12:48:13 +03:00
|
|
|
int textTop = 0;
|
2020-06-23 17:29:02 +04:00
|
|
|
int size = 0;
|
|
|
|
int padding = 0;
|
2022-09-29 11:52:18 +04:00
|
|
|
UnreadBadgeSize sizeId = UnreadBadgeSize::Dialogs;
|
2016-06-21 18:58:07 +03:00
|
|
|
style::font font;
|
|
|
|
};
|
2022-09-29 11:52:18 +04:00
|
|
|
|
2022-02-10 12:56:57 +03:00
|
|
|
[[nodiscard]] QSize CountUnreadBadgeSize(
|
|
|
|
const QString &unreadCount,
|
|
|
|
const UnreadBadgeStyle &st,
|
|
|
|
int allowDigits = 0);
|
2022-09-29 11:52:18 +04:00
|
|
|
|
2022-01-26 14:47:23 +03:00
|
|
|
QRect PaintUnreadBadge(
|
2022-09-17 00:23:27 +04:00
|
|
|
QPainter &p,
|
2019-05-22 11:57:25 +03:00
|
|
|
const QString &t,
|
2017-11-05 15:21:30 +04:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
const UnreadBadgeStyle &st,
|
2019-05-22 11:57:25 +03:00
|
|
|
int allowDigits = 0);
|
2016-06-03 15:45:33 +03:00
|
|
|
|
2021-10-01 14:57:24 +04:00
|
|
|
} // namespace Dialogs::Ui
|