2017-04-08 13:27:53 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-04-08 13:27:53 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-04-08 13:27:53 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ui/widgets/input_fields.h"
|
|
|
|
|
|
|
|
class HistoryWidget;
|
|
|
|
namespace Window {
|
|
|
|
class Controller;
|
|
|
|
} // namespace Window
|
|
|
|
|
|
|
|
QString ConvertTagToMimeTag(const QString &tagId);
|
|
|
|
|
|
|
|
EntitiesInText ConvertTextTagsToEntities(const TextWithTags::Tags &tags);
|
2018-01-25 10:10:52 +00:00
|
|
|
TextWithTags::Tags ConvertEntitiesToTextTags(
|
|
|
|
const EntitiesInText &entities);
|
|
|
|
std::unique_ptr<QMimeData> MimeDataFromTextWithEntities(
|
|
|
|
const TextWithEntities &forClipboard);
|
|
|
|
void SetClipboardWithEntities(
|
|
|
|
const TextWithEntities &forClipboard,
|
|
|
|
QClipboard::Mode mode = QClipboard::Clipboard);
|
2017-04-08 13:27:53 +00:00
|
|
|
|
|
|
|
class MessageField final : public Ui::FlatTextarea {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-08-17 08:31:24 +00:00
|
|
|
MessageField(QWidget *parent, not_null<Window::Controller*> controller, const style::FlatTextarea &st, base::lambda<QString()> placeholderFactory = base::lambda<QString()>(), const QString &val = QString());
|
2017-04-08 13:27:53 +00:00
|
|
|
|
|
|
|
bool hasSendText() const;
|
|
|
|
|
|
|
|
void setInsertFromMimeDataHook(base::lambda<bool(const QMimeData *data)> hook) {
|
|
|
|
_insertFromMimeDataHook = std::move(hook);
|
|
|
|
}
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void onEmojiInsert(EmojiPtr emoji);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void focused();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void focusInEvent(QFocusEvent *e) override;
|
|
|
|
void dropEvent(QDropEvent *e) override;
|
|
|
|
bool canInsertFromMimeData(const QMimeData *source) const override;
|
|
|
|
void insertFromMimeData(const QMimeData *source) override;
|
|
|
|
|
|
|
|
private:
|
2017-08-17 08:31:24 +00:00
|
|
|
not_null<Window::Controller*> _controller;
|
2017-04-08 13:27:53 +00:00
|
|
|
base::lambda<bool(const QMimeData *data)> _insertFromMimeDataHook;
|
|
|
|
|
|
|
|
};
|