1 /*
2  * pwm/winobj.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2001.
5  *
6  * You may distribute and modify this program under the terms of either
7  * the Clarified Artistic License or the GNU GPL, version 2 or later.
8  */
9 
10 #ifndef INCLUDED_WINOBJ_H
11 #define INCLUDED_WINOBJ_H
12 
13 #include "common.h"
14 #include "thing.h"
15 
16 
17 #define WWINOBJ_MAPPED 0x100000
18 #define WWINOBJ_HIDDEN 0x200000
19 
20 #define WORKSPACE_STICKY -2
21 #define WORKSPACE_CURRENT -1
22 #define WORKSPACE_UNKNOWN -1
23 
24 #define WWINOBJ_IS_MAPPED(F) ((F)->flags&WWINOBJ_MAPPED)
25 #define WWINOBJ_IS_HIDDEN(F) ((F)->flags&WWINOBJ_HIDDEN)
26 #define WWINOBJ_IS_STICKY(F) ((F)->workspace==WORKSPACE_STICKY)
27 
28 
29 enum{
30 	LVL_KEEP_ON_BOTTOM=0,
31 	LVL_NORMAL=1,
32 	LVL_KEEP_ON_TOP=2,
33 	LVL_MENU=3,
34 	N_STACK_LVLS=4,
35 	LVL_OTHER=-1 /* used for transients and submenus that are stacked
36 				  * above their "parents"
37 				  */
38 };
39 
40 
41 /* */
42 
43 
44 #define INHERIT_WWINOBJ                         \
45 	INHERIT_WTHING;                             \
46                                                 \
47 	int stack_lvl;                              \
48 	struct _WWinObj *stack_prev, *stack_next;   \
49 	struct _WWinObj *stack_above;               \
50 	struct _WWinObj *stack_above_list;          \
51 	int workspace;                              \
52 	int x, y, w, h
53 
54 
55 /* */
56 
57 
58 typedef struct _WWinObj{
59 	INHERIT_WWINOBJ;
60 } WWinObj;
61 
62 
63 /* */
64 
65 
66 extern void add_winobj(WWinObj *obj, int ws, int init_stack_lvl);
67 extern void add_winobj_above(WWinObj *obj, WWinObj *above);
68 
69 extern void restack_winobj(WWinObj *obj, int stack_lvl, bool raiselower);
70 extern void restack_winobj_above(WWinObj *obj, WWinObj *above, bool raiselower);
71 
72 extern void unlink_winobj_d(WWinObj *obj);
73 
74 extern void raise_winobj(WWinObj *obj);
75 extern void lower_winobj(WWinObj *obj);
76 extern void raiselower_winobj(WWinObj *obj);
77 
78 extern void map_winobj(WWinObj *obj);
79 extern void unmap_winobj(WWinObj *obj);
80 extern void do_map_winobj(WWinObj *obj);
81 extern void do_unmap_winobj(WWinObj *obj);
82 
83 extern WWinObj *traverse_winobjs(WWinObj *current, WWinObj *root);
84 extern WWinObj *traverse_winobjs_b(WWinObj *p, WWinObj *root, WWinObj **next);
85 extern WWinObj *init_traverse_winobjs_b(WWinObj *root, WWinObj **next);
86 
87 extern void set_winobj_pos(WWinObj *obj, int x, int y);
88 extern bool winobj_is_visible(WWinObj *obj);
89 
90 #endif /* INCLUDED_WINOBJ_H */
91 
92