init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
103
Telegram/lib_ui/ui/text/text_extended_data.h
Normal file
103
Telegram/lib_ui/ui/text/text_extended_data.h
Normal file
@@ -0,0 +1,103 @@
|
||||
// This file is part of Desktop App Toolkit,
|
||||
// a set of libraries for developing nice desktop applications.
|
||||
//
|
||||
// For license and copyright information please follow this link:
|
||||
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "ui/click_handler.h"
|
||||
|
||||
namespace Ui::Text {
|
||||
|
||||
struct Modification;
|
||||
class String;
|
||||
|
||||
class SpoilerClickHandler final : public ClickHandler {
|
||||
public:
|
||||
SpoilerClickHandler(
|
||||
not_null<String*> text,
|
||||
Fn<bool(const ClickContext&)> filter);
|
||||
|
||||
[[nodiscard]] not_null<String*> text() const;
|
||||
void setText(not_null<String*> text);
|
||||
|
||||
void onClick(ClickContext context) const override;
|
||||
|
||||
private:
|
||||
not_null<String*> _text;
|
||||
const Fn<bool(const ClickContext &)> _filter;
|
||||
|
||||
};
|
||||
|
||||
class PreClickHandler final : public ClickHandler {
|
||||
public:
|
||||
PreClickHandler(not_null<String*> text, uint16 offset, uint16 length);
|
||||
|
||||
[[nodiscard]] not_null<String*> text() const;
|
||||
void setText(not_null<String*> text);
|
||||
|
||||
void onClick(ClickContext context) const override;
|
||||
|
||||
private:
|
||||
not_null<String*> _text;
|
||||
uint16 _offset = 0;
|
||||
uint16 _length = 0;
|
||||
|
||||
};
|
||||
|
||||
class BlockquoteClickHandler final : public ClickHandler {
|
||||
public:
|
||||
BlockquoteClickHandler(not_null<String*> text, int quoteIndex);
|
||||
|
||||
[[nodiscard]] not_null<String*> text() const;
|
||||
void setText(not_null<String*> text);
|
||||
|
||||
void onClick(ClickContext context) const override;
|
||||
|
||||
private:
|
||||
not_null<String*> _text;
|
||||
uint16 _quoteIndex = 0;
|
||||
|
||||
};
|
||||
|
||||
struct SpoilerData {
|
||||
explicit SpoilerData(Fn<void()> repaint)
|
||||
: animation(std::move(repaint)) {
|
||||
}
|
||||
|
||||
SpoilerAnimation animation;
|
||||
std::shared_ptr<SpoilerClickHandler> link;
|
||||
Animations::Simple revealAnimation;
|
||||
bool revealed = false;
|
||||
};
|
||||
|
||||
struct QuoteDetails {
|
||||
QString language;
|
||||
std::shared_ptr<PreClickHandler> copy;
|
||||
std::shared_ptr<BlockquoteClickHandler> toggle;
|
||||
int copyWidth = 0;
|
||||
int maxWidth = 0;
|
||||
int minHeight = 0;
|
||||
int scrollLeft = 0;
|
||||
bool blockquote = false;
|
||||
bool collapsed = false;
|
||||
bool expanded = false;
|
||||
bool pre = false;
|
||||
};
|
||||
|
||||
struct QuotesData {
|
||||
std::vector<QuoteDetails> list;
|
||||
Fn<void(int index, bool expanded)> expandCallback;
|
||||
};
|
||||
|
||||
struct ExtendedData {
|
||||
std::vector<ClickHandlerPtr> links;
|
||||
std::unique_ptr<QuotesData> quotes;
|
||||
std::unique_ptr<SpoilerData> spoiler;
|
||||
std::vector<Modification> modifications;
|
||||
};
|
||||
|
||||
} // namespace Ui::Text
|
||||
Reference in New Issue
Block a user