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 /* Gets the current terminal size, returns TRUE if ok. */
34 int term_get_size(int *width, int *height);
36 /* Resize terminal - if width or height is negative,
37 the new size is unknown and should be figured out somehow */
38 void term_resize(int width, int height);
39 void term_resize_final(int width, int height);
40 /* Resize the terminal if needed */
41 void term_resize_dirty(void);
43 /* Returns TRUE if terminal has colors */
44 int term_has_colors(void);
45 /* Force the colors on any way you can */
46 void term_force_colors(int set);
49 void term_clear(void);
53 /* Create a new window in terminal */
54 TERM_WINDOW *term_window_create(int x, int y, int width, int height);
55 /* Destroy a terminal window */
56 void term_window_destroy(TERM_WINDOW *window);
58 /* Move/resize window */
59 void term_window_move(TERM_WINDOW *window, int x, int y,
60 int width, int height);
62 void term_window_clear(TERM_WINDOW *window);
63 /* Scroll window up/down */
64 void term_window_scroll(TERM_WINDOW *window, int count);
66 void term_set_color(TERM_WINDOW *window, int col);
68 void term_move(TERM_WINDOW *window, int x, int y);
69 void term_addch(TERM_WINDOW *window, int chr);
70 void term_add_unichar(TERM_WINDOW *window, unichar chr);
71 void term_addstr(TERM_WINDOW *window, const char *str);
72 void term_clrtoeol(TERM_WINDOW *window);
74 void term_move_cursor(int x, int y);
76 void term_refresh_freeze(void);
77 void term_refresh_thaw(void);
78 void term_refresh(TERM_WINDOW *window);
80 /* Automatically detach irssi when terminal is lost */
81 void term_auto_detach(int set);
82 void term_detach(void);
83 void term_attach(FILE *in, FILE *out);
87 /* keyboard input handling */
88 void term_set_input_type(int type);
89 int term_gets(unichar *buffer, int size);
92 void term_common_init(void);
93 void term_common_deinit(void);