Fixed some issues reported by winapi_check.
[wine] / include / console.h
1 /* console.h */
2 /* Copyright 1998 - Joseph Pranevich */
3
4 /* Include file for definitions pertaining to Wine's text-console
5    interface. 
6 */
7
8 #ifndef __WINE_CONSOLE_H
9 #define __WINE_CONSOLE_H
10
11 #include <stdio.h>
12 #include "config.h"
13
14 /* Can we compile with curses/ncurses? */
15 #if (   (defined(HAVE_LIBNCURSES) || defined(HAVE_LIBCURSES)) &&        \
16         (defined(HAVE_CURSES_H) || defined(HAVE_NCURSES_H))             \
17 )
18 # define WINE_NCURSES
19 #else
20 # undef WINE_NCURSES
21 #endif
22
23 #define CONSOLE_DEFAULT_DRIVER "tty"
24
25 typedef struct CONSOLE_DRIVER
26 {
27    void (*init)(void);
28    void (*close)(void);
29    void (*write)(char, int, int, int);
30    void (*moveCursor)(char, char);
31    void (*getCursorPosition)(char *, char *);
32    void (*getCharacterAtCursor)(char *, int *, int *, int *);
33    void (*clearScreen)(void);
34
35    /* Color-control functions */
36    int  (*allocColor)(int color);
37    void (*setBackgroundColor)(int fg, int bg);
38    void (*getBackgroundColor)(int *fg, int *bg);
39
40    /* Keyboard Functions */
41    int  (*checkForKeystroke)(char *, char *);
42    void (*getKeystroke)(char *, char *);
43
44    /* Windowing Functions */
45    void (*resizeScreen)(int, int);
46    void (*notifyResizeScreen)(int, int); /* May be rethought later... */
47
48    /* Accellerator Functions (Screen) */
49    void (*clearWindow)(char, char, char, char, int, int);
50    void (*scrollUpWindow)(char, char, char, char, char, int, int);
51    void (*scrollDownWindow)(char, char, char, char, char, int, int);
52
53    /* Accellerator Functions (Keyboard) */
54    char (*getCharacter)(void);
55
56    /* Other functions */
57    void (*refresh)(void);
58    
59    /* Other data */
60    int norefresh;
61    FILE *console_out;
62    FILE *console_in;
63    int x_res;
64    int y_res;
65
66 } CONSOLE_device;
67
68 extern CONSOLE_device driver; /* Global driver struct */
69
70 /* Generic defines */
71 void CONSOLE_Close(void);
72 void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute);
73 void CONSOLE_MoveCursor(char row, char col);
74 void CONSOLE_ClearWindow(char, char, char, char, int, int);
75 void CONSOLE_ScrollUpWindow(char, char, char, char, char, int, int);
76 void CONSOLE_ScrollDownWindow(char, char, char, char, char, int, int);
77 int  CONSOLE_CheckForKeystroke(char *, char*);
78 void CONSOLE_GetKeystroke(char *, char *);
79 void CONSOLE_GetCursorPosition(char *, char *);
80 void CONSOLE_GetCharacterAtCursor(char *, int *, int *, int *);
81 void CONSOLE_Refresh(void);
82 void CONSOLE_SetRefresh(int);
83 int  CONSOLE_GetRefresh(void);
84 void CONSOLE_ClearScreen(void);
85 char CONSOLE_GetCharacter(void);
86 void CONSOLE_ResizeScreen(int, int);
87 void CONSOLE_NotifyResizeScreen(int, int); 
88 void CONSOLE_WriteRawString(char *);
89 int  CONSOLE_AllocColor(int);
90 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 void GENERIC_ClearWindow(char, char, char, char, int, int);
96 void GENERIC_ScrollUpWindow(char, char, char, char, char, int, int);
97 void GENERIC_ScrollDownWindow(char, char, char, char, char, int, int);
98 char GENERIC_GetCharacter(void);
99
100 /* TTY specific defines */
101 void TTY_Write(char out, int fg_color, int bg_color, int attribute);
102 void TTY_Start(void);
103 void TTY_GetKeystroke(char *, char *);
104
105 #ifdef WINE_NCURSES
106
107 /* ncurses defines */
108 void NCURSES_Write(char out, int fg_color, int bg_color, int attribute);
109 void NCURSES_Start(void);
110 void NCURSES_Init(void);
111 void NCURSES_Close(void);
112 int  NCURSES_CheckForKeystroke(char *, char *);
113 void NCURSES_GetKeystroke(char *, char *);
114 void NCURSES_MoveCursor(char ,char);
115 void NCURSES_GetCursorPosition(char *, char *);
116 void NCURSES_GetCharacterAtCursor(char *, int *, int *, int *);
117 void NCURSES_Refresh(void);
118 void NCURSES_ClearScreen(void);
119 void NCURSES_NotifyResizeScreen(int x, int y);
120 int  NCURSES_AllocColor(int);
121 void NCURSES_SetBackgroundColor(int fg, int bg);
122 void NCURSES_GetBackgroundColor(int *fg, int *bg);
123
124 #endif /* WINE_NCURSES */
125
126 /* Xterm specific defines */
127 void XTERM_Start(void);
128 void XTERM_Close(void);
129 void XTERM_Init(void);
130 void XTERM_ResizeScreen(int x, int y);
131
132 /* Color defines */
133 /* These will eventually be hex triples for dynamic allocation */
134 /* Triplets added by A.C. and commented out until the support  */
135 /* code can be written into the console routines.              */
136 #define WINE_BLACK              1     /*    0x000000      */ 
137 #define WINE_BLUE               2     /*    0x0000ff      */
138 #define WINE_GREEN              3     /*    0x008000      */
139 #define WINE_CYAN               4     /*    0x00eeee      */
140 #define WINE_MAGENTA            5     /*    0xcd00cd      */
141 #define WINE_BROWN              6     /*    0xcd3333      */
142 #define WINE_RED                7     /*    0xff0000      */
143 #define WINE_LIGHT_GRAY         8     /*    0xc0c0c0      */
144 #define WINE_DARK_GRAY          9     /*    0x808080      */
145 #define WINE_LIGHT_BLUE         10    /*    0x98f5ff      */
146 #define WINE_LIGHT_GREEN        11    /*    0x00ff00      */
147 #define WINE_LIGHT_RED          12    /*    0xee6363      */
148 #define WINE_LIGHT_MAGENTA      13    /*    0xff00ff      */
149 #define WINE_LIGHT_CYAN         14    /*    0x00ffff      */
150 #define WINE_YELLOW             15    /*    0xffff00      */
151 #define WINE_WHITE              16    /*    0xffffff      */
152
153 #endif /* CONSOLE_H */