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 /** Text View */ 19 /** */ 20 /**************************************************************************/ 21 22 #define GX_SOURCE_CODE 23 24 25 /* Include necessary system files. */ 26 27 #include "gx_api.h" 28 #include "gx_system.h" 29 #include "gx_canvas.h" 30 #include "gx_context.h" 31 #include "gx_text_input_cursor.h" 32 33 /**************************************************************************/ 34 /* */ 35 /* FUNCTION RELEASE */ 36 /* */ 37 /* _gx_text_input_cursor_draw PORTABLE C */ 38 /* 6.1 */ 39 /* AUTHOR */ 40 /* */ 41 /* Kenneth Maxwell, Microsoft Corporation */ 42 /* */ 43 /* DESCRIPTION */ 44 /* */ 45 /* This function calculates the cursor position and draws the cursor */ 46 /* */ 47 /* INPUT */ 48 /* */ 49 /* widget Widget control block */ 50 /* */ 51 /* OUTPUT */ 52 /* */ 53 /* None */ 54 /* */ 55 /* CALLS */ 56 /* */ 57 /* _gx_canvas_line_draw Draw the the specified line */ 58 /* on the current context */ 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_text_input_cursor_draw(GX_TEXT_INPUT_CURSOR * cursor_ptr)74VOID _gx_text_input_cursor_draw(GX_TEXT_INPUT_CURSOR *cursor_ptr) 75 { 76 GX_POINT cursor_pos = cursor_ptr -> gx_text_input_cursor_pos; 77 GX_VALUE y_start; 78 GX_VALUE y_end; 79 80 if(!cursor_ptr->gx_text_input_cursor_height) 81 { 82 return; 83 } 84 85 y_start = (GX_VALUE)(cursor_pos.gx_point_y - (cursor_ptr->gx_text_input_cursor_height >> 1)); 86 y_end = (GX_VALUE)(y_start + cursor_ptr->gx_text_input_cursor_height - 1); 87 88 /* Set brush width to cursor width. */ 89 _gx_context_brush_width_set((UINT)(cursor_ptr -> gx_text_input_cursor_width)); 90 91 /* Draw cursor line. */ 92 _gx_canvas_line_draw(cursor_pos.gx_point_x, y_start, cursor_pos.gx_point_x, y_end); 93 } 94 95