1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* |
4 |
|
|
* This program and the accompanying materials are made available under the |
5 |
|
|
* terms of the MIT License which is available at |
6 |
|
|
* https://opensource.org/licenses/MIT. |
7 |
|
|
* |
8 |
|
|
* SPDX-License-Identifier: MIT |
9 |
|
|
**************************************************************************/ |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
/**************************************************************************/ |
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/** */ |
15 |
|
|
/** GUIX Component */ |
16 |
|
|
/** */ |
17 |
|
|
/** Scroll Management (Scroll) */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
|
21 |
|
|
#define GX_SOURCE_CODE |
22 |
|
|
|
23 |
|
|
/* Include necessary system files. */ |
24 |
|
|
|
25 |
|
|
#include "gx_api.h" |
26 |
|
|
#include "gx_system.h" |
27 |
|
|
#include "gx_canvas.h" |
28 |
|
|
#include "gx_context.h" |
29 |
|
|
#include "gx_widget.h" |
30 |
|
|
#include "gx_button.h" |
31 |
|
|
#include "gx_scrollbar.h" |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gx_scroll_thumb_draw PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION */ |
44 |
|
|
/* */ |
45 |
|
|
/* This service draws a scroll thumb. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* scroll_thumb Scroll thumb widget control */ |
50 |
|
|
/* block */ |
51 |
|
|
/* */ |
52 |
|
|
/* OUTPUT */ |
53 |
|
|
/* */ |
54 |
|
|
/* None */ |
55 |
|
|
/* */ |
56 |
|
|
/* CALLS */ |
57 |
|
|
/* */ |
58 |
|
|
/* _gx_context_pixelmap_get Retrieve pixelmap image */ |
59 |
|
|
/* _gx_widget_width_get Gets the width of the widget */ |
60 |
|
|
/* _gx_widget_height_get Gets the height of the widget */ |
61 |
|
|
/* _gx_canvas_pixelmap_draw Draw pixelmap */ |
62 |
|
|
/* */ |
63 |
|
|
/* CALLED BY */ |
64 |
|
|
/* */ |
65 |
|
|
/* Application Code */ |
66 |
|
|
/* GUIX Internal Code */ |
67 |
|
|
/* */ |
68 |
|
|
/* RELEASE HISTORY */ |
69 |
|
|
/* */ |
70 |
|
|
/* DATE NAME DESCRIPTION */ |
71 |
|
|
/* */ |
72 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
73 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
74 |
|
|
/* resulting in version 6.1 */ |
75 |
|
|
/* */ |
76 |
|
|
/**************************************************************************/ |
77 |
|
16904 |
VOID _gx_scroll_thumb_draw(GX_SCROLL_THUMB *thumb) |
78 |
|
|
{ |
79 |
|
16904 |
GX_WIDGET *widget = (GX_WIDGET *)thumb; |
80 |
|
|
GX_VALUE xpos; |
81 |
|
|
GX_VALUE ypos; |
82 |
|
|
GX_PIXELMAP *map; |
83 |
|
|
GX_VALUE widget_width; |
84 |
|
|
GX_VALUE widget_height; |
85 |
|
|
|
86 |
✓✓ |
16904 |
if (thumb -> gx_scroll_thumb_pixelmap) |
87 |
|
|
{ |
88 |
|
445 |
_gx_context_pixelmap_get(thumb -> gx_scroll_thumb_pixelmap, &map); |
89 |
|
|
|
90 |
✓✓ |
445 |
if (map) |
91 |
|
|
{ |
92 |
|
442 |
xpos = widget -> gx_widget_size.gx_rectangle_left; |
93 |
|
442 |
_gx_widget_width_get(widget, &widget_width); |
94 |
|
442 |
xpos = (GX_VALUE)(xpos + (widget_width - map -> gx_pixelmap_width) / 2); |
95 |
|
|
|
96 |
|
442 |
ypos = widget -> gx_widget_size.gx_rectangle_top; |
97 |
|
442 |
_gx_widget_height_get(widget, &widget_height); |
98 |
|
442 |
ypos = (GX_VALUE)(ypos + (widget_height - map -> gx_pixelmap_height) / 2); |
99 |
|
|
|
100 |
|
442 |
_gx_canvas_pixelmap_draw(xpos, ypos, map); |
101 |
|
|
} |
102 |
|
|
} |
103 |
|
|
else |
104 |
|
|
{ |
105 |
|
16459 |
_gx_widget_border_draw(widget, thumb -> gx_scroll_thumb_border_color, |
106 |
|
|
widget -> gx_widget_normal_fill_color, |
107 |
|
|
widget -> gx_widget_normal_fill_color, GX_TRUE); |
108 |
|
|
} |
109 |
|
16904 |
} |
110 |
|
|
|