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 |
|
|
/** Progress Bar Management (Radial Progress Bar) */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
#define GX_SOURCE_CODE |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
/* Include necessary system files. */ |
26 |
|
|
|
27 |
|
|
#include "gx_api.h" |
28 |
|
|
#include "gx_radial_progress_bar.h" |
29 |
|
|
#include "gx_widget.h" |
30 |
|
|
#include "gx_utility.h" |
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gx_radial_prpgress_bar_size_update PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function calculate the size of the radial progress bar. */ |
45 |
|
|
/* */ |
46 |
|
|
/* INPUT */ |
47 |
|
|
/* */ |
48 |
|
|
/* radial_progress Radial progess bar control */ |
49 |
|
|
/* block */ |
50 |
|
|
/* */ |
51 |
|
|
/* OUTPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* status Completion status */ |
54 |
|
|
/* */ |
55 |
|
|
/* CALLS */ |
56 |
|
|
/* */ |
57 |
|
|
/* _gx_widget_resize Resize the widget */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLED BY */ |
60 |
|
|
/* */ |
61 |
|
|
/* Application Code */ |
62 |
|
|
/* */ |
63 |
|
|
/**************************************************************************/ |
64 |
|
|
|
65 |
|
1729 |
UINT _gx_radial_progress_bar_size_update(GX_RADIAL_PROGRESS_BAR *radial_progress) |
66 |
|
|
{ |
67 |
|
|
GX_RADIAL_PROGRESS_BAR_INFO *info; |
68 |
|
|
GX_RECTANGLE *size; |
69 |
|
|
GX_RECTANGLE new_size; |
70 |
|
|
GX_VALUE width; |
71 |
|
|
|
72 |
|
1729 |
info = &radial_progress -> gx_radial_progress_bar_info; |
73 |
|
|
|
74 |
|
1729 |
width = info -> gx_radial_progress_bar_info_selected_brush_width; |
75 |
|
|
|
76 |
✓✓ |
1729 |
if (width < info -> gx_radial_progress_bar_info_normal_brush_width) |
77 |
|
|
{ |
78 |
|
451 |
width = info -> gx_radial_progress_bar_info_normal_brush_width; |
79 |
|
|
} |
80 |
|
|
|
81 |
|
1729 |
width = (GX_VALUE)((width + 1) >> 1); |
82 |
|
|
/* Calculate new size. */ |
83 |
|
1729 |
new_size.gx_rectangle_left = (GX_VALUE)(info -> gx_radial_progress_bar_info_xcenter - info -> gx_radial_progress_bar_info_radius - width); |
84 |
|
1729 |
new_size.gx_rectangle_right = (GX_VALUE)(info -> gx_radial_progress_bar_info_xcenter + info -> gx_radial_progress_bar_info_radius + width); |
85 |
|
1729 |
new_size.gx_rectangle_top = (GX_VALUE)(info -> gx_radial_progress_bar_info_ycenter - info -> gx_radial_progress_bar_info_radius - width); |
86 |
|
1729 |
new_size.gx_rectangle_bottom = (GX_VALUE)(info -> gx_radial_progress_bar_info_ycenter + info -> gx_radial_progress_bar_info_radius + width); |
87 |
|
|
|
88 |
|
|
/* Retrieve old progress bar size. */ |
89 |
|
1729 |
size = &radial_progress -> gx_widget_size; |
90 |
|
|
|
91 |
✓✓ |
1729 |
if ((new_size.gx_rectangle_left != size -> gx_rectangle_left) || |
92 |
✓✓ |
372 |
(new_size.gx_rectangle_right != size -> gx_rectangle_right) || |
93 |
✓✓ |
370 |
(new_size.gx_rectangle_top != size -> gx_rectangle_top)) |
94 |
|
|
{ |
95 |
|
|
/* Update radial progress bar size. */ |
96 |
|
1360 |
_gx_widget_resize((GX_WIDGET *)radial_progress, &new_size); |
97 |
|
|
} |
98 |
|
|
|
99 |
|
1729 |
return GX_SUCCESS; |
100 |
|
|
} |
101 |
|
|
|