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  (Chart)                                                 */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 /* Include necessary system files.  */
24 
25 #include "gx_api.h"
26 #include "gx_widget.h"
27 #include "gx_line_chart.h"
28 
29 /* Bring in externs for caller checking code.  */
30 GX_CALLER_CHECKING_EXTERNS
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gxe_line_chart_create                              PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function checks for errors in the line chart create function.  */
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 /*    status                                Completion status             */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*    _gx_line_chart_create                 Actual line chart create call */
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 /**************************************************************************/
_gxe_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,UINT control_block_size)77 UINT  _gxe_line_chart_create(GX_LINE_CHART *chart,
78                              GX_CONST GX_CHAR *name,
79                              GX_WIDGET *parent,
80                              GX_CONST GX_LINE_CHART_INFO *info,
81                              ULONG style,
82                              USHORT chart_id,
83                              GX_CONST GX_RECTANGLE *size,
84                              UINT control_block_size)
85 {
86 UINT status;
87 
88     /* Check for appropriate caller.  */
89     GX_INIT_AND_THREADS_CALLER_CHECKING
90 
91     /* Check for invalid input pointers.  */
92     if ((chart == GX_NULL) || (size == GX_NULL))
93     {
94         return(GX_PTR_ERROR);
95     }
96 
97     if (control_block_size != sizeof(GX_LINE_CHART))
98     {
99         return(GX_INVALID_SIZE);
100     }
101 
102     /* Check for widget already created.  */
103     if (chart -> gx_widget_type != 0)
104     {
105         return(GX_ALREADY_CREATED);
106     }
107 
108     /* Call the actual icon button create function.  */
109     status = _gx_line_chart_create(chart, name, parent, info, style, chart_id, size);
110 
111     /* Return completion status.  */
112     return status;
113 }
114 
115