2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-23 18:57:12 +00:00

115 lines
2.1 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
2021-10-01 14:57:24 +04:00
namespace Ui {
} // namespace Ui
namespace Data {
class Forum;
class Folder;
} // namespace Data
2021-10-01 14:57:24 +04:00
namespace Dialogs {
class Row;
class FakeRow;
2019-06-17 16:37:29 +02:00
class BasicRow;
2021-10-01 14:57:24 +04:00
} // namespace Dialogs
2021-10-01 14:57:24 +04:00
namespace Dialogs::Ui {
using namespace ::Ui;
2022-08-09 14:12:19 +03:00
class VideoUserpic;
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;
};
const style::icon *ChatTypeIcon(
2018-02-22 16:50:56 +03:00
not_null<PeerData*> peer,
const PaintContext &context = {});
class RowPainter {
public:
static void Paint(
Painter &p,
not_null<const Row*> row,
VideoUserpic *videoUserpic,
const PaintContext &context);
static void Paint(
Painter &p,
not_null<const FakeRow*> row,
const PaintContext &context);
static QRect SendActionAnimationRect(
int animationLeft,
int animationWidth,
int animationHeight,
int fullWidth,
bool textUpdated);
};
void PaintCollapsedRow(
Painter &p,
2019-06-17 16:37:29 +02:00
const BasicRow &row,
Data::Folder *folder,
const QString &text,
int unread,
int fullWidth,
bool selected);
enum class UnreadBadgeSize {
Dialogs,
MainMenu,
HistoryToDown,
StickersPanel,
StickersBox,
TouchBar,
ReactionInDialogs,
kCount,
};
struct UnreadBadgeStyle {
UnreadBadgeStyle();
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;
int size = 0;
int padding = 0;
UnreadBadgeSize sizeId = UnreadBadgeSize::Dialogs;
style::font font;
};
[[nodiscard]] QSize CountUnreadBadgeSize(
const QString &unreadCount,
const UnreadBadgeStyle &st,
int allowDigits = 0);
2022-01-26 14:47:23 +03:00
QRect PaintUnreadBadge(
2022-09-17 00:23:27 +04:00
QPainter &p,
const QString &t,
int x,
int y,
const UnreadBadgeStyle &st,
int allowDigits = 0);
2021-10-01 14:57:24 +04:00
} // namespace Dialogs::Ui