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 /** Accordion Menu Management (Menu) */
18 /** */
19 /**************************************************************************/
20
21 #define GX_SOURCE_CODE
22
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_menu.h"
28 #include "gx_widget.h"
29
30 /**************************************************************************/
31 /* */
32 /* FUNCTION RELEASE */
33 /* */
34 /* _gx_accordion_menu_create PORTABLE C */
35 /* 6.1 */
36 /* AUTHOR */
37 /* */
38 /* Kenneth Maxwell, Microsoft Corporation */
39 /* */
40 /* DESCRIPTION */
41 /* */
42 /* This function creates an accordion menu. */
43 /* */
44 /* INPUT */
45 /* */
46 /* menu Pointer to the accordion menu */
47 /* control block */
48 /* name Name of the menu */
49 /* parent Parent widget control block */
50 /* style Style of the widget */
51 /* accordion_menu_id Application-defined ID of */
52 /* the accordion menu */
53 /* size Accordion menu size */
54 /* */
55 /* OUTPUT */
56 /* */
57 /* status Completion status */
58 /* */
59 /* CALLS */
60 /* */
61 /* _gx_widget_create Create a widget */
62 /* _gx_widget_link Link a widget to its parent */
63 /* */
64 /* CALLED BY */
65 /* */
66 /* Application Code */
67 /* */
68 /* RELEASE HISTORY */
69 /* */
70 /* DATE NAME DESCRIPTION */
71 /* */
72 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
73 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
74 /* resulting in version 6.1 */
75 /* */
76 /**************************************************************************/
_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)77 UINT _gx_accordion_menu_create(GX_ACCORDION_MENU *accordion, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
78 ULONG style, USHORT accordion_menu_id, GX_CONST GX_RECTANGLE *size)
79 {
80
81 /* Call the widget create function. */
82 _gx_widget_create((GX_WIDGET *)accordion, name, GX_NULL, style, accordion_menu_id, size);
83
84 /* Populate the rest of the accordion menu control block - overriding as necessary. */
85 accordion -> gx_widget_type = GX_TYPE_ACCORDION_MENU;
86 accordion -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_accordion_menu_event_process;
87 accordion -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_accordion_menu_draw;
88 accordion -> gx_accordion_menu_expand_item = GX_NULL;
89 accordion -> gx_accordion_menu_collapse_item = GX_NULL;
90 accordion -> gx_accordion_menu_animation_status = 0;
91
92 /* Determine if a parent widget was provided. */
93 if (parent)
94 {
95 _gx_widget_link(parent, (GX_WIDGET *)accordion);
96 }
97
98 /* Return completion status code. */
99 return(GX_SUCCESS);
100 }
101
102