home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cons-010.zip / Console / src / common / os2con.h < prev    next >
C/C++ Source or Header  |  1997-09-10  |  5KB  |  151 lines

  1. /******************************************************************************\
  2. |*                                                                            *|
  3. |* OS/2 console control routines: header file                                 *|
  4. |* Copyright (C) 1997 by FRIENDS software                                     *|
  5. |* All Rights Reserved                                                        *|
  6. |* Portability: OS/2                                                          *|
  7. |*                                                                            *|
  8. |* This program is free software; you can redistribute it and/or modify       *|
  9. |* it under the terms of the GNU General Public License as published by       *|
  10. |* the Free Software Foundation; either version 2 of the License, or          *|
  11. |* (at your option) any later version.                                        *|
  12. |*                                                                            *|
  13. |* This program is distributed in the hope that it will be useful,            *|
  14. |* but WITHOUT ANY WARRANTY; without even the implied warranty of             *|
  15. |* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *|
  16. |* GNU General Public License for more details.                               *|
  17. |*                                                                            *|
  18. |* You should have received a copy of the GNU General Public License          *|
  19. |* along with this program; if not, write to the Free Software                *|
  20. |* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA  *|
  21. |*                                                                            *|
  22. \******************************************************************************/
  23.  
  24. #ifndef __ANSI_H__
  25. #define __ANSI_H__
  26.  
  27. #include "stype.h"
  28.  
  29. #ifdef __cplusplus
  30.  extern "C" {
  31. #endif
  32.  
  33. #define colSAME        -1
  34. #define colBLACK    0
  35. #define colBLUE        1
  36. #define    colGREEN    2
  37. #define colCYAN        3
  38. #define colRED        4
  39. #define colMAGENTA    5
  40. #define colBROWN    6
  41. #define colGRAY        7
  42. #define colDGRAY    8
  43. #define colLBLUE    9
  44. #define colLGREEN    10
  45. #define colLCYAN    11
  46. #define colLRED        12
  47. #define colLMAGENTA    13
  48. #define colYELLOW    14
  49. #define colWHITE    15
  50.  
  51. // Output ANSI color sequence (if ANSI == 1)
  52. void SetColor(int Fore, int Back);
  53.  
  54. // Query console width & height
  55. void GetConsoleSize(int *Width, int *Height); 
  56.  
  57. // Set console (window) width & height
  58. void SetConsoleSize(int Width, int Height, int Attr);
  59.  
  60. // Clear console
  61. void ClearConsole(int Attr);
  62.  
  63. // Set cursor position
  64. void SetCursorPos(int X, int Y);
  65.  
  66. // Enable ANSI colors?
  67. extern boolean ANSI;
  68.  
  69. // Console font size structure
  70. typedef struct
  71. {
  72.  int W;
  73.  int H;
  74. } tFontSize, *pFontSize;
  75.  
  76. // The list of console fonts
  77. extern PVIOFONTCELLSIZE FontList;
  78. extern ULONG FontCount;
  79.  
  80. // VIO window handles
  81. extern HWND vioHWND;
  82. extern HWND listHWND;
  83. extern HWND clientHWND;
  84. extern HWND dlgHWND;
  85. extern HSWITCH vioHSW;
  86.  
  87. //--- "Tricky" functions ---
  88.  
  89. // Get VIO window handle
  90. extern HWND GetWindowHWND();
  91.  
  92. // Query the list of available VIO fonts (result placed in FontList[])
  93. extern BOOL QueryFontList();
  94.  
  95. // Set console font size (relatively slow!)
  96. extern BOOL SetConsoleFontSize(int H, int W);
  97.  
  98. // Query console font size (relatively slow!)
  99. extern BOOL GetConsoleFontSize(int *H, int *W);
  100.  
  101. // Compute nearest font that is about WxH size
  102. extern int  NearestFont(int H, int W);
  103.  
  104. // Set maximal possible console size (but not maximizing the window!)
  105. extern BOOL SetMaxConsoleSize();
  106.  
  107. // Maximize console window
  108. extern BOOL MaximizeConsole();
  109.  
  110. // Minimize console window
  111. extern BOOL MinimizeConsole();
  112.  
  113. // Restore console window
  114. extern BOOL RestoreConsole();
  115.  
  116. // Show/hide console (not same as minimizing/restoring!)
  117. extern BOOL ShowConsole(BOOL Show);
  118.  
  119. // Make console active desktop window
  120. extern BOOL SelectConsole();
  121.  
  122. // Start console window title+border flashing
  123. extern BOOL FlashConsole(BOOL State);
  124.  
  125. // Resize console window (Flags consists of SWP_XXX constants )
  126. extern BOOL SetPixelConsoleSize(int X, int Y, int W, int H, ULONG Flags);
  127.  
  128. // Get console window position & size (fast)
  129. extern BOOL GetPixelConsoleSize(int *X, int *Y, int *W, int *H);
  130.  
  131. // Set console window border width/height
  132. extern BOOL SetConsoleBorderSize(int W, int H);
  133.  
  134. // Query console window border width/height
  135. extern BOOL GetConsoleBorderSize(int *W, int *H);
  136.  
  137. // Set console window title string (not always works! This is a feature of PM)
  138. extern BOOL SetConsoleTitle(char *title);
  139.  
  140. // Lock updates on desktop
  141. BOOL LockConsoleUpdate();
  142.  
  143. // Unlock updates on desktop; nested calls are allowed
  144. BOOL UnlockConsoleUpdate();
  145.  
  146. #ifdef __cplusplus
  147.  }
  148. #endif
  149.  
  150. #endif __ANSI_H__
  151.