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