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 /**   Text Button Management (Button)                                     */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_button.h"
28 
29 GX_CALLER_CHECKING_EXTERNS
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gxe_multi_line_text_button_create                  PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function checks for errors in the text button create function  */
44 /*    call.                                                               */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    button                                Button control block          */
49 /*    name                                  Name of button                */
50 /*    parent                                Parent widget control block   */
51 /*    text_id                               text resource id              */
52 /*    style                                 Style of button               */
53 /*    size                                  Button size                   */
54 /*    text_button_control_block_size        Size of the text button       */
55 /*                                            control block               */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    status                                Completion status             */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*    _gx_text_button_create                Actual text button create     */
64 /*                                          function                      */
65 /*                                                                        */
66 /*  CALLED BY                                                             */
67 /*                                                                        */
68 /*    Application Code                                                    */
69 /*                                                                        */
70 /*  RELEASE HISTORY                                                       */
71 /*                                                                        */
72 /*    DATE              NAME                      DESCRIPTION             */
73 /*                                                                        */
74 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
75 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
76 /*                                            resulting in version 6.1    */
77 /*                                                                        */
78 /**************************************************************************/
_gxe_multi_line_text_button_create(GX_MULTI_LINE_TEXT_BUTTON * button,GX_CONST GX_CHAR * name,GX_WIDGET * parent,GX_RESOURCE_ID text_id,ULONG style,USHORT Id,GX_CONST GX_RECTANGLE * size,UINT text_button_control_block_size)79 UINT  _gxe_multi_line_text_button_create(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
80                                          GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
81                                          GX_CONST GX_RECTANGLE *size, UINT text_button_control_block_size)
82 {
83 
84 UINT status;
85 
86     /* Check for appropriate caller.  */
87     GX_INIT_AND_THREADS_CALLER_CHECKING
88 
89     /* Check for invalid input pointers.  */
90     if ((button == GX_NULL) || (size == GX_NULL))
91     {
92         return(GX_PTR_ERROR);
93     }
94 
95     if (text_button_control_block_size != sizeof(GX_MULTI_LINE_TEXT_BUTTON))
96     {
97         return(GX_INVALID_SIZE);
98     }
99 
100     /* Check for id is created.  */
101     if (button -> gx_widget_type != 0)
102     {
103         return GX_ALREADY_CREATED;
104     }
105 
106     /* Call the actual text button create function.  */
107     status = _gx_multi_line_text_button_create(button, name, parent, text_id, style, Id, size);
108 
109     /* Return completion status.  */
110     return status;
111 }
112 
113