mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:17:45 +00:00
Start poking at a TerminalWidget.
This commit is contained in:
parent
f337616741
commit
c61cbf4234
4 changed files with 106 additions and 4 deletions
33
Widgets/TerminalWidget.h
Normal file
33
Widgets/TerminalWidget.h
Normal file
|
@ -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 };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue