imported irssi.
[silc.git] / apps / irssi / src / fe-text / statusbar.h
1 #ifndef __STATUSBAR_H
2 #define __STATUSBAR_H
3
4 #include "mainwindows.h"
5
6 #define SBAR_PRIORITY_HIGH      100
7 #define SBAR_PRIORITY_NORMAL    0
8 #define SBAR_PRIORITY_LOW       -100
9
10 enum {
11         STATUSBAR_POS_UP,
12         STATUSBAR_POS_MIDDLE,
13         STATUSBAR_POS_DOWN
14 };
15
16 typedef struct SBAR_ITEM_REC SBAR_ITEM_REC;
17 typedef void (*STATUSBAR_FUNC) (SBAR_ITEM_REC *item, int get_size_only);
18
19 typedef struct {
20         MAIN_WINDOW_REC *window;
21
22         int pos;
23         int line;
24
25         char *color_string;
26         int color;
27
28         int ypos; /* real position in screen at the moment */
29         GSList *items;
30 } STATUSBAR_REC;
31
32 struct SBAR_ITEM_REC {
33         STATUSBAR_REC *bar;
34         STATUSBAR_FUNC func;
35
36         /* what item wants */
37         int priority;
38         int min_size, max_size;
39         unsigned int right_justify:1;
40
41         /* what item gets */
42         int xpos, size;
43 };
44
45 /* ypos is used only when pos == STATUSBAR_POS_MIDDLE */
46 STATUSBAR_REC *statusbar_create(int pos, int ypos);
47 void statusbar_destroy(STATUSBAR_REC *bar);
48
49 STATUSBAR_REC *statusbar_find(int pos, int line);
50
51 SBAR_ITEM_REC *statusbar_item_create(STATUSBAR_REC *bar,
52                                      int priority, int right_justify,
53                                      STATUSBAR_FUNC func);
54 void statusbar_item_remove(SBAR_ITEM_REC *item);
55
56 /* redraw statusbar, NULL = all */
57 void statusbar_redraw(STATUSBAR_REC *bar);
58 void statusbar_item_redraw(SBAR_ITEM_REC *item);
59
60 void statusbar_init(void);
61 void statusbar_deinit(void);
62
63 #endif