1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** GUIX Component */
17 /** */
18 /** Accordion Menu Management (Menu) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "gx_api.h"
28 #include "gx_menu.h"
29 #include "gx_widget.h"
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _gx_accordion_menu_create PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Kenneth Maxwell, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function creates an accordion menu. */
44 /* */
45 /* INPUT */
46 /* */
47 /* menu Pointer to the accordion menu */
48 /* control block */
49 /* name Name of the menu */
50 /* parent Parent widget control block */
51 /* style Style of the widget */
52 /* accordion_menu_id Application-defined ID of */
53 /* the accordion menu */
54 /* size Accordion menu size */
55 /* */
56 /* OUTPUT */
57 /* */
58 /* status Completion status */
59 /* */
60 /* CALLS */
61 /* */
62 /* _gx_widget_create Create a widget */
63 /* _gx_widget_link Link a widget to its parent */
64 /* */
65 /* CALLED BY */
66 /* */
67 /* Application Code */
68 /* */
69 /* RELEASE HISTORY */
70 /* */
71 /* DATE NAME DESCRIPTION */
72 /* */
73 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
74 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
75 /* resulting in version 6.1 */
76 /* */
77 /**************************************************************************/
_gx_accordion_menu_create(GX_ACCORDION_MENU * accordion,GX_CONST GX_CHAR * name,GX_WIDGET * parent,ULONG style,USHORT accordion_menu_id,GX_CONST GX_RECTANGLE * size)78 UINT _gx_accordion_menu_create(GX_ACCORDION_MENU *accordion, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
79 ULONG style, USHORT accordion_menu_id, GX_CONST GX_RECTANGLE *size)
80 {
81
82 /* Call the widget create function. */
83 _gx_widget_create((GX_WIDGET *)accordion, name, GX_NULL, style, accordion_menu_id, size);
84
85 /* Populate the rest of the accordion menu control block - overriding as necessary. */
86 accordion -> gx_widget_type = GX_TYPE_ACCORDION_MENU;
87 accordion -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_accordion_menu_event_process;
88 accordion -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_accordion_menu_draw;
89 accordion -> gx_accordion_menu_expand_item = GX_NULL;
90 accordion -> gx_accordion_menu_collapse_item = GX_NULL;
91 accordion -> gx_accordion_menu_animation_status = 0;
92
93 /* Determine if a parent widget was provided. */
94 if (parent)
95 {
96 _gx_widget_link(parent, (GX_WIDGET *)accordion);
97 }
98
99 /* Return completion status code. */
100 return(GX_SUCCESS);
101 }
102
103