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 |
|
|
/** Radial Slider Management (Slider) */ |
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_context.h" |
30 |
|
|
#include "gx_canvas.h" |
31 |
|
|
#include "gx_radial_slider.h" |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gx_radial_slider_draw PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This function draws a radial slider widget. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* slider Radial slider control block */ |
50 |
|
|
/* */ |
51 |
|
|
/* OUTPUT */ |
52 |
|
|
/* */ |
53 |
|
|
/* None */ |
54 |
|
|
/* */ |
55 |
|
|
/* CALLS */ |
56 |
|
|
/* */ |
57 |
|
|
/* _gx_widget_draw Default widget draw */ |
58 |
|
|
/* _gx_context_pixelmap_get Retrieve pixelmap with */ |
59 |
|
|
/* specified pixelmap id */ |
60 |
|
|
/* _gx_canvas_pixelmap_draw Draw a pixelmap to canvas */ |
61 |
|
|
/* _gx_widget_children_draw Draw widget children */ |
62 |
|
|
/* _gx_radial_slider_needle_rectangle_get */ |
63 |
|
|
/* Retrive needle bounding */ |
64 |
|
|
/* rectangle */ |
65 |
|
|
/* */ |
66 |
|
|
/* CALLED BY */ |
67 |
|
|
/* */ |
68 |
|
|
/* GUIX Internal Code */ |
69 |
|
|
/* Application Code */ |
70 |
|
|
/* */ |
71 |
|
|
/**************************************************************************/ |
72 |
|
163 |
VOID _gx_radial_slider_draw(GX_RADIAL_SLIDER *slider) |
73 |
|
|
{ |
74 |
|
163 |
GX_PIXELMAP *map = GX_NULL; |
75 |
|
|
GX_RECTANGLE size; |
76 |
|
|
|
77 |
|
|
/* Call default widget draw. */ |
78 |
|
163 |
_gx_widget_background_draw((GX_WIDGET *)slider); |
79 |
|
|
|
80 |
|
163 |
_gx_context_pixelmap_get(slider -> gx_radial_slider_info.gx_radial_slider_info_background_pixelmap, &map); |
81 |
|
|
|
82 |
|
163 |
_gx_widget_context_fill_set((GX_WIDGET *)slider); |
83 |
|
|
|
84 |
✓✓ |
163 |
if (map) |
85 |
|
|
{ |
86 |
|
|
/* Draw background pixelmap. */ |
87 |
|
161 |
_gx_canvas_pixelmap_draw(slider -> gx_widget_size.gx_rectangle_left, slider -> gx_widget_size.gx_rectangle_top, map); |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
/* Pick needle pixelmap. */ |
91 |
|
163 |
_gx_context_pixelmap_get(slider -> gx_radial_slider_info.gx_radial_slider_info_needle_pixelmap, &map); |
92 |
|
|
|
93 |
✓✓ |
163 |
if (map) |
94 |
|
|
{ |
95 |
|
|
/* Calcualte needle bounding rectangle. */ |
96 |
|
161 |
_gx_radial_slider_needle_rectangle_calculate(slider, &size); |
97 |
|
|
|
98 |
|
|
/* Draw needle. */ |
99 |
|
161 |
_gx_canvas_pixelmap_draw(size.gx_rectangle_left, size.gx_rectangle_top, map); |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
/* Draw children widgets. */ |
103 |
|
163 |
_gx_widget_children_draw((GX_WIDGET *)slider); |
104 |
|
163 |
} |
105 |
|
|
|