d8b8403651
* Replace QPoint and QSize with Coord, a C++ class derived from COORD. * Replace QRect with SmallRect, a C++ class derived from SMALL_RECT. * Turn Win32Console into a non-QObject class.
43 lines
908 B
C++
43 lines
908 B
C++
#ifndef WIN32CONSOLE_H
|
|
#define WIN32CONSOLE_H
|
|
|
|
#include <windows.h>
|
|
#include "Coord.h"
|
|
#include "SmallRect.h"
|
|
|
|
class Win32Console
|
|
{
|
|
public:
|
|
Win32Console();
|
|
~Win32Console();
|
|
|
|
HANDLE conin();
|
|
HANDLE conout();
|
|
HWND hwnd();
|
|
void postCloseMessage();
|
|
|
|
// Buffer and window sizes.
|
|
Coord bufferSize();
|
|
SmallRect windowRect();
|
|
void resizeBuffer(const Coord &size);
|
|
void moveWindow(const SmallRect &rect);
|
|
void reposition(const Coord &bufferSize, const SmallRect &windowRect);
|
|
|
|
// Cursor.
|
|
Coord cursorPosition();
|
|
void setCursorPosition(const Coord &point);
|
|
|
|
// Input stream.
|
|
void writeInput(const INPUT_RECORD *ir, int count=1);
|
|
|
|
// Screen content.
|
|
void read(const SmallRect &rect, CHAR_INFO *data);
|
|
void write(const SmallRect &rect, const CHAR_INFO *data);
|
|
|
|
private:
|
|
HANDLE m_conin;
|
|
HANDLE m_conout;
|
|
};
|
|
|
|
#endif // WIN32CONSOLE_H
|