mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
75 lines
1.1 KiB
C++
75 lines
1.1 KiB
C++
#ifndef WORDPART_H
|
|
#define WORDPART_H
|
|
|
|
#include <QRect>
|
|
#include <QStringRef>
|
|
|
|
class Word;
|
|
|
|
class WordPart
|
|
{
|
|
public:
|
|
WordPart(Word& word, int x, int y, const QStringRef& copyText, bool allowTrailingSpace = true);
|
|
|
|
const Word& word() const {
|
|
return m_word;
|
|
}
|
|
|
|
int width() const {
|
|
return m_width;
|
|
}
|
|
|
|
int height() const {
|
|
return m_height;
|
|
}
|
|
|
|
int x() const {
|
|
return m_x;
|
|
}
|
|
|
|
int y() const {
|
|
return m_y;
|
|
}
|
|
|
|
void setPosition(int x, int y) {
|
|
m_x = x;
|
|
m_y = y;
|
|
}
|
|
|
|
int right() const {
|
|
return m_x + m_width;
|
|
}
|
|
|
|
int bottom() const {
|
|
return m_y + m_height;
|
|
}
|
|
|
|
QRect rect() const {
|
|
return QRect(m_x, m_y, m_width, m_height);
|
|
}
|
|
|
|
const QStringRef copyText() const {
|
|
return m_copyText;
|
|
}
|
|
|
|
int hasTrailingSpace() const {
|
|
return m_trailingSpace;
|
|
}
|
|
|
|
const QString& getText() const;
|
|
|
|
private:
|
|
Word& m_word;
|
|
|
|
QStringRef m_copyText;
|
|
|
|
int m_x;
|
|
int m_y;
|
|
int m_width;
|
|
int m_height;
|
|
|
|
bool m_trailingSpace;
|
|
};
|
|
|
|
#endif // WORDPART_H
|