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 /** Window Management (Window) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "gx_api.h"
28 #include "gx_widget.h"
29 #include "gx_window.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _gx_window_create PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Kenneth Maxwell, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function creates a window, which is a special type of */
45 /* widget. */
46 /* */
47 /* INPUT */
48 /* */
49 /* window Pointer to window control */
50 /* block */
51 /* name Logical name of window */
52 /* parent Pointer to parent window */
53 /* style Window Style */
54 /* window_id Application-defined ID of the */
55 /* window */
56 /* size Size of the window */
57 /* */
58 /* OUTPUT */
59 /* */
60 /* status Completion status */
61 /* */
62 /* CALLS */
63 /* */
64 /* _gx_widget_create Create the underlying widget */
65 /* _gx_widget_border_width_get Get the widget border width */
66 /* _gx_widget_client_get Get the widget client */
67 /* _gx_widget_link Link the widget to the parent */
68 /* */
69 /* CALLED BY */
70 /* */
71 /* Application Code */
72 /* */
73 /* RELEASE HISTORY */
74 /* */
75 /* DATE NAME DESCRIPTION */
76 /* */
77 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
78 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
79 /* fixed compiler warnings, */
80 /* resulting in version 6.1 */
81 /* */
82 /**************************************************************************/
_gx_window_create(GX_WINDOW * window,GX_CONST GX_CHAR * name,GX_WIDGET * parent,ULONG style,USHORT window_id,GX_CONST GX_RECTANGLE * size)83 UINT _gx_window_create(GX_WINDOW *window, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
84 ULONG style, USHORT window_id, GX_CONST GX_RECTANGLE *size)
85 {
86
87 GX_VALUE border_width;
88
89 /* Call the widget create function. */
90 _gx_widget_create((GX_WIDGET *)window, name, GX_NULL, style, window_id, size);
91
92 /* Populate the rest of window control block - overriding as necessary. */
93 window -> gx_widget_type = GX_TYPE_WINDOW;
94 window -> gx_widget_status |= GX_STATUS_ACCEPTS_FOCUS;
95 _gx_widget_border_width_get((GX_WIDGET *)window, &border_width);
96 _gx_widget_client_get((GX_WIDGET *)window,
97 border_width,
98 &window -> gx_window_client);
99
100 window -> gx_window_views = GX_NULL;
101 window -> gx_widget_normal_fill_color = GX_COLOR_ID_WINDOW_FILL;
102 window -> gx_widget_selected_fill_color = GX_COLOR_ID_WINDOW_FILL;
103 window -> gx_window_wallpaper = 0;
104 window -> gx_widget_type = GX_TYPE_WINDOW;
105 window -> gx_window_move_mode = 0;
106 window -> gx_window_move_start.gx_point_x = 0;
107 window -> gx_window_move_start.gx_point_y = 0;
108 window -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_window_draw;
109 window -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_window_event_process;
110 window -> gx_window_scroll_info_get = (VOID (*)(GX_WINDOW *, ULONG, GX_SCROLL_INFO *))(void (*)(void))_gx_window_scroll_info_get;
111
112 /* Determine if a parent widget was provided. */
113 if (parent)
114 {
115 _gx_widget_link(parent, (GX_WIDGET *)window);
116 }
117
118 /* Return completion status code. */
119 return(GX_SUCCESS);
120 }
121
122