FreeBASIC  0.91.0
fb_console.h
Go to the documentation of this file.
1  typedef struct _fb_Rect {
2  int Left, Top, Right, Bottom;
3  } fb_Rect;
4 
5  typedef struct _fb_Coord {
6  int X, Y;
7  } fb_Coord;
8 
9  struct _fb_ConHooks;
10 
11  typedef void (*fb_fnHookConScroll)( struct _fb_ConHooks *handle, int x1, int y1, int x2, int y2, int rows );
12  typedef int (*fb_fnHookConWrite )( struct _fb_ConHooks *handle, const void *buffer, size_t length );
13 
14  typedef struct _fb_ConHooks {
15  void *Opaque;
16 
19 
22  } fb_ConHooks;
23 
24  static __inline__
26  {
27  fb_Rect *pBorder = &handle->Border;
28  fb_Coord *pCoord = &handle->Coord;
29  if( pBorder->Bottom!=-1 ) {
30  if( pCoord->Y > pBorder->Bottom ) {
31  int nRows = pCoord->Y - pBorder->Bottom;
32  handle->Scroll( handle,
33  pBorder->Left,
34  pBorder->Top,
35  pBorder->Right,
36  pBorder->Bottom,
37  nRows );
38  return TRUE;
39  }
40  }
41  return FALSE;
42  }
43 
44  void fb_ConPrintRaw ( fb_ConHooks *handle, const char *pachText, size_t TextLength );
45  void fb_ConPrintRawWstr ( fb_ConHooks *handle, const FB_WCHAR *pachText, size_t TextLength );
46  void fb_ConPrintTTY ( fb_ConHooks *handle, const char *pachText, size_t TextLength, int is_text_mode );
47  void fb_ConPrintTTYWstr ( fb_ConHooks *handle, const FB_WCHAR *pachText, size_t TextLength, int is_text_mode );
48 
49  int fb_ConsoleWidth ( int cols, int rows );
50  void fb_ConsoleClear ( int mode );
51 
52  int fb_ConsoleLocate ( int row, int col, int cursor );
53  int fb_ConsoleGetY ( void );
54  int fb_ConsoleGetX ( void );
55 FBCALL void fb_ConsoleGetSize ( int *cols, int *rows );
56 FBCALL void fb_ConsoleGetXY ( int *col, int *row );
57 
58 FBCALL unsigned int fb_ConsoleReadXY ( int col, int row, int colorflag );
59  int fb_ConsoleColor ( int fc, int bc, int flags );
60  int fb_ConsoleGetColorAtt( void );
61 
62 FBCALL int fb_ConsoleView ( int toprow, int botrow );
63  int fb_ConsoleViewEx ( int toprow, int botrow, int set_cursor );
64  void fb_ConsoleGetView ( int *toprow, int *botrow );
65  int fb_ConsoleGetMaxRow ( void );
66  void fb_ConsoleViewUpdate( void );
67 
68  void fb_ConsoleScroll ( int nrows );
69 
70  int fb_ConsoleGetkey ( void );
71  FBSTRING *fb_ConsoleInkey ( void );
72  int fb_ConsoleKeyHit ( void );
73 
74  int fb_ConsoleMultikey ( int scancode );
75  int fb_ConsoleGetMouse ( int *x, int *y, int *z, int *buttons_, int *clip );
76  int fb_ConsoleSetMouse ( int x, int y, int cursor, int clip );
77 
78  void fb_ConsolePrintBuffer( const char *buffer, int mask );
79  void fb_ConsolePrintBufferWstr( const FB_WCHAR *buffer, int mask );
80  void fb_ConsolePrintBufferEx( const void *buffer, size_t len, int mask );
81  void fb_ConsolePrintBufferWstrEx( const FB_WCHAR *buffer, size_t len, int mask );
82 
83  char *fb_ConsoleReadStr ( char *buffer, ssize_t len );
84 
85  int fb_ConsoleGetTopRow ( void );
86  int fb_ConsoleGetBotRow ( void );
87  void fb_ConsoleSetTopBotRows( int top, int bot );
88 
89  void fb_ConsoleSleep ( int msecs );
90 
91  int fb_ConsoleIsRedirected( int is_input );
92 
93  int fb_ConsolePageCopy ( int src, int dst );
94  int fb_ConsolePageSet ( int active, int visible );
95 
96 FBCALL FBSTRING *fb_ConReadLine ( int soft_cursor );
97 
98 FBCALL int fb_ConsoleInput ( FBSTRING *text, int addquestion, int addnewline );
99  int fb_ConsoleLineInput ( FBSTRING *text, void *dst, ssize_t dst_len, int fillrem, int addquestion, int addnewline );
100  int fb_ConsoleLineInputWstr( const FB_WCHAR *text, FB_WCHAR *dst, ssize_t max_chars, int addquestion, int addnewline );
101 
102  int fb_hConsoleInputBufferChanged( void );