mirror-chatterino2/wordpart.h

113 lines
1.5 KiB
C
Raw Normal View History

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
class Word;
class WordPart
{
public:
2017-01-11 18:52:09 +01:00
WordPart(Word &word, int x, int y, const QString &copyText,
bool allowTrailingSpace = true);
2017-01-11 01:08:20 +01:00
2017-01-15 16:38:30 +01:00
WordPart(Word &word, int x, int y, int width, int height,
const QString &copyText, const QString &customText,
bool allowTrailingSpace = true);
2017-01-11 18:52:09 +01:00
const Word &
word() const
{
2017-01-11 01:08:20 +01:00
return m_word;
}
2017-01-11 18:52:09 +01:00
int
width() const
{
2017-01-11 01:08:20 +01:00
return m_width;
}
2017-01-11 18:52:09 +01:00
int
height() const
{
2017-01-11 01:08:20 +01:00
return m_height;
}
2017-01-11 18:52:09 +01:00
int
x() const
{
2017-01-11 01:08:20 +01:00
return m_x;
}
2017-01-11 18:52:09 +01:00
int
y() const
{
2017-01-11 01:08:20 +01:00
return m_y;
}
2017-01-11 18:52:09 +01:00
void
setPosition(int x, int y)
{
2017-01-11 01:08:20 +01:00
m_x = x;
m_y = y;
}
2017-01-13 18:59:11 +01:00
void
setY(int y)
{
m_y = y;
}
2017-01-11 18:52:09 +01:00
int
right() const
{
2017-01-11 01:08:20 +01:00
return m_x + m_width;
}
2017-01-11 18:52:09 +01:00
int
bottom() const
{
2017-01-11 01:08:20 +01:00
return m_y + m_height;
}
2017-01-11 18:52:09 +01:00
QRect
rect() const
{
2017-01-11 01:08:20 +01:00
return QRect(m_x, m_y, m_width, m_height);
}
2017-01-11 18:52:09 +01:00
const QString
copyText() const
{
2017-01-11 01:08:20 +01:00
return m_copyText;
}
2017-01-11 18:52:09 +01:00
int
hasTrailingSpace() const
{
2017-01-11 01:08:20 +01:00
return m_trailingSpace;
}
2017-01-15 16:38:30 +01:00
const QString &
text() const
{
return m_text;
}
2017-01-11 01:08:20 +01:00
private:
2017-01-11 18:52:09 +01:00
Word &m_word;
2017-01-11 01:08:20 +01:00
2017-01-11 18:52:09 +01:00
QString m_copyText;
2017-01-15 16:38:30 +01:00
QString m_text;
2017-01-11 01:08:20 +01:00
int m_x;
int m_y;
int m_width;
int m_height;
bool m_trailingSpace;
};
2017-01-11 18:52:09 +01:00
#endif // WORDPART_H