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_system.h" 28 #include "gx_canvas.h" 29 #include "gx_utility.h" 30 #include "gx_widget.h" 31 32 33 /**************************************************************************/ 34 /* */ 35 /* FUNCTION RELEASE */ 36 /* */ 37 /* _gx_widget_clipping_update PORTABLE C */ 38 /* 6.1 */ 39 /* AUTHOR */ 40 /* */ 41 /* Kenneth Maxwell, Microsoft Corporation */ 42 /* */ 43 /* DESCRIPTION */ 44 /* */ 45 /* Update the clipping members of each child widget to prevent them */ 46 /* from drawing outside their parent's area. */ 47 /* */ 48 /* INPUT */ 49 /* */ 50 /* widget Pointer to the widget */ 51 /* */ 52 /* OUTPUT */ 53 /* */ 54 /* None */ 55 /* */ 56 /* CALLS */ 57 /* */ 58 /* _gx_utility_rectangle_overlap_detect Detect overlapping rectangle */ 59 /* _gx_widget_child_clipping_update Update child clipping area */ 60 /* */ 61 /* CALLED BY */ 62 /* */ 63 /* GUIX Internal Code */ 64 /* GUIX application code */ 65 /* */ 66 /* RELEASE HISTORY */ 67 /* */ 68 /* DATE NAME DESCRIPTION */ 69 /* */ 70 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 71 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 72 /* resulting in version 6.1 */ 73 /* */ 74 /**************************************************************************/ _gx_widget_clipping_update(GX_WIDGET * widget)75VOID _gx_widget_clipping_update(GX_WIDGET *widget) 76 { 77 GX_WIDGET *parent; 78 GX_WINDOW *win; 79 80 if (!widget) 81 { 82 return; 83 } 84 parent = widget -> gx_widget_parent; 85 86 if (parent) 87 { 88 _gx_utility_rectangle_overlap_detect(&parent -> gx_widget_clip, 89 &widget -> gx_widget_size, &widget -> gx_widget_clip); 90 91 if (parent -> gx_widget_type >= GX_TYPE_WINDOW && 92 !(widget -> gx_widget_status & GX_STATUS_NONCLIENT)) 93 { 94 win = (GX_WINDOW *)parent; 95 _gx_utility_rectangle_overlap_detect(&win -> gx_window_client, 96 &widget -> gx_widget_clip, &widget -> gx_widget_clip); 97 } 98 } 99 else 100 { 101 widget -> gx_widget_clip = widget -> gx_widget_size; 102 } 103 104 _gx_widget_child_clipping_update(widget); 105 } 106 107