4 typedef struct _TERM_WINDOW TERM_WINDOW;
7 #define ATTR_RESETFG 0x0100
8 #define ATTR_RESETBG 0x0200
9 #define ATTR_BOLD 0x0400
10 #define ATTR_BLINK 0x0800
11 #define ATTR_UNDERLINE 0x1000
12 #define ATTR_REVERSE 0x2000
14 #define ATTR_RESET (ATTR_RESETFG|ATTR_RESETBG)
16 #define ATTR_NOCOLORS (ATTR_UNDERLINE|ATTR_REVERSE)
19 #define TERM_TYPE_8BIT 0 /* normal 8bit text */
20 #define TERM_TYPE_UTF8 1
21 #define TERM_TYPE_BIG5 2
23 typedef guint32 unichar;
25 extern TERM_WINDOW *root_window;
26 extern int term_width, term_height;
27 extern int term_use_colors, term_type, term_detached;
29 /* Initialize / deinitialize terminal */
31 void term_deinit(void);
33 /* Resize terminal - if width or height is negative,
34 the new size is unknown and should be figured out somehow */
35 void term_resize(int width, int height);
36 void term_resize_final(int width, int height);
37 /* Resize the terminal if needed */
38 void term_resize_dirty(void);
40 /* Returns TRUE if terminal has colors */
41 int term_has_colors(void);
42 /* Force the colors on any way you can */
43 void term_force_colors(int set);
46 void term_clear(void);
50 /* Create a new window in terminal */
51 TERM_WINDOW *term_window_create(int x, int y, int width, int height);
52 /* Destroy a terminal window */
53 void term_window_destroy(TERM_WINDOW *window);
55 /* Move/resize window */
56 void term_window_move(TERM_WINDOW *window, int x, int y,
57 int width, int height);
59 void term_window_clear(TERM_WINDOW *window);
60 /* Scroll window up/down */
61 void term_window_scroll(TERM_WINDOW *window, int count);
63 void term_set_color(TERM_WINDOW *window, int col);
65 void term_move(TERM_WINDOW *window, int x, int y);
66 void term_addch(TERM_WINDOW *window, int chr);
67 void term_add_unichar(TERM_WINDOW *window, unichar chr);
68 void term_addstr(TERM_WINDOW *window, const char *str);
69 void term_clrtoeol(TERM_WINDOW *window);
71 void term_move_cursor(int x, int y);
73 void term_refresh_freeze(void);
74 void term_refresh_thaw(void);
75 void term_refresh(TERM_WINDOW *window);
77 /* Automatically detach irssi when terminal is lost */
78 void term_auto_detach(int set);
79 void term_detach(void);
80 void term_attach(FILE *in, FILE *out);
84 /* keyboard input handling */
85 void term_set_input_type(int type);
86 int term_gets(unichar *buffer, int size);
89 void term_common_init(void);
90 void term_common_deinit(void);