New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / hyperlayers / upfrontlayer.c
blobb7505926000f931e9e32417380eddf4bf5b2412c
1 /*
2 Copyright © 1995-2001, 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 <exec/memory.h>
11 #include <aros/libcall.h>
12 #include <proto/graphics.h>
13 #include <proto/layers.h>
14 #include "layers_intern.h"
17 /*****************************************************************************
19 NAME */
21 AROS_LH2(LONG, UpfrontLayer,
23 /* SYNOPSIS */
24 AROS_LHA(LONG , dummy, A0),
25 AROS_LHA(struct Layer *, l , A1),
27 /* LOCATION */
28 struct LayersBase *, LayersBase, 8, Layers)
30 /* FUNCTION
31 Brings a layer to the front. If this layer is a backdrop layer
32 it is brought in front of all backdrop layers and behind the
33 last non-backdrop layer. By clearing the BACKDROP flag of a layer
34 a backdrop layer can be brought in front of all other layers.
35 Parts of a simple layer that become visible are added to the
36 damage list and the REFRESH flag is set.
38 INPUTS
39 dummy - unused
40 L - pointer to layer
42 RESULT
43 TRUE - layer was moved
44 FALSE - layer could not be moved (probably out of memory)
46 NOTES
48 EXAMPLE
50 BUGS
52 SEE ALSO
53 CreateUpfrontLayer() CreateUpfrontHookLayer() BehindLayer()
54 CreateBehindLayer() CreateBehindHookLayer()
56 INTERNALS
58 HISTORY
59 27-11-96 digulla automatically created from
60 layers_lib.fd and clib/layers_protos.h
62 *****************************************************************************/
64 AROS_LIBFUNC_INIT
65 AROS_LIBBASE_EXT_DECL(struct LayersBase *,LayersBase)
67 struct Layer * first, * _l;
68 int found = FALSE;
69 LONG ret;
71 //kprintf("\t\t%s called!\n",__FUNCTION__);
72 LockLayers(l->LayerInfo);
75 * Move the layer in front of that layer with the same
76 * priority.
77 * Also keep its children in front of itself.
79 first = GetFirstFamilyMember(l);
82 * If there is nobody in front of the first family member
83 * I don't have to do anything.
84 * first can also be l.
86 if (NULL == first->front)
88 UnlockLayers(l->LayerInfo);
89 return TRUE;
92 * Search for the new place
93 * search all layers that have the same priority.
94 * If I find another layer with the same nesting
95 * as the one to be moved I have a place to move.
96 * Stop at the frontmost layer
98 _l = first->front;
101 if (_l -> priority == l->priority)
103 while (1)
105 if (_l->nesting == l->nesting)
106 found = TRUE;
107 if (NULL == _l->front || _l->front->priority != l->priority)
108 break;
109 _l = _l->front;
113 if (FALSE == found)
115 UnlockLayers(l->LayerInfo);
116 return TRUE;
119 ret = _MoveLayerToFront(l,_l, LayersBase);
123 * Unlock all locked layers.
125 UnlockLayers(l->LayerInfo);
127 return TRUE;
129 AROS_LIBFUNC_EXIT
130 } /* UpfrontLayer */