Changed the GDI driver interface to pass an opaque PHYSDEV pointer
[wine] / include / console.h
1 /*
2  * Include file for definitions pertaining to Wine's text-console
3  * interface.
4  *
5  * Copyright 1998 - Joseph Pranevich
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #ifndef __WINE_CONSOLE_H
23 #define __WINE_CONSOLE_H
24
25 #ifndef __WINE_CONFIG_H 
26 # error You must include config.h to use this header 
27 #endif 
28
29 #include <stdio.h>
30
31 /* Can we compile with curses/ncurses? */
32 #if (   (defined(HAVE_LIBNCURSES) || defined(HAVE_LIBCURSES)) &&        \
33         (defined(HAVE_CURSES_H) || defined(HAVE_NCURSES_H))             \
34 )
35 # define WINE_NCURSES
36 #else
37 # undef WINE_NCURSES
38 #endif
39
40 #define CONSOLE_DEFAULT_DRIVER "tty"
41
42 typedef struct CONSOLE_DRIVER
43 {
44    void (*init)(void);
45    void (*close)(void);
46    void (*write)(char, int, int, int);
47    void (*moveCursor)(char, char);
48    void (*getCursorPosition)(char *, char *);
49    void (*getCharacterAtCursor)(char *, int *, int *, int *);
50    void (*clearScreen)(void);
51
52    /* Color-control functions */
53    int  (*allocColor)(int color);
54    void (*setBackgroundColor)(int fg, int bg);
55    void (*getBackgroundColor)(int *fg, int *bg);
56
57    /* Keyboard Functions */
58    int  (*checkForKeystroke)(char *, char *);
59    void (*getKeystroke)(char *, char *);
60
61    /* Windowing Functions */
62    void (*resizeScreen)(int, int);
63    void (*notifyResizeScreen)(int, int); /* May be rethought later... */
64
65    /* Accelerator Functions (Screen) */
66    void (*clearWindow)(char, char, char, char, int, int);
67    void (*scrollUpWindow)(char, char, char, char, char, int, int);
68    void (*scrollDownWindow)(char, char, char, char, char, int, int);
69
70    /* Accelerator Functions (Keyboard) */
71    char (*getCharacter)(void);
72
73    /* Other functions */
74    void (*refresh)(void);
75    
76    /* Other data */
77    int norefresh;
78    FILE *console_out;
79    FILE *console_in;
80    int x_res;
81    int y_res;
82
83 } CONSOLE_device;
84
85 extern CONSOLE_device driver; /* Global driver struct */
86
87 /* Generic defines */
88 void CONSOLE_Close(void);
89 void CONSOLE_Write(char out, int fg_color, int bg_color, int attribute);
90 void CONSOLE_MoveCursor(char row, char col);
91 void CONSOLE_ClearWindow(char, char, char, char, int, int);
92 void CONSOLE_ScrollUpWindow(char, char, char, char, char, int, int);
93 void CONSOLE_ScrollDownWindow(char, char, char, char, char, int, int);
94 int  CONSOLE_CheckForKeystroke(char *, char*);
95 void CONSOLE_GetKeystroke(char *, char *);
96 void CONSOLE_GetCursorPosition(char *, char *);
97 void CONSOLE_GetCharacterAtCursor(char *, int *, int *, int *);
98 void CONSOLE_Refresh(void);
99 void CONSOLE_SetRefresh(int);
100 int  CONSOLE_GetRefresh(void);
101 void CONSOLE_ClearScreen(void);
102 char CONSOLE_GetCharacter(void);
103 void CONSOLE_ResizeScreen(int, int);
104 void CONSOLE_NotifyResizeScreen(int, int); 
105 void CONSOLE_WriteRawString(char *);
106 int  CONSOLE_AllocColor(int);
107 void CONSOLE_SetBackgroundColor(int fg, int bg);
108 void CONSOLE_GetBackgroundColor(int *fg, int *bg);
109
110 /* Generic Defines */
111 void GENERIC_Start(void);
112 void GENERIC_ClearWindow(char, char, char, char, int, int);
113 void GENERIC_ScrollUpWindow(char, char, char, char, char, int, int);
114 void GENERIC_ScrollDownWindow(char, char, char, char, char, int, int);
115 char GENERIC_GetCharacter(void);
116
117 /* TTY specific defines */
118 void TTY_Write(char out, int fg_color, int bg_color, int attribute);
119 void TTY_Start(void);
120 void TTY_GetKeystroke(char *, char *);
121
122 #ifdef WINE_NCURSES
123
124 /* ncurses defines */
125 void NCURSES_Write(char out, int fg_color, int bg_color, int attribute);
126 void NCURSES_Start(void);
127 void NCURSES_Init(void);
128 void NCURSES_Close(void);
129 int  NCURSES_CheckForKeystroke(char *, char *);
130 void NCURSES_GetKeystroke(char *, char *);
131 void NCURSES_MoveCursor(char ,char);
132 void NCURSES_GetCursorPosition(char *, char *);
133 void NCURSES_GetCharacterAtCursor(char *, int *, int *, int *);
134 void NCURSES_Refresh(void);
135 void NCURSES_ClearScreen(void);
136 void NCURSES_NotifyResizeScreen(int x, int y);
137 int  NCURSES_AllocColor(int);
138 void NCURSES_SetBackgroundColor(int fg, int bg);
139 void NCURSES_GetBackgroundColor(int *fg, int *bg);
140
141 #endif /* WINE_NCURSES */
142
143 /* Xterm specific defines */
144 void XTERM_Start(void);
145 void XTERM_Close(void);
146 void XTERM_Init(void);
147 void XTERM_ResizeScreen(int x, int y);
148
149 /* Color defines */
150 /* These will eventually be hex triples for dynamic allocation */
151 /* Triplets added by A.C. and commented out until the support  */
152 /* code can be written into the console routines.              */
153 #define WINE_BLACK              1     /*    0x000000      */ 
154 #define WINE_BLUE               2     /*    0x0000ff      */
155 #define WINE_GREEN              3     /*    0x008000      */
156 #define WINE_CYAN               4     /*    0x00eeee      */
157 #define WINE_MAGENTA            5     /*    0xcd00cd      */
158 #define WINE_BROWN              6     /*    0xcd3333      */
159 #define WINE_RED                7     /*    0xff0000      */
160 #define WINE_LIGHT_GRAY         8     /*    0xc0c0c0      */
161 #define WINE_DARK_GRAY          9     /*    0x808080      */
162 #define WINE_LIGHT_BLUE         10    /*    0x98f5ff      */
163 #define WINE_LIGHT_GREEN        11    /*    0x00ff00      */
164 #define WINE_LIGHT_RED          12    /*    0xee6363      */
165 #define WINE_LIGHT_MAGENTA      13    /*    0xff00ff      */
166 #define WINE_LIGHT_CYAN         14    /*    0x00ffff      */
167 #define WINE_YELLOW             15    /*    0xffff00      */
168 #define WINE_WHITE              16    /*    0xffffff      */
169
170 #endif /* CONSOLE_H */