2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
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 /*****************************************************************************
19 #include <proto/layers.h>
21 AROS_LH2(LONG
, MoveLayerInFrontOf
,
24 AROS_LHA(struct Layer
*, layer_to_move
, A0
),
25 AROS_LHA(struct Layer
*, other_layer
, A1
),
28 struct LayersBase
*, LayersBase
, 28, Layers
)
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
42 layer_to_move - pointer to layer that is to be moved
43 other_layer - pointer to other layer that will be behind the
47 TRUE - layer was moved
48 FALSE - layer could not be moved. (probably out of memory)
61 27-11-96 digulla automatically created from
62 layers_lib.fd and clib/layers_protos.h
64 *****************************************************************************/
67 AROS_LIBBASE_EXT_DECL(struct LayersBase
*,LayersBase
)
69 struct Layer
* first
, *_l
;
73 if (layer_to_move
->parent
!= other_layer
->parent
||
74 layer_to_move
->priority
< other_layer
->priority
)
77 LockLayers(layer_to_move
->LayerInfo
);
79 first
= GetFirstFamilyMember(layer_to_move
);
81 _l
= layer_to_move
->parent
->front
;
85 * If I run into the other layer before I find l
86 * then I know I have to move it to the back.
88 if (_l
== other_layer
)
91 if (_l
== layer_to_move
)
99 UnlockLayers(layer_to_move
->LayerInfo
);
104 _l
= GetFirstFamilyMember(other_layer
);
109 * If the topmost child of the other layer is
110 * behind my layer I don't have to do anything.
112 if (layer_to_move
->back
== _l
)
114 UnlockLayers(layer_to_move
->LayerInfo
);
117 ret
= _MoveLayerBehind(layer_to_move
, _l
, LayersBase
);
121 ret
= _MoveLayerToFront(layer_to_move
, _l
, LayersBase
);
124 UnlockLayers(layer_to_move
->LayerInfo
);
128 } /* MoveLayerInFrontOf */