1 /*
2  * pwm/thing.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_THING_H
11 #define INCLUDED_THING_H
12 
13 #include "common.h"
14 
15 #define WTHING_UNKNOWN		0x0000
16 #define	WTHING_SCREEN		0x0100
17 #define WTHING_WORKSPACE	0x0200
18 
19 #define	WTHING_CLIENTWIN	0x0400
20 #define WTHING_DOCKWIN		0x0420
21 
22 #define	WTHING_WINOBJ		0x0800
23 #define	WTHING_FRAME		0x0810
24 #define WTHING_MENU			0x0820
25 #define WTHING_DOCK			0x0840
26 
27 #define WTHING_IS(THING, TYPE) (((THING)->type&(TYPE))==(TYPE))
28 
29 #define WTHING_SUBDEST		0x10000
30 #define WTHING_UNFOCUSABLE 	0x20000
31 #define WTHING_IS_UNFOCUSABLE(F) ((F)->flags&WTHING_UNFOCUSABLE)
32 
33 
34 #define INHERIT_WTHING                     \
35 	int type, flags;                       \
36 	struct _WThing *t_parent, *t_children; \
37  	struct _WThing *t_next, *t_prev
38 
39 #define WTHING_INIT(OBJ, TYPE)         \
40 	(OBJ)->type=(TYPE);                \
41 	(OBJ)->flags=0;                    \
42 	(OBJ)->t_parent=(OBJ)->t_children= \
43 	(OBJ)->t_next=(OBJ)->t_prev=NULL
44 
45 typedef struct _WThing{
46 	INHERIT_WTHING;
47 } WThing;
48 
49 
50 extern void link_thing(WThing *parent, WThing *child);
51 extern void link_thing_before(WThing *before, WThing *child);
52 extern void unlink_thing(WThing *thing);
53 extern void destroy_subthings(WThing *thing);
54 extern void destroy_thing(WThing *thing);
55 extern void free_thing(WThing *thing);
56 
57 WThing *next_thing(WThing *first, int filt);
58 WThing *prev_thing(WThing *first, int filt);
59 WThing *subthing(WThing *parent, int filt);
60 
61 struct _WClientWin *next_clientwin(struct _WClientWin *first);
62 struct _WClientWin *prev_clientwin(struct _WClientWin *first);
63 struct _WClientWin *first_clientwin(WThing *parent);
64 
65 extern struct _WThing *nth_thing(WThing *first, int num);
66 extern struct _WThing *nth_subthing(WThing *parent, int num);
67 
68 extern struct _WThing *find_thing(Window win);
69 extern struct _WThing *find_thing_t(Window win, int type);
70 extern struct _WFrame *find_frame_of(Window win);
71 extern struct _WWinObj *find_winobj_of(Window win);
72 extern struct _WClientWin *find_clientwin(Window win);
73 extern struct _WWinObj *winobj_of(WThing *thing);
74 
75 #endif /* INCLUDED_THING_H */
76