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