2017-01-11 01:08:20 +01:00
|
|
|
#ifndef WORDPART_H
|
|
|
|
#define WORDPART_H
|
|
|
|
|
|
|
|
#include <QRect>
|
2017-01-11 18:52:09 +01:00
|
|
|
#include <QString>
|
2017-01-11 01:08:20 +01:00
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
namespace chatterino {
|
|
|
|
namespace messages {
|
|
|
|
|
2017-01-11 01:08:20 +01:00
|
|
|
class Word;
|
|
|
|
|
|
|
|
class WordPart
|
|
|
|
{
|
|
|
|
public:
|
2017-01-18 04:33:30 +01:00
|
|
|
WordPart(Word &getWord, int getX, int getY, const QString &getCopyText,
|
2017-01-11 18:52:09 +01:00
|
|
|
bool allowTrailingSpace = true);
|
2017-01-11 01:08:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
WordPart(Word &getWord, int getX, int getY, int getWidth, int getHeight,
|
|
|
|
const QString &getCopyText, const QString &customText,
|
2017-01-15 16:38:30 +01:00
|
|
|
bool allowTrailingSpace = true);
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const Word &
|
2017-01-18 04:33:30 +01:00
|
|
|
getWord() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return this->m_word;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
2017-01-18 04:33:30 +01:00
|
|
|
getWidth() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return this->width;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
2017-01-18 04:33:30 +01:00
|
|
|
getHeight() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return this->height;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
2017-01-18 04:33:30 +01:00
|
|
|
getX() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return this->x;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
2017-01-18 04:33:30 +01:00
|
|
|
getY() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return this->y;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
void
|
|
|
|
setPosition(int x, int y)
|
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
this->x = x;
|
|
|
|
this->y = y;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-13 18:59:11 +01:00
|
|
|
void
|
|
|
|
setY(int y)
|
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
this->y = y;
|
2017-01-13 18:59:11 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
2017-01-18 04:33:30 +01:00
|
|
|
getRight() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return this->x + this->width;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
2017-01-18 04:33:30 +01:00
|
|
|
getBottom() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return this->y + this->height;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
QRect
|
2017-01-18 04:33:30 +01:00
|
|
|
getRect() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return QRect(this->x, this->y, this->width, this->height);
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
const QString
|
2017-01-18 04:33:30 +01:00
|
|
|
getCopyText() const
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return this->copyText;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
int
|
|
|
|
hasTrailingSpace() const
|
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return this->_trailingSpace;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-15 16:38:30 +01:00
|
|
|
const QString &
|
2017-01-18 04:33:30 +01:00
|
|
|
getText() const
|
2017-01-15 16:38:30 +01:00
|
|
|
{
|
2017-01-18 14:48:42 +01:00
|
|
|
return this->text;
|
2017-01-15 16:38:30 +01:00
|
|
|
}
|
2017-01-11 01:08:20 +01:00
|
|
|
|
|
|
|
private:
|
2017-01-18 21:30:23 +01:00
|
|
|
Word &m_word;
|
2017-01-11 01:08:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
QString copyText;
|
|
|
|
QString text;
|
2017-01-11 01:08:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
2017-01-11 01:08:20 +01:00
|
|
|
|
2017-01-18 04:33:30 +01:00
|
|
|
bool _trailingSpace;
|
2017-01-11 01:08:20 +01:00
|
|
|
};
|
2017-01-18 21:30:23 +01:00
|
|
|
}
|
|
|
|
}
|
2017-01-11 01:08:20 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
#endif // WORDPART_H
|