51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef CHAT_HEADER
-#define CHAT_HEADER
+#pragma once
#include <string>
#include <vector>
#include "irrlichttypes.h"
#include "util/enriched_string.h"
+#include "settings.h"
// Chat console related classes
{
public:
ChatBuffer(u32 scrollback);
- ~ChatBuffer();
+ ~ChatBuffer() = default;
// Append chat line
// Removes oldest chat line if scrollback size is reached
- void addLine(std::wstring name, std::wstring text);
+ void addLine(const std::wstring &name, const std::wstring &text);
// Remove all chat lines
void clear();
u32 formatChatLine(const ChatLine& line, u32 cols,
std::vector<ChatFormattedLine>& destination) const;
+ void resize(u32 scrollback);
protected:
s32 getTopScrollPos() const;
s32 getBottomScrollPos() const;
{
public:
ChatPrompt(const std::wstring &prompt, u32 history_limit);
- ~ChatPrompt();
+ ~ChatPrompt() = default;
// Input character or string
void input(wchar_t ch);
void input(const std::wstring &str);
// Add a string to the history
- void addToHistory(std::wstring line);
+ void addToHistory(const std::wstring &line);
// Get current line
std::wstring getLine() const { return m_line; }
void clear();
// Replace the current line with the given text
- std::wstring replace(std::wstring line);
+ std::wstring replace(const std::wstring &line);
// Select previous command from history
void historyPrev();
{
public:
ChatBackend();
- ~ChatBackend();
+ ~ChatBackend() = default;
// Add chat message
- void addMessage(std::wstring name, std::wstring text);
+ void addMessage(const std::wstring &name, std::wstring text);
// Parse and add unparsed chat message
void addUnparsedMessage(std::wstring line);
// Get the recent messages buffer
ChatBuffer& getRecentBuffer();
// Concatenate all recent messages
- EnrichedString getRecentChat();
+ EnrichedString getRecentChat() const;
// Get the console prompt
ChatPrompt& getPrompt();
void scrollPageDown();
void scrollPageUp();
+ // Resize recent buffer based on settings
+ void applySettings();
+
private:
ChatBuffer m_console_buffer;
ChatBuffer m_recent_buffer;
ChatPrompt m_prompt;
};
-
-#endif
-