|
1 /* Public Domain Curses */ |
|
2 |
|
3 /* $Id: curspriv.h,v 1.158 2008/07/13 16:08:16 wmcbrine Exp $ */ |
|
4 |
|
5 /* Private definitions and declarations for use within PDCurses. |
|
6 These should generally not be referenced by applications. */ |
|
7 |
|
8 #ifndef __CURSES_INTERNALS__ |
|
9 #define __CURSES_INTERNALS__ 1 |
|
10 |
|
11 #ifdef HAVE_CONFIG_H |
|
12 # include <config.h> |
|
13 #endif |
|
14 |
|
15 #define CURSES_LIBRARY |
|
16 #include <curses.h> |
|
17 |
|
18 #if defined(__TURBOC__) || defined(__EMX__) || defined(__DJGPP__) || \ |
|
19 defined(__CYGWIN32__) || defined(__MINGW32__) || \ |
|
20 defined(__WATCOMC__) || defined(__PACIFIC__) |
|
21 # ifndef HAVE_VSSCANF |
|
22 # define HAVE_VSSCANF /* have vsscanf() */ |
|
23 # endif |
|
24 #endif |
|
25 |
|
26 #if defined(__CYGWIN32__) || defined(__MINGW32__) || \ |
|
27 defined(__LCC__) || defined(__WATCOMC__) |
|
28 # ifndef HAVE_VSNPRINTF |
|
29 # define HAVE_VSNPRINTF /* have vsnprintf() */ |
|
30 # endif |
|
31 #endif |
|
32 |
|
33 #if defined(_MSC_VER) && defined(_WIN32) && !defined(_CRT_SECURE_NO_DEPRECATE) |
|
34 # define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */ |
|
35 #endif |
|
36 |
|
37 /*----------------------------------------------------------------------*/ |
|
38 |
|
39 typedef struct /* structure for ripped off lines */ |
|
40 { |
|
41 int line; |
|
42 int (*init)(WINDOW *, int); |
|
43 } RIPPEDOFFLINE; |
|
44 |
|
45 /* Window properties */ |
|
46 |
|
47 #define _SUBWIN 0x01 /* window is a subwindow */ |
|
48 #define _PAD 0x10 /* X/Open Pad. */ |
|
49 #define _SUBPAD 0x20 /* X/Open subpad. */ |
|
50 |
|
51 /* Miscellaneous */ |
|
52 |
|
53 #define _NO_CHANGE -1 /* flags line edge unchanged */ |
|
54 |
|
55 #define _ECHAR 0x08 /* Erase char (^H) */ |
|
56 #define _DWCHAR 0x17 /* Delete Word char (^W) */ |
|
57 #define _DLCHAR 0x15 /* Delete Line char (^U) */ |
|
58 |
|
59 extern WINDOW *pdc_lastscr; |
|
60 extern bool pdc_trace_on; /* tracing flag */ |
|
61 extern bool pdc_color_started; |
|
62 extern unsigned long pdc_key_modifiers; |
|
63 extern MOUSE_STATUS pdc_mouse_status; |
|
64 |
|
65 /*----------------------------------------------------------------------*/ |
|
66 |
|
67 /* Platform implementation functions */ |
|
68 |
|
69 void PDC_beep(void); |
|
70 bool PDC_can_change_color(void); |
|
71 int PDC_color_content(short, short *, short *, short *); |
|
72 bool PDC_check_key(void); |
|
73 int PDC_curs_set(int); |
|
74 void PDC_flushinp(void); |
|
75 int PDC_get_columns(void); |
|
76 int PDC_get_cursor_mode(void); |
|
77 int PDC_get_key(void); |
|
78 int PDC_get_rows(void); |
|
79 void PDC_gotoyx(int, int); |
|
80 int PDC_init_color(short, short, short, short); |
|
81 void PDC_init_pair(short, short, short); |
|
82 int PDC_modifiers_set(void); |
|
83 int PDC_mouse_set(void); |
|
84 void PDC_napms(int); |
|
85 int PDC_pair_content(short, short *, short *); |
|
86 void PDC_reset_prog_mode(void); |
|
87 void PDC_reset_shell_mode(void); |
|
88 int PDC_resize_screen(int, int); |
|
89 void PDC_restore_screen_mode(int); |
|
90 void PDC_save_screen_mode(int); |
|
91 void PDC_scr_close(void); |
|
92 void PDC_scr_free(void); |
|
93 int PDC_scr_open(int, char **); |
|
94 void PDC_set_keyboard_binary(bool); |
|
95 void PDC_transform_line(int, int, int, const chtype *); |
|
96 const char *PDC_sysname(void); |
|
97 |
|
98 /* Internal cross-module functions */ |
|
99 |
|
100 void PDC_init_atrtab(void); |
|
101 WINDOW *PDC_makelines(WINDOW *); |
|
102 WINDOW *PDC_makenew(int, int, int, int); |
|
103 int PDC_mouse_in_slk(int, int); |
|
104 void PDC_slk_free(void); |
|
105 void PDC_slk_initialize(void); |
|
106 void PDC_sync(WINDOW *); |
|
107 |
|
108 #ifdef PDC_WIDE |
|
109 int PDC_mbtowc(wchar_t *, const char *, size_t); |
|
110 size_t PDC_mbstowcs(wchar_t *, const char *, size_t); |
|
111 size_t PDC_wcstombs(char *, const wchar_t *, size_t); |
|
112 #endif |
|
113 |
|
114 #ifdef PDCDEBUG |
|
115 # define PDC_LOG(x) if (pdc_trace_on) PDC_debug x |
|
116 # define RCSID(x) static const char *rcsid = x; |
|
117 #else |
|
118 # define PDC_LOG(x) |
|
119 # define RCSID(x) |
|
120 #endif |
|
121 |
|
122 /* Internal macros for attributes */ |
|
123 |
|
124 #ifdef CHTYPE_LONG |
|
125 # define PDC_COLOR_PAIRS 256 |
|
126 #else |
|
127 # define PDC_COLOR_PAIRS 32 |
|
128 #endif |
|
129 |
|
130 #ifndef max |
|
131 # define max(a,b) (((a) > (b)) ? (a) : (b)) |
|
132 #endif |
|
133 #ifndef min |
|
134 # define min(a,b) (((a) < (b)) ? (a) : (b)) |
|
135 #endif |
|
136 |
|
137 #define DIVROUND(num, divisor) ((num) + ((divisor) >> 1)) / (divisor) |
|
138 |
|
139 #define PDC_CLICK_PERIOD 150 /* time to wait for a click, if |
|
140 not set by mouseinterval() */ |
|
141 |
|
142 #endif /* __CURSES_INTERNALS__*/ |