Main Page | Modules | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members

winconsole.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * $Id: winconsole.h,v 1.2 2003/06/27 08:36:41 schou Exp $
00003  * Author: Jakob Schou Jensen <schou@sourceforge.net>
00004  * Licence: GPL
00005  *
00006  * Description: Windows console
00007  *
00008  ****************************************************************************/
00009 
00015 #include <windows.h>
00016 #include <stdlib.h>
00017 #include <malloc.h>
00018 #include <memory.h>
00019 #include <tchar.h>
00020 
00021 class WinConsole {
00022   // Text buffer
00023   char *text;
00024   int *lineIndexTable;
00025 
00026   int maxLines, maxChars;
00027   int nLines, topLine, curLine;
00028   int curLineLen, curLinePos;
00029 
00030   // Display
00031   int disLineCount, disLine, disLineNum, disLineOff;
00032   int disWidth, disHeight;
00033   int fontWidth, fontHeight;
00034   int xBorder, yBorder;
00035   HWND hWnd;
00036 
00037   void printLine(HDC hDC, char *line, int ypos);
00038   int getDisplayLineCount(int disWidth);
00039   int getDisplayLineNum(int lineNum, int disWidth);
00040   char *getLine(int i){ 
00041     if(i<0 || i>=nLines) return "";
00042     else return &text[lineIndexTable[(topLine+i)%maxLines]]; 
00043   }
00044 public:
00045   void deltaResize(int &dw, int &dh);
00046   void addLine(char *line);
00047   void print(char *str);
00048   int lineCount(){ return nLines; }
00049   void setDisplaySize(int width, int height){ disWidth = width; disHeight = height; }
00050   void updateDisplay();
00051   void init(HWND hWnd);
00052   int wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
00053   WinConsole();
00054 };
00055 

Generated on Mon Jul 21 10:44:47 2003 for Rover by doxygen 1.3.2