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 /**   Tree View Management (Tree View)                                    */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_window.h"
29 #include "gx_widget.h"
30 #include "gx_tree_view.h"
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_tree_view_create                                PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function creates an tree view.                                 */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    tree                                  Pointer to the tree view      */
49 /*                                            control block               */
50 /*    name                                  Name of the tree view         */
51 /*    parent                                Parent widget control block   */
52 /*    style                                 Style of the widget           */
53 /*    tree_menu_id                          Application-defined ID of     */
54 /*                                          the tree view                 */
55 /*    size                                  Tree view size                */
56 /*                                                                        */
57 /*  OUTPUT                                                                */
58 /*                                                                        */
59 /*    status                                Completion status             */
60 /*                                                                        */
61 /*  CALLS                                                                 */
62 /*                                                                        */
63 /*    _gx_window_create                     Create a window               */
64 /*    _gx_widget_link                       Link a widget to its parent   */
65 /*                                                                        */
66 /*  CALLED BY                                                             */
67 /*                                                                        */
68 /*    Application Code                                                    */
69 /*                                                                        */
70 /*  RELEASE HISTORY                                                       */
71 /*                                                                        */
72 /*    DATE              NAME                      DESCRIPTION             */
73 /*                                                                        */
74 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
75 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
76 /*                                            fixed compiler warnings,    */
77 /*                                            resulting in version 6.1    */
78 /*                                                                        */
79 /**************************************************************************/
_gx_tree_view_create(GX_TREE_VIEW * tree,GX_CONST GX_CHAR * name,GX_WIDGET * parent,ULONG style,USHORT tree_menu_id,GX_CONST GX_RECTANGLE * size)80 UINT  _gx_tree_view_create(GX_TREE_VIEW *tree, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
81                            ULONG style, USHORT tree_menu_id, GX_CONST GX_RECTANGLE *size)
82 {
83 
84     /* Call the window create function.  */
85     _gx_window_create((GX_WINDOW *)tree, name, GX_NULL, style, tree_menu_id, size);
86 
87     /* Populate the rest of the tree view control block - overriding as necessary.  */
88     tree -> gx_widget_type = GX_TYPE_TREE_VIEW;
89     tree -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_tree_view_event_process;
90     tree -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_tree_view_draw;
91     tree -> gx_window_scroll_info_get = (VOID (*)(struct GX_WINDOW_STRUCT *, ULONG, GX_SCROLL_INFO *))(void (*)(void))_gx_tree_view_scroll_info_get;
92     tree -> gx_tree_view_collapse_pixelmap_id = 0;
93     tree -> gx_tree_view_expand_pixelmap_id = 0;
94     tree -> gx_tree_view_root_line_color = GX_COLOR_ID_SHADOW;
95     tree -> gx_tree_view_indentation = 22;
96     tree -> gx_tree_view_x_shift = 0;
97     tree -> gx_tree_view_y_shift = 0;
98     tree -> gx_tree_view_tree_width = 0;
99     tree -> gx_tree_view_tree_height = 0;
100     tree -> gx_tree_view_selected = GX_NULL;
101 
102     /* Determine if a parent widget was provided.  */
103     if (parent)
104     {
105         _gx_widget_link(parent, (GX_WIDGET *)tree);
106     }
107 
108     /* Return completion status code. */
109     return(GX_SUCCESS);
110 }
111 
112