1 /*************************************************************************** 2 * Copyright (c) 2024 Microsoft Corporation 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the MIT License which is available at 6 * https://opensource.org/licenses/MIT. 7 * 8 * SPDX-License-Identifier: MIT 9 **************************************************************************/ 10 11 12 /**************************************************************************/ 13 /**************************************************************************/ 14 /** */ 15 /** GUIX Component */ 16 /** */ 17 /** Animation Management (Animation) */ 18 /** */ 19 /**************************************************************************/ 20 21 #define GX_SOURCE_CODE 22 23 24 /* Include necessary system files. */ 25 26 #include "gx_api.h" 27 #include "gx_system.h" 28 #include "gx_animation.h" 29 30 /**************************************************************************/ 31 /* */ 32 /* FUNCTION RELEASE */ 33 /* */ 34 /* _gx_animation_delete PORTABLE C */ 35 /* 6.1.7 */ 36 /* AUTHOR */ 37 /* */ 38 /* Ting Zhu, Microsoft Corporation */ 39 /* */ 40 /* DESCRIPTION */ 41 /* */ 42 /* This function deletes an animation sequence if the input animation */ 43 /* pointer is not NULL, otherwise, deletes all animations belong to */ 44 /* the animation parent. */ 45 /* */ 46 /* */ 47 /* INPUT */ 48 /* */ 49 /* target Pointer to animation control */ 50 /* block */ 51 /* parent Pointer to animation parent */ 52 /* */ 53 /* OUTPUT */ 54 /* */ 55 /* status Completion status */ 56 /* */ 57 /* CALLS */ 58 /* */ 59 /* _gx_animation_stop Deactivate an animation */ 60 /* _gx_system_animation_free Free system animation */ 61 /* */ 62 /* CALLED BY */ 63 /* */ 64 /* GUIX Internal Code */ 65 /* Application Code */ 66 /* */ 67 /* RELEASE HISTORY */ 68 /* */ 69 /* DATE NAME DESCRIPTION */ 70 /* */ 71 /* 06-02-2021 Ting Zhu Initial Version 6.1.7 */ 72 /* */ 73 /**************************************************************************/ 74 _gx_animation_delete(GX_ANIMATION * target,GX_WIDGET * parent)75UINT _gx_animation_delete(GX_ANIMATION *target, GX_WIDGET *parent) 76 { 77 GX_ANIMATION *animation; 78 GX_ANIMATION *next; 79 80 if (target) 81 { 82 animation = target; 83 } 84 else 85 { 86 animation = _gx_system_animation_list; 87 } 88 89 while (animation) 90 { 91 if (target) 92 { 93 next = GX_NULL; 94 parent = target -> gx_animation_info.gx_animation_parent; 95 } 96 else 97 { 98 next = animation -> gx_animation_next; 99 } 100 101 if (animation -> gx_animation_info.gx_animation_parent == parent) 102 { 103 104 /* Stop animation. */ 105 _gx_animation_stop(animation); 106 107 if (animation -> gx_animation_system_allocated) 108 { 109 110 /* If this animation came from the system pool, return it. */ 111 _gx_system_animation_free(animation); 112 } 113 else 114 { 115 /* Invalid animation. */ 116 animation -> gx_animation_status = 0; 117 } 118 } 119 120 animation = next; 121 } 122 123 return(GX_SUCCESS); 124 } 125 126