atrooney-online-2/include/aotextarea.h
Crystalwarrior 7097053723 Change all instances of "colour" to "color" for consistency's sake
Overhaul inline colors system to properly support additive text and further expansion
Add two new colors - Gray and Blank, the latter being used for IC parsing.
Instead of adding text symbol by symbol, reveal more of the already-rendered text instead so that it properly anticipates words that need to be on the newline.
Changed the append_ic function slightly so it appends ": " to text only after it's no longer needed.
Made gray color less inconsistent with everything else
2019-09-24 21:24:25 +03:00

26 lines
605 B
C++

#ifndef AOTEXTAREA_H
#define AOTEXTAREA_H
#include <QTextBrowser>
#include <QScrollBar>
#include <QTextCursor>
#include <QRegExp>
#include <QDebug>
class AOTextArea : public QTextBrowser
{
public:
AOTextArea(QWidget *p_parent = nullptr);
void append_linked(QString p_message);
void append_chatmessage(QString p_name, QString p_message, QString p_colur);
void append_error(QString p_message);
private:
const QRegExp url_parser_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b");
void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down);
};
#endif // AOTEXTAREA_H