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 |
|
|
/** Window Management (Window) */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
|
21 |
|
|
#define GX_SOURCE_CODE |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#include "gx_api.h" |
27 |
|
|
#include "gx_system.h" |
28 |
|
|
#include "gx_window.h" |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _gx_window_root_create PORTABLE C */ |
36 |
|
|
/* 6.3.0 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* This function creates a root window, which is a special type of */ |
44 |
|
|
/* widget. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* root_window Root Window control block */ |
49 |
|
|
/* name Name of window */ |
50 |
|
|
/* canvas Canvas this root window */ |
51 |
|
|
/* belongs to */ |
52 |
|
|
/* style Style of window */ |
53 |
|
|
/* Id User-specified root window ID */ |
54 |
|
|
/* size Window size */ |
55 |
|
|
/* */ |
56 |
|
|
/* OUTPUT */ |
57 |
|
|
/* */ |
58 |
|
|
/* status Completion status */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLS */ |
61 |
|
|
/* */ |
62 |
|
|
/* memset Set control block to zero */ |
63 |
|
|
/* _gx_window_create Create the underlying window */ |
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 |
|
|
/* 10-31-2023 Ting Zhu Modified comment(s), */ |
77 |
|
|
/* updated the link logic, */ |
78 |
|
|
/* resulting in version 6.3.0 */ |
79 |
|
|
/* */ |
80 |
|
|
/**************************************************************************/ |
81 |
|
1189 |
UINT _gx_window_root_create(GX_WINDOW_ROOT *root_window, GX_CONST GX_CHAR *name, |
82 |
|
|
GX_CANVAS *canvas, ULONG style, USHORT Id, |
83 |
|
|
GX_CONST GX_RECTANGLE *size) |
84 |
|
|
{ |
85 |
|
|
|
86 |
|
|
/* Clear the root window control block. */ |
87 |
|
1189 |
memset(root_window, 0, sizeof(GX_WINDOW_ROOT)); |
88 |
|
|
|
89 |
|
|
/* Call the standard window create API. */ |
90 |
|
1189 |
_gx_window_create((GX_WINDOW *)root_window, name, GX_NULL, style, Id, size); |
91 |
|
|
|
92 |
|
|
/* Populate the rest of root window control block - overriding as necessary. */ |
93 |
|
1189 |
root_window -> gx_widget_normal_fill_color = GX_COLOR_ID_CANVAS; |
94 |
|
1189 |
root_window -> gx_widget_selected_fill_color = GX_COLOR_ID_CANVAS; |
95 |
|
1189 |
root_window -> gx_widget_disabled_fill_color = GX_COLOR_ID_CANVAS; |
96 |
|
1189 |
root_window -> gx_widget_type = GX_TYPE_ROOT_WINDOW; |
97 |
|
1189 |
root_window -> gx_window_root_canvas = canvas; |
98 |
|
1189 |
root_window -> gx_window_root_views_changed = GX_TRUE; |
99 |
|
1189 |
root_window -> gx_widget_status &= ~GX_STATUS_MOVABLE; |
100 |
|
1189 |
root_window -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_window_root_event_process; |
101 |
|
|
|
102 |
|
1189 |
GX_ENTER_CRITICAL |
103 |
|
|
|
104 |
✓✓ |
1189 |
if (_gx_system_root_window_created_list) |
105 |
|
|
{ |
106 |
|
|
/* link this root to the one previously created */ |
107 |
|
462 |
root_window -> gx_widget_next = (GX_WIDGET *)_gx_system_root_window_created_list; |
108 |
|
|
|
109 |
|
462 |
_gx_system_root_window_created_list -> gx_widget_previous = (GX_WIDGET *)root_window; |
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
/* Update the root window pointer */ |
113 |
|
1189 |
_gx_system_root_window_created_list = root_window; |
114 |
|
|
|
115 |
|
1189 |
GX_EXIT_CRITICAL |
116 |
|
|
|
117 |
|
|
/* Return the status from window create. */ |
118 |
|
1189 |
return(GX_SUCCESS); |
119 |
|
|
} |
120 |
|
|
|