summaryrefslogtreecommitdiff
path: root/Widgets/TerminalWidget.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-11 02:50:08 +0200
committerAndreas Kling <awesomekling@gmail.com>2018-10-11 02:50:08 +0200
commitc61cbf4234cbfe76fc2db04600f17b07c4f4d2a3 (patch)
tree2ad0803a0f27323a5e02d4423f5898a5ff598196 /Widgets/TerminalWidget.h
parentf337616741b690feb36ed8e104df85ed5117daaa (diff)
downloadserenity-c61cbf4234cbfe76fc2db04600f17b07c4f4d2a3.zip
Start poking at a TerminalWidget.
Diffstat (limited to 'Widgets/TerminalWidget.h')
-rw-r--r--Widgets/TerminalWidget.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/Widgets/TerminalWidget.h b/Widgets/TerminalWidget.h
new file mode 100644
index 0000000000..ba77c5d10a
--- /dev/null
+++ b/Widgets/TerminalWidget.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include "Widget.h"
+#include <AK/ByteBuffer.h>
+
+struct CharacterWithAttributes {
+ byte character;
+ byte attribute;
+};
+
+class TerminalWidget final : public Widget {
+public:
+ explicit TerminalWidget(Widget* parent);
+ virtual ~TerminalWidget() override;
+
+ unsigned rows() const { return m_rows; }
+ unsigned columns() const { return m_columns; }
+
+private:
+ CharacterWithAttributes& at(unsigned row, unsigned column);
+
+ virtual void onPaint(PaintEvent&) override;
+ void onReceive(const ByteBuffer&);
+ void onReceive(byte);
+
+ unsigned m_columns { 80 };
+ unsigned m_rows { 25 };
+
+ unsigned m_cursorRow { 0 };
+ unsigned m_cursorColumn { 0 };
+
+ CharacterWithAttributes* m_screen { nullptr };
+};