Added SILC Thread Queue API
[crypto.git] / apps / irssi / src / fe-text / term.h
1 #ifndef __TERM_H
2 #define __TERM_H
3
4 typedef struct _TERM_WINDOW TERM_WINDOW;
5
6 /* text attributes */
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
13
14 #define ATTR_RESET      (ATTR_RESETFG|ATTR_RESETBG)
15
16 #define ATTR_NOCOLORS (ATTR_UNDERLINE|ATTR_REVERSE)
17
18 /* terminal types */
19 #define TERM_TYPE_8BIT          0 /* normal 8bit text */
20 #define TERM_TYPE_UTF8          1
21 #define TERM_TYPE_BIG5          2
22
23 typedef guint32 unichar;
24
25 extern TERM_WINDOW *root_window;
26 extern int term_width, term_height;
27 extern int term_use_colors, term_type, term_detached;
28
29 /* Initialize / deinitialize terminal */
30 int term_init(void);
31 void term_deinit(void);
32
33 /* Gets the current terminal size, returns TRUE if ok. */
34 int term_get_size(int *width, int *height);
35
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);
42
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);
47
48 /* Clear screen */
49 void term_clear(void);
50 /* Beep */
51 void term_beep(void);
52
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);
57
58 /* Move/resize window */
59 void term_window_move(TERM_WINDOW *window, int x, int y,
60                       int width, int height);
61 /* Clear window */
62 void term_window_clear(TERM_WINDOW *window);
63 /* Scroll window up/down */
64 void term_window_scroll(TERM_WINDOW *window, int count);
65
66 void term_set_color(TERM_WINDOW *window, int col);
67
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);
73
74 void term_move_cursor(int x, int y);
75
76 void term_refresh_freeze(void);
77 void term_refresh_thaw(void);
78 void term_refresh(TERM_WINDOW *window);
79
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);
84
85 void term_stop(void);
86
87 /* keyboard input handling */
88 void term_set_input_type(int type);
89 int term_gets(unichar *buffer, int size);
90
91 /* internal */
92 void term_common_init(void);
93 void term_common_deinit(void);
94
95 #endif