mirror-chatterino2/wordpart.h
2017-01-11 18:52:09 +01:00

98 lines
1.2 KiB
C++

#ifndef WORDPART_H
#define WORDPART_H
#include <QRect>
#include <QString>
class Word;
class WordPart
{
public:
WordPart(Word &word, int x, int y, const QString &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 QString
copyText() const
{
return m_copyText;
}
int
hasTrailingSpace() const
{
return m_trailingSpace;
}
const QString &getText() const;
private:
Word &m_word;
QString m_copyText;
int m_x;
int m_y;
int m_width;
int m_height;
bool m_trailingSpace;
};
#endif // WORDPART_H