4 typedef struct _TERM_WINDOW TERM_WINDOW;
6 #define ATTR_RESETFG 0x0100
7 #define ATTR_RESETBG 0x0200
8 #define ATTR_BOLD 0x0400
9 #define ATTR_BLINK 0x0800
10 #define ATTR_UNDERLINE 0x1000
11 #define ATTR_REVERSE 0x2000
13 #define ATTR_RESET (ATTR_RESETFG|ATTR_RESETBG)
15 #define ATTR_NOCOLORS (ATTR_UNDERLINE|ATTR_REVERSE)
18 /* XXX I didn't check the encoding range of big5+. This is standard big5. */
19 # define is_big5_los(lo) (((char)0x40<=lo)&&(lo<=(char)0x7E)) /* standard */
20 # define is_big5_lox(lo) (((char)0x80<=lo)&&(lo<=(char)0xFE)) /* extended */
21 # define is_big5_hi(hi) (((char)0x81<=hi)&&(hi<=(char)0xFE))
22 # define is_big5(hi,lo) is_big5_hi(hi) && (is_big5_los(lo) || is_big5_lox(lo))
25 extern TERM_WINDOW *root_window;
26 extern int term_width, term_height, term_use_colors, term_detached;
28 /* Initialize / deinitialize terminal */
30 void term_deinit(void);
32 /* Resize terminal - if width or height is negative,
33 the new size is unknown and should be figured out somehow */
34 void term_resize(int width, int height);
35 void term_resize_final(int width, int height);
36 /* Resize the terminal if needed */
37 void term_resize_dirty(void);
39 /* Returns TRUE if terminal has colors */
40 int term_has_colors(void);
41 /* Force the colors on any way you can */
42 void term_force_colors(int set);
45 void term_clear(void);
49 /* Create a new window in terminal */
50 TERM_WINDOW *term_window_create(int x, int y, int width, int height);
51 /* Destroy a terminal window */
52 void term_window_destroy(TERM_WINDOW *window);
54 /* Move/resize window */
55 void term_window_move(TERM_WINDOW *window, int x, int y,
56 int width, int height);
58 void term_window_clear(TERM_WINDOW *window);
59 /* Scroll window up/down */
60 void term_window_scroll(TERM_WINDOW *window, int count);
62 void term_set_color(TERM_WINDOW *window, int col);
64 void term_move(TERM_WINDOW *window, int x, int y);
65 void term_addch(TERM_WINDOW *window, int chr);
66 void term_addstr(TERM_WINDOW *window, const char *str);
67 void term_clrtoeol(TERM_WINDOW *window);
69 void term_move_cursor(int x, int y);
71 void term_refresh_freeze(void);
72 void term_refresh_thaw(void);
73 void term_refresh(TERM_WINDOW *window);
75 /* Automatically detach irssi when terminal is lost */
76 void term_auto_detach(int set);
77 void term_detach(void);
78 void term_attach(FILE *in, FILE *out);
81 int term_gets(unsigned char *buffer, int size);
84 void term_common_init(void);
85 void term_common_deinit(void);