]> git.decadent.org.uk Git - ion3.git/blob - mod_tiling/tiling.h
Imported Upstream version 20090110
[ion3.git] / mod_tiling / tiling.h
1 /*
2  * ion/mod_tiling/tiling.h
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2009. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9 #ifndef ION_MOD_TILING_TILING_H
10 #define ION_MOD_TILING_TILING_H
11
12 #include <libtu/ptrlist.h>
13 #include <libextl/extl.h>
14 #include <ioncore/common.h>
15 #include <ioncore/region.h>
16 #include <ioncore/screen.h>
17 #include <ioncore/rectangle.h>
18 #include <ioncore/pholder.h>
19 #include <ioncore/navi.h>
20 #include <ioncore/manage.h>
21 #include "split.h"
22
23
24 INTRCLASS(WTiling);
25 DECLCLASS(WTiling){
26     WRegion reg;
27     WSplit *split_tree;
28     WSplitST *stdispnode;
29     PtrList *managed_list;
30     WRegionSimpleCreateFn *create_frame_fn;
31     Window dummywin;
32     bool batchop;
33 };
34
35
36 extern bool tiling_init(WTiling *ws, WWindow *parent, const WFitParams *fp,
37                        WRegionSimpleCreateFn *create_frame_fn, bool ci);
38 extern WTiling *create_tiling(WWindow *parent, const WFitParams *fp, 
39                             WRegionSimpleCreateFn *create_frame_fn, bool ci);
40 extern WTiling *create_tiling_simple(WWindow *parent, const WFitParams *fp);
41 extern void tiling_deinit(WTiling *ws);
42
43 extern bool tiling_do_attach_initial(WTiling *tiling, WRegion *reg);
44
45 extern ExtlTab tiling_resize_tree(WTiling *ws, WSplit *node, ExtlTab g);
46
47 extern WRegion *tiling_current(WTiling *ws);
48 extern WRegion *tiling_nextto(WTiling *ws, WRegion *reg, const char *str, bool any);
49 extern WRegion *tiling_farthest(WTiling *ws, const char *str, bool any);
50 extern WRegion *tiling_region_at(WTiling *ws, int x, int y);
51
52 extern WFrame *tiling_split_top(WTiling *ws, const char *dirstr);
53 extern WFrame *tiling_split_at(WTiling *ws, WFrame *frame, 
54                               const char *dirstr, bool attach_current);
55 extern void tiling_unsplit_at(WTiling *ws, WRegion *reg);
56
57 extern WSplitSplit *tiling_set_floating(WTiling *ws, WSplitSplit *split, 
58                                        int sp);
59
60 extern WSplit *tiling_split_tree(WTiling *ws);
61 extern WSplit *tiling_split_of(WTiling *ws, WRegion *reg);
62
63 extern void tiling_do_managed_remove(WTiling *ws, WRegion *reg);
64
65 DYNFUN bool tiling_managed_add(WTiling *ws, WRegion *reg);
66 extern bool tiling_managed_add_default(WTiling *ws, WRegion *reg);
67
68 extern WRegion *tiling_do_navi_next(WTiling *ws, WRegion *reg, 
69                                     WRegionNavi nh, bool nowrap,
70                                     bool any);
71 extern WRegion *tiling_do_navi_first(WTiling *ws, WRegionNavi nh, 
72                                      bool any);
73 extern WRegion *tiling_navi_next(WTiling *ws, WRegion *reg, 
74                                  WRegionNavi nh, WRegionNaviData *data);
75 extern WRegion *tiling_navi_first(WTiling *ws, WRegionNavi nh,
76                                   WRegionNaviData *data);
77
78 /* Inherited dynfun implementations */
79
80 extern bool tiling_fitrep(WTiling *ws, WWindow *par, const WFitParams *fp);
81 extern void tiling_map(WTiling *ws);
82 extern void tiling_unmap(WTiling *ws);
83 extern ExtlTab tiling_get_configuration(WTiling *ws);
84 extern void tiling_managed_rqgeom(WTiling *ws, WRegion *reg,
85                                   const WRQGeomParams *rq,
86                                   WRectangle *geomret);
87 extern void tiling_managed_remove(WTiling *ws, WRegion *reg);
88 extern bool tiling_rescue_clientwins(WTiling *ws, WRescueInfo *ph);
89 extern WPHolder *tiling_get_rescue_pholder_for(WTiling *ws, WRegion *mgd);
90 extern void tiling_do_set_focus(WTiling *ws, bool warp);
91 extern bool tiling_managed_prepare_focus(WTiling *ws, WRegion *reg, 
92                                         int flags, WPrepareFocusResult *res);
93 extern void tiling_manage_stdisp(WTiling *ws, WRegion *stdisp, 
94                                 const WMPlexSTDispInfo *di);
95 extern void tiling_unmanage_stdisp(WTiling *ws, bool permanent, bool nofocus);
96
97 extern void tiling_fallback_focus(WTiling *ws, bool warp);
98
99 /* Loading */
100
101 /* Stupid C can't handle recursive 'WSplitLoadFn *fn' here, so we have
102  * to use the void pointer.
103  */
104 typedef WSplit *WSplitLoadFn(WTiling *ws, const WRectangle *geom, ExtlTab tab);
105
106 extern WRegion *tiling_load(WWindow *par, const WFitParams *fp, ExtlTab tab);
107
108 DYNFUN WSplit *tiling_load_node(WTiling *ws, const WRectangle *geom, ExtlTab tab);
109 extern WSplit *tiling_load_node_default(WTiling *ws, const WRectangle *geom, ExtlTab tab);
110
111 extern WSplit *load_splitregion(WTiling *ws, const WRectangle *geom, ExtlTab tab);
112 extern WSplit *load_splitsplit(WTiling *ws, const WRectangle *geom, ExtlTab tab);
113 extern WSplit *load_splitst(WTiling *ws, const WRectangle *geom, ExtlTab tab);
114
115 /* Iteration */
116
117 typedef PtrListIterTmp WTilingIterTmp;
118
119 #define FOR_ALL_MANAGED_BY_TILING(VAR, WS, TMP) \
120     FOR_ALL_ON_PTRLIST(WRegion*, VAR, (WS)->managed_list, TMP)
121     
122 #define FOR_ALL_MANAGED_BY_TILING_UNSAFE(VAR, WS) \
123     FOR_ALL_ON_PTRLIST_UNSAFE(WRegion*, VAR, (WS)->managed_list)
124
125 /* Misc. */
126
127 #define TILING_STDISP_OF(WS) \
128      ((WS)->stdispnode!=NULL ? (WS)->stdispnode->regnode.reg : NULL)
129
130
131 #endif /* ION_MOD_TILING_TILING_H */