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 /** Widget Management (Widget) */ 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 #include "gx_system.h" 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _gx_widget_canvas_get PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Kenneth Maxwell, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This service gets the widget canvas. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* widget Pointer to widget */ 49 /* return_canvas Pointer to destination for */ 50 /* widget's canvas */ 51 /* */ 52 /* OUTPUT */ 53 /* */ 54 /* status Completion status */ 55 /* */ 56 /* CALLS */ 57 /* */ 58 /* _gx_window_root_find Find the root window */ 59 /* */ 60 /* CALLED BY */ 61 /* */ 62 /* Application Code */ 63 /* GUIX Internal Code */ 64 /* */ 65 /* RELEASE HISTORY */ 66 /* */ 67 /* DATE NAME DESCRIPTION */ 68 /* */ 69 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ 70 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */ 71 /* resulting in version 6.1 */ 72 /* */ 73 /**************************************************************************/ _gx_widget_canvas_get(GX_WIDGET * widget,GX_CANVAS ** return_canvas)74UINT _gx_widget_canvas_get(GX_WIDGET *widget, GX_CANVAS **return_canvas) 75 { 76 GX_WINDOW_ROOT *root; 77 GX_DRAW_CONTEXT *context; 78 UINT status; 79 80 status = _gx_window_root_find(widget, &root); 81 82 if (status == GX_SUCCESS) 83 { 84 *return_canvas = root -> gx_window_root_canvas; 85 } 86 else 87 { 88 context = _gx_system_current_draw_context; 89 if (context) 90 { 91 *return_canvas = context -> gx_draw_context_canvas; 92 status = GX_SUCCESS; 93 } 94 else 95 { 96 *return_canvas = GX_NULL; 97 } 98 } 99 100 return(status); 101 } 102 103