comparison g23m/condat/ms/src/bmi/MmiBookMenuWindow.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*******************************************************************************
2
3 CONDAT (UK)
4
5 ********************************************************************************
6
7 This software product is the property of Condat (UK) Ltd and may not be
8 disclosed to any third party without the express permission of the owner.
9
10 ********************************************************************************
11
12 $Project name: Basic MMI
13 $Project code: BMI (6349)
14 $Module: PhoneBook
15 $File: MmiBookMenuWindow.c
16 $Revision: 1.0
17
18 $Author: Condat(UK)
19 $Date: 25/10/00
20
21 ********************************************************************************
22
23 Description:
24
25 Menu handling for the phone book
26
27 ********************************************************************************
28 $History: MmiBookMenuWindow.c
29
30 Sep 01, 2005 REF: CRR 32707 x0021334
31 Description: Select Softkey dosen't work for the second time on choosing Volume option in Ringer menu
32 Fix: Select soft key operation in volume menu has been modified to fix this problem.
33
34 Apr 05, 2005 REF: ENH 29994 xdeepadh
35 Description: Implementation of Generic Midi Ringer and Modification of existing Midi Test Application
36 Solution: Generic Midi Ringer and Midi Test Application were implemented.
37
38 25/10/00 Original Condat(UK) BMI version.
39
40 $End
41
42 *******************************************************************************/
43
44 /*******************************************************************************
45
46 Include Files
47
48 *******************************************************************************/
49 #define ENTITY_MFW
50
51 /* includes */
52 #include <string.h>
53 #include <stdio.h>
54 #include <stdlib.h>
55
56 #if defined (NEW_FRAME)
57
58 #include "typedefs.h"
59 #include "vsi.h"
60 #include "pei.h"
61 #include "custom.h"
62 #include "gsm.h"
63
64 #else
65
66 #include "STDDEFS.H"
67 #include "custom.h"
68 #include "gsm.h"
69 #include "vsi.h"
70
71 #endif
72
73 #include "mfw_sys.h"
74
75 #include "mfw_mfw.h"
76 #include "mfw_win.h"
77 #include "mfw_kbd.h"
78 #include "mfw_lng.h"
79 /* SPR#1428 - SH - New Editor changes */
80 #ifndef NEW_EDITOR
81 #include "mfw_edt.h"
82 #endif
83 #include "mfw_icn.h"
84 #include "mfw_mnu.h"
85 #include "mfw_tim.h"
86
87 #include "mfw_sim.h"
88 #include "mfw_cm.h"
89 #include "mfw_nm.h"
90 #include "mfw_phb.h"
91 #include "mfw_mme.h"
92 #include "mfw_sat.h"
93 #include "mfw_sms.h"
94
95 #include "dspl.h"
96
97 #include "ksd.h"
98 #include "psa.h"
99
100 #include "MmiMain.h"
101 #include "MmiBookController.h"
102 #include "MmiDummy.h"
103 #include "MmiDialogs.h"
104 #include "MmiLists.h"
105 #include "mmiColours.h"
106
107
108 #include "MmiMenu.h"
109 #include "mmiCall.h"
110 #include "Mmiicons.h"
111 #include "MmiIdle.h"
112
113 #include "MmiSoftKeys.h"
114 #include "MmiSounds.h"
115 #include "MmiIdle.h"
116 #include "MmiNetwork.h"
117 #include "mmiSat_i.h"
118 #include "MmiAoc.h"
119
120 #include "gdi.h"
121 #include "audio.h"
122
123 #include "cus_aci.h"
124 #include "mfw_ffs.h"
125 #include "MmiTimers.h"
126
127 #include "MmiBookShared.h"
128 #include "MmiSettings.h" // for keypadlock
129 #include "MmiSounds.h"
130 #include "MmiIdle.h"
131
132 extern UBYTE HUPKeyOrigin; // Variable to indicate that long end key press is coming from menu
133
134 /*******************************************************************************
135 External Function Prototype
136
137 *******************************************************************************/
138 /* Fix for the melody and volume settings. 3/4/01 MZ */
139 extern BOOL getScrollSelectMenuItem(void);
140 extern clearScrollSelectMenuItem(void);
141 extern void volMenuItemSelected(void);
142 extern USHORT getSoundsReason(void);
143 extern void startRingerVolSettingInactivityTimer(void);
144 extern void stopRingerVolSettingInactivityTimer(void);
145 extern void restartVolSettingInactivityTimer(void);
146 //Apr 05, 2005 REF: ENH 29994 xdeepadh
147 #ifdef FF_MIDI_RINGER
148 extern MfwHnd hPlayerStartTimer; /* timeout till start of midi file */
149 #endif
150
151 /*******************************************************************************
152
153 Private Methods
154
155 *******************************************************************************/
156
157
158
159 /*******************************************************************************
160
161 $Function: bookMenuMenuCB
162
163 $Description: Menu handler for the menu window
164
165 $Returns: MFW_EVENT_CONSUMED if event handled, otherwise
166 MFW_EVENT_PASSED
167
168 $Arguments: e, event, m, menu handle
169
170 *******************************************************************************/
171
172 static int bookMenuMenuCB( MfwEvt e, MfwMnu *m )
173 {
174 T_MFW_HND window = mfwParent( mfw_header() );
175 T_MFW_WIN *win_data = ((T_MFW_HDR *)window)->data;
176 tBookStandard *data = (tBookStandard *) win_data->user;
177
178 TRACE_FUNCTION( "bookMenuMenuCB()" );
179
180 /* We only handle the ESCAPE event in here
181 */
182 switch( e )
183 {
184 case E_MNU_ESCAPE:
185 {
186 /* Escape requested, we need to shut down this window
187 */
188 if (data->Callback)
189 (data->Callback) (data->parent_win, NULL, NULL);
190 bookMenuDestroy( window );
191 stopRingerVolSettingInactivityTimer();
192 }
193 break;
194
195 default:
196 {
197 /* unknown event, pass it up the tree for handling elsewhere
198 */
199 return MFW_EVENT_PASSED;
200 }
201 /* break; */ /* RAVI */
202 }
203
204 /* We got here, event handled, prevent anyone else
205 dealing with it
206 */
207 return MFW_EVENT_CONSUMED;
208 }
209
210
211
212
213
214
215 /*******************************************************************************
216
217 $Function: bookMenuDialog
218
219 $Description: Menu window dialog function
220
221 $Returns: none
222
223 $Arguments: win, window handle
224 event, event to be handled
225 value, not used
226 parameter, not used
227
228 *******************************************************************************/
229
230 void bookMenuDialog( T_MFW_HND win, USHORT event, SHORT value, void *parameter )
231 {
232 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data;
233 tBookStandard *data = (tBookStandard *) win_data->user;
234 /* MfwMnu *mnu; */ /* RAVI */
235
236 TRACE_FUNCTION( "bookMenuDialog()" );
237
238 /* The menu dialog function has to deal with initialisation
239 and responses from the PIN2 validation methods
240 */
241 switch( event )
242 {
243 case MENU_INIT:
244 {
245 /* On initialisation, we can create the menus and
246 display the window
247 */
248 data->menu = mnuCreate( data->win, (MfwMnuAttr *) parameter, E_MNU_ESCAPE, (MfwCb) bookMenuMenuCB );
249 mnuLang( data->menu, mainMmiLng );
250 mnuUnhide( data->menu );
251 winShow( data->win );
252
253 if (value EQ PhbkMainMenu)
254 {
255 // start the timer for the keypadlock
256 tim_start (data->menu_tim);
257 data->status_of_timer = FALSE;
258 }
259 else
260 {
261 data->status_of_timer = TRUE;
262 }
263 if(value == SettingVolume)
264 {
265 /*
266 The ringer volume settings dialog has been invoked, create and start the
267 4 second time out.
268 */
269 /* RAVI - 20-1-2006 */
270 #ifdef NEPTUNE_BOARD
271 setSoundsReason(SettingVolume);
272 #endif
273 /* END RAVI */
274 startRingerVolSettingInactivityTimer();
275 }
276
277 }
278 break;
279
280 case ADD_CALLBACK:
281 {
282 /* Change the callback from the default menu callback to one specified
283 * in parameter */
284 data->Callback = (T_VOID_FUNC)parameter;
285 }
286 break;
287
288 case DEFAULT_OPTION:
289 {
290 /* Highlight an option in the menu when it is opened. Parameter points to a UBYTE. */
291
292 mnuChooseVisibleItem(data->menu, *((UBYTE *)parameter));
293 }
294 break;
295
296 case PIN2_OK:
297 {
298 /* We have received a PIN2 authorisation, so we can execute the
299 the requested function
300 */
301
302 TRACE_EVENT("PIN2_OK: Should carry on to perform phonebook op");
303 (data->phbk->pin2_next)( data->phbk->menu, data->phbk->item);
304
305 }
306 break;
307 case E_MNU_ESCAPE:
308 {
309 /* Escape requested, we need to shut down this window
310 */
311 bookMenuDestroy( win);
312 }
313 break;
314 default:
315 {
316 /* In situations where a PIN2 abort is returned, we can handle it
317 as a default event, and just ignore it
318 */
319 TRACE_EVENT("PIN2 not OK");
320 }
321 break;
322 }
323 }
324
325
326
327 /*******************************************************************************
328
329 $Function: bookMenuTimCB
330
331 $Description: Menu tim handler
332
333 $Returns:
334
335 $Arguments:
336
337 *******************************************************************************/
338
339 static int bookMenuTimCB (T_MFW_EVENT event, T_MFW_TIM *tc)
340 {
341 T_MFW_HND window = mfwParent( mfw_header() );
342 T_MFW_WIN *win_data = ((T_MFW_HDR *)window)->data;
343 tBookStandard *data = (tBookStandard *) win_data->user;
344
345 data->status_of_timer = TRUE;
346
347 /* ADDED RAVI - 25-11-2005 */
348 return 0;
349 /* END RAVI */
350
351 }
352
353
354
355
356
357
358 /*******************************************************************************
359
360 $Function: bookMenuWindowCB
361
362 $Description: Menu window handler
363
364 $Returns: MFW_EVENT_CONSUMED if event handled, otherwise
365 MFW_EVENT_PASSED
366
367 $Arguments: e, event, m, window handle
368
369 *******************************************************************************/
370
371 static int bookMenuWindowCB( MfwEvt e, MfwWin *w )
372 {
373 tBookStandard * data = (tBookStandard *)w->user;
374 MfwMnu * mnu;
375
376 TRACE_FUNCTION( "bookMenuWindowCB()" );
377
378 if (!w)
379 return MFW_EVENT_PASSED;
380
381 switch( e )
382 {
383 case MfwWinVisible:
384 {
385 dspl_ClearAll(); // sbh - clear screen before update
386 mnu = (MfwMnu *) mfwControl( data->menu );
387
388 /*
389 **Check whether the data is valid, if not use 'sensible' default values
390 */
391 if (mnu)
392 {
393 if (mnu->curAttr)
394 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, mnu->curAttr->mnuColour);
395 else
396 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, COLOUR_LIST_SUBMENU);
397
398 }
399 else
400 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, COLOUR_LIST_SUBMENU);
401 }
402 break;
403
404 default:
405 {
406 /* unknown event, pass it up the tree for handling elsewhere
407 */
408 return MFW_EVENT_PASSED;
409 }
410 /* break; */ /* RAVI */
411 }
412
413 /* We got here, event handled, prevent anyone else
414 dealing with it
415 */
416 return MFW_EVENT_CONSUMED;
417 }
418
419
420
421
422
423
424 /*******************************************************************************
425
426 $Function: bookMenuKbdCB
427
428 $Description: tbd
429
430 $Returns: MFW_EVENT_CONSUMED always
431
432 $Arguments: e, event, k, key handle
433
434 *******************************************************************************/
435
436 static int bookMenuKbdCB( MfwEvt e, MfwKbd *k )
437 {
438 static BOOL storeSelectedItemToPcm=FALSE;
439 T_MFW_HND window = mfwParent( mfw_header() );
440 T_MFW_WIN *win_data = ((T_MFW_HDR *)window)->data;
441 tBookStandard *data = (tBookStandard *) win_data->user;
442 MfwMnu *mnu;
443 U8 keycode; /* SPR#1608 - SH */
444
445 TRACE_FUNCTION( "bookMenuKbdCB()" );
446
447 /* handle the keypress
448 */
449 switch (k->code)
450 {
451 case KCD_MNUUP:
452 {
453 // keypadLock will not activate anymore
454 data->status_of_timer = TRUE;
455 /* Update the window with the previous element
456 */
457 mnuUp( data->menu );
458 /*
459 Special case when setting up ringer volume, the current ringer
460 is played as user scrolls the volume settings Silent -> cresendo.
461 MZ.
462 */
463 /* RAVI - 20-1-2006 */
464 #ifdef NEPTUNE_BOARD
465 if (getSoundsReason () == SettingVolume)
466 {
467 volumeMenuScrollUp();
468 }
469 #endif
470 /* END RAVI */
471
472 if(getScrollSelectMenuItem() == TRUE ||(getSoundsReason() == SettingVolume) )
473 {
474 mnuSelect(data->menu);
475 /* Scroll up in volume setting */
476 restartVolSettingInactivityTimer();
477 }
478 }
479 break;
480
481 case KCD_MNUDOWN:
482 {
483 // keypadLock will not activate anymore
484 data->status_of_timer = TRUE;
485 /* Update the window with the next element
486 */
487 mnuDown( data->menu );
488
489 /*
490 Special case when setting up ringer volume, the current ringer
491 is played as user scrolls the volume settings Silent -> cresendo.
492 MZ.
493 */
494 /* RAVI - 20-1-2006 */
495 #ifdef NEPTUNE_BOARD
496 if (getSoundsReason () == SettingVolume)
497 {
498 volumeMenuScrollDown();
499 }
500 #endif
501 /* END RAVI */
502
503 if((getScrollSelectMenuItem() == TRUE) || (getSoundsReason() == SettingVolume))
504 {
505 mnuSelect(data->menu);
506 restartVolSettingInactivityTimer();
507 }
508
509 }
510 break;
511
512 case KCD_MNUSELECT:
513 case KCD_LEFT:
514 {
515 // keypadLock will not activate anymore
516 data->status_of_timer = TRUE;
517
518 // Select this element
519 mnuSelect( data->menu );
520 mnu = (MfwMnu *) mfwControl( data->menu );
521
522 if (mnu != NULL)
523 {
524 if (mnu->curAttr != NULL)
525 {
526 // API - 24-01-03 - 1606 - Soft Key updating add this win Focus check
527 if( winIsFocussed(window) )
528 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, mnu->curAttr->mnuColour);
529 }
530 }
531
532 // A volume or tone setting menu has been entered. MZ 2/4/01
533 if((getScrollSelectMenuItem() == TRUE) || (getSoundsReason() == SettingVolume))
534 {
535 TRACE_FUNCTION("@@@@ A volume or tone settin");
536
537 /*
538 First time pcm flag is false, subsequent selection of menu item
539 will select and terminate the volume settings menu. 3/4/01 MZ.
540 */
541 if(storeSelectedItemToPcm ==TRUE || getSoundsReason() == SettingVolume )
542 {
543 clearScrollSelectMenuItem();
544 volMenuItemSelected();
545 storeSelectedItemToPcm =FALSE;
546 mnuEscape( data->menu );
547 if(getSoundsReason() == SettingVolume)
548 {
549 setSoundsReason(SoundsNone);
550 stopRingerVolSettingInactivityTimer();
551 }
552 //Apr 05, 2005 REF: ENH 29994 xdeepadh
553 #ifdef FF_MIDI_RINGER
554 //Delete the timer for volume scrolling
555 if(hPlayerStartTimer!=NULL)
556 timDelete(hPlayerStartTimer);
557 #endif
558 break;
559 }
560 /*
561 Second time the left soft key is used, store the setting in pcm and terminate the
562 volume settings menu.
563 */
564 storeSelectedItemToPcm =TRUE;
565
566 }
567 }
568 break;
569
570 // POWER key takes us to idle screen.
571 case KCD_POWER:
572 data->status_of_timer = TRUE;
573
574 HUPKeyOrigin = 0; // sbh - we're coming from the menu screen, so don't shut down right away
575
576 //return to idle screen
577
578 if (data->Callback)
579 (data->Callback) (data->parent_win, NULL, NULL);
580
581 bookMenuDestroy(data->win);
582 stopRingerVolSettingInactivityTimer();
583
584 SEND_EVENT(idle_get_window(), IDLE_UPDATE, 0, 0);
585 break;
586
587 case KCD_RIGHT:
588 case KCD_HUP:
589 {
590 // keypadLock will not activate anymore
591 data->status_of_timer = TRUE;
592
593 // Sep 01, 2005 REF: CRR 32707 x0021334
594 // Set storeSelectedItemToPcm to FALSE to enable proper operation every time instead of
595 // handling it in alterate attempts.
596 storeSelectedItemToPcm = FALSE;
597
598 HUPKeyOrigin = 0; // sbh - we're coming from the menu screen, so don't shut down right away
599
600 /* get us out of here
601 */
602 mnuEscape( data->menu );
603 mnu = (MfwMnu *) mfwControl( data->menu );
604 if (mnu != NULL)
605 {
606 if (mnu->curAttr != NULL)
607 {
608 // API - 24-01-03 - 1606 - Soft Key updating add this win Focus check
609 if( winIsFocussed(window) )
610 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, mnu->curAttr->mnuColour);
611 }
612 }
613
614 // Return the menu scroll behavior to normal.
615 if(getScrollSelectMenuItem() == TRUE)
616 {
617 clearScrollSelectMenuItem();
618 }
619 /*
620 If user exits the volume settings menu from the Idle or Incoming call screen.
621 clear the soundsReason.
622 */
623 if(getSoundsReason() == SettingVolume)
624 {
625 /* RAVI - 20-1-2006 */
626 #ifdef NEPTUNE_BOARD
627 /* Restore the volume setting */
628 restorePreviousVolumeSetting ();
629 #endif
630 /* END RAVI */
631 stopRingerVolSettingInactivityTimer();
632 setSoundsReason(SoundsNone);
633 //Apr 05, 2005 REF: ENH 29994 xdeepadh
634 #ifdef FF_MIDI_RINGER
635 //Delete teh timer for volume scrolling
636 if(hPlayerStartTimer!=NULL)
637 timDelete(hPlayerStartTimer);
638 #endif
639 }
640
641 }
642 break;
643
644 case KCD_STAR:
645 {
646
647 /*
648 * Keypadlock will lock only
649 * within two seconds by press "*"
650 */
651
652 if(data->status_of_timer EQ FALSE)
653 {
654 TRACE_EVENT ("activate KEYpadLOCK");
655 mnuEscape( data->menu );
656 settingsKeyPadLockOn ();
657 }
658
659 /* SPR#1608 - SH - Otherwise, send '*' keypress to idle screen */
660
661 else if (window == data->phbk->menu_main_win)
662 {
663 /* Number key presses in phonebook menu returns user to idle screen,
664 add key press to Idle edit screen. */
665
666 keycode = k->code;
667
668 bookMenuDestroy(data->win);
669
670 SEND_EVENT(idle_get_window(), IDLE_START_DIALLING_NUMBER, 0, &keycode);
671 }
672 }
673 break;
674
675 case KCD_HASH:
676 {
677 /*
678 * Keypadlock will lock only
679 * within two seconds by press "*"
680 */
681 if(data->status_of_timer EQ FALSE)
682 {
683 TRACE_EVENT ("activate Silent mode");
684
685 if(FFS_flashData.settings_status & SettingsSilentMode)
686 {
687 settingsSilentModeOff();
688 }
689 else
690 {
691 settingsSilentModeOn();
692 }
693 mnuEscape( data->menu );
694 }
695
696 /* SPR#1608 - SH - Otherwise, send '#' keypress to idle screen */
697
698 else if (window == data->phbk->menu_main_win)
699 {
700 /* Number key presses in phonebook menu returns user to idle screen,
701 add key press to Idle edit screen. */
702
703 keycode = k->code;
704
705 bookMenuDestroy(data->win);
706
707 SEND_EVENT(idle_get_window(), IDLE_START_DIALLING_NUMBER, 0, &keycode);
708 }
709 }
710 break;
711
712 default:
713 {
714 TRACE_EVENT("bookMenuKbdCb - DEFAULT!");
715 /* SH - only allow dialling if we are in the main menu */
716 if (window == data->phbk->menu_main_win)
717 {
718 /* keypadLock will not activate anymore */
719 data->status_of_timer = TRUE;
720
721 /* Number key presses in phonebook menu returns user to idle screen,
722 add key press to Idle edit screen. */
723
724 keycode = k->code;
725
726 bookMenuDestroy(data->win);
727
728 if ((k->code>=KCD_0 && k->code<=KCD_9))
729 {
730 TRACE_EVENT("Idle Editor Start!");
731 SEND_EVENT(idle_get_window(), IDLE_START_DIALLING_NUMBER, 0, &keycode);
732 }
733 }
734 }
735 break;
736 }
737
738 /* always consume the event
739 */
740 return MFW_EVENT_CONSUMED;
741 }
742
743
744
745
746
747
748
749 /*******************************************************************************
750
751 $Function: bookMenuKbdLongCB
752
753 $Description: keyboard long press event handler
754
755 $Returns: MFW_EVENT_CONSUMED always
756
757 $Arguments: e, event, k, key handle
758
759 *******************************************************************************/
760
761 static int bookMenuKbdLongCB( MfwEvt e, MfwKbd *k )
762 {
763 T_MFW_HND window = mfwParent( mfw_header() );
764 T_MFW_WIN *win_data = ((T_MFW_HDR *)window)->data;
765 tBookStandard *data = (tBookStandard *) win_data->user;
766
767 TRACE_FUNCTION( "bookMenuKbdLongCB()" );
768
769 if ( ( e & KEY_CLEAR ) && ( e & KEY_LONG ) )
770 { mnuEscape( data->menu );
771 return MFW_EVENT_CONSUMED;
772 }
773 /*if long press on END key*/
774 if ( ( e & KEY_HUP) && ( e & KEY_LONG ) )
775 {
776 U8 keycode;
777 U8 uMode;
778 uMode = dspl_Enable(0);
779
780 // keypadLock will not activate anymore
781 data->status_of_timer = TRUE;
782
783 //return to idle screen
784
785 keycode = k->code;
786
787 if (data->Callback)
788 (data->Callback) (data->parent_win, NULL, NULL);
789
790 bookMenuDestroy(data->win);
791 stopRingerVolSettingInactivityTimer();
792
793 SEND_EVENT(idle_get_window(), IDLE_UPDATE, 0, &keycode);
794
795 dspl_Enable(uMode);
796 }
797
798 return MFW_EVENT_CONSUMED;
799 }
800
801
802
803
804
805
806 /*******************************************************************************
807
808 $Function: bookMenuCreate
809
810 $Description: Create the menu window
811
812 $Returns: handle of newly created window, or NULL if error
813
814 $Arguments: parent, handle of the parent window
815
816 *******************************************************************************/
817
818 static T_MFW_HND bookMenuCreate( MfwHnd parent )
819 {
820 T_MFW_WIN *parent_win_data = ( (T_MFW_HDR *) parent )->data;
821 T_phbk *phbk = (T_phbk *)parent_win_data->user;
822 T_MFW_WIN *win_data;
823 tBookStandard *data;
824
825 TRACE_FUNCTION( "bookMenuCreate()" );
826
827 /* allocate memory for our control block
828 */
829 if ( ( data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ) ) == NULL )
830 return NULL;
831
832 /* Create the window if we can
833 */
834 if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookMenuWindowCB ) ) == NULL )
835 {
836 FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
837 return NULL;
838 }
839
840 /* Okay, we have created the control block and the window, so
841 we now need to configure the dialog and data pointers
842 */
843 data->mmi_control.dialog = (T_DIALOG_FUNC) bookMenuDialog;
844 data->mmi_control.data = data;
845 win_data = ((T_MFW_HDR *)data->win)->data;
846 win_data->user = (void *) data;
847 data->phbk = phbk;
848 data->parent_win = parent;
849
850 /* create keyboards and menus for our window
851 */
852 data->kbd = kbdCreate ( data->win, KEY_ALL, (MfwCb) bookMenuKbdCB );
853 data->kbd_long = kbdCreate ( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookMenuKbdLongCB );
854 data->menu_tim = tim_create (data->win, THREE_SECS, (MfwCb) bookMenuTimCB);
855
856 data->Callback = NULL; // Use standard menu callback (changed by sending event ADD_CALLBACK)
857
858 /* And return the handle of the newly created window
859 */
860 return data->win;
861 }
862
863
864
865
866
867 /*******************************************************************************
868
869 Public Methods
870
871 *******************************************************************************/
872
873 /*******************************************************************************
874
875 $Function: bookMenuStart
876
877 $Description: tbd
878
879 $Returns: tbd
880
881 $Arguments: tbd
882
883 *******************************************************************************/
884
885 T_MFW_HND bookMenuStart( MfwHnd parent, MfwMnuAttr *menuAttr,SHORT reason )
886 {
887 T_MFW_HND win;
888
889 win = bookMenuCreate( parent );
890
891 if ( win != NULL )
892 SEND_EVENT( win, MENU_INIT, reason, (MfwMnuAttr *) menuAttr );
893 return win;
894 }
895
896
897
898 /*******************************************************************************
899
900 $Function: bookMenuDestroy
901
902 $Description: Destroy the menu window
903
904 $Returns: none
905
906 $Arguments: window, handle of the window being destroyed
907
908 *******************************************************************************/
909
910 void bookMenuDestroy( MfwHnd window )
911 {
912 T_MFW_WIN *win_data = ((T_MFW_HDR *)window)->data;
913 tBookStandard *data = (tBookStandard *) win_data->user;
914 char test_string[40];
915
916 TRACE_FUNCTION( "bookMenuDestroy()" );
917
918 if (window == NULL)
919 {
920 TRACE_EVENT ("Error : Called with NULL Pointer");
921 return;
922 }
923
924 if ( data )
925 {
926
927 /* If we have the root window here then we use the main phone
928 book destroy method
929 */
930 if ( data->phbk->root_win == window )
931 {
932 bookPhonebookDestroy( data->phbk->win );
933 return;
934 }
935
936 /* Otherwise clear down our pointers and free the current
937 menu window structures
938 */
939 if ( data->phbk->search_win == window )
940 data->phbk->search_win = 0;
941 if ( data->phbk->menu_main_win == window )
942 data->phbk->menu_main_win = 0;
943 if ( data->phbk->menu_options_win == window )
944 data->phbk->menu_options_win = 0;
945 if ( data->phbk->menu_options_win_2 == window )
946 data->phbk->menu_options_win_2 = 0;
947 if ( data->phbk->menu_call_options_win == window )
948 data->phbk->menu_call_options_win = 0;
949 if ( data->phbk->menu_call_options_win_2 == window )
950 data->phbk->menu_call_options_win_2 = 0;
951
952 winDelete( data->win );
953 FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
954 sprintf(test_string, "Bookmenudestroy: %d", mfwCheckMemoryLeft());
955 TRACE_EVENT(test_string);
956 }
957
958 }
959
960
961
962
963
964
965 /*******************************************************************************
966
967 End of File
968
969 *******************************************************************************/