]> git.decadent.org.uk Git - ion3.git/blob - mod_statusbar/statusbar.h
9d335886495c950cc004a4d8e76ef4f911247346
[ion3.git] / mod_statusbar / statusbar.h
1 /*
2  * ion/mod_statusbar/statusbar.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2008. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9 #ifndef ION_MOD_STATUSBAR_STATUSBAR_H
10 #define ION_MOD_STATUSBAR_STATUSBAR_H
11
12 #include <libtu/ptrlist.h>
13 #include <libextl/extl.h>
14 #include <ioncore/common.h>
15 #include <ioncore/gr.h>
16 #include <ioncore/manage.h>
17 #include <ioncore/sizehint.h>
18
19
20 #define STATUSBAR_NX_STR "?"
21
22
23 typedef enum{
24     WSBELEM_ALIGN_LEFT=0,
25     WSBELEM_ALIGN_CENTER=1,
26     WSBELEM_ALIGN_RIGHT=2
27 } WSBElemAlign;
28
29
30 typedef enum{
31     WSBELEM_NONE=0,
32     WSBELEM_TEXT=1,
33     WSBELEM_METER=2,
34     WSBELEM_STRETCH=3,
35     WSBELEM_FILLER=4,
36     WSBELEM_SYSTRAY=5
37 } WSBElemType;
38   
39
40 INTRSTRUCT(WSBElem);
41
42 DECLSTRUCT(WSBElem){
43     int type;
44     int align;
45     int stretch;
46     int text_w;
47     char *text;
48     int max_w;
49     char *tmpl;
50     StringId meter;
51     StringId attr;
52     int zeropad;
53     int x;
54     PtrList *traywins;
55 };
56
57 INTRCLASS(WStatusBar);
58
59 DECLCLASS(WStatusBar){
60     WWindow wwin;
61     GrBrush *brush;
62     WSBElem *elems;
63     int nelems;
64     int natural_w, natural_h;
65     int filleridx;
66     WStatusBar *sb_next, *sb_prev;
67     PtrList *traywins;
68     bool systray_enabled;
69 };
70
71 extern bool statusbar_init(WStatusBar *p, WWindow *parent, 
72                            const WFitParams *fp);
73 extern WStatusBar *create_statusbar(WWindow *parent, const WFitParams *fp);
74 extern void statusbar_deinit(WStatusBar *p);
75
76 extern WRegion *statusbar_load(WWindow *par, const WFitParams *fp, 
77                                ExtlTab tab);
78
79 extern void statusbar_set_natural_w(WStatusBar *p, const char *str);
80 extern void statusbar_size_hints(WStatusBar *p, WSizeHints *h);
81 extern void statusbar_updategr(WStatusBar *p);
82 extern void statusbar_set_contents(WStatusBar *sb, ExtlTab t);
83
84 extern void statusbar_set_template(WStatusBar *sb, const char *tmpl);
85 extern void statusbar_set_template_table(WStatusBar *sb, ExtlTab t);
86 extern ExtlTab statusbar_get_template_table(WStatusBar *sb);
87
88 extern WStatusBar *mod_statusbar_find_suitable(WClientWin *cwin,
89                                                const WManageParams *param);
90
91 #endif /* ION_MOD_STATUSBAR_STATUSBAR_H */