chiark / gitweb /
Imported Debian patch 1.0.0-6
[e16] / src / container.h
1 /*
2  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
3  * Copyright (C) 2004-2008 Kim Woelders
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to
7  * deal in the Software without restriction, including without limitation the
8  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9  * sell copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies of the Software, its documentation and marketing & publicity
14  * materials, and acknowledgment shall be given in the documentation, materials
15  * and software packages that this Software was used.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20  * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _CONTAINER_H_
25 #define _CONTAINER_H_
26
27 #include <X11/Xlib.h>
28 #include "eimage.h"
29
30 typedef struct _container Container;
31
32 typedef struct {
33    unsigned int        anim_time;       /* Animation run time  (ms) */
34 } ContainerCfg;
35
36 typedef struct {
37    void               *obj;
38    int                 xo, yo, wo, ho;  /* Outer */
39    int                 xi, yi, wi, hi;  /* Inner */
40    EImage             *im;
41 } ContainerObject;
42
43 typedef struct {
44    void                (*Init) (Container * ct);
45    void                (*Exit) (Container * ct, int wm_exit);
46    void                (*Signal) (Container * ct, int signal, void *prm);
47    void                (*Event) (Container * ct, XEvent * ev);
48    void                (*ObjSizeCalc) (Container * ct, ContainerObject * cto);
49    void                (*ObjPlace) (Container * ct, ContainerObject * cto,
50                                     EImage * im);
51 } ContainerOps;
52
53 struct _container {
54    const ContainerOps *ops;
55    const char         *wm_name;
56    const char         *menu_title;
57    const char         *dlg_title;
58
59    /* user settings */
60    char               *name;
61    char                type;
62    char                orientation;
63    char                scrollbar_side;
64    char                arrow_side;
65    char                nobg;
66    int                 iconsize;
67    char                auto_resize;
68    char                draw_icon_base;
69    char                scrollbar_hide;
70    char                cover_hide;
71    int                 auto_resize_anchor;
72    /* Iconbox specific */
73    char                shownames;
74    int                 anim_mode;
75    int                 icon_mode;
76
77    /* internally set stuff */
78    EWin               *ewin;
79    int                 w, h;
80    int                 pos;
81    int                 max, max_min;
82    ImageClass         *ic_box;
83    ImageClass         *ic_item_base;
84    EImage             *im_item_base;
85
86    char                arrow1_hilited;
87    char                arrow1_clicked;
88    char                arrow2_hilited;
89    char                arrow2_clicked;
90    char                icon_clicked;
91    char                scrollbar_hilited;
92    char                scrollbar_clicked;
93    char                scrollbox_clicked;
94
95    Win                 win;
96    Win                 cover_win;
97    Win                 icon_win;
98    Win                 scroll_win;
99    Win                 arrow1_win;
100    Win                 arrow2_win;
101    Win                 scrollbar_win;
102    Win                 scrollbarknob_win;
103
104    int                 num_objs;
105    ContainerObject    *objs;
106
107    /* these are theme-settable parameters */
108    int                 scroll_thickness;
109    int                 arrow_thickness;
110    int                 bar_thickness;
111    int                 knob_length;
112
113    /* State flags */
114    char                do_update;
115 };
116
117 extern ContainerCfg Conf_containers;
118
119 void                ContainerRedraw(Container * ct);
120
121 typedef int         (ContainerIterator) (Container * ct, void *data);
122 Container          *ContainersIterate(ContainerIterator * cti, int type,
123                                       void *data);
124 Container         **ContainersGetList(int *pnum);
125
126 int                 ContainerObjectAdd(Container * ct, void *obj);
127 int                 ContainerObjectDel(Container * ct, void *obj);
128 int                 ContainerObjectFind(Container * ct, void *obj);
129 void               *ContainerObjectFindByXY(Container * ct, int x, int y);
130
131 /* Here? */
132 #define IB_TYPE_ICONBOX     0
133 #define IB_TYPE_SYSTRAY     1
134
135 #endif /* _CONTAINER_H_ */