ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

tconsole.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "tnconfig.h"
00004 
00005 /* A diagram of the following values:
00006  *
00007  *           (0,0)
00008  *              +----------------------------------------+
00009  *              |                                        |
00010  *              |                                        |
00011  *              |                                        |
00012  *              |                                        |
00013  *              |                                        |
00014  *              |                                        |
00015  *              |                                        |
00016  *              |                                        |
00017  *              |                                        |
00018  *              |                                        |
00019  *              |                                        |
00020  *              |                                        |
00021  *              |                                        |
00022  *              |          CON_TOP                       |
00023  *              +---------------------------+.....?......|     ---
00024  *              |              .            |            |      |
00025  *              |              .            | <-- OR --> |      |
00026  *              |              .            |            |      |
00027  *  CON_LEFT    |              .            | CON_RIGHT  |
00028  *    (=0)      |              .            | (=CON_     |  CON_LINES
00029  *              |..............*            |   WIDTH)   |
00030  *              |            (CON_CUR_X,    |            |      |
00031  *              |             CON_CUR_Y)    |            |      |
00032  *              |                           |            |      |
00033  *              |                           |            |      |
00034  *              |                           |            |      |
00035  *              +---------------------------+------------+     ---
00036  *                   CON_BOTTOM (=CON_TOP + CON_HEIGHT)
00037  *
00038  *              |--------- CON_COLS --------|
00039  *
00040  * Keep in mind that CON_TOP, CON_BOTTOM, CON_LEFT, and CON_RIGHT are relative
00041  * to zero, but CON_CUR_X, CON_CUR_Y, CON_WIDTH, and CON_HEIGHT are relative to
00042  * CON_TOP and CON_LEFT
00043  */
00044 
00045 #define CON_TOP     ConsoleInfo.srWindow.Top
00046 #define CON_BOTTOM  ConsoleInfo.srWindow.Bottom
00047 
00048 #define CON_LEFT    0
00049 #define CON_RIGHT   (ConsoleInfo.dwSize.X - 1)
00050 
00051 #define CON_HEIGHT  (CON_BOTTOM - CON_TOP)
00052 #define CON_WIDTH   (CON_RIGHT - CON_LEFT)
00053 #define CON_LINES   (CON_HEIGHT + 1)
00054 #define CON_COLS    (CON_WIDTH + 1)
00055 
00056 #define CON_CUR_X   (ConsoleInfo.dwCursorPosition.X - CON_LEFT)
00057 #define CON_CUR_Y   (ConsoleInfo.dwCursorPosition.Y - CON_TOP)
00058 
00059 
00060 class TConsole {
00061 public:
00062     TConsole(HANDLE hConsole);
00063     ~TConsole();
00064     void sync();
00065 
00066     // Cursor movement routines
00067     int GetRawCursorX() {return CON_CUR_X;}
00068     int GetRawCursorY() {return CON_CUR_Y;}
00069     int GetCursorX() {return CON_CUR_X;}
00070     int GetCursorY() {
00071         if(iScrollStart != -1)
00072             return CON_CUR_Y - iScrollStart;
00073         return GetRawCursorY();
00074     }
00075     void SetRawCursorPosition(int x, int y);
00076     void SetCursorPosition(int x, int y);
00077     void SetCursorSize(int pct);
00078     void MoveCursorPosition(int x, int y);
00079 
00080     // Screen mode/size routines
00081     int GetWidth() {return CON_COLS;}
00082     int GetHeight() {return CON_LINES;}
00083     void SetExtendedMode(int iFunction, BOOL bEnable);
00084     void SetWindowSize(int width, int height);  // Set the size of the window,
00085                                                 // but not the buffer
00086 
00087     // Color/attribute routines
00088     void SetAttrib(unsigned char wAttr) {wAttributes = wAttr;}
00089     unsigned char GetAttrib() {return wAttributes;}
00090     void Normal();                              // Reset all attributes
00091     void HighVideo();                           // Aka "bold"
00092     void LowVideo();
00093     void SetForeground(unsigned char wAttrib);  // Set the foreground directly
00094     void SetBackground(unsigned char wAttrib);
00095     void BlinkOn();                             // Blink on/off
00096     void BlinkOff();
00097     void UnderlineOn();                         // Underline on/off
00098     void UnderlineOff();
00099     void UlBlinkOn();                           // Blink+Underline on/off
00100     void UlBlinkOff();
00101     void ReverseOn();                           // Reverse on/off
00102     void ReverseOff();
00103     void Lightbg();                             // High-intensity background
00104     void Darkbg();                              // Low-intensity background
00105     void setDefaultFg(unsigned char u) {defaultfg = u;}
00106     void setDefaultBg(unsigned char u) {defaultbg = u;}
00107 
00108     // Text output routines
00109     unsigned long WriteText(const char *pszString, unsigned long cbString);
00110     unsigned long WriteString(const char* pszString, unsigned long cbString);
00111     unsigned long WriteStringFast(const char *pszString, unsigned long cbString);
00112     unsigned long WriteCtrlString(const char* pszString, unsigned long cbString);
00113     unsigned long WriteCtrlChar(char c);
00114     unsigned long NetWriteString(const char* pszString, unsigned long cbString);
00115 
00116     // Clear screen/screen area functions
00117     void ClearScreen(char c = ' ');
00118     void ClearWindow(int start, int end, char c = ' ');
00119     void ClearEOScreen(char c = ' ');
00120     void ClearBOScreen(char c = ' ');
00121     void ClearLine(char c = ' ');
00122     void ClearEOLine(char c = ' ');
00123     void ClearBOLine(char c = ' ');
00124 
00125     // Scrolling and text output control functions
00126     void SetScroll(int start, int end);
00127     void ScrollDown(int iStartRow , int iEndRow, int bUp);
00128     void ScrollAll(int bUp) {ScrollDown(iScrollStart, iScrollEnd, bUp);}
00129     void index();
00130     void reverse_index();
00131     void setLineWrap(bool bEnabled){
00132         if(!ini.get_lock_linewrap())
00133             ini.set_value("Wrap_Line", bEnabled ? "true" : "false");
00134     }
00135     bool getLineWrap() {return ini.get_wrapline();}
00136 
00137     // Insert/delete characters/lines
00138     void InsertLine(int numlines);          // Added by Titus von Boxberg 30/3/97
00139     void InsertCharacter(int numchar);      // "
00140     void DeleteCharacter(int numchar);      // "
00141     void InsertMode(int i) {insert_mode = i;}
00142 
00143     // Miscellaneous functions
00144     void Beep();
00145 
00146 protected:
00147     HANDLE hConsole;
00148 
00149     CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo;
00150 
00151     unsigned char wAttributes;
00152     unsigned char fg, bg;
00153     unsigned char defaultfg, defaultbg;
00154     unsigned char origfg, origbg;
00155 
00156     bool blink;
00157     bool underline;
00158     bool reverse;
00159 
00160     int iScrollStart;
00161     int iScrollEnd;
00162     int insert_mode;
00163 };
00164 
00165 // Non-member functions for saving state -- used by the scrollback buffer viewer
00166 void saveScreen(CHAR_INFO* chiBuffer);
00167 void restoreScreen(CHAR_INFO* chiBuffer);
00168 CHAR_INFO* newBuffer();
00169 void deleteBuffer(CHAR_INFO* chiBuffer);

Generated on Sat May 26 2012 04:16:11 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.