gui_picker.h
11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
/*******************************************************************************
* Modification Notice:
* --------------------------
* This software is modified by MediaTek Inc. and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*******************************************************************************/
/*******************************************************************************
* Filename:
* ---------
* gui_picker.h
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
* Picker CP
*
* Author:
* -------
* -------
*
*------------------------------------------------------------------------------
* $Log$
*
* 12 19 2013 renxiao.zeng
* removed!
* .
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================
*******************************************************************************/
#include "MMI_features.h"
#ifdef __MMI_UI_TIME_PICKER__
#include "MMIDataType.h"
#include "gdi_const.h"
#include "gdi_datatype.h"
#include "gui_data_types.h"
#include "gui.h"
#include "gui_typedef.h"
#include "gui_inputs.h"
#include "ImeGprot.h"
#include "ImeGprotEnums.h"
#include "mmi_rp_app_uiframework_def.h"
#ifndef __GUI_PICKER_H__
#define __GUI_PICKER_H__
/*****************************************************************************
* Define
*****************************************************************************/
#define GUI_PICKER_BORDER_GAP (2)
#define GUI_PICKER_MAX_BIT (5) //must be less than this
#define GUI_PICKER_MAX_NUM (10000) //must be less than this
#define GUI_PICKER_TEXT_BUFFER_SIZE ((GUI_PICKER_MAX_BIT+7)/8*8)
#define GUI_PICKER_TEXT_X_OFFSET (4)
#define GUI_PICKER_INVALID_INDEX (-1)
#define GUI_PICKER_INVALID_NUM (-1)
//for cosmos style picker
#define GUI_PICKER_9_SLICE_BG_LEFT (6)
#define GUI_PICKER_9_SLICE_BG_TOP (32)//(44)
#define GUI_PICKER_9_SLICE_BG_RIGHT (7)
#define GUI_PICKER_9_SLICE_BG_BOTTOM (10)//(22)
#define GUI_PICKER_SHADOWN_HEIGHT (18)
#define GUI_PICKER_ARROW_WIDTH (13)
#define GUI_PICKER_ARROW_HEIGHT (27)
#define GUI_PICKER_COLUMNE_GAP (1)
#define GUI_PICKER_NUMBER_X_OFFSET (30)
#define GUI_PICKER_SHADOW_HEIGHT (18)
#define GUI_PICKER_TEXT_COLOR_GRAY gui_color(178, 178, 178)
#define GUI_PICKER_TEXT_COLOR_THIN_BLACK gui_color(100, 100, 100)
#define GUI_PICKER_TEXT_COLOR_WHITE gui_color(255, 255, 255)
#define GUI_PICKER_TEXT_COLOR_BLACK gui_color(0, 0, 0)
#define GUI_PICKER_TEXT_COLOR_BLUE gui_color(0, 192, 255)
#define GUI_PICKER_MAX_COLUMN (3) //max column in a picker
#define GUI_PICKER_MAX_DISPLAY_ROW (5)
#define __GUI_PICKER_SSP_AUTO_FREE_RUN__
//SSP
#define GUI_PICKER_SSP_TIMER_DELAY (100)
#define GUI_PICKER_SSP_RECOVER_STEP (20)
#define GUI_PICKER_SSP_REDUCING_FACTOR (0.2)
#define GUI_PICKER_SSP_FREE_RUN_SPEED (60)
#ifdef __GUI_PICKER_SSP_AUTO_FREE_RUN__
#define GUI_PICKER_SSP_FREE_RUN_THRESHOLD (10) //when move diff lager than this, auto free run
#define GUI_PICKER_SSP_TIME_THRESHOLD (300) //when time less than this, auto free run
#define GUI_PICKER_SSP_STOP_THRESHOLD (20) //when speed less than this, stop free run
#endif
#define __RANFOW_TUNING__
#ifdef __RANFOW_TUNING__
#define PICKER_TUNING_LOOP (1) //picker can loop
#define PICKER_TUNING_DIALER_SHOW_MATRIX (2)
#endif //__RANFOW_TUNING__
#define GUI_PICKER_NO_ERROR (0)
#define GUI_PICKER_ERROR_WRONG_TYPE (-1)
#define GUI_PICKER_ERROR_WRONG_STYLE (-2)
typedef enum
{
GUI_PICKER_SSP_STATE_NONE,
GUI_PICKER_SSP_STATE_HOLD,
GUI_PICKER_SSP_STATE_MOVE,
GUI_PICKER_SSP_STATE_FREE_RUN, //no use in picker now
GUI_PICKER_SSP_STATE_RECOVER
} gui_picker_ssp_state;
typedef enum
{
GUI_PICKER_NUM_COLOR_WHITE,
GUI_PICKER_NUM_COLOR_BLACK,
GUI_PICKER_NUM_COLOR_MAX
} gui_picker_num_color;
typedef enum
{
GUI_PICKER_TYPE_DATE, //there will be three pages
GUI_PICKER_TYPE_YEAR,
GUI_PICKER_TYPE_MONTH_AND_DAY,
GUI_PICKER_TYPE_TIME,
GUI_PICKER_TYPE_MAX
} gui_picker_type;
typedef enum
{
GUI_PICKER_SWITCH_TYPE_LEFT,
GUI_PICKER_SWITCH_TYPE_RIGHT,
GUI_PICKER_SWITCH_TYPE_UP,
GUI_PICKER_SWITCH_TYPE_DOWN,
GUI_PICKER_SWITCH_TYPE_MAX
} gui_picker_switch_type;
typedef enum
{
GUI_PICKER_HINT_POSITION_CLOSE_TO_CENTER, //hint will be close to center
GUI_PICKER_HINT_POSITION_AUTO_BY_BOUND //hint will has the same bound as center, and auto position
} gui_picker_hint_position_type;
typedef enum
{
GUI_PICKER_STYLE_START,
GUI_PICKER_STYLE_COSMOS = GUI_PICKER_STYLE_START,
GUI_PICKER_STYLE_END = GUI_PICKER_STYLE_COSMOS,
} gui_picker_style;
#ifdef __MMI_TOUCH_SCREEN__
typedef enum
{
GUI_PICKER_PEN_STATUS_NONE,
GUI_PICKER_PEN_STATUS_DOWN_IN_BOUND,
GUI_PICKER_PEN_STATUS_DOWN_IN_VISIBLE,
GUI_PICKER_PEN_STATUS_MAX
} gui_picker_pen_status;
#endif //__MMI_TOUCH_SCREEN__
typedef U16 (*gui_picker_get_switch_func_ptr)(U16 current_value, gui_picker_switch_type switch_type, U8 switch_offset);
typedef struct
{
U8 column;
U8 line_height;
U8 bit[GUI_PICKER_MAX_COLUMN];
U16 number[GUI_PICKER_MAX_COLUMN];
gui_picker_get_switch_func_ptr get_switch_func[GUI_PICKER_MAX_COLUMN];
gui_bound column_bound[GUI_PICKER_MAX_COLUMN];
U16 column_name_id[GUI_PICKER_MAX_COLUMN];
} gui_picker_number_struct;
typedef struct
{
gui_picker_type type;
gui_picker_style style;
} gui_picker_header;
typedef struct
{
gui_picker_header header;
U8 display_row; //how many row to display(the center will always be selected, it must be odd)
U16 min_year;
U16 max_year;
U16 current_year;
U8 month;
U8 day;
} gui_picker_date_struct;
typedef struct
{
gui_picker_header header;
U8 display_row; //how many row to display(the center will always be selected, it must be odd)
U16 min_year;
U16 max_year;
U16 current_year;
} gui_picker_year_struct;
typedef struct
{
gui_picker_header header;
MMI_BOOL two_page; //whether divide to two page
U8 display_row; //how many row to display(the center will always be selected, it must be odd)
U8 month;
U8 day;
} gui_picker_month_and_day_struct;
typedef struct
{
gui_picker_header header;
MMI_BOOL two_page; //whether divide to two page
U8 display_row; //how many row to display(the center will always be selected, it must be odd)
U8 hour;
U8 minute;
} gui_picker_time_struct;
#define GUI_PICKER_STRUCT_MAX_SIZE ((sizeof(gui_picker_date_struct)+31)/32*32)
typedef struct
{
#ifdef __RANFOW_TUNING__
U8 inject_index;
#endif //__RANFOW_TUNING__
U8 highlight_index; //current highlight index
#ifdef __MMI_TOUCH_SCREEN__
S16 pos_offset;
U32 pen_down_time;
#ifdef __GUI_PICKER_SSP_AUTO_FREE_RUN__
float ssp_speed;
#endif
gui_picker_pen_status pen_status;
mmi_pen_point_struct pen_down_pos;
mmi_pen_point_struct last_pen_move_pos;
#endif //__MMI_TOUCH_SCREEN__
gui_bound effective_bound;
gui_bound original_bound;
gui_picker_ssp_state ssp_state;
gui_picker_number_struct picker_number;
U8 user_data[GUI_PICKER_STRUCT_MAX_SIZE]; //provide memory for user
} gui_picker_context_struct;
/*****************************************************************************
* Extern Global Function
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* gui_picker_set_highlight
* DESCRIPTION
* Set picker highlight item (use for month&day or time)
* PARAMETERS
* highlight_index
* RETURNS
* void
*****************************************************************************/
extern void gui_picker_set_highlight(U8 highlight_index);
/*****************************************************************************
* FUNCTION
* gui_picker_get_user_data
* DESCRIPTION
* Get Picker user data
* PARAMETERS
* void
* RETURNS
* U8*
*****************************************************************************/
extern U8* gui_picker_get_user_data(void);
/*****************************************************************************
* FUNCTION
* gui_picker_create
* DESCRIPTION
* Create Picker
* PARAMETERS
* user_data [IN] it contains a gui picker struct
* bound [IN] the whole area picker in
* RETURNS
* U8 -- if error, will return error code
*****************************************************************************/
extern U8 gui_picker_create(U8* user_data, gui_bound bound);
/*****************************************************************************
* FUNCTION
* gui_picker_show
* DESCRIPTION
* Show Picker
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
extern void gui_picker_show(void);
/*****************************************************************************
* FUNCTION
* gui_picker_inject_string
* DESCRIPTION
* This function handle inject string. only available when __RANFOW_TUNING__ is defined
* PARAMETERS
* index
* RETURNS
* U8
*****************************************************************************/
extern U8 gui_picker_inject_string(U8 index);
#endif //__GUI_PICKER_H__
#endif //__MMI_UI_TIME_PICKER__