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_animation.h"
28 #include "gx_system.h"
29 
30 /**************************************************************************/
31 /*                                                                        */
32 /*  FUNCTION                                               RELEASE        */
33 /*                                                                        */
34 /*    _gx_animation_drag_enable                           PORTABLE C      */
35 /*                                                           6.1          */
36 /*  AUTHOR                                                                */
37 /*                                                                        */
38 /*    Kenneth Maxwell, Microsoft Corporation                              */
39 /*                                                                        */
40 /*  DESCRIPTION                                                           */
41 /*                                                                        */
42 /*    This function sets screen slide animation event process as a hook   */
43 /*    procedure of the widget's default event process.                    */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    animation                             Pointer to animation control  */
48 /*                                            block                       */
49 /*    widget                                Pointer to widget control     */
50 /*                                            block                       */
51 /*    info                                  Animation information         */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    status                                Completion status             */
56 /*                                                                        */
57 /*  CALLS                                                                 */
58 /*                                                                        */
59 /*    None                                                                */
60 /*                                                                        */
61 /*  CALLED BY                                                             */
62 /*                                                                        */
63 /*    Application Code                                                    */
64 /*                                                                        */
65 /*  RELEASE HISTORY                                                       */
66 /*                                                                        */
67 /*    DATE              NAME                      DESCRIPTION             */
68 /*                                                                        */
69 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
70 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
71 /*                                            resulting in version 6.1    */
72 /*                                                                        */
73 /**************************************************************************/
_gx_animation_drag_enable(GX_ANIMATION * animation,GX_WIDGET * widget,GX_ANIMATION_INFO * info)74 UINT  _gx_animation_drag_enable(GX_ANIMATION *animation, GX_WIDGET *widget, GX_ANIMATION_INFO *info)
75 {
76     /* Test invalid animation status. */
77     if (animation -> gx_animation_status != GX_ANIMATION_IDLE)
78     {
79         return(GX_INVALID_STATUS);
80     }
81 
82     /* Save the widget's event process function, and replace it with the slide animation event process. */
83     animation -> gx_animation_original_event_process_function = widget -> gx_widget_event_process_function;
84     widget -> gx_widget_event_process_function = _gx_animation_drag_event_process;
85 
86     /* Save the animation parameters */
87     animation -> gx_animation_info = *info;
88     animation -> gx_animation_timer = animation -> gx_animation_info.gx_animation_frame_interval;
89     animation -> gx_animation_next = _gx_system_animation_list;
90     animation -> gx_animation_total_steps = info -> gx_animation_steps;
91     _gx_system_animation_list = animation;
92 
93     /* Return completion status code. */
94     return(GX_SUCCESS);
95 }
96 
97