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 |
|
|
/** Widget Management (Widget) */ |
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_system.h" |
29 |
|
|
#include "gx_window.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gx_widget_style_set PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function updates the style of the specified widget. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* widget Widget control block */ |
49 |
|
|
/* style New style */ |
50 |
|
|
/* */ |
51 |
|
|
/* OUTPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* status Completion status */ |
54 |
|
|
/* */ |
55 |
|
|
/* CALLS */ |
56 |
|
|
/* */ |
57 |
|
|
/* _gx_window_view_update_detect Detect if views changed */ |
58 |
|
|
/* _gx_system_dirty_mark Mark the widget as dirty */ |
59 |
|
|
/* */ |
60 |
|
|
/* CALLED BY */ |
61 |
|
|
/* */ |
62 |
|
|
/* GUIX Internal Code */ |
63 |
|
|
/* */ |
64 |
|
|
/* RELEASE HISTORY */ |
65 |
|
|
/* */ |
66 |
|
|
/* DATE NAME DESCRIPTION */ |
67 |
|
|
/* */ |
68 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
69 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
70 |
|
|
/* resulting in version 6.1 */ |
71 |
|
|
/* */ |
72 |
|
|
/**************************************************************************/ |
73 |
|
18 |
UINT _gx_widget_style_set(GX_WIDGET *widget, ULONG style) |
74 |
|
|
{ |
75 |
|
|
GX_WINDOW *window; |
76 |
|
|
GX_EVENT my_event; |
77 |
|
18 |
ULONG old_style = widget -> gx_widget_style; |
78 |
|
|
|
79 |
|
|
/* Update the widget style. */ |
80 |
|
18 |
widget -> gx_widget_style = style; |
81 |
|
|
|
82 |
✓✓ |
18 |
if (style & GX_STYLE_TRANSPARENT) |
83 |
|
|
{ |
84 |
✓✓ |
9 |
if (!(widget -> gx_widget_status & GX_STATUS_TRANSPARENT)) |
85 |
|
|
{ |
86 |
|
|
/* If we are changing a window transparency and the window is visible, |
87 |
|
|
we have to check to see if viewports need to be updated |
88 |
|
|
*/ |
89 |
✓✓ |
5 |
if (widget -> gx_widget_type >= GX_TYPE_WINDOW && |
90 |
✓✓ |
3 |
widget -> gx_widget_status & GX_STATUS_VISIBLE) |
91 |
|
|
{ |
92 |
|
2 |
window = (GX_WINDOW *)widget; |
93 |
|
2 |
_gx_window_view_update_detect(window); |
94 |
|
|
} |
95 |
|
5 |
widget -> gx_widget_status |= GX_STATUS_TRANSPARENT; |
96 |
|
|
} |
97 |
|
|
} |
98 |
|
|
else |
99 |
|
|
{ |
100 |
✓✓ |
9 |
if (widget -> gx_widget_status & GX_STATUS_TRANSPARENT) |
101 |
|
|
{ |
102 |
|
|
/* If we are changing a window transparency and the window is visible, |
103 |
|
|
we have to check to see if viewports need to be updated |
104 |
|
|
*/ |
105 |
✓✓ |
5 |
if (widget -> gx_widget_type >= GX_TYPE_WINDOW && |
106 |
✓✓ |
3 |
widget -> gx_widget_status & GX_STATUS_VISIBLE) |
107 |
|
|
{ |
108 |
|
2 |
window = (GX_WINDOW *)widget; |
109 |
|
2 |
_gx_window_view_update_detect(window); |
110 |
|
|
} |
111 |
|
5 |
widget -> gx_widget_status &= ~GX_STATUS_TRANSPARENT; |
112 |
|
|
} |
113 |
|
|
} |
114 |
|
|
|
115 |
✓✓ |
18 |
if (widget -> gx_widget_style & GX_STYLE_ENABLED) |
116 |
|
|
{ |
117 |
|
17 |
_gx_widget_status_add(widget, GX_STATUS_SELECTABLE); |
118 |
|
|
} |
119 |
|
|
else |
120 |
|
|
{ |
121 |
|
1 |
_gx_widget_status_remove(widget, GX_STATUS_SELECTABLE); |
122 |
|
|
} |
123 |
|
|
|
124 |
✓✓ |
18 |
if (widget -> gx_widget_status & GX_STATUS_VISIBLE) |
125 |
|
|
{ |
126 |
|
10 |
_gx_system_dirty_mark(widget); |
127 |
|
|
} |
128 |
|
|
|
129 |
|
|
/* notify widget of style modification */ |
130 |
|
18 |
memset(&my_event, 0, sizeof(GX_EVENT)); |
131 |
|
18 |
my_event.gx_event_payload.gx_event_ulongdata = old_style; |
132 |
|
18 |
my_event.gx_event_type = GX_EVENT_STYLE_CHANGED; |
133 |
|
18 |
my_event.gx_event_target = widget; |
134 |
|
18 |
_gx_system_event_fold(&my_event); |
135 |
|
|
|
136 |
|
18 |
return(GX_SUCCESS); |
137 |
|
|
} |
138 |
|
|
|