some fixes to accented characters
[tangerine.git] / rom / hyperlayers / islayerhiddenbysibling.c
blobbff96419c6aead31d72b4e2210c2bdbe30d2ecdd
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <proto/exec.h>
9 #include <exec/types.h>
10 #include "layers_intern.h"
11 #include <aros/libcall.h>
12 #include <proto/graphics.h>
13 #include "basicfuncs.h"
14 #include "../graphics/intregions.h"
16 /*****************************************************************************
18 NAME */
19 #include <proto/layers.h>
20 AROS_LH2(BOOL, IsLayerHiddenBySibling,
22 /* SYNOPSIS */
23 AROS_LHA(struct Layer *, l , A0),
24 AROS_LHA(BOOL , check_invisible, D0),
26 /* LOCATION */
27 struct LayersBase *, LayersBase, 44, Layers)
29 /* FUNCTION
30 Checks whether this layer is hidden by any siblings
31 that are in front of it. All these siblings must have
32 the same priority as that layer.
33 It can be specified whether invisible siblings are to be
34 considered in the comparison.
36 INPUTS
37 L - pointer to layer
38 check_invisible - whether invisible siblings are to be considered
40 RESULT
41 TRUE - layer is hidden by one or more siblings
42 FALSE - layer is fully visible
44 NOTES
46 EXAMPLE
48 BUGS
50 SEE ALSO
52 INTERNALS
54 HISTORY
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 struct Layer * _l;
61 struct Region * r;
62 BOOL result = FALSE;
64 if (NULL == l ||
65 NULL == (r = NewRegion()))
66 return FALSE;
68 LockLayers(l->LayerInfo);
70 _l = l->front;
72 while (NULL != _l) {
74 * If they differ in priority then return FALSE.
76 if (_l->priority != l->priority) {
77 break;
81 * Only need to check with those layers that
82 * have the same nesting count (are immediate
83 * siblings to the layer l).
85 if (l->nesting == _l->nesting &&
86 ( IS_VISIBLE(_l) || TRUE == check_invisible) &&
87 TRUE == overlap(_l->visibleshape->bounds, l->visibleshape->bounds))
89 /* The layers overlap if an AND operation on
90 * both layers' visible region does not
91 * leave an empty region.
93 SetRegion(l->visibleshape,r);
94 AndRegionRegion(_l->visibleshape,r);
95 if (NULL != r->RegionRectangle) {
96 result = TRUE;
97 break;
100 _l = _l->front;
103 UnlockLayers(l->LayerInfo);
105 DisposeRegion(r);
107 return result;
109 AROS_LIBFUNC_EXIT
110 } /* IsLayerHiddenBySibling */