Merge branch '132_search_skip_hidden'
[midnight-commander.git] / src / myslang.h
bloba8c8b42b8ca30573c185f8a2be93db4ec7ee80e6
1 #ifndef MC_MYSLANG_H
2 #define MC_MYSLANG_H
4 #ifdef HAVE_SLANG_SLANG_H
5 # include <slang/slang.h>
6 #else
7 # include <slang.h>
8 #endif /* HAVE_SLANG_SLANG_H */
10 enum {
11 KEY_BACKSPACE = 400,
12 KEY_END, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT,
13 KEY_HOME, KEY_A1, KEY_C1, KEY_NPAGE, KEY_PPAGE, KEY_IC,
14 KEY_ENTER, KEY_DC, KEY_SCANCEL, KEY_BTAB
17 #define KEY_F(x) (1000+x)
19 #define ACS_VLINE SLSMG_VLINE_CHAR
20 #define ACS_HLINE SLSMG_HLINE_CHAR
21 #define ACS_ULCORNER SLSMG_ULCORN_CHAR
22 #define ACS_LLCORNER SLSMG_LLCORN_CHAR
23 #define ACS_URCORNER SLSMG_URCORN_CHAR
24 #define ACS_LRCORNER SLSMG_LRCORN_CHAR
26 #define ACS_LTEE 't'
27 #define acs() SLsmg_set_char_set(1)
28 #define noacs() SLsmg_set_char_set (0)
29 #define baudrate() SLang_TT_Baud_Rate
31 enum {
32 COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE,
33 COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE
36 /* When using Slang with color, we have all the indexes free but
37 * those defined here (A_BOLD, A_UNDERLINE, A_REVERSE, A_BOLD_REVERSE)
39 #define A_BOLD 0x40
40 #define A_UNDERLINE 0x40
41 #define A_REVERSE 0x20
42 #define A_BOLD_REVERSE 0x21
44 #ifndef A_NORMAL
45 # define A_NORMAL 0x00
46 #endif
48 #define COLOR_PAIR(x) x
50 #ifndef TRUE
51 # define TRUE 1
52 # define FALSE 0
53 #endif
55 void slang_set_raw_mode (void);
57 #define doupdate()
58 #define raw() slang_set_raw_mode()
59 #define noraw()
60 #define nodelay(x,val) set_slang_delay(val)
61 #define noecho()
62 #define beep() SLtt_beep ()
63 #define keypad(scr,value) slang_keypad (value)
65 #define ungetch(x) SLang_ungetkey(x)
66 #define start_color()
67 #define touchwin(x) SLsmg_touch_lines(0, LINES)
68 #define reset_shell_mode() slang_shell_mode()
69 #define reset_prog_mode() slang_prog_mode()
70 #define flushinp()
72 void slint_goto (int y, int x);
73 void attrset (int color);
74 void set_slang_delay (int);
75 void slang_init (void);
76 void slang_prog_mode (void);
77 void hline (int ch, int len);
78 void vline (int ch, int len);
79 int getch (void);
80 void slang_keypad (int set);
81 void slang_shell_mode (void);
82 void slang_shutdown (void);
83 int has_colors (void);
85 #define move(x, y) SLsmg_gotorc(x, y)
86 #define getyx(stdscr, row, col) \
87 do { \
88 row = SLsmg_get_row(); \
89 col = SLsmg_get_column(); \
90 } while (0)
91 #define printw SLsmg_printf
92 #define COLS SLtt_Screen_Cols
93 #define LINES SLtt_Screen_Rows
94 #define standend() SLsmg_normal_video()
96 #ifdef UTF8
98 * Patched S-Lang in Red Hat 8.0 expects wchar_t as the argument to addch()
99 * Avoid conversion by using SLsmg_write_nchars(), which takes char*
101 #undef addch
102 static inline void
103 mc_addch (char c)
105 SLsmg_write_nchars (&c, 1);
107 #define addch(c) mc_addch(c)
108 #else
109 #define addch(c) SLsmg_write_char(c)
110 #endif
112 #define addstr(s) SLsmg_write_string(str_unconst(s))
113 #define refresh() SLsmg_refresh()
114 #define endwin() SLsmg_reset_smg()
116 #define SLsmg_draw_double_box(r,c,dr,dc) SLsmg_draw_box ((r), (c), (dr), (dc))
118 #endif