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 /** Drop List (List) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26 #include "gx_api.h"
27 #include "gx_widget.h"
28 #include "gx_system.h"
29 #include "gx_drop_list.h"
30 #include "gx_context.h"
31 #include "gx_canvas.h"
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _gx_drop_list_background_draw PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Kenneth Maxwell, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function draws the background of drop list, which is a special */
46 /* type of widget. */
47 /* */
48 /* INPUT */
49 /* */
50 /* drop list Drop List control block */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* None */
55 /* */
56 /* CALLS */
57 /* */
58 /* _gx_widget_border_draw Draw the border */
59 /* _gx_context_pixelmap_get Retrieve pixelmap image */
60 /* _gx_widget_border_width_get Get the border width */
61 /* _gx_widget_client_get Find the client area of a */
62 /* widget */
63 /* _gx_canvas_pixelmap_tile Tile a pixelmap */
64 /* _gx_canvas_pixelmap_draw Draw a pixelmap */
65 /* _gx_widget_background_draw Draw widget background */
66 /* */
67 /* CALLED BY */
68 /* */
69 /* _gx_drop_list_draw */
70 /* */
71 /* RELEASE HISTORY */
72 /* */
73 /* DATE NAME DESCRIPTION */
74 /* */
75 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
76 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
77 /* resulting in version 6.1 */
78 /* */
79 /**************************************************************************/
_gx_drop_list_background_draw(GX_DROP_LIST * drop_list)80 VOID _gx_drop_list_background_draw(GX_DROP_LIST *drop_list)
81 {
82 GX_RESOURCE_ID pixelmap_id;
83 GX_PIXELMAP *map;
84 GX_VALUE xpos;
85 GX_VALUE ypos;
86 GX_WIDGET *widget;
87 GX_VALUE border_width;
88 GX_COLOR color;
89 GX_RECTANGLE client;
90
91 widget = (GX_WIDGET *)drop_list;
92 map = GX_NULL;
93 pixelmap_id = drop_list -> gx_drop_list_pixelmap;
94
95 if (pixelmap_id)
96 {
97 _gx_context_pixelmap_get(pixelmap_id, &map);
98 }
99
100 if (map)
101 {
102 _gx_widget_border_width_get(widget, &border_width);
103 color = widget -> gx_widget_normal_fill_color;
104 _gx_widget_border_draw(widget, GX_COLOR_ID_DEFAULT_BORDER, color, color, GX_TRUE);
105
106 if (drop_list -> gx_widget_style & GX_STYLE_TILE_BACKGROUND)
107 {
108 _gx_widget_client_get(widget, border_width, &client);
109 _gx_canvas_pixelmap_tile(&client, map);
110 }
111 else
112 {
113 xpos = (GX_VALUE)(widget->gx_widget_clip.gx_rectangle_left + border_width + 1);
114 ypos = (GX_VALUE)(widget->gx_widget_clip.gx_rectangle_top + border_width + 1);
115 _gx_canvas_pixelmap_draw(xpos, ypos, map);
116 }
117 }
118 else
119 {
120 _gx_widget_background_draw((GX_WIDGET *)drop_list);
121 }
122 }
123
124