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 
27 #include "gx_api.h"
28 #include "gx_widget.h"
29 #include "gx_window.h"
30 #include "gx_system.h"
31 #include "gx_drop_list.h"
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gx_drop_list_open                                  PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This service opens a drop list.                                     */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    drop_list                             Drop list control block       */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    status                                Completion status             */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    _gx_window_root_find                  Find the root window          */
58 /*    _gx_widget_resize                     Resize a widget               */
59 /*    _gx_vertical_list_children_position   Position the children for     */
60 /*                                          the vertical list             */
61 /*    _gx_widget_link                       Link the widget to its root   */
62 /*    _gx_system_focus_claim                Claim the input focus         */
63 /*                                                                        */
64 /*  CALLED BY                                                             */
65 /*                                                                        */
66 /*    _gx_drop_list_event_process                                         */
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 /**************************************************************************/
_gx_drop_list_open(GX_DROP_LIST * drop_list)77 UINT _gx_drop_list_open(GX_DROP_LIST *drop_list)
78 {
79 GX_WINDOW_ROOT   *root;
80 GX_WIDGET        *child;
81 GX_RECTANGLE      size;
82 GX_VERTICAL_LIST *list = &drop_list -> gx_drop_list_popup.gx_popup_list_list;
83 
84     if (list -> gx_widget_status & GX_STATUS_VISIBLE)
85     {
86         drop_list -> gx_drop_list_popup_open = GX_TRUE;
87         return(GX_SUCCESS);
88     }
89     _gx_window_root_find((GX_WIDGET *)drop_list, &root);
90 
91     size = drop_list -> gx_widget_size;
92     size.gx_rectangle_top = (GX_VALUE)(size.gx_rectangle_bottom + 1);
93     size.gx_rectangle_bottom = (GX_VALUE)(size.gx_rectangle_top + drop_list -> gx_drop_list_open_height);
94     _gx_widget_resize((GX_WIDGET *)list, &size);
95     _gx_vertical_list_children_position(list);
96     _gx_widget_link((GX_WIDGET *)drop_list -> gx_widget_parent, (GX_WIDGET *)list);
97 
98     _gx_vertical_list_selected_widget_get(list, &child);
99     if (child)
100     {
101         child -> gx_widget_style |= GX_STYLE_DRAW_SELECTED;
102     }
103 
104     drop_list -> gx_drop_list_popup_open = GX_TRUE;
105     _gx_system_focus_claim((GX_WIDGET *)list);
106 
107     return(GX_SUCCESS);
108 }
109 
110