mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-20 08:03:45 +08:00
86 lines
1.9 KiB
C++
86 lines
1.9 KiB
C++
/*
|
|
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 "info/profile/tabs/info_profile_tab_top_bar_bindings.h"
|
|
#include "storage/storage_shared_media.h"
|
|
|
|
class PeerData;
|
|
class QPainter;
|
|
|
|
namespace Data {
|
|
class ForumTopic;
|
|
class SavedSublist;
|
|
enum class ProfileTab : uchar;
|
|
} // namespace Data
|
|
|
|
namespace Ui {
|
|
class RpWidget;
|
|
} // namespace Ui
|
|
|
|
namespace Info {
|
|
class Controller;
|
|
} // namespace Info
|
|
|
|
namespace Info::Profile {
|
|
|
|
struct MediaTabContext {
|
|
not_null<Controller*> controller;
|
|
not_null<PeerData*> peer;
|
|
Data::ForumTopic *topic = nullptr;
|
|
Data::SavedSublist *sublist = nullptr;
|
|
PeerData *migrated = nullptr;
|
|
QWidget *parent = nullptr;
|
|
Fn<void(int ymin, int ymax)> scrollToRequest;
|
|
Fn<void(int count)> onlineCountChanged;
|
|
};
|
|
|
|
struct MediaTabState {
|
|
virtual ~MediaTabState() = default;
|
|
};
|
|
|
|
class MediaTabContent {
|
|
public:
|
|
virtual ~MediaTabContent() = default;
|
|
|
|
[[nodiscard]] virtual not_null<Ui::RpWidget*> widget() = 0;
|
|
[[nodiscard]] virtual TabTopBarBindings topBarBindings() = 0;
|
|
|
|
virtual void resizeToWidth(int newWidth) = 0;
|
|
|
|
virtual void deactivated() {
|
|
}
|
|
|
|
virtual void setVisibleRegion(int top, int bottom) {
|
|
}
|
|
|
|
virtual void setTopOverlay(int height) {
|
|
}
|
|
|
|
// Painter is translated to tab widget origin, clipped to filler.
|
|
virtual void paintOverflow(QPainter &p) {
|
|
}
|
|
|
|
[[nodiscard]] virtual std::unique_ptr<MediaTabState> saveState() {
|
|
return nullptr;
|
|
}
|
|
virtual void restoreState(std::unique_ptr<MediaTabState> state) {
|
|
}
|
|
};
|
|
|
|
struct MediaTabDescriptor {
|
|
QString id;
|
|
rpl::producer<TextWithEntities> title;
|
|
rpl::producer<bool> shown;
|
|
std::optional<Storage::SharedMediaType> sharedMediaType;
|
|
Fn<std::unique_ptr<MediaTabContent>(MediaTabContext)> factory;
|
|
Data::ProfileTab profileTab = {};
|
|
};
|
|
|
|
} // namespace Info::Profile
|