addition of silc.css
[crypto.git] / apps / irssi / src / fe-common / core / fe-windows.h
1 #ifndef __WINDOWS_H
2 #define __WINDOWS_H
3
4 #include "servers.h"
5
6 #define STRUCT_SERVER_REC SERVER_REC
7 #include "window-item-def.h"
8
9 enum {
10         DATA_LEVEL_NONE = 0,
11         DATA_LEVEL_TEXT,
12         DATA_LEVEL_MSG,
13         DATA_LEVEL_HILIGHT
14 };
15
16 typedef struct {
17         char *servertag;
18         char *name;
19         unsigned int sticky:1;
20 } WINDOW_BIND_REC;
21
22 typedef struct {
23         int refnum;
24         char *name;
25
26         int width, height;
27
28         GSList *items;
29         WI_ITEM_REC *active;
30         SERVER_REC *active_server;
31         char *servertag; /* active_server must be either NULL or have this tag (unless there's items in this window) */
32
33         int level; /* message level */
34         GSList *bound_items; /* list of WINDOW_BIND_RECs */
35
36         unsigned int sticky_refnum:1;
37         unsigned int destroying:1;
38
39         /* window-specific command line history */
40         GList *history, *history_pos;
41         int history_lines, history_over_counter;
42
43         int data_level; /* current data level */
44         char *hilight_color; /* current hilight color in %format */
45
46         time_t last_timestamp; /* When was last timestamp printed */
47         time_t last_line; /* When was last line printed */
48
49         char *theme_name; /* active theme in window, NULL = default */
50         void *theme; /* THEME_REC */
51
52         void *gui_data;
53 } WINDOW_REC;
54
55 extern GSList *windows;
56 extern WINDOW_REC *active_win;
57
58 WINDOW_REC *window_create(WI_ITEM_REC *item, int automatic);
59 void window_destroy(WINDOW_REC *window);
60
61 void window_auto_destroy(WINDOW_REC *window);
62
63 void window_set_active(WINDOW_REC *window);
64 void window_change_server(WINDOW_REC *window, void *server);
65
66 void window_set_refnum(WINDOW_REC *window, int refnum);
67 void window_set_name(WINDOW_REC *window, const char *name);
68 void window_set_level(WINDOW_REC *window, int level);
69
70 /* return active item's name, or if none is active, window's name */
71 char *window_get_active_name(WINDOW_REC *window);
72
73 WINDOW_REC *window_find_level(void *server, int level);
74 WINDOW_REC *window_find_closest(void *server, const char *name, int level);
75 WINDOW_REC *window_find_refnum(int refnum);
76 WINDOW_REC *window_find_name(const char *name);
77 WINDOW_REC *window_find_item(SERVER_REC *server, const char *name);
78
79 int window_refnum_prev(int refnum, int wrap);
80 int window_refnum_next(int refnum, int wrap);
81 int windows_refnum_last(void);
82
83 GSList *windows_get_sorted(void);
84
85 WINDOW_BIND_REC *window_bind_add(WINDOW_REC *window, const char *servertag,
86                                  const char *name);
87 void window_bind_destroy(WINDOW_REC *window, WINDOW_BIND_REC *rec);
88
89 WINDOW_BIND_REC *window_bind_find(WINDOW_REC *window, const char *servertag,
90                                   const char *name);
91 void window_bind_remove_unsticky(WINDOW_REC *window);
92
93 void windows_init(void);
94 void windows_deinit(void);
95
96 #endif