2 * ion/ioncore/groupedpholder.c
4 * Copyright (c) Tuomo Valkonen 2005-2007.
6 * See the included file LICENSE for details.
9 #include <libtu/objp.h>
10 #include <libtu/obj.h>
14 #include "groupedpholder.h"
20 bool groupedpholder_init(WGroupedPHolder *ph, WPHolder *cont)
24 pholder_init(&(ph->ph));
32 WGroupedPHolder *create_groupedpholder(WPHolder *cont)
34 CREATEOBJ_IMPL(WGroupedPHolder, groupedpholder, (p, cont));
38 void groupedpholder_deinit(WGroupedPHolder *ph)
41 destroy_obj((Obj*)ph->cont);
45 pholder_deinit(&(ph->ph));
55 static bool grouped_do_attach_final(WGroupCW *cwg,
57 WGroupAttachParams *param)
61 REGION_GEOM(cwg)=REGION_GEOM(reg);
67 param->geom.w=REGION_GEOM(reg).w;
68 param->geom.h=REGION_GEOM(reg).h;
69 param->szplcy=SIZEPOLICY_FULL_EXACT;
70 param->szplcy_set=TRUE;
72 return group_do_attach_final(&cwg->grp, reg, param);
76 WRegion *grouped_handler(WWindow *par,
80 WRegionAttachData *data=(WRegionAttachData*)frp_;
81 WGroupAttachParams param=GROUPATTACHPARAMS_INIT;
86 cwg=create_groupcw(par, fp);
92 param.level=STACKING_LEVEL_BOTTOM;
97 if(!(fp->mode®ION_FIT_WHATEVER)){
102 reg=region_attach_helper((WRegion*)cwg, par, fp,
103 (WRegionDoAttachFn*)grouped_do_attach_final,
107 destroy_obj((Obj*)cwg);
111 return (WRegion*)cwg;
115 WRegion *groupedpholder_do_attach(WGroupedPHolder *ph, int flags,
116 WRegionAttachData *data)
118 WRegionAttachData data2;
123 data2.type=REGION_ATTACH_NEW;
124 data2.u.n.fn=grouped_handler;
125 data2.u.n.param=data;
127 return pholder_do_attach(ph->cont, flags, &data2);
134 /*{{{ Other dynfuns */
137 bool groupedpholder_do_goto(WGroupedPHolder *ph)
139 return (ph->cont!=NULL
140 ? pholder_goto(ph->cont)
145 WRegion *groupedpholder_do_target(WGroupedPHolder *ph)
147 return (ph->cont!=NULL
148 ? pholder_target(ph->cont)
153 WPHolder *groupedpholder_do_root(WGroupedPHolder *ph)
160 root=pholder_root(ph->cont);
162 return (root!=ph->cont
171 /*{{{ Class information */
174 static DynFunTab groupedpholder_dynfuntab[]={
175 {(DynFun*)pholder_do_attach,
176 (DynFun*)groupedpholder_do_attach},
178 {(DynFun*)pholder_do_goto,
179 (DynFun*)groupedpholder_do_goto},
181 {(DynFun*)pholder_do_target,
182 (DynFun*)groupedpholder_do_target},
184 {(DynFun*)pholder_do_root,
185 (DynFun*)groupedpholder_do_root},
190 IMPLCLASS(WGroupedPHolder, WPHolder, groupedpholder_deinit,
191 groupedpholder_dynfuntab);