added another level of unneeded abstraction

This commit is contained in:
fourtf
2017-02-02 22:15:09 +01:00
parent 93660233fd
commit c6c90d9f50
10 changed files with 330 additions and 237 deletions
+59
View File
@@ -0,0 +1,59 @@
#ifndef MESSAGEREF_H
#define MESSAGEREF_H
#include <memory>
#include "messages/message.h"
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);
void
requestRelayout()
{
relayoutRequested = true;
}
const std::vector<WordPart> &
getWordParts() const
{
return wordParts;
}
private:
Message *message;
std::shared_ptr<Message> messagePtr;
std::vector<messages::WordPart> wordParts;
int height = 0;
int currentLayoutWidth = -1;
bool relayoutRequested = true;
int fontGeneration = -1;
int emoteGeneration = -1;
void alignWordParts(int lineStart, int lineHeight);
};
}
}
#endif // MESSAGEREF_H