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 /** System Management (System) */ 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 30 31 /**************************************************************************/ 32 /* */ 33 /* FUNCTION RELEASE */ 34 /* */ 35 /* _gx_widget_pixelmap_get PORTABLE C */ 36 /* 6.1 */ 37 /* AUTHOR */ 38 /* */ 39 /* Kenneth Maxwell, Microsoft Corporation */ 40 /* */ 41 /* DESCRIPTION */ 42 /* */ 43 /* This service gets the pixelmap associated with the supplied */ 44 /* resource ID. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* widget Called widget control block */ 49 /* pixelmap_id Pixelmap resource ID */ 50 /* return_pixelmap Pointer to pixelmap */ 51 /* destination pointer */ 52 /* */ 53 /* OUTPUT */ 54 /* */ 55 /* status Completion status */ 56 /* */ 57 /* CALLS */ 58 /* */ 59 /* _gx_widget_pixelmap_get Actual widget pixelmap get */ 60 /* function */ 61 /* */ 62 /* CALLED BY */ 63 /* */ 64 /* Application Code */ 65 /* _gx_drop_list_pixelmap_set Assign pixelmap to drop list */ 66 /* _gx_icon_pixelmap_update Update pixelmap in an icon */ 67 /* _gx_pixelmap_slider_pixelmap_update Update pixelmap in slider */ 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 /* */ 77 /**************************************************************************/ _gx_widget_pixelmap_get(GX_WIDGET * widget,GX_RESOURCE_ID resource_id,GX_PIXELMAP ** return_pixelmap)78UINT _gx_widget_pixelmap_get(GX_WIDGET *widget, GX_RESOURCE_ID resource_id, GX_PIXELMAP **return_pixelmap) 79 { 80 GX_PIXELMAP *map = GX_NULL; 81 UINT status = GX_INVALID_CANVAS; 82 83 GX_CANVAS *canvas; 84 GX_DISPLAY *display; 85 86 if (widget -> gx_widget_status & GX_STATUS_VISIBLE) 87 { 88 _gx_widget_canvas_get(widget, &canvas); 89 90 if (canvas) 91 { 92 display = canvas -> gx_canvas_display; 93 94 /* Determine if the ID is within range. */ 95 if (resource_id < display -> gx_display_pixelmap_table_size) 96 { 97 /* Yes, the ID is within range. Perform a table lookup and return the 98 pixelmap pointer. */ 99 map = display -> gx_display_pixelmap_table[resource_id]; 100 status = GX_SUCCESS; 101 } 102 else 103 { 104 status = GX_INVALID_RESOURCE_ID; 105 } 106 } 107 } 108 109 *return_pixelmap = map; 110 return status; 111 } 112 113