2 * ion/ioncore/groupedpholder.c
4 * Copyright (c) Tuomo Valkonen 2005-2006.
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_attach_(ph->cont, flags, &data2);
137 /*{{{ Other dynfuns */
140 bool groupedpholder_do_goto(WGroupedPHolder *ph)
143 return pholder_goto(ph->cont);
149 WRegion *groupedpholder_do_target(WGroupedPHolder *ph)
152 return pholder_target(ph->cont);
161 /*{{{ Class information */
164 static DynFunTab groupedpholder_dynfuntab[]={
165 {(DynFun*)pholder_do_attach,
166 (DynFun*)groupedpholder_do_attach},
168 {(DynFun*)pholder_do_goto,
169 (DynFun*)groupedpholder_do_goto},
171 {(DynFun*)pholder_do_target,
172 (DynFun*)groupedpholder_do_target},
177 IMPLCLASS(WGroupedPHolder, WPHolder, groupedpholder_deinit,
178 groupedpholder_dynfuntab);