tdesktop/Telegram/SourceFiles/dialogs/ui/dialogs_layout.h

145 lines
2.8 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
#include "ui/cached_round_corners.h"
namespace style {
struct DialogRow;
} // namespace style
namespace st {
extern const style::DialogRow &defaultDialogRow;
} // namespace st
2021-10-01 10:57:24 +00:00
namespace Ui {
} // namespace Ui
namespace Data {
class Forum;
class Folder;
} // namespace Data
2021-10-01 10:57:24 +00:00
namespace Dialogs {
class Row;
class FakeRow;
2019-06-17 14:37:29 +00:00
class BasicRow;
2021-10-01 10:57:24 +00:00
} // namespace Dialogs
2021-10-01 10:57:24 +00:00
namespace Dialogs::Ui {
using namespace ::Ui;
2022-08-09 11:12:19 +00:00
class VideoUserpic;
struct TopicJumpCorners {
CornersPixmaps normal;
CornersPixmaps inverted;
QPixmap small;
int invertedRadius = 0;
int smallKey = 0; // = `-radius` if top right else `radius`.
};
struct TopicJumpCache {
TopicJumpCorners corners;
TopicJumpCorners over;
2022-11-14 07:24:31 +00:00
TopicJumpCorners selected;
TopicJumpCorners rippleMask;
};
struct PaintContext {
not_null<const style::DialogRow*> st;
TopicJumpCache *topicJumpCache = nullptr;
Data::Folder *folder = nullptr;
Data::Forum *forum = nullptr;
QBrush currentBg;
FilterId filter = 0;
float64 topicsExpanded = 0.;
crl::time now = 0;
int width = 0;
bool active = false;
bool selected = false;
2022-11-14 07:24:31 +00:00
bool topicJumpSelected = false;
bool paused = false;
bool search = false;
bool narrow = false;
bool displayUnreadInfo = false;
};
const style::icon *ChatTypeIcon(
2018-02-22 13:50:56 +00:00
not_null<PeerData*> peer,
const PaintContext &context = { .st = &st::defaultDialogRow });
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(
not_null<const style::DialogRow*> st,
int animationLeft,
int animationWidth,
int animationHeight,
int fullWidth,
bool textUpdated);
};
void PaintCollapsedRow(
Painter &p,
2019-06-17 14:37:29 +00:00
const BasicRow &row,
Data::Folder *folder,
const QString &text,
int unread,
const PaintContext &context);
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 09:48:13 +00: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 11:47:23 +00:00
QRect PaintUnreadBadge(
2022-09-16 20:23:27 +00:00
QPainter &p,
const QString &t,
int x,
int y,
const UnreadBadgeStyle &st,
int allowDigits = 0);
2021-10-01 10:57:24 +00:00
} // namespace Dialogs::Ui