some fixes to accented characters
[tangerine.git] / rom / hyperlayers / movelayerinfrontof.c
blob455d56236aec6851602181695e8a86ea72edb357
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <aros/libcall.h>
10 #include <proto/layers.h>
11 #include <proto/graphics.h>
12 #include <graphics/clip.h>
13 #include <graphics/layers.h>
14 #include "layers_intern.h"
16 /*****************************************************************************
18 NAME */
19 #include <proto/layers.h>
21 AROS_LH2(LONG, MoveLayerInFrontOf,
23 /* SYNOPSIS */
24 AROS_LHA(struct Layer *, layer_to_move, A0),
25 AROS_LHA(struct Layer *, other_layer, A1),
27 /* LOCATION */
28 struct LayersBase *, LayersBase, 28, Layers)
30 /* FUNCTION
31 Moves layer directly in front of another layer. Other layers
32 might become visible. You cannot move a backdrop layer in front
33 of a non-backdrop layer. You can also not move a layer in front
34 of a layer with different relationship to the root layer. Boot
35 have to be children of grandchildren or grandgrandchildren etc.
36 of the root layer. The root layer is not visible to you and
37 should never be accessed.
38 If parts of a simple layer become visible these areas are added
39 to the damage list.
41 INPUTS
42 layer_to_move - pointer to layer that is to be moved
43 other_layer - pointer to other layer that will be behind the
44 layer_to_move.
46 RESULT
47 TRUE - layer was moved
48 FALSE - layer could not be moved. (probably out of memory)
50 NOTES
52 EXAMPLE
54 BUGS
56 SEE ALSO
58 INTERNALS
60 HISTORY
61 27-11-96 digulla automatically created from
62 layers_lib.fd and clib/layers_protos.h
64 *****************************************************************************/
66 AROS_LIBFUNC_INIT
68 struct Layer * first, *_l;
69 int toback = TRUE;
70 LONG ret;
72 if (layer_to_move->parent != other_layer->parent ||
73 layer_to_move->priority < other_layer->priority)
74 return FALSE;
76 LockLayers(layer_to_move->LayerInfo);
78 first = GetFirstFamilyMember(layer_to_move);
80 _l = layer_to_move->parent->front;
81 while (1)
84 * If I run into the other layer before I find l
85 * then I know I have to move it to the back.
86 */
87 if (_l == other_layer)
88 break;
90 if (_l == layer_to_move)
92 toback = FALSE;
93 break;
95 _l = _l->front;
96 if (NULL == _l)
98 UnlockLayers(layer_to_move->LayerInfo);
99 return FALSE;
103 _l = GetFirstFamilyMember(other_layer);
105 if (TRUE == toback)
108 * If the topmost child of the other layer is
109 * behind my layer I don't have to do anything.
111 if (layer_to_move->back == _l)
113 UnlockLayers(layer_to_move->LayerInfo);
114 return TRUE;
116 ret = _MoveLayerBehind(layer_to_move, _l, LayersBase);
118 else
120 ret = _MoveLayerToFront(layer_to_move, _l, LayersBase);
123 UnlockLayers(layer_to_move->LayerInfo);
124 return ret;
126 AROS_LIBFUNC_EXIT
127 } /* MoveLayerInFrontOf */