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 |
|
|
/** Vertical 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_window.h" |
29 |
|
|
|
30 |
|
|
GX_CALLER_CHECKING_EXTERNS |
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gxe_vertical_list_create PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function checks for errors in the vertical list create */ |
45 |
|
|
/* function call. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* vertical_list Vertical list control block */ |
50 |
|
|
/* name Name of vertical list */ |
51 |
|
|
/* parent Pointer to parent widget */ |
52 |
|
|
/* total_rows Total number of rows in */ |
53 |
|
|
/* vertical list */ |
54 |
|
|
/* callback User-specified Callback */ |
55 |
|
|
/* function */ |
56 |
|
|
/* style Style of scrollbar widget */ |
57 |
|
|
/* vertical_list_id Application-defined ID of */ |
58 |
|
|
/* vertical list */ |
59 |
|
|
/* size Dimensions of vertical list */ |
60 |
|
|
/* vertical_list_control_block_size Size of the vertical list */ |
61 |
|
|
/* control block */ |
62 |
|
|
/* */ |
63 |
|
|
/* OUTPUT */ |
64 |
|
|
/* */ |
65 |
|
|
/* status Completion status */ |
66 |
|
|
/* */ |
67 |
|
|
/* CALLS */ |
68 |
|
|
/* */ |
69 |
|
|
/* _gx_vertical_list_create Actual vertical list create */ |
70 |
|
|
/* function */ |
71 |
|
|
/* */ |
72 |
|
|
/* CALLED BY */ |
73 |
|
|
/* */ |
74 |
|
|
/* Application Code */ |
75 |
|
|
/* */ |
76 |
|
|
/**************************************************************************/ |
77 |
|
610 |
UINT _gxe_vertical_list_create(GX_VERTICAL_LIST *vertical_list, GX_CONST GX_CHAR *name, |
78 |
|
|
GX_WIDGET *parent, INT total_rows, |
79 |
|
|
VOID (*callback)(GX_VERTICAL_LIST *, GX_WIDGET *, INT), |
80 |
|
|
ULONG style, USHORT vertical_list_id, GX_CONST GX_RECTANGLE *size, |
81 |
|
|
UINT vertical_list_control_block_size) |
82 |
|
|
{ |
83 |
|
|
UINT status; |
84 |
|
|
|
85 |
|
|
/* Check for appropriate caller. */ |
86 |
✓✓✓✓ ✓✓ |
610 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
87 |
|
|
|
88 |
|
|
/* Check for invalid input pointers. */ |
89 |
✓✓✓✓
|
608 |
if ((vertical_list == GX_NULL) || (size == GX_NULL)) |
90 |
|
|
{ |
91 |
|
2 |
return GX_PTR_ERROR; |
92 |
|
|
} |
93 |
|
|
|
94 |
✓✓ |
606 |
if (vertical_list_control_block_size != sizeof(GX_VERTICAL_LIST)) |
95 |
|
|
{ |
96 |
|
1 |
return(GX_INVALID_SIZE); |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
/* Check for id is created. */ |
100 |
✓✓ |
605 |
if (vertical_list -> gx_widget_type != 0) |
101 |
|
|
{ |
102 |
|
1 |
return(GX_ALREADY_CREATED); |
103 |
|
|
} |
104 |
|
|
|
105 |
|
|
/* Check for valid number of rows . */ |
106 |
✓✓ |
604 |
if (total_rows <= 0) |
107 |
|
|
{ |
108 |
|
1 |
return GX_INVALID_VALUE; |
109 |
|
|
} |
110 |
|
|
|
111 |
|
|
/* Check for invalid widget. */ |
112 |
✓✓✓✓
|
603 |
if (parent && (parent -> gx_widget_type == 0)) |
113 |
|
|
{ |
114 |
|
1 |
return GX_INVALID_WIDGET; |
115 |
|
|
} |
116 |
|
|
|
117 |
|
|
/* Call the actual vertical list create function. */ |
118 |
|
602 |
status = _gx_vertical_list_create(vertical_list, name, parent, total_rows, callback, style, vertical_list_id, size); |
119 |
|
|
|
120 |
|
|
/* Return completion status. */ |
121 |
|
602 |
return status; |
122 |
|
|
} |
123 |
|
|
|