00001 /* 00002 File: Console.h 00003 00004 Copyright(C) C. Kotterink, Computed Graphics 00005 */ 00006 #ifndef CONSOLE_H 00007 #define CONSOLE_H2 00008 00009 #include<TextFile.h> 00010 #include<Widget.h> 00011 00012 #include<string> 00013 00014 class windowbuf; 00015 00022 class Console : public Widget 00023 { 00024 friend windowbuf; 00025 public: 00027 static Console *getConsole(); 00028 00030 Console &operator<<(const string &line); 00031 00032 // Inherited from Region 00033 void resize(unsigned short w, unsigned short h); 00034 void refresh(); 00035 00036 protected: 00038 static Console *instance; 00039 00041 static const int lineBuffers = 80; 00042 00044 static const int lineSeperate = 4; 00045 00047 int currentLine; 00048 00050 int lineDistance; 00051 00053 int visibleBuffers; 00054 00056 string text[lineBuffers]; 00057 00058 private: 00059 typedef Widget super; 00060 00062 Console(); 00063 00065 int addChar(char *text, int length); 00066 00068 void log(const string &line); 00069 00071 TextFile f; 00072 }; 00073 #endif