console.h 4.95 KB
Newer Older
1 2
/* console.h */
/* Copyright 1998 - Joseph Pranevich */
3 4 5 6 7

/* Include file for definitions pertaining to Wine's text-console
   interface. 
*/

8 9
#ifndef __WINE_CONSOLE_H
#define __WINE_CONSOLE_H
10

11
#include <stdio.h>
12 13
#include "config.h"

14 15 16 17 18
/* Can we compile with curses/ncurses? */
#if (	(defined(HAVE_LIBNCURSES) || defined(HAVE_LIBCURSES)) &&	\
	(defined(HAVE_CURSES_H) || defined(HAVE_NCURSES_H))		\
)
# define WINE_NCURSES
19
#else
20
# undef WINE_NCURSES
21 22
#endif

23 24
#define CONSOLE_DEFAULT_DRIVER "tty"

25 26
typedef struct CONSOLE_DRIVER
{
27 28
   void (*init)(void);
   void (*close)(void);
29 30 31 32
   void (*write)(char, int, int, int);
   void (*moveCursor)(char, char);
   void (*getCursorPosition)(char *, char *);
   void (*getCharacterAtCursor)(char *, int *, int *, int *);
33
   void (*clearScreen)(void);
34

35 36 37
   /* Color-control functions */
   int  (*allocColor)(int color);
   void (*setBackgroundColor)(int fg, int bg);
38
   void (*getBackgroundColor)(int *fg, int *bg);
39

40
   /* Keyboard Functions */
41
   int  (*checkForKeystroke)(char *, char *);
42 43
   void (*getKeystroke)(char *, char *);

44 45 46 47
   /* Windowing Functions */
   void (*resizeScreen)(int, int);
   void (*notifyResizeScreen)(int, int); /* May be rethought later... */

48 49 50 51 52 53
   /* Accellerator Functions (Screen) */
   void (*clearWindow)(char, char, char, char, int, int);
   void (*scrollUpWindow)(char, char, char, char, char, int, int);
   void (*scrollDownWindow)(char, char, char, char, char, int, int);

   /* Accellerator Functions (Keyboard) */
54
   char (*getCharacter)(void);
55 56

   /* Other functions */
57
   void (*refresh)(void);
58 59 60
   
   /* Other data */
   int norefresh;
61 62
   FILE *console_out;
   FILE *console_in;
63 64
   int x_res;
   int y_res;
65

66 67
} CONSOLE_device;

68
extern CONSOLE_device driver; /* Global driver struct */
69 70

/* Generic defines */
Patrik Stridvall's avatar
Patrik Stridvall committed
71
void CONSOLE_Close(void);
72 73 74 75 76 77 78 79 80
void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute);
void CONSOLE_MoveCursor(char row, char col);
void CONSOLE_ClearWindow(char, char, char, char, int, int);
void CONSOLE_ScrollUpWindow(char, char, char, char, char, int, int);
void CONSOLE_ScrollDownWindow(char, char, char, char, char, int, int);
int  CONSOLE_CheckForKeystroke(char *, char*);
void CONSOLE_GetKeystroke(char *, char *);
void CONSOLE_GetCursorPosition(char *, char *);
void CONSOLE_GetCharacterAtCursor(char *, int *, int *, int *);
81
void CONSOLE_Refresh(void);
82
void CONSOLE_SetRefresh(int);
83 84 85 86 87
int  CONSOLE_GetRefresh(void);
void CONSOLE_ClearScreen(void);
char CONSOLE_GetCharacter(void);
void CONSOLE_ResizeScreen(int, int);
void CONSOLE_NotifyResizeScreen(int, int); 
88
void CONSOLE_WriteRawString(char *);
89 90
int  CONSOLE_AllocColor(int);
void CONSOLE_SetBackgroundColor(int fg, int bg);
91
void CONSOLE_GetBackgroundColor(int *fg, int *bg);
92 93

/* Generic Defines */
94
void GENERIC_Start(void);
95 96 97
void GENERIC_ClearWindow(char, char, char, char, int, int);
void GENERIC_ScrollUpWindow(char, char, char, char, char, int, int);
void GENERIC_ScrollDownWindow(char, char, char, char, char, int, int);
98
char GENERIC_GetCharacter(void);
99 100 101

/* TTY specific defines */
void TTY_Write(char out, int fg_color, int bg_color, int attribute);
102
void TTY_Start(void);
103 104 105 106 107 108
void TTY_GetKeystroke(char *, char *);

#ifdef WINE_NCURSES

/* ncurses defines */
void NCURSES_Write(char out, int fg_color, int bg_color, int attribute);
109 110 111
void NCURSES_Start(void);
void NCURSES_Init(void);
void NCURSES_Close(void);
112 113 114 115 116
int  NCURSES_CheckForKeystroke(char *, char *);
void NCURSES_GetKeystroke(char *, char *);
void NCURSES_MoveCursor(char ,char);
void NCURSES_GetCursorPosition(char *, char *);
void NCURSES_GetCharacterAtCursor(char *, int *, int *, int *);
117 118
void NCURSES_Refresh(void);
void NCURSES_ClearScreen(void);
119
void NCURSES_NotifyResizeScreen(int x, int y);
120 121
int  NCURSES_AllocColor(int);
void NCURSES_SetBackgroundColor(int fg, int bg);
122
void NCURSES_GetBackgroundColor(int *fg, int *bg);
123 124 125

#endif /* WINE_NCURSES */

126
/* Xterm specific defines */
127 128 129
void XTERM_Start(void);
void XTERM_Close(void);
void XTERM_Init(void);
130
void XTERM_ResizeScreen(int x, int y);
131

132 133
/* Color defines */
/* These will eventually be hex triples for dynamic allocation */
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
/* Triplets added by A.C. and commented out until the support  */
/* code can be written into the console routines.              */
#define WINE_BLACK		1     /*    0x000000      */ 
#define WINE_BLUE		2     /*    0x0000ff      */
#define WINE_GREEN		3     /*    0x008000      */
#define WINE_CYAN		4     /*    0x00eeee      */
#define WINE_MAGENTA		5     /*    0xcd00cd      */
#define WINE_BROWN		6     /*    0xcd3333      */
#define WINE_RED		7     /*    0xff0000      */
#define WINE_LIGHT_GRAY		8     /*    0xc0c0c0      */
#define WINE_DARK_GRAY		9     /*    0x808080      */
#define WINE_LIGHT_BLUE		10    /*    0x98f5ff      */
#define WINE_LIGHT_GREEN	11    /*    0x00ff00      */
#define WINE_LIGHT_RED		12    /*    0xee6363      */
#define WINE_LIGHT_MAGENTA	13    /*    0xff00ff      */
#define WINE_LIGHT_CYAN		14    /*    0x00ffff      */
#define WINE_YELLOW		15    /*    0xffff00      */
#define WINE_WHITE		16    /*    0xffffff      */
152

153
#endif /* CONSOLE_H */