2 * ion/ioncore/groupedpholder.c
4 * Copyright (c) Tuomo Valkonen 2005-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 <libtu/objp.h>
13 #include <libtu/obj.h>
17 #include "groupedpholder.h"
23 bool groupedpholder_init(WGroupedPHolder *ph, WPHolder *cont)
27 pholder_init(&(ph->ph));
35 WGroupedPHolder *create_groupedpholder(WPHolder *cont)
37 CREATEOBJ_IMPL(WGroupedPHolder, groupedpholder, (p, cont));
41 void groupedpholder_deinit(WGroupedPHolder *ph)
44 destroy_obj((Obj*)ph->cont);
48 pholder_deinit(&(ph->ph));
58 static bool grouped_do_attach_final(WGroupCW *cwg,
60 WGroupAttachParams *param)
64 REGION_GEOM(cwg)=REGION_GEOM(reg);
70 param->geom.w=REGION_GEOM(reg).w;
71 param->geom.h=REGION_GEOM(reg).h;
72 param->szplcy=SIZEPOLICY_FULL_EXACT;
73 param->szplcy_set=TRUE;
75 return group_do_attach_final(&cwg->grp, reg, param);
79 WRegion *grouped_handler(WWindow *par,
83 WRegionAttachData *data=(WRegionAttachData*)frp_;
84 WGroupAttachParams param=GROUPATTACHPARAMS_INIT;
89 cwg=create_groupcw(par, fp);
95 param.level=STACKING_LEVEL_BOTTOM;
100 if(!(fp->mode®ION_FIT_WHATEVER)){
105 reg=region_attach_helper((WRegion*)cwg, par, fp,
106 (WRegionDoAttachFn*)grouped_do_attach_final,
110 destroy_obj((Obj*)cwg);
114 return (WRegion*)cwg;
118 WRegion *groupedpholder_do_attach(WGroupedPHolder *ph, int flags,
119 WRegionAttachData *data)
121 WRegionAttachData data2;
126 data2.type=REGION_ATTACH_NEW;
127 data2.u.n.fn=grouped_handler;
128 data2.u.n.param=data;
130 return pholder_do_attach(ph->cont, flags, &data2);
137 /*{{{ Other dynfuns */
140 bool groupedpholder_do_goto(WGroupedPHolder *ph)
142 return (ph->cont!=NULL
143 ? pholder_goto(ph->cont)
148 WRegion *groupedpholder_do_target(WGroupedPHolder *ph)
150 return (ph->cont!=NULL
151 ? pholder_target(ph->cont)
156 WPHolder *groupedpholder_do_root(WGroupedPHolder *ph)
163 root=pholder_root(ph->cont);
165 return (root!=ph->cont
174 /*{{{ Class information */
177 static DynFunTab groupedpholder_dynfuntab[]={
178 {(DynFun*)pholder_do_attach,
179 (DynFun*)groupedpholder_do_attach},
181 {(DynFun*)pholder_do_goto,
182 (DynFun*)groupedpholder_do_goto},
184 {(DynFun*)pholder_do_target,
185 (DynFun*)groupedpholder_do_target},
187 {(DynFun*)pholder_do_root,
188 (DynFun*)groupedpholder_do_root},
193 IMPLCLASS(WGroupedPHolder, WPHolder, groupedpholder_deinit,
194 groupedpholder_dynfuntab);