6 /* A diagram of the following values:
9 * +----------------------------------------+
24 * +---------------------------+.....?......| ---
26 * | . | <-- OR --> | |
28 * CON_LEFT | . | CON_RIGHT |
29 * (=0) | . | (=CON_ | CON_LINES
30 * |..............* | WIDTH) |
36 * +---------------------------+------------+ ---
37 * CON_BOTTOM (=CON_TOP + CON_HEIGHT)
39 * |--------- CON_COLS --------|
41 * Keep in mind that CON_TOP, CON_BOTTOM, CON_LEFT, and CON_RIGHT are relative
42 * to zero, but CON_CUR_X, CON_CUR_Y, CON_WIDTH, and CON_HEIGHT are relative to
43 * CON_TOP and CON_LEFT
46 #define CON_TOP ConsoleInfo.srWindow.Top
47 #define CON_BOTTOM ConsoleInfo.srWindow.Bottom
50 #define CON_RIGHT (ConsoleInfo.dwSize.X - 1)
52 #define CON_HEIGHT (CON_BOTTOM - CON_TOP)
53 #define CON_WIDTH (CON_RIGHT - CON_LEFT)
54 #define CON_LINES (CON_HEIGHT + 1)
55 #define CON_COLS (CON_WIDTH + 1)
57 #define CON_CUR_X (ConsoleInfo.dwCursorPosition.X - CON_LEFT)
58 #define CON_CUR_Y (ConsoleInfo.dwCursorPosition.Y - CON_TOP)
63 TConsole(HANDLE hConsole
);
67 // Cursor movement routines
68 int GetRawCursorX() {return CON_CUR_X
;}
69 int GetRawCursorY() {return CON_CUR_Y
;}
70 int GetCursorX() {return CON_CUR_X
;}
72 if(iScrollStart
!= -1)
73 return CON_CUR_Y
- iScrollStart
;
74 return GetRawCursorY();
76 void SetRawCursorPosition(int x
, int y
);
77 void SetCursorPosition(int x
, int y
);
78 void SetCursorSize(int pct
);
79 void MoveCursorPosition(int x
, int y
);
81 // Screen mode/size routines
82 int GetWidth() {return CON_COLS
;}
83 int GetHeight() {return CON_LINES
;}
84 void SetExtendedMode(int iFunction
, BOOL bEnable
);
85 void SetWindowSize(int width
, int height
); // Set the size of the window,
88 // Color/attribute routines
89 void SetAttrib(unsigned char wAttr
) {wAttributes
= wAttr
;}
90 unsigned char GetAttrib() {return wAttributes
;}
91 void Normal(); // Reset all attributes
92 void HighVideo(); // Aka "bold"
94 void SetForeground(unsigned char wAttrib
); // Set the foreground directly
95 void SetBackground(unsigned char wAttrib
);
96 void BlinkOn(); // Blink on/off
98 void UnderlineOn(); // Underline on/off
100 void UlBlinkOn(); // Blink+Underline on/off
102 void ReverseOn(); // Reverse on/off
104 void Lightbg(); // High-intensity background
105 void Darkbg(); // Low-intensity background
106 void setDefaultFg(unsigned char u
) {defaultfg
= u
;}
107 void setDefaultBg(unsigned char u
) {defaultbg
= u
;}
109 // Text output routines
110 unsigned long WriteText(const char *pszString
, unsigned long cbString
);
111 unsigned long WriteString(const char* pszString
, unsigned long cbString
);
112 unsigned long WriteStringFast(const char *pszString
, unsigned long cbString
);
113 unsigned long WriteCtrlString(const char* pszString
, unsigned long cbString
);
114 unsigned long WriteCtrlChar(char c
);
115 unsigned long NetWriteString(const char* pszString
, unsigned long cbString
);
117 // Clear screen/screen area functions
118 void ClearScreen(char c
= ' ');
119 void ClearWindow(int start
, int end
, char c
= ' ');
120 void ClearEOScreen(char c
= ' ');
121 void ClearBOScreen(char c
= ' ');
122 void ClearLine(char c
= ' ');
123 void ClearEOLine(char c
= ' ');
124 void ClearBOLine(char c
= ' ');
126 // Scrolling and text output control functions
127 void SetScroll(int start
, int end
);
128 void ScrollDown(int iStartRow
, int iEndRow
, int bUp
);
129 void ScrollAll(int bUp
) {ScrollDown(iScrollStart
, iScrollEnd
, bUp
);}
131 void reverse_index();
132 void setLineWrap(bool bEnabled
){
133 if(!ini
.get_lock_linewrap())
134 ini
.set_value("Wrap_Line", bEnabled
? "true" : "false");
136 bool getLineWrap() {return ini
.get_wrapline();}
138 // Insert/delete characters/lines
139 void InsertLine(int numlines
); // Added by Titus von Boxberg 30/3/97
140 void InsertCharacter(int numchar
); // "
141 void DeleteCharacter(int numchar
); // "
142 void InsertMode(int i
) {insert_mode
= i
;}
144 // Miscellaneous functions
150 CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo
;
152 unsigned char wAttributes
;
153 unsigned char fg
, bg
;
154 unsigned char defaultfg
, defaultbg
;
155 unsigned char origfg
, origbg
;
166 // Non-member functions for saving state -- used by the scrollback buffer viewer
167 void saveScreen(CHAR_INFO
* chiBuffer
);
168 void restoreScreen(CHAR_INFO
* chiBuffer
);
169 CHAR_INFO
* newBuffer();
170 void deleteBuffer(CHAR_INFO
* chiBuffer
);