Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

484 lines
7.1 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. screen.hxx
  5. Abstract:
  6. This module contains the declaration for the SCREEN class.
  7. The SCREEN class provides methods that models the stream
  8. of bytes, with write access.
  9. Read operations from a SCREEN are not allowed.
  10. End of stream in a SCREEN object means that the cursor is
  11. in the last column of the last row.
  12. Author:
  13. Jaime Sasson (jaimes) 21-Mar-1991
  14. Environment:
  15. ULIB, User Mode
  16. --*/
  17. #if !defined( _SCREEN_ )
  18. #define _SCREEN_
  19. #include "stream.hxx"
  20. enum SCROLL_DIRECTION {
  21. SCROLL_UP,
  22. SCROLL_DOWN,
  23. SCROLL_LEFT,
  24. SCROLL_RIGHT
  25. };
  26. DECLARE_CLASS( SCREEN );
  27. class SCREEN : public STREAM {
  28. public:
  29. ULIB_EXPORT
  30. DECLARE_CONSTRUCTOR( SCREEN );
  31. ULIB_EXPORT
  32. DECLARE_CAST_MEMBER_FUNCTION( SCREEN );
  33. NONVIRTUAL
  34. ULIB_EXPORT
  35. ~SCREEN (
  36. );
  37. NONVIRTUAL
  38. ULIB_EXPORT
  39. BOOLEAN
  40. Initialize(
  41. );
  42. NONVIRTUAL
  43. BOOLEAN
  44. Initialize(
  45. IN BOOLEAN CurrentActiveScreen,
  46. IN USHORT NumberOfRows,
  47. IN USHORT NumberOfColumns,
  48. IN USHORT TextAttribute,
  49. IN BOOLEAN ExpandAsciiControlSequence DEFAULT TRUE,
  50. IN BOOLEAN WrapAtEndOfLine DEFAULT TRUE
  51. );
  52. NONVIRTUAL
  53. ULIB_EXPORT
  54. BOOLEAN
  55. ChangeScreenSize(
  56. IN USHORT NumberOfRows,
  57. IN USHORT NumberOfColumns,
  58. OUT PBOOLEAN IsFullScreen DEFAULT NULL
  59. );
  60. NONVIRTUAL
  61. BOOLEAN
  62. ChangeTextAttribute(
  63. IN USHORT Attribute
  64. );
  65. NONVIRTUAL
  66. BOOLEAN
  67. DisableAsciiControlSequence(
  68. );
  69. NONVIRTUAL
  70. BOOLEAN
  71. DisableWrapMode(
  72. );
  73. NONVIRTUAL
  74. BOOLEAN
  75. EnableAsciiControlSequence(
  76. );
  77. NONVIRTUAL
  78. BOOLEAN
  79. EnableWrapMode(
  80. );
  81. NONVIRTUAL
  82. BOOLEAN
  83. EraseLine(
  84. IN USHORT LineNumber
  85. );
  86. NONVIRTUAL
  87. ULIB_EXPORT
  88. BOOLEAN
  89. EraseScreen(
  90. );
  91. #ifdef FE_SB
  92. NONVIRTUAL
  93. ULIB_EXPORT
  94. BOOLEAN
  95. EraseScreenAndResetAttribute(
  96. );
  97. #endif
  98. NONVIRTUAL
  99. BOOLEAN
  100. EraseToEndOfLine(
  101. );
  102. NONVIRTUAL
  103. BOOLEAN
  104. FillRectangularRegionAttribute(
  105. IN USHORT TopLeftRow,
  106. IN USHORT TopLeftColumn,
  107. IN USHORT BottomRightRow,
  108. IN USHORT BottomRightColumn,
  109. IN USHORT Attribute
  110. );
  111. NONVIRTUAL
  112. BOOLEAN
  113. FillRegionAttribute(
  114. IN USHORT StartRow,
  115. IN USHORT StartColumn,
  116. IN USHORT EndRow,
  117. IN USHORT EndColumn,
  118. IN USHORT Attribute
  119. );
  120. NONVIRTUAL
  121. BOOLEAN
  122. FillRectangularRegionCharacter(
  123. IN USHORT TopLeftRow,
  124. IN USHORT TopLeftColumn,
  125. IN USHORT BottomRightRow,
  126. IN USHORT BottomRightColumn,
  127. IN CHAR Character
  128. );
  129. NONVIRTUAL
  130. BOOLEAN
  131. FillRegionCharacter(
  132. IN USHORT StartRow,
  133. IN USHORT StartColumn,
  134. IN USHORT EndRow,
  135. IN USHORT EndColumn,
  136. IN CHAR Character
  137. );
  138. NONVIRTUAL
  139. BOOLEAN
  140. IsAsciiControlSequenceEnabled(
  141. ) CONST;
  142. VIRTUAL
  143. BOOLEAN
  144. IsAtEnd(
  145. ) CONST;
  146. NONVIRTUAL
  147. BOOLEAN
  148. IsWrapModeEnabled(
  149. ) CONST;
  150. NONVIRTUAL
  151. BOOLEAN
  152. MoveCursorDown(
  153. IN USHORT Rows
  154. );
  155. NONVIRTUAL
  156. BOOLEAN
  157. MoveCursorLeft(
  158. IN USHORT Columns
  159. );
  160. NONVIRTUAL
  161. BOOLEAN
  162. MoveCursorRight(
  163. IN USHORT Columns
  164. );
  165. NONVIRTUAL
  166. ULIB_EXPORT
  167. BOOLEAN
  168. MoveCursorTo(
  169. IN USHORT Row,
  170. IN USHORT Column
  171. );
  172. NONVIRTUAL
  173. BOOLEAN
  174. MoveCursorUp(
  175. IN USHORT Rows
  176. );
  177. VIRTUAL
  178. STREAMACCESS
  179. QueryAccess(
  180. ) CONST;
  181. NONVIRTUAL
  182. ULIB_EXPORT
  183. DWORD
  184. QueryCodePage (
  185. );
  186. NONVIRTUAL
  187. BOOLEAN
  188. QueryCursorPosition(
  189. OUT PUSHORT Row,
  190. OUT PUSHORT Column
  191. );
  192. VIRTUAL
  193. HANDLE
  194. QueryHandle(
  195. ) CONST;
  196. NONVIRTUAL
  197. DWORD
  198. QueryOutputCodePage (
  199. );
  200. NONVIRTUAL
  201. ULIB_EXPORT
  202. VOID
  203. QueryScreenSize(
  204. OUT PUSHORT NumberOfRows,
  205. OUT PUSHORT NumberOfColumns,
  206. OUT PUSHORT WindowRows DEFAULT NULL,
  207. OUT PUSHORT WindowColumns DEFAULT NULL
  208. ) CONST;
  209. VIRTUAL
  210. BOOLEAN
  211. Read(
  212. OUT PBYTE Buffer,
  213. IN ULONG BytesToRead,
  214. OUT PULONG BytesRead
  215. );
  216. VIRTUAL
  217. BOOLEAN
  218. ReadChar(
  219. OUT PWCHAR Char,
  220. IN BOOLEAN Unicode DEFAULT FALSE
  221. );
  222. VIRTUAL
  223. BOOLEAN
  224. ReadMbString(
  225. IN PSTR String,
  226. IN DWORD BufferSize,
  227. INOUT PDWORD StringSize,
  228. IN PSTR Delimiters,
  229. IN BOOLEAN ExpandTabs DEFAULT FALSE,
  230. IN DWORD TabExp DEFAULT 8
  231. );
  232. VIRTUAL
  233. BOOLEAN
  234. ReadWString(
  235. IN PWSTR String,
  236. IN DWORD BufferSize,
  237. INOUT PDWORD StringSize,
  238. IN PWSTR Delimiters,
  239. IN BOOLEAN ExpandTabs DEFAULT FALSE,
  240. IN DWORD TabExp DEFAULT 8
  241. );
  242. VIRTUAL
  243. BOOLEAN
  244. ReadString(
  245. OUT PWSTRING String,
  246. IN PWSTRING Delimiter,
  247. IN BOOLEAN Unicode DEFAULT FALSE
  248. );
  249. NONVIRTUAL
  250. BOOLEAN
  251. ScrollScreen(
  252. USHORT Amount,
  253. SCROLL_DIRECTION Direction
  254. );
  255. NONVIRTUAL
  256. ULIB_EXPORT
  257. BOOLEAN
  258. SetCodePage(
  259. IN DWORD CodePage
  260. );
  261. NONVIRTUAL
  262. BOOLEAN
  263. SetCursorOff(
  264. );
  265. NONVIRTUAL
  266. BOOLEAN
  267. SetCursorOn(
  268. );
  269. NONVIRTUAL
  270. BOOLEAN
  271. SetCursorSize(
  272. IN ULONG Size
  273. );
  274. NONVIRTUAL
  275. ULIB_EXPORT
  276. BOOLEAN
  277. SetOutputCodePage(
  278. IN DWORD CodePage
  279. );
  280. NONVIRTUAL
  281. BOOLEAN
  282. SetScreenActive(
  283. );
  284. VIRTUAL
  285. BOOLEAN
  286. WriteString(
  287. IN PCWSTRING String,
  288. IN CHNUM Position DEFAULT 0,
  289. IN CHNUM Length DEFAULT TO_END,
  290. IN CHNUM Granularity DEFAULT 0
  291. );
  292. VIRTUAL
  293. BOOLEAN
  294. WriteChar(
  295. IN WCHAR Char
  296. );
  297. private:
  298. HANDLE _ScreenHandle;
  299. // USHORT _Rows;
  300. // USHORT _Columns;
  301. USHORT _TextAttribute;
  302. ULONG _ScreenMode;
  303. };
  304. INLINE
  305. BOOLEAN
  306. SCREEN::IsAsciiControlSequenceEnabled(
  307. ) CONST
  308. /*++
  309. Routine Description:
  310. Determines if expansion of ASCII control sequences are currently
  311. allowed.
  312. Arguments:
  313. None.
  314. Return Value:
  315. BOOLEAN - Indicates if ASCII control sequences are allowed.
  316. --*/
  317. {
  318. if( ( _ScreenMode & ENABLE_PROCESSED_OUTPUT ) ) {
  319. return( TRUE );
  320. } else {
  321. return( FALSE );
  322. }
  323. }
  324. INLINE
  325. BOOLEAN
  326. SCREEN::IsWrapModeEnabled(
  327. ) CONST
  328. /*++
  329. Routine Description:
  330. Determines if twrap is allowed in the screen.
  331. Arguments:
  332. None.
  333. Return Value:
  334. BOOLEAN - Indicates if the screen is in the wrap mode.
  335. --*/
  336. {
  337. if( ( _ScreenMode & ENABLE_WRAP_AT_EOL_OUTPUT ) ) {
  338. return( TRUE );
  339. } else {
  340. return( FALSE );
  341. }
  342. }
  343. #endif // _SCREEN_