comparison src/aci2/bmi/mmiWindow.c @ 120:3c2acfa1a72f

src/aci2/bmi: file renames to make filename case consistent
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 07 Oct 2016 03:46:05 +0000
parents src/aci2/bmi/mmiwindow.c@93999a60b835
children
comparison
equal deleted inserted replaced
119:b92a33c204b6 120:3c2acfa1a72f
1
2 /*******************************************************************************
3
4 TI (Shanghai)
5
6 ********************************************************************************
7
8 This software product is the property of TI (Shanghai) Ltd and may not be
9 disclosed to any third party without the express permission of the owner.
10
11 ********************************************************************************
12
13 $Project name: TISHMMI Project
14 $Project code: BMI (6349)
15 $Module: MMI
16 $File: MmiWindow.c
17 $Revision: 1.0
18
19 $Author: Yan Bin(bin-yan@ti.com)
20 $Date: 28/08/03
21
22 ********************************************************************************
23
24 Description:
25
26 This module provides definitions of the types and
27 constants which are shared across the MMI window
28 application modules.
29
30 ********************************************************************************
31 $History: MmiWindow.c
32
33 CRR 23959: xpradipg 26 Aug 2004
34 Description: List not updated after deleting the messages in Unsent/Inbox folder
35 Solution: The list is refreshed everytime the user returns from the options menu
36
37 13 Aug 2004 xreddymn: Extended MFW to support Suspend and Resume of third-party applications
38 28/08/03 Original TI(Shanghai) BMI version.
39
40 $End
41
42 *******************************************************************************/
43 #define MMI_MMIWINDOW_C
44
45 #define ENTITY_MFW
46
47 /* includes */
48 #include <string.h>
49 #include <stdio.h>
50 #include <stdlib.h>
51 #include <stdarg.h>
52
53 #if defined (NEW_FRAME)
54
55 #include "typedefs.h"
56 #include "vsi.h"
57 #include "pei.h"
58 #include "custom.h"
59 #include "gsm.h"
60
61 #else
62
63 #include "STDDEFS.H"
64 #include "custom.h"
65 #include "gsm.h"
66 #include "vsi.h"
67
68 #endif
69 #include "prim.h"
70
71
72 #include "mfw_mfw.h"
73 #include "mfw_win.h"
74 #include "mfw_kbd.h"
75 #include "mfw_edt.h"
76 #include "mfw_tim.h"
77 #include "mfw_phb.h"
78 #include "ksd.h"
79 #include "psa.h"
80 #include "mfw_sms.h"
81 #include "mfw_smsi.h"
82 #include "mfw_icn.h"
83 #include "mfw_mnu.h"
84 #include "mfw_lng.h"
85 #include "mfw_sat.h"
86 #include "mfw_kbd.h"
87 #include "mfw_nm.h"
88
89 #include "psa_util.h"
90
91 #include "dspl.h"
92 // #include "unicode_types.h"
93
94 #include "MmiMain.h"
95 #include "MmiDummy.h"
96 //#include "MmiLists.h"
97 #include "MmiMmi.h"
98 #include "mmiCall.h"//GW 29/11/01 for 'callNumber'
99
100 #include "MmiDialogs.h"
101 #include "MmiLists.h"
102 #include "MmiMenu.h"
103 #include "MmiSoftKeys.h"
104 //#include "MmiEditor.h"
105 #include "MmiBookShared.h" // MZ
106 #include "mfw_ffs.h"
107 #include "mmiwindow.h"
108
109 #include "cus_aci.h"
110
111 #include "prim.h"
112 #ifndef PCM_2_FFS
113 #include "pcm.h"
114 #endif
115
116
117 #include "aci_cmh.h" //GW 29/11/01 added for types in aci_fd.h
118 #include "aci_fd.h" //GW 29/11/01 added for types in 'cmh.h'
119 #include "cmh.h" //GW 29/11/01 added for types in 'cmh_phb.h'
120 #include "cmh_phb.h" //GW 29/11/01 added for cmhPHB_getAdrStr
121
122 #include "mmiColours.h"
123
124 //GW 29/11/01 - added header file - removed extern void callNumber(UBYTE* number);
125 extern MfwWin* getWinData( MfwHnd win);
126
127 /*********************************************************************
128
129 DYNAMIC MENU WINDOW. DECLARATION
130
131 **********************************************************************/
132 //CRR 23959 - xpradipg 26 Aug 2004
133 //moved the structure declaration to mmiwindow.h
134
135 static T_MMIWINDOW* getUserData_T_MMIWINDOW( T_MFW_WIN *win)
136 {
137 if (win == NULL)
138 return (NULL);
139 return((T_MMIWINDOW *)win->user);
140 }
141
142
143 /*******************************************************************************
144
145 $Function: MMIWindow_win_cb
146
147 $Description: Window callback function of the MMI window
148
149 $Returns: none
150
151 $Arguments: w - mfw window handler
152 e - mfw event
153
154 *******************************************************************************/
155
156 static int MMIWindow_win_cb (MfwEvt e, MfwWin *w)
157 {
158 T_MMIWINDOW* data = (T_MMIWINDOW *)w->user;
159 TRACE_FUNCTION ("MMIWindow_win_cb()");
160 switch (e)
161 {
162 case MfwWinVisible: /* window is visible */
163 SEND_EVENT(data->win,MWM_ONDRAW,0,0 );
164 break;
165
166 /* xreddymn Aug-09-2004, MMI-SPR-23964 (TII_MMS33)
167 * Implemented suspend and resume functionality for MFW windows
168 * The following code posts SUSPEND event
169 */
170 case MfwWinSuspend: /* window is suspended */
171 SEND_EVENT(data->win,MWM_SUSPEND,0,0 );
172 break;
173
174 /* xreddymn Aug-09-2004, MMI-SPR-23964 (TII_MMS33)
175 * Implemented suspend and resume functionality for MFW windows
176 * The following code posts RESUME event
177 */
178 case MfwWinResume: /* window is resumed */
179 SEND_EVENT(data->win,MWM_RESUME,0,0 );
180 break;
181
182 case MfwWinFocussed: /* input focus / selected */
183 case MfwWinDelete: /* window will be deleted */
184 default:
185 return MFW_EVENT_REJECTED;
186 }
187 return MFW_EVENT_CONSUMED;
188 }
189
190
191 /*******************************************************************************
192
193 $Function: MMIWindow_kbd_cb
194
195 $Description: keyboard callback function for the MMI window
196
197 $Returns: execution status
198
199 $Arguments: e - event id
200 k - keyboard info
201 *******************************************************************************/
202
203 int MMIWindow_kbd_cb (MfwEvt e, MfwKbd *k)
204 /* SmsRead_R_OPT keyboard event handler */
205 {
206 T_MFW_HND win = mfwParent(mfw_header());
207 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
208 T_MMIWINDOW * data = (T_MMIWINDOW *)win_data->user;
209
210 TRACE_FUNCTION ("MMIWindow_kbd_cb()");
211
212 if (e & KEY_LONG)
213 {
214 switch (k->code)
215 {
216 case KCD_HUP: /* back to previous menu */
217 mnuEscape(data->menu);
218 break;
219 case KCD_RIGHT: /* Power Down */
220 return MFW_EVENT_REJECTED; /* handled by idle */
221 default: /* no response to all other keys */
222 return MFW_EVENT_CONSUMED;
223 }
224 }
225 else
226 {
227 switch (k->code)
228 {
229 case KCD_MNUUP: /* highlight previous entry */
230 mnuUp(data->menu);
231 break;
232 case KCD_MNUDOWN: /* highlight next entry */
233 mnuDown(data->menu);
234 break;
235 case KCD_MNUSELECT:
236 case KCD_LEFT: /* activate this entry */
237 mnuSelect(data->menu);
238 break;
239 case KCD_HUP: /* back to previous menu */
240 case KCD_RIGHT: /* back to previous menu */
241 mnuEscape(data->menu);
242 break;
243 default: /* no response to all other keys */
244 return MFW_EVENT_CONSUMED;
245 }
246 }
247 return MFW_EVENT_CONSUMED;
248 }
249
250
251
252 /*******************************************************************************
253
254 $Function: MMIWindow_mnu_cb
255
256 $Description: Menu callback function for the MMI window
257
258 $Returns: none
259
260 $Arguments: e - event id
261 m - menu handle
262 *******************************************************************************/
263
264 static int MMIWindow_mnu_cb (MfwEvt e, MfwMnu *m)
265
266 {
267 T_MFW_HND win = mfwParent(mfw_header());
268 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
269 T_MMIWINDOW * data = (T_MMIWINDOW *)win_data->user;
270
271 TRACE_FUNCTION ("MMIWindow_mnu_cb()");
272
273 switch (e)
274 {
275 case E_MNU_ESCAPE: /* back to previous menu */
276 MMI_DestoryWindow(data->win);
277 break;
278 default: /* in mnuCreate() only E_MNU_ESCAPE has been enabled! */
279 return MFW_EVENT_REJECTED;
280 }
281 return MFW_EVENT_CONSUMED;
282 }
283
284
285 GLOBAL_EXT T_MFW_HND MMI_CreateWindow(T_MFW_HND hWinParent,
286 T_DIALOG_FUNC win_exec_cb,
287 void * parameter,
288 MfwCb kbd_cb,
289 MfwMnuAttr *pMnuAttr,
290 unsigned long dwStyle)
291 {
292 T_MMIWINDOW* data = (T_MMIWINDOW *)ALLOC_MEMORY (sizeof (T_MMIWINDOW));
293 T_MFW_WIN * win;
294
295 TRACE_FUNCTION ("MMI_CreateWindow()");
296
297 memset(data,0,sizeof (T_MMIWINDOW));
298 /*
299 * Create window handler
300 */
301
302 /* xreddymn Aug-09-2004, MMI-SPR-23964 (TII_MMS33)
303 * Implemented suspend and resume functionality for MFW windows
304 * Subscribed for MfwWinSuspend and MfwWinResume events
305 */
306 data->win =win_create (hWinParent, 0, E_WIN_VISIBLE|MfwWinSuspend|MfwWinResume, (T_MFW_CB)MMIWindow_win_cb);
307 if (data->win EQ NULL)
308 {
309 return NULL;
310 }
311 /*
312 * connect the dialog data to the MFW-window
313 */
314
315 data->mmi_control.dialog = (T_DIALOG_FUNC)win_exec_cb;
316 data->mmi_control.data = data;
317 win = getWinData(data->win);
318 win->user = (void *)data;
319
320 data->parent = hWinParent;
321 data->id = 0;
322 data->info_win=0;
323
324 if(pMnuAttr)
325 {
326 //CRR 23959: xpradipg 26 Aug 2004
327 //Do not create the default kbd handler if there is one specified
328 if(!kbd_cb)
329 {
330 data->kbd = kbdCreate(data->win,KEY_ALL, (MfwCb)MMIWindow_kbd_cb);
331 data->kbd_long = kbdCreate(data->win,KEY_ALL|KEY_LONG,(MfwCb)MMIWindow_kbd_cb);
332 }
333 data->menu = mnuCreate(data->win,pMnuAttr, E_MNU_ESCAPE, (MfwCb)MMIWindow_mnu_cb);
334 mnuLang(data->menu,mainMmiLng);
335 /* put the (new) dialog window on top of the window stack */
336 mnuUnhide(data->menu);
337 }
338 //CRR 23959: xpradipg 26 Aug 2004
339 //check for the keyboard handler irrespective of the menu attribute presence
340 if(kbd_cb)
341 {
342 data->kbd = kbdCreate(data->win,KEY_ALL, (MfwCb)kbd_cb);
343 data->kbd_long = kbdCreate(data->win,KEY_ALL|KEY_LONG,(MfwCb)kbd_cb);
344 }
345
346
347 if (data->win NEQ NULL)
348 {
349 SEND_EVENT (data->win, MWM_CREATE, 0, (void *)parameter);
350 }
351
352 winShow(data->win);
353 return data->win;
354
355 }
356 GLOBAL_EXT T_MFW_HND MMI_DestoryWindow(T_MFW_HND hWin)
357 {
358 T_MFW_WIN * win_data;
359 T_MMIWINDOW* data;
360 USHORT i;
361
362 TRACE_FUNCTION ("MMI_DestoryWindow()");
363
364 if (hWin)
365 {
366 win_data = getWinData(hWin);
367 data = getUserData_T_MMIWINDOW(win_data);
368 SEND_EVENT (data->win, MWM_DESTORY, 0, (void *)0);
369 if (data)
370 {
371 /*
372 * Delete WIN handler
373 */
374
375 if (data->info_win)
376 {
377 SEND_EVENT(data->info_win,DIALOG_DESTROY,0,0 );
378 data->info_win = 0;
379 }
380 if (data->list_win){
381 SEND_EVENT(data->list_win,DIALOG_DESTROY,0,0 );
382 data->list_win = 0;
383 }
384 if (data->kbd)
385 {
386 kbd_delete(data->kbd);
387 data->kbd = 0;
388 }
389 if (data->kbd_long)
390 {
391 kbd_delete(data->kbd_long);
392 data->kbd_long = 0;
393 }
394 if (data->menu){
395 mnuDelete(data->menu);
396 data->menu=0;
397 }
398
399 win_delete (data->win);
400 FREE_MEMORY ((void *)data, sizeof (T_MMIWINDOW));
401
402 }else
403 {
404 TRACE_EVENT ("MMSBox_destory() called twice");
405 }
406 }
407 }
408
409 GLOBAL_EXT T_MFW_HND MMI_ParentWindow(T_MFW_HND hWin)
410 {
411 T_MFW_WIN * win_data;
412 T_MMIWINDOW* data;
413
414 TRACE_FUNCTION ("MMI_ParentWindow()");
415
416 if (hWin)
417 {
418 win_data = getWinData(hWin);
419 data = getUserData_T_MMIWINDOW(win_data);
420 return data->parent;
421 }
422 return NULL;
423 }
424
425 #undef MMI_MMIWINDOW_C
426
427