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 |
|
|
/** 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 |
|
|
/**************************************************************************/ |
71 |
|
544 |
UINT _gx_tree_view_create(GX_TREE_VIEW *tree, GX_CONST GX_CHAR *name, GX_WIDGET *parent, |
72 |
|
|
ULONG style, USHORT tree_menu_id, GX_CONST GX_RECTANGLE *size) |
73 |
|
|
{ |
74 |
|
|
|
75 |
|
|
/* Call the window create function. */ |
76 |
|
544 |
_gx_window_create((GX_WINDOW *)tree, name, GX_NULL, style, tree_menu_id, size); |
77 |
|
|
|
78 |
|
|
/* Populate the rest of the tree view control block - overriding as necessary. */ |
79 |
|
544 |
tree -> gx_widget_type = GX_TYPE_TREE_VIEW; |
80 |
|
544 |
tree -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_tree_view_event_process; |
81 |
|
544 |
tree -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_tree_view_draw; |
82 |
|
544 |
tree -> gx_window_scroll_info_get = (VOID (*)(struct GX_WINDOW_STRUCT *, ULONG, GX_SCROLL_INFO *))(void (*)(void))_gx_tree_view_scroll_info_get; |
83 |
|
544 |
tree -> gx_tree_view_collapse_pixelmap_id = 0; |
84 |
|
544 |
tree -> gx_tree_view_expand_pixelmap_id = 0; |
85 |
|
544 |
tree -> gx_tree_view_root_line_color = GX_COLOR_ID_SHADOW; |
86 |
|
544 |
tree -> gx_tree_view_indentation = 22; |
87 |
|
544 |
tree -> gx_tree_view_x_shift = 0; |
88 |
|
544 |
tree -> gx_tree_view_y_shift = 0; |
89 |
|
544 |
tree -> gx_tree_view_tree_width = 0; |
90 |
|
544 |
tree -> gx_tree_view_tree_height = 0; |
91 |
|
544 |
tree -> gx_tree_view_selected = GX_NULL; |
92 |
|
|
|
93 |
|
|
/* Determine if a parent widget was provided. */ |
94 |
✓✓ |
544 |
if (parent) |
95 |
|
|
{ |
96 |
|
542 |
_gx_widget_link(parent, (GX_WIDGET *)tree); |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
/* Return completion status code. */ |
100 |
|
544 |
return(GX_SUCCESS); |
101 |
|
|
} |
102 |
|
|
|