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 /**   Line Chart Management (Line Chart)                                  */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_widget.h"
28 #include "gx_window.h"
29 #include "gx_line_chart.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_line_chart_create                               PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function creates a GX_LINE_CHART widget                        */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    chart                                 GX_LINE_CHART control block   */
49 /*    name                                  Logical name of icon widget   */
50 /*    parent                                Pointer to the parent widget  */
51 /*    info                                  chart drawing parameters      */
52 /*    style                                 chart style flags             */
53 /*    chart_id                              chart ID                      */
54 /*    size                                  chart size                    */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    Completion Status                                                   */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*    _gx_window_create                                                   */
63 /*    _gx_widget_link                                                     */
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_line_chart_create(GX_LINE_CHART * chart,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_CONST GX_LINE_CHART_INFO * info,ULONG style,USHORT chart_id,GX_CONST GX_RECTANGLE * size)78 UINT _gx_line_chart_create(GX_LINE_CHART *chart,
79                            GX_CONST GX_CHAR *name,
80                            GX_WIDGET *parent,
81                            GX_CONST GX_LINE_CHART_INFO *info,
82                            ULONG style,
83                            USHORT chart_id,
84                            GX_CONST GX_RECTANGLE *size)
85 {
86 
87     _gx_window_create((GX_WINDOW *) chart, name, parent, style, chart_id, size);
88 
89     chart -> gx_widget_draw_function =           (VOID (*)(GX_WIDGET *))_gx_line_chart_draw;
90 
91     chart -> gx_line_chart_info = *info;
92     chart -> gx_widget_type = GX_TYPE_LINE_CHART;
93 
94     if (parent)
95     {
96         _gx_widget_link(parent, (GX_WIDGET *) chart);
97     }
98 
99     return(GX_SUCCESS);
100 }
101