The Pedigree Project 0.1
LocalIO.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef LOCALIO_H
21#define LOCALIO_H
22
26#include "pedigree/kernel/debugger/DebuggerIO.h"
27#include "pedigree/kernel/processor/types.h"
28
29class Keyboard;
30class Vga;
31
32#define MAX_CONSOLE_WIDTH 90
33#define MAX_CONSOLE_HEIGHT 30
34#define CONSOLE_DEFAULT_MODE 2
35
40class LocalIO : public DebuggerIO {
41 public:
45 LocalIO(Vga* pVga, Keyboard* pKeyboard);
46 ~LocalIO();
47
48 void initialise();
49 void destroy();
50
56 void setCliUpperLimit(size_t nlines);
57 void setCliLowerLimit(size_t nlines);
58
64 void enableCli();
65 void disableCli();
66
67 void cls();
68
69 virtual char getCharNonBlock();
70
76 void drawHorizontalLine(char c, size_t row, size_t colStart, size_t colEnd,
77 DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
78 void drawVerticalLine(char c, size_t col, size_t rowStart, size_t rowEnd,
79 DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
80
85 void drawString(const char* str, size_t row, size_t col, DebuggerIO::Colour foreColour,
86 DebuggerIO::Colour backColour);
87
91 size_t getWidth() {
92 return m_nWidth;
93 }
94 size_t getHeight() {
95 return m_nHeight;
96 }
97
102 void enableRefreshes();
103 void disableRefreshes();
104 void forceRefresh();
105
110 char getChar();
111
112 void readDimensions() {}
113
114 protected:
118 void scroll();
119
123 void moveCursor();
124
125 void putChar(char c, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour);
126
127 void setMode(int nMode);
128 int getMode();
129
133 uint16_t m_pFramebuffer[MAX_CONSOLE_WIDTH * MAX_CONSOLE_HEIGHT];
134
138 uint16_t m_pOldFramebuffer[MAX_CONSOLE_WIDTH * MAX_CONSOLE_HEIGHT];
139
140 size_t m_nWidth;
141 size_t m_nHeight;
142
150
154 size_t m_CursorX, m_CursorY;
155
160
165
166 private:
167 LocalIO(const LocalIO&);
168 LocalIO& operator=(const LocalIO&);
169};
170
173#endif
uint16_t m_pFramebuffer[MAX_CONSOLE_WIDTH *MAX_CONSOLE_HEIGHT]
Definition LocalIO.h:133
size_t m_LowerCliLimit
Definition LocalIO.h:148
char getChar()
Definition LocalIO.cc:126
void enableRefreshes()
Definition LocalIO.cc:218
void enableCli()
Definition LocalIO.cc:90
size_t m_UpperCliLimit
Definition LocalIO.h:146
void moveCursor()
Definition LocalIO.cc:249
Keyboard * m_pKeyboard
Definition LocalIO.h:164
uint16_t m_pOldFramebuffer[MAX_CONSOLE_WIDTH *MAX_CONSOLE_HEIGHT]
Definition LocalIO.h:138
size_t getWidth()
Definition LocalIO.h:91
void setCliUpperLimit(size_t nlines)
Definition LocalIO.cc:70
void drawString(const char *str, size_t row, size_t col, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
Definition LocalIO.cc:184
void scroll()
Definition LocalIO.cc:232
size_t m_CursorX
Definition LocalIO.h:154
void drawHorizontalLine(char c, size_t row, size_t colStart, size_t colEnd, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)
Definition LocalIO.cc:130
Vga * m_pVga
Definition LocalIO.h:159