• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HI_GV_SCROLLGRID_H
17 #define HI_GV_SCROLLGRID_H
18 #include "hi_gv_conf.h"
19 
20 #ifdef HIGV_USE_WIDGET_SCROLLGRID
21 /* add include here */
22 #include "hi_gv_resm.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #define HIGV_SCROLLGRID_COL_MAX 20
29 
30 typedef enum {
31     SCROLLGRID_COLTYPE_TXT = 0, /* text */
32     SCROLLGRID_COLTYPE_IMG, /* picture */
33     SCROLLGRID_COLTYPE_IMG_MEM,  /* memory picture */
34     SCROLLGRID_COLTYPE_BUTT
35 } HIGV_SCROLLGRID_COLTYPE_E;
36 
37 /*  The callback function is uded to convert string */
38 typedef HI_S32 (*HIGV_SCROLLGRID_CONV_CB)(HIGV_HANDLE scrollGridPara, HI_U32 cellCol, HI_U32 cell,
39     const HI_CHAR *srcStr, HI_CHAR *dstStr, HI_U32 length);
40 
41 typedef struct _HIGV_SCROLLGRID_COLATTR_S { /* the column attribute structure; */
42     HIGV_SCROLLGRID_COLTYPE_E Type; /* The type of column ; */
43     HI_U32 Top; /* The top position of cell */
44     HI_U32 Left; /* The top position of cell */
45     HI_U32 Width; /* The width of cell */
46     HI_U32 Height; /* The height of cell */
47     HI_U32 Align; /* The alignment of text */
48     HIGV_HANDLE hImage;  /*  The picture handle(only support the cloumn type is LIST_COLTYPE_IMG)
49                             */
50     HI_U32 FieldColIdxInDb;  /* The index in database corresponding column in scrollgrid */
51     HIGV_SCROLLGRID_CONV_CB ConvString;  /* The convert string callback */
52 } HIGV_SCROLLGRID_COLATTR_S;
53 
54 typedef enum _SCROLLGRID_DIRECTION_E {  /* Scroll direction */
55     SCROLLGRID_DIRECTION_HORI,      /* <Horizal direction */
56     SCROLLGRID_DIRECTION_VERT,  /* Vertical direction */
57     SCROLLGRID_DIRECTION_BUTT
58 } HIGV_SCROLLGRID_DIRECTION_E;
59 
60 typedef struct _HIGV_SCROLLGRID_STYLE_S {   /*  Layout structure */
61     HI_U32 RowNum; /* Row number in a page */
62     HI_U32 ColNum; /*  Column number in a page */
63     HI_U32 LeftMargin; /* left margin of the page */
64     HI_U32 RightMargin; /* Right margin of the page */
65     HI_U32 TopMargin; /* Up margin of the page */
66     HI_U32 BtmMargin; /* Bottom margin of the page */
67     HI_U32 RowSpace; /* The space of row */
68     HI_U32 ColSpace; /* The space of column */
69     HI_U32 HLHeight; /* The height of horizontal line */
70     HI_COLOR HLColor; /* The color of horizontal line  */
71     HI_U32 VLWidth; /* The width of vertical line */
72     HI_COLOR VLColor; /* The color of vertical line  */
73     HI_U32 FocusRectAnchor; /* The anchor position of focus item */
74     HI_U32 IsFocusAtBg; /* The focus is drawn at the background */
75     HI_U32 ImgDecIndex; /* The index of decode picture */
76     HI_U32 IsDynamicDecImg; /* Is Dynamic decode image */
77     HIGV_SCROLLGRID_DIRECTION_E Direction; /* Scroll direction */
78     HI_RESID FocusRectSkin;
79     HI_RESID FocusRectNormSkin;
80     HI_RESID replaceImage;
81 } HIGV_SCROLLGRID_STYLE_S;
82 
83 /*
84 * brief Initiatlize the scrollgird.
85 * attention : Set the head of scrollgrid and row num.
86 *
87 * param[in] scrollGridPara    Scrollgrid handle.
88 * param[in] style   Scrollgrid handle.
89 * param[in] colAttr Scrollgrid handle.
90 * param[in] cellColNum Scrollgrid handle.
91 * retval ::HI_SUCCESS
92 * retval ::HI_ERR_COMM_LOST
93 * retval ::HI_ERR_COMM_INVAL
94 * retval ::HI_ERR_COMM_NORES
95 */
96 HI_S32 HI_GV_ScrollGrid_Init(HIGV_HANDLE scrollGridPara, const HIGV_SCROLLGRID_STYLE_S *style,
97     const HIGV_SCROLLGRID_COLATTR_S *colAttr, HI_U32 cellColNum);
98 
99 /*
100 * brief Get the content of scrollgrid.
101 * param[in] scrollGridPara   Scrollgrid handle.
102 * param[in] cell   Cell.
103 * param[in] cellCol The column attribute of cell.
104 * param[out] value the content of cell.
105 * param[in] length String length.
106 * retval ::HI_SUCCESS
107 * retval ::HI_ERR_COMM_LOST Maybe the handle is invaldi or no data.
108 * retval ::HI_ERR_COMM_INVAL
109 */
110 HI_S32 HI_GV_ScrollGrid_GetCellValue(HIGV_HANDLE scrollGridPara, HI_U32 cell,
111     HI_U32 cellCol, HI_CHAR *value, HI_U32 length);
112 
113 /*
114 * brief Set the selected cell of the scrollgrid.
115 * attention : This api only support the current selected item.
116 *
117 * param[in] scrollGrid
118 * param[in] cell  Cell index.
119 * retval ::HI_SUCCESS
120 * retval ::HI_ERR_COMM_LOST
121 * retval ::HI_ERR_COMM_INVAL
122 * see ::HI_GV_ScrollGrid_GetSelCell
123 */
124 HI_S32 HI_GV_ScrollGrid_SetSelCell(HIGV_HANDLE scrollGridPara, HI_U32 cell);
125 
126 /*
127 * brief Get the selected of cell.
128 * param[in] scrollGridPara  Scrollgrid handle.
129 * param[out] cell Cell index.
130 * retval ::HI_SUCCESS
131 * retval ::HI_ERR_COMM_LOST
132 * retval ::HI_ERR_COMM_INVAL
133 * see ::HI_GV_ScrollGrid_SetSelCell
134 */
135 HI_S32 HI_GV_ScrollGrid_GetSelCell(HIGV_HANDLE scrollGridPara, HI_U32 *cell);
136 
137 /*
138 * brief Get the cell number of scrollgrid.
139 * param[in]  scrollGridPara  Scrollgrid handle.
140 * param[out] cellNum Cell number.
141 * retval ::HI_SUCCESS
142 * retval ::HI_ERR_COMM_LOST
143 * retval ::HI_ERR_COMM_INVAL
144 */
145 HI_S32 HI_GV_ScrollGrid_GetCellNum(HIGV_HANDLE scrollGridPara, HI_U32 *cellNum);
146 
147 /*
148 * brief Page up or page right.
149 * param[in]  scrollGridPara  Scrollgrid handle.
150 * retval ::HI_SUCCESS
151 * retval ::HI_ERR_COMM_LOST
152 * retval ::HI_ERR_COMM_INVAL
153 */
154 HI_S32 HI_GV_ScrollGrid_PageForward(HIGV_HANDLE scrollGridPara);
155 
156 /*
157 * brief Page up or page left.
158 * param[in]  scrollGridPara  Scrollgrid handle.
159 * retval ::HI_SUCCESS
160 * retval ::HI_ERR_COMM_LOST
161 * retval ::HI_ERR_COMM_INVAL
162 */
163 HI_S32 HI_GV_ScrollGrid_PageBackward(HIGV_HANDLE scrollGridPara);
164 
165 /*
166 * brief Back to origin.
167 * param[in]  scrollGridPara  Scrollgrid handle.
168 * retval ::HI_SUCCESS
169 * retval ::HI_ERR_COMM_LOST
170 * retval ::HI_ERR_COMM_INVAL
171 */
172 HI_S32 HI_GV_ScrollGrid_MoveToOrigin(HIGV_HANDLE scrollGridPara);
173 
174 /*
175 * brief Move to last.
176 * param[in]  scrollGridPara  Scrollgrid handle.
177 * retval ::HI_SUCCESS
178 * retval ::HI_ERR_COMM_LOST
179 * retval ::HI_ERR_COMM_INVAL
180 */
181 HI_S32 HI_GV_ScrollGrid_MoveToLast(HIGV_HANDLE scrollGridPara);
182 
183 /*
184 * brief Set the attribute of scrollgird.
185 * param[in]  scrollGridPara  ScrollGrid handle.
186 * param[in]  horizontalLineHeight  The height of horizontal line.
187 * param[in]  horizontalLineColor  The color of horizontal line.
188 * param[in]  verticalLineWidth The width of vertical line.
189 * param[in]  verticalLineColor  The color of vertical line.
190 * retval ::HI_SUCCESS
191 * retval ::HI_ERR_COMM_LOST
192 * retval ::HI_ERR_COMM_INVAL
193 * see ::HI_GV_ScrollGrid_GetGridding
194 */
195 HI_S32 HI_GV_ScrollGrid_SetGridding(HIGV_HANDLE scrollGridPara, HI_U32 horizontalLineHeight,
196     HI_COLOR horizontalLineColor, HI_U32 verticalLineWidth, HI_COLOR verticalLineColor);
197 
198 /*
199 * brief Get the attribute of scrollgird.
200 * param[in]  scrollGridPara  ScrollGrid handle.ؼ
201 * param[out]  horizontalLineHeight The height of horizontal line.
202 * param[out]  horizontalLineColor  The color of horizontal line.
203 * param[out]  verticalLineWidth  The width of vertical line.
204 * param[out]  verticalLineColor  The color of vertical line.
205 * retval ::HI_SUCCESS
206 * retval ::HI_ERR_COMM_LOST
207 * retval ::HI_ERR_COMM_INVAL
208 * see::HI_GV_ScrollGrid_SetGridding
209 */
210 HI_S32 HI_GV_ScrollGrid_GetGridding(HIGV_HANDLE scrollGridPara, HI_U32 *horizontalLineHeight,
211     HI_COLOR *horizontalLineColor, HI_U32 *verticalLineWidth, HI_COLOR *verticalLineColor);
212 
213 /*
214 * brief Get touch diff.
215 * param[in]  scrollGridPara  Scrollgrid handle.
216 * param[out]  diff  diff distance.
217 * retval ::HI_SUCCESS
218 * retval ::HI_ERR_COMM_LOST
219 * retval ::HI_ERR_COMM_INVAL
220 */
221 HI_S32 HI_GV_ScrollGrid_GetTouchDiff(HIGV_HANDLE scrollGridPara, HI_S32 *diff);
222 
223 /*
224 * brief Set content location.
225 * param[in]  scrollGridPara  Scrollgrid handle.
226 * param[in]  diff  diff distance.
227 * retval ::HI_SUCCESS
228 * retval ::HI_ERR_COMM_LOST
229 * retval ::HI_ERR_COMM_INVAL
230 */
231 HI_S32 HI_GV_ScrollGrid_Adjust(HIGV_HANDLE scrollGridPara, HI_S32 diff);
232 
233 /*
234 * brief Set gesture enable.
235 * param[in]  scrollGridPara  Scrollgrid handle.
236 * param[in]  enable   Is enable gesture.
237 * retval ::HI_SUCCESS
238 * retval ::HI_ERR_COMM_LOST
239 * retval ::HI_ERR_COMM_INVAL
240 */
241 HI_S32 HI_GV_ScrollGrid_EnableGesture(HIGV_HANDLE scrollGridPara, HI_BOOL enable);
242 
243 /*
244 * brief Get gesture enable.
245 * param[in]  scrollGridPara  Scrollgrid handle.
246 * param[in]  enable   Is enable gesture.
247 * retval ::HI_SUCCESS
248 * retval ::HI_ERR_COMM_LOST
249 * retval ::HI_ERR_COMM_INVAL
250 */
251 HI_S32 HI_GV_ScrollGrid_IsGestureEnable(HIGV_HANDLE scrollGridPara, HI_BOOL *enable);
252 
253 /*
254 * brief Register scrollgrid widget.
255 * retval ::HI_SUCCESS
256 * retval ::HI_ERR_COMM_LOST
257 * retval ::HI_ERR_COMM_INVAL
258 */
259 HI_S32 HI_GV_ScrollGrid_RegisterWidget(HI_VOID);
260 
261 #ifdef __cplusplus
262 }
263 #endif
264 #endif /* HI_GV_LIST_H */
265 #endif
266