1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
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 |
|
|
/**************************************************************************/ |
66 |
|
26689 |
VOID _gx_text_input_cursor_draw(GX_TEXT_INPUT_CURSOR *cursor_ptr) |
67 |
|
|
{ |
68 |
|
26689 |
GX_POINT cursor_pos = cursor_ptr -> gx_text_input_cursor_pos; |
69 |
|
|
GX_VALUE y_start; |
70 |
|
|
GX_VALUE y_end; |
71 |
|
|
|
72 |
✓✓ |
26689 |
if(!cursor_ptr->gx_text_input_cursor_height) |
73 |
|
|
{ |
74 |
|
29 |
return; |
75 |
|
|
} |
76 |
|
|
|
77 |
|
26660 |
y_start = (GX_VALUE)(cursor_pos.gx_point_y - (cursor_ptr->gx_text_input_cursor_height >> 1)); |
78 |
|
26660 |
y_end = (GX_VALUE)(y_start + cursor_ptr->gx_text_input_cursor_height - 1); |
79 |
|
|
|
80 |
|
|
/* Set brush width to cursor width. */ |
81 |
|
26660 |
_gx_context_brush_width_set((UINT)(cursor_ptr -> gx_text_input_cursor_width)); |
82 |
|
|
|
83 |
|
|
/* Draw cursor line. */ |
84 |
|
26660 |
_gx_canvas_line_draw(cursor_pos.gx_point_x, y_start, cursor_pos.gx_point_x, y_end); |
85 |
|
|
} |
86 |
|
|
|