ladybird/Applications/IRCClient/IRCLogBuffer.h
Andreas Kling fa69b9fbb7 IRCClient: Switch to using an HtmlView for the IRC window contents :^)
This seemed like a perfect fit for LibHTML. We can now style the IRC
channels and queries however we like with the power of HTML and CSS.

This patch doesn't do much in the way of styling, it just gets the
basic mechanism into place.
2019-10-28 20:53:19 +01:00

33 lines
855 B
C++

#pragma once
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <LibDraw/Color.h>
#include <LibHTML/DOM/Document.h>
class IRCLogBuffer : public RefCounted<IRCLogBuffer> {
public:
static NonnullRefPtr<IRCLogBuffer> create();
~IRCLogBuffer();
struct Message {
time_t timestamp { 0 };
char prefix { 0 };
String sender;
String text;
Color color { Color::Black };
};
void add_message(char prefix, const String& name, const String& text, Color = Color::Black);
void add_message(const String& text, Color = Color::Black);
void dump() const;
const Document& document() const { return *m_document; }
Document& document() { return *m_document; }
private:
IRCLogBuffer();
RefPtr<Document> m_document;
RefPtr<Element> m_container_element;
};