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 30 31 /**************************************************************************/ 32 /* */ 33 /* FUNCTION RELEASE */ 34 /* */ 35 /* _gx_widget_style_remove PORTABLE C */ 36 /* 6.1 */ 37 /* AUTHOR */ 38 /* */ 39 /* Kenneth Maxwell, Microsoft Corporation */ 40 /* */ 41 /* DESCRIPTION */ 42 /* */ 43 /* This service removes a style from the widget. */ 44 /* */ 45 /* INPUT */ 46 /* */ 47 /* widget Pointer to widget */ 48 /* style Style to remove */ 49 /* */ 50 /* OUTPUT */ 51 /* */ 52 /* status Completion status */ 53 /* */ 54 /* CALLS */ 55 /* */ 56 /* _gx_system_dirty_mark Mark widget dirty if visible */ 57 /* */ 58 /* CALLED BY */ 59 /* */ 60 /* Application Code */ 61 /* GUIX Internal Code */ 62 /* */ 63 /* RELEASE HISTORY */ 64 /* */ 65 /* DATE NAME DESCRIPTION */ 66 /* */ 67 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 68 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 69 /* resulting in version 6.1 */ 70 /* */ 71 /**************************************************************************/ _gx_widget_style_remove(GX_WIDGET * widget,ULONG style)72UINT _gx_widget_style_remove(GX_WIDGET *widget, ULONG style) 73 { 74 ULONG old_style = widget -> gx_widget_style; 75 GX_EVENT my_event; 76 77 /* Update the widget status. */ 78 widget -> gx_widget_style &= ~style; 79 80 if (style & GX_STYLE_TRANSPARENT) 81 { 82 _gx_widget_status_remove(widget, GX_STATUS_TRANSPARENT); 83 } 84 85 if (style & GX_STYLE_ENABLED) 86 { 87 _gx_widget_status_remove(widget, GX_STATUS_SELECTABLE); 88 } 89 90 if (widget -> gx_widget_status & GX_STATUS_VISIBLE) 91 { 92 _gx_system_dirty_mark(widget); 93 } 94 95 /* notify widget of style modification */ 96 97 memset(&my_event, 0, sizeof(GX_EVENT)); 98 my_event.gx_event_payload.gx_event_ulongdata = old_style; 99 my_event.gx_event_type = GX_EVENT_STYLE_CHANGED; 100 my_event.gx_event_target = widget; 101 _gx_system_event_fold(&my_event); 102 103 /* Return the completion status. */ 104 return(GX_SUCCESS); 105 } 106 107