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