2017-02-02 22:15:09 +01:00
|
|
|
#ifndef MESSAGEREF_H
|
|
|
|
#define MESSAGEREF_H
|
|
|
|
|
|
|
|
#include "messages/message.h"
|
|
|
|
|
2017-02-03 19:31:51 +01:00
|
|
|
#include <QPixmap>
|
|
|
|
#include <memory>
|
|
|
|
|
2017-02-02 22:15:09 +01:00
|
|
|
namespace chatterino {
|
|
|
|
namespace messages {
|
|
|
|
|
|
|
|
class MessageRef
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MessageRef(std::shared_ptr<Message> message);
|
|
|
|
|
|
|
|
Message *
|
|
|
|
getMessage()
|
|
|
|
{
|
|
|
|
return this->message;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
getHeight() const
|
|
|
|
{
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool layout(int width, bool enableEmoteMargins = true);
|
|
|
|
|
|
|
|
const std::vector<WordPart> &
|
|
|
|
getWordParts() const
|
|
|
|
{
|
|
|
|
return wordParts;
|
|
|
|
}
|
|
|
|
|
2017-02-03 19:31:51 +01:00
|
|
|
std::shared_ptr<QPixmap> buffer = nullptr;
|
|
|
|
bool updateBuffer = false;
|
|
|
|
|
2017-02-17 23:51:35 +01:00
|
|
|
bool tryGetWordPart(QPoint point, messages::Word &word);
|
|
|
|
|
|
|
|
int getSelectionIndex(QPoint position);
|
|
|
|
|
2017-02-02 22:15:09 +01:00
|
|
|
private:
|
|
|
|
Message *message;
|
|
|
|
std::shared_ptr<Message> messagePtr;
|
|
|
|
|
|
|
|
std::vector<messages::WordPart> wordParts;
|
|
|
|
|
|
|
|
int height = 0;
|
|
|
|
|
|
|
|
int currentLayoutWidth = -1;
|
|
|
|
int fontGeneration = -1;
|
|
|
|
int emoteGeneration = -1;
|
2017-02-17 23:51:35 +01:00
|
|
|
Word::Type currentWordTypes = Word::None;
|
2017-02-02 22:15:09 +01:00
|
|
|
|
|
|
|
void alignWordParts(int lineStart, int lineHeight);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // MESSAGEREF_H
|