2 Copyright © 1995-2007, 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 *****************************************************************************/
68 struct Layer
* first
, *_l
;
72 if (layer_to_move
->parent
!= other_layer
->parent
||
73 layer_to_move
->priority
< other_layer
->priority
)
76 LockLayers(layer_to_move
->LayerInfo
);
78 first
= GetFirstFamilyMember(layer_to_move
);
80 _l
= layer_to_move
->parent
->front
;
84 * If I run into the other layer before I find l
85 * then I know I have to move it to the back.
87 if (_l
== other_layer
)
90 if (_l
== layer_to_move
)
98 UnlockLayers(layer_to_move
->LayerInfo
);
103 _l
= GetFirstFamilyMember(other_layer
);
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
);
116 ret
= _MoveLayerBehind(layer_to_move
, _l
, LayersBase
);
120 ret
= _MoveLayerToFront(layer_to_move
, _l
, LayersBase
);
123 UnlockLayers(layer_to_move
->LayerInfo
);
127 } /* MoveLayerInFrontOf */