4 * Copyright (c) Tuomo Valkonen 1999-2007.
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.
12 #include <ioncore/common.h>
13 #include <ioncore/mplex.h>
14 #include <ioncore/focus.h>
15 #include <ioncore/return.h>
16 #include <ioncore/group.h>
20 static WRegion *mkbottom_fn(WWindow *parent, const WFitParams *fp,
23 WRegion *reg=(WRegion*)param;
25 WSplitRegion *node=NULL;
27 if(!region_fitrep(reg, parent, fp))
30 tiling=create_tiling(parent, fp, NULL, FALSE);
35 node=create_splitregion(®ION_GEOM(tiling), reg);
37 tiling->split_tree=(WSplit*)node;
38 tiling->split_tree->ws_if_root=tiling;
40 region_detach_manager(reg);
42 if(tiling_managed_add(tiling, reg))
43 return (WRegion*)tiling;
45 #warning "TODO: reattach?"
47 destroy_obj((Obj*)tiling->split_tree);
48 tiling->split_tree=NULL;
51 destroy_obj((Obj*)tiling);
57 * Create a new \type{WTiling} 'bottom' for the group of \var{reg},
58 * consisting of \var{reg}.
61 bool mod_tiling_mkbottom(WRegion *reg)
63 WGroup *grp=REGION_MANAGER_CHK(reg, WGroup);
64 WGroupAttachParams ap=GROUPATTACHPARAMS_INIT;
65 WRegionAttachData data;
69 warn(TR("Not member of a group"));
73 if(grp->bottom!=NULL){
74 warn(TR("Manager group already has bottom"));
79 ap.level=STACKING_LEVEL_BOTTOM;
82 ap.szplcy=SIZEPOLICY_FULL_EXACT;
85 ap.switchto=region_may_control_focus(reg);
89 data.type=REGION_ATTACH_NEW;
90 data.u.n.fn=mkbottom_fn;
93 /* kele... poisto samalla kuin attach */
94 return (group_do_attach(grp, &ap, &data)!=NULL);