Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / muimaster / mui_layout.c
blob3d8e1d02ede108757f213dcdd020eec39fc9a73d
1 /*
2 Copyright © 2002-2007, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <intuition/classusr.h>
7 #include <clib/alib_protos.h>
8 #include <proto/intuition.h>
9 #include <proto/muimaster.h>
11 #include "mui.h"
12 #include "muimaster_intern.h"
14 //#define MYDEBUG 1
15 #include "debug.h"
17 /*****************************************************************************
19 NAME */
20 AROS_LH6(BOOL, MUI_Layout,
22 /* SYNOPSIS */
23 AROS_LHA(Object *, obj, A0),
24 AROS_LHA(LONG, left, D0),
25 AROS_LHA(LONG, top, D1),
26 AROS_LHA(LONG, width, D2),
27 AROS_LHA(LONG, height, D3),
28 AROS_LHA(ULONG, flags, D4),
30 /* LOCATION */
31 struct Library *, MUIMasterBase, 21, MUIMaster)
33 /* FUNCTION
35 INPUTS
37 RESULT
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
47 INTERNALS
49 HISTORY
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 static const struct MUIP_Layout method = { MUIM_Layout };
56 Object *parent = _parent(obj);
59 * Called only by groups, never by windows
61 // ASSERT(parent != NULL);
63 if (_flags(parent) & MADF_ISVIRTUALGROUP)
65 /* I'm not yet sure what to do by virtual groups in virtual groups, eighter add their offsets too or not, will be tested soon */
66 IPTR val;
67 get(parent,MUIA_Virtgroup_Left,&val);
68 left -= val;
69 get(parent,MUIA_Virtgroup_Top,&val);
70 top -= val;
73 _left(obj) = left + _mleft(parent);
74 _top(obj) = top + _mtop(parent);
75 _width(obj) = width;
76 _height(obj) = height;
78 D(bug("muimaster.library/mui_layout.c: 0x%lx %ldx%ldx%ldx%ld\n",obj,_left(obj),_top(obj),_right(obj),_bottom(obj)));
80 DoMethodA(obj, (Msg)&method);
81 return TRUE;
83 AROS_LIBFUNC_EXIT
85 } /* MUIA_Layout */