wgui.c
上传用户:dengyu
上传日期:2022-05-01
资源大小:153k
文件大小:64k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*******************************************************************************
  36.  * Filename:
  37.  * ---------
  38.  *  wgui..c
  39.  *
  40.  * Project:
  41.  * --------
  42.  *  MAUI
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *  key_handlers wrappers and initialize UI..
  47.  *
  48.  * Author:
  49.  * -------
  50.  * -------
  51.  *
  52.  *==============================================================================
  53.  *             HISTORY
  54.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  55.  *------------------------------------------------------------------------------
  56.  * removed!
  57.  * removed!
  58.  * removed!
  59.  *
  60.  * removed!
  61.  * removed!
  62.  * removed!
  63.  *
  64.  * removed!
  65.  * removed!
  66.  * removed!
  67.  *
  68.  * removed!
  69.  * removed!
  70.  * removed!
  71.  *
  72.  * removed!
  73.  * removed!
  74.  * removed!
  75.  *
  76.  * removed!
  77.  * removed!
  78.  * removed!
  79.  *
  80.  * removed!
  81.  * removed!
  82.  * removed!
  83.  *
  84.  * removed!
  85.  * removed!
  86.  * removed!
  87.  *
  88.  * removed!
  89.  * removed!
  90.  * removed!
  91.  *
  92.  * removed!
  93.  * removed!
  94.  * removed!
  95.  *
  96.  * removed!
  97.  * removed!
  98.  * removed!
  99.  *
  100.  * removed!
  101.  * removed!
  102.  * removed!
  103.  *
  104.  * removed!
  105.  * removed!
  106.  * removed!
  107.  *
  108.  * removed!
  109.  * removed!
  110.  * removed!
  111.  *
  112.  * removed!
  113.  * removed!
  114.  * removed!
  115.  *
  116.  * removed!
  117.  * removed!
  118.  * removed!
  119.  *
  120.  * removed!
  121.  * removed!
  122.  * removed!
  123.  *
  124.  * removed!
  125.  * removed!
  126.  * removed!
  127.  *
  128.  * removed!
  129.  * removed!
  130.  * removed!
  131.  *
  132.  * removed!
  133.  * removed!
  134.  * removed!
  135.  *
  136.  * removed!
  137.  * removed!
  138.  * removed!
  139.  *
  140.  * removed!
  141.  * removed!
  142.  * removed!
  143.  *
  144.  * removed!
  145.  * removed!
  146.  * removed!
  147.  *
  148.  * removed!
  149.  * removed!
  150.  * removed!
  151.  *
  152.  * removed!
  153.  * removed!
  154.  * removed!
  155.  *
  156.  * removed!
  157.  * removed!
  158.  * removed!
  159.  *
  160.  * removed!
  161.  * removed!
  162.  * removed!
  163.  *
  164.  * removed!
  165.  * removed!
  166.  * removed!
  167.  *
  168.  * removed!
  169.  * removed!
  170.  * removed!
  171.  *
  172.  * removed!
  173.  * removed!
  174.  * removed!
  175.  *
  176.  * removed!
  177.  * removed!
  178.  * removed!
  179.  *
  180.  * removed!
  181.  * removed!
  182.  * removed!
  183.  *
  184.  * removed!
  185.  * removed!
  186.  * removed!
  187.  *
  188.  * removed!
  189.  * removed!
  190.  * removed!
  191.  *
  192.  * removed!
  193.  * removed!
  194.  * removed!
  195.  *
  196.  * removed!
  197.  * removed!
  198.  * removed!
  199.  *
  200.  * removed!
  201.  * removed!
  202.  * removed!
  203.  *
  204.  * removed!
  205.  * removed!
  206.  * removed!
  207.  *
  208.  * removed!
  209.  * removed!
  210.  * removed!
  211.  * removed!
  212.  *
  213.  * removed!
  214.  * removed!
  215.  * removed!
  216.  * removed!
  217.  * removed!
  218.  */
  219. /**********************************************************************************
  220.    Filename:      wgui.c
  221.    Author:        manju
  222.    Date Created:  August-07-2002
  223.    Contains:      PixTel UI wrapper routines
  224.                Contains several parts and has been split to multiple
  225.                code files. See other files named wgui_*.c and wgui_*.h
  226.                This file contains common functions and data.
  227. **********************************************************************************/
  228. /* Include: MMI header file */
  229. #include "mmi_frm_gprot.h"
  230. #include "WguiCategoryGprot.h"
  231. #include "wgui_fixed_menuitems.h"
  232. #include "wgui_virtual_keyboard.h"
  233. #include "IdleAppDef.h"
  234. #include "FunAndGamesDefs.h"
  235. #if(!UI_DISABLE_EMS_INPUT_BOX)
  236. #endif 
  237. #ifdef __MMI_VUI_ENGINE__
  238. extern void vrt_canvas_suspend();
  239. #endif    
  240. #include "wgui_softkeys.h"
  241. /* 
  242.  * removed!
  243.  */
  244. static void (*MMI_keyboard_key_handler) (S32 vkey_code, S32 key_state) = NULL;
  245. static void (*MMI_keyboard_input_handler) (S32 vkey_code) = NULL;
  246. static void (*MMI_keyboard_global_key_handler) (S32 vkey_code, S32 key_state) = NULL;
  247. static void (*MMI_keyboard_global_input_handler) (S32 vkey_code) = NULL;
  248. static void (*MMI_key_input_handler_function) (MMI_key_code_type key_code, MMI_key_event_type key_event);
  249. static void (*MMI_key_down_handler_function) (MMI_key_code_type key_code);
  250. static void (*MMI_key_up_handler_function) (MMI_key_code_type key_code);
  251. /* 
  252.  * removed!
  253.  */
  254. S32 MMI_status_bar_height;
  255. S32 MMI_content_x;
  256. S32 MMI_content_y;
  257. S32 MMI_content_width;
  258. S32 MMI_content_height;
  259. extern MMI_theme **MMI_themes;
  260. /* 
  261.  * removed!
  262.  */
  263. /*****************************************************************************
  264.  * removed!
  265.  * removed!
  266.  * removed!
  267.  * removed!
  268.  * removed!
  269.  * removed!
  270.  * removed!
  271.  * removed!
  272.  *****************************************************************************/
  273. void MMI_dummy_function(void)
  274. {
  275.     /*----------------------------------------------------------------*/
  276.     /* Local Variables                                                */
  277.     /*----------------------------------------------------------------*/
  278.     /*----------------------------------------------------------------*/
  279.     /* Code Body                                                      */
  280.     /*----------------------------------------------------------------*/
  281. }
  282. /* Functions for keyboard Support   */
  283. /*****************************************************************************
  284.  * FUNCTION
  285.  *  dummy_keyboard_key_handler
  286.  * DESCRIPTION
  287.  *  Dummy keyboard key handler
  288.  * PARAMETERS
  289.  *  vkey_code       [IN]        Key_code
  290.  *  key_state       [IN]        Key_state
  291.  * RETURNS
  292.  *  void
  293.  *****************************************************************************/
  294. void dummy_keyboard_key_handler(S32 vkey_code, S32 key_state)
  295. {
  296.     /*----------------------------------------------------------------*/
  297.     /* Local Variables                                                */
  298.     /*----------------------------------------------------------------*/
  299.     /*----------------------------------------------------------------*/
  300.     /* Code Body                                                      */
  301.     /*----------------------------------------------------------------*/
  302.     UI_UNUSED_PARAMETER(vkey_code);
  303.     UI_UNUSED_PARAMETER(key_state);
  304. }
  305. /*****************************************************************************
  306.  * FUNCTION
  307.  *  dummy_keyboard_input_handler
  308.  * DESCRIPTION
  309.  *  Dummy keyboard input handler
  310.  * PARAMETERS
  311.  *  vkey_code       [IN]        Key_code
  312.  * RETURNS
  313.  *  void
  314.  *****************************************************************************/
  315. void dummy_keyboard_input_handler(S32 vkey_code)
  316. {
  317.     /*----------------------------------------------------------------*/
  318.     /* Local Variables                                                */
  319.     /*----------------------------------------------------------------*/
  320.     /*----------------------------------------------------------------*/
  321.     /* Code Body                                                      */
  322.     /*----------------------------------------------------------------*/
  323.     UI_UNUSED_PARAMETER(vkey_code);
  324. }
  325. /*****************************************************************************
  326.  * FUNCTION
  327.  *  keyboard_key_handler
  328.  * DESCRIPTION
  329.  *  Handles key events (UP/DOWN)
  330.  * PARAMETERS
  331.  *  vkey_code       [IN]        Key's scan code
  332.  *  key_state       [IN]        Key's state (up or down)
  333.  * RETURNS
  334.  *  void
  335.  *****************************************************************************/
  336. void keyboard_key_handler(S32 vkey_code, S32 key_state)
  337. {
  338.     /*----------------------------------------------------------------*/
  339.     /* Local Variables                                                */
  340.     /*----------------------------------------------------------------*/
  341.     U8 state = 0;
  342.     /*----------------------------------------------------------------*/
  343.     /* Code Body                                                      */
  344.     /*----------------------------------------------------------------*/
  345.     /* Perform scan code and key state mapping here */
  346.     if (key_state == KEYBOARD_KEY_DOWN)
  347.     {
  348.         state = 1;
  349.     }
  350.     else if (key_state == KEYBOARD_KEY_UP)
  351.     {
  352.         state = 0;
  353.     }
  354.     if (MMI_keyboard_key_handler != NULL)
  355.     {
  356.         MMI_keyboard_key_handler(vkey_code, state);
  357.     }
  358. }
  359. /*****************************************************************************
  360.  * FUNCTION
  361.  *  keyboard_input_handler
  362.  * DESCRIPTION
  363.  *  Handles keyboard input
  364.  * PARAMETERS
  365.  *  vkey_code       [IN]        Key's character code (ASCII)
  366.  * RETURNS
  367.  *  void
  368.  *****************************************************************************/
  369. void keyboard_input_handler(S32 vkey_code)
  370. {
  371.     /*----------------------------------------------------------------*/
  372.     /* Local Variables                                                */
  373.     /*----------------------------------------------------------------*/
  374.     /*----------------------------------------------------------------*/
  375.     /* Code Body                                                      */
  376.     /*----------------------------------------------------------------*/
  377.     if (MMI_keyboard_input_handler != NULL)
  378.     {
  379.         MMI_keyboard_input_handler(vkey_code);
  380.     }
  381. }
  382. /*****************************************************************************
  383.  * FUNCTION
  384.  *  keyboard_global_key_handler
  385.  * DESCRIPTION
  386.  *  Handles key events (UP/DOWN)
  387.  * PARAMETERS
  388.  *  vkey_code       [IN]        Key's scan code
  389.  *  key_state       [IN]        Key's state (up or down)
  390.  * RETURNS
  391.  *  void
  392.  *****************************************************************************/
  393. void keyboard_global_key_handler(S32 vkey_code, S32 key_state)
  394. {
  395.     /*----------------------------------------------------------------*/
  396.     /* Local Variables                                                */
  397.     /*----------------------------------------------------------------*/
  398.     U8 state = 0;
  399.     /*----------------------------------------------------------------*/
  400.     /* Code Body                                                      */
  401.     /*----------------------------------------------------------------*/
  402.     /* Perform scan code and key state mapping here */
  403.     if (key_state == KEYBOARD_KEY_DOWN)
  404.     {
  405.         state = 1;
  406.     }
  407.     else if (key_state == KEYBOARD_KEY_UP)
  408.     {
  409.         state = 0;
  410.     }
  411.     if (MMI_keyboard_global_key_handler != NULL)
  412.     {
  413.         MMI_keyboard_global_key_handler(vkey_code, state);
  414.     }
  415. }
  416. /*****************************************************************************
  417.  * FUNCTION
  418.  *  keyboard_global_input_handler
  419.  * DESCRIPTION
  420.  *  Handles keyboard input
  421.  * PARAMETERS
  422.  *  vkey_code       [IN]        Key's character code (ASCII)
  423.  * RETURNS
  424.  *  void
  425.  *****************************************************************************/
  426. void keyboard_global_input_handler(S32 vkey_code)
  427. {
  428.     /*----------------------------------------------------------------*/
  429.     /* Local Variables                                                */
  430.     /*----------------------------------------------------------------*/
  431.     /*----------------------------------------------------------------*/
  432.     /* Code Body                                                      */
  433.     /*----------------------------------------------------------------*/
  434.     if (MMI_keyboard_global_input_handler != NULL)
  435.     {
  436.         MMI_keyboard_global_input_handler(vkey_code);
  437.     }
  438. }
  439. /*****************************************************************************
  440.  * FUNCTION
  441.  *  register_keyboard_key_handler
  442.  * DESCRIPTION
  443.  *  Registers a function to be called for key handling
  444.  * PARAMETERS
  445.  *  f       [IN]        Function to be called for key handling
  446.  * RETURNS
  447.  *  void
  448.  *****************************************************************************/
  449. void register_keyboard_key_handler(void (*f) (S32 vkey_code, S32 key_state))
  450. {
  451.     /*----------------------------------------------------------------*/
  452.     /* Local Variables                                                */
  453.     /*----------------------------------------------------------------*/
  454.     /*----------------------------------------------------------------*/
  455.     /* Code Body                                                      */
  456.     /*----------------------------------------------------------------*/
  457.     MMI_keyboard_key_handler = f;
  458. }
  459. /*****************************************************************************
  460.  * FUNCTION
  461.  *  register_keyboard_input_handler
  462.  * DESCRIPTION
  463.  *  Registers a function to be called for key input
  464.  * PARAMETERS
  465.  *  f       [IN]        Function that is called upon key events
  466.  * RETURNS
  467.  *  void
  468.  *****************************************************************************/
  469. void register_keyboard_input_handler(void (*f) (S32 vkey_code))
  470. {
  471.     /*----------------------------------------------------------------*/
  472.     /* Local Variables                                                */
  473.     /*----------------------------------------------------------------*/
  474.     /*----------------------------------------------------------------*/
  475.     /* Code Body                                                      */
  476.     /*----------------------------------------------------------------*/
  477.     MMI_keyboard_input_handler = f;
  478. }
  479. /*****************************************************************************
  480.  * FUNCTION
  481.  *  register_keyboard_global_key_handler
  482.  * DESCRIPTION
  483.  *  Registers a function to be called for key handling
  484.  * PARAMETERS
  485.  *  f       [IN]        Function that is called upon key events
  486.  * RETURNS
  487.  *  void
  488.  *****************************************************************************/
  489. void register_keyboard_global_key_handler(void (*f) (S32 vkey_code, S32 key_state))
  490. {
  491.     /*----------------------------------------------------------------*/
  492.     /* Local Variables                                                */
  493.     /*----------------------------------------------------------------*/
  494.     /*----------------------------------------------------------------*/
  495.     /* Code Body                                                      */
  496.     /*----------------------------------------------------------------*/
  497.     MMI_keyboard_global_key_handler = f;
  498. }
  499. /*****************************************************************************
  500.  * FUNCTION
  501.  *  register_keyboard_global_input_handler
  502.  * DESCRIPTION
  503.  *  Register_keyboard_global_input_handler
  504.  * PARAMETERS
  505.  *  f       [IN]        Function that is called upon key events
  506.  * RETURNS
  507.  *  void
  508.  *****************************************************************************/
  509. void register_keyboard_global_input_handler(void (*f) (S32 vkey_code))
  510. {
  511.     /*----------------------------------------------------------------*/
  512.     /* Local Variables                                                */
  513.     /*----------------------------------------------------------------*/
  514.     /*----------------------------------------------------------------*/
  515.     /* Code Body                                                      */
  516.     /*----------------------------------------------------------------*/
  517.     MMI_keyboard_global_input_handler = f;
  518. }
  519. /*****************************************************************************
  520.  * FUNCTION
  521.  *  clear_keyboard_key_handler
  522.  * DESCRIPTION
  523.  *  Clears the function called to handle key events
  524.  * PARAMETERS
  525.  *  void
  526.  * RETURNS
  527.  *  void
  528.  *****************************************************************************/
  529. void clear_keyboard_key_handler(void)
  530. {
  531.     /*----------------------------------------------------------------*/
  532.     /* Local Variables                                                */
  533.     /*----------------------------------------------------------------*/
  534.     /*----------------------------------------------------------------*/
  535.     /* Code Body                                                      */
  536.     /*----------------------------------------------------------------*/
  537.     MMI_keyboard_key_handler = dummy_keyboard_key_handler;
  538. }
  539. /*****************************************************************************
  540.  * FUNCTION
  541.  *  clear_keyboard_input_handler
  542.  * DESCRIPTION
  543.  *  Clears the function called to handle key input
  544.  * PARAMETERS
  545.  *  void
  546.  * RETURNS
  547.  *  void
  548.  *****************************************************************************/
  549. void clear_keyboard_input_handler(void)
  550. {
  551.     /*----------------------------------------------------------------*/
  552.     /* Local Variables                                                */
  553.     /*----------------------------------------------------------------*/
  554.     /*----------------------------------------------------------------*/
  555.     /* Code Body                                                      */
  556.     /*----------------------------------------------------------------*/
  557.     MMI_keyboard_input_handler = dummy_keyboard_input_handler;
  558. }
  559. /*****************************************************************************
  560.  * FUNCTION
  561.  *  clear_keyboard_global_key_handler
  562.  * DESCRIPTION
  563.  *  Clears the function called to handle key events
  564.  * PARAMETERS
  565.  *  void
  566.  * RETURNS
  567.  *  void
  568.  *****************************************************************************/
  569. void clear_keyboard_global_key_handler(void)
  570. {
  571.     /*----------------------------------------------------------------*/
  572.     /* Local Variables                                                */
  573.     /*----------------------------------------------------------------*/
  574.     /*----------------------------------------------------------------*/
  575.     /* Code Body                                                      */
  576.     /*----------------------------------------------------------------*/
  577.     MMI_keyboard_global_key_handler = dummy_keyboard_key_handler;
  578. }
  579. /*****************************************************************************
  580.  * FUNCTION
  581.  *  clear_keyboard_global_input_handler
  582.  * DESCRIPTION
  583.  *  Clears the function called to handle key input
  584.  * PARAMETERS
  585.  *  void
  586.  * RETURNS
  587.  *  void
  588.  *****************************************************************************/
  589. void clear_keyboard_global_input_handler(void)
  590. {
  591.     /*----------------------------------------------------------------*/
  592.     /* Local Variables                                                */
  593.     /*----------------------------------------------------------------*/
  594.     /*----------------------------------------------------------------*/
  595.     /* Code Body                                                      */
  596.     /*----------------------------------------------------------------*/
  597.     MMI_keyboard_global_input_handler = dummy_keyboard_input_handler;
  598. }
  599. /* Key handling wrappers      */
  600. /*****************************************************************************
  601.  * FUNCTION
  602.  *  clear_key_handlers
  603.  * DESCRIPTION
  604.  *  Clears the key handlers
  605.  * PARAMETERS
  606.  *  void
  607.  * RETURNS
  608.  *  void
  609.  *****************************************************************************/
  610. void clear_key_handlers(void)
  611. {
  612.     /*----------------------------------------------------------------*/
  613.     /* Local Variables                                                */
  614.     /*----------------------------------------------------------------*/
  615.     /*----------------------------------------------------------------*/
  616.     /* Code Body                                                      */
  617.     /*----------------------------------------------------------------*/
  618.     clear_softkey_handler(MMI_LEFT_SOFTKEY);
  619.     clear_softkey_handler(MMI_RIGHT_SOFTKEY);
  620. #ifdef __MMI_WGUI_CSK_ENABLE__
  621.     clear_softkey_handler(MMI_CENTER_SOFTKEY);
  622. #endif 
  623.     register_keyboard_key_handler(dummy_keyboard_key_handler);
  624.     register_keyboard_input_handler(dummy_keyboard_input_handler);
  625.     register_keyboard_global_input_handler(dummy_keyboard_input_handler);
  626.     ClearInputEventHandler(MMI_DEVICE_KEY);
  627. }
  628. /*****************************************************************************
  629.  * FUNCTION
  630.  *  clear_category_screen_key_handlers
  631.  * DESCRIPTION
  632.  *  Clears the key handlers used in category screen
  633.  * PARAMETERS
  634.  *  void
  635.  * RETURNS
  636.  *  void
  637.  *****************************************************************************/
  638. void clear_category_screen_key_handlers(void)
  639. {
  640.     /*----------------------------------------------------------------*/
  641.     /* Local Variables                                                */
  642.     /*----------------------------------------------------------------*/
  643.     /*----------------------------------------------------------------*/
  644.     /* Code Body                                                      */
  645.     /*----------------------------------------------------------------*/
  646.     clear_softkey_handler(MMI_LEFT_SOFTKEY);
  647.     clear_softkey_handler(MMI_RIGHT_SOFTKEY);
  648. #ifdef __MMI_WGUI_CSK_ENABLE__
  649.     clear_softkey_handler(MMI_CENTER_SOFTKEY);
  650. #endif 
  651.     register_keyboard_key_handler(dummy_keyboard_key_handler);
  652.     register_keyboard_input_handler(dummy_keyboard_input_handler);
  653. }
  654. /*****************************************************************************
  655.  * FUNCTION
  656.  *  register_key_input_handler
  657.  * DESCRIPTION
  658.  *  Registers a key input handler for a keypad key
  659.  * PARAMETERS
  660.  *  f       [IN]        Function that is called on receiving key events
  661.  * RETURNS
  662.  *  void
  663.  *****************************************************************************/
  664. void register_key_input_handler(void (*f) (MMI_key_code_type key_code, MMI_key_event_type key_event))
  665. {
  666.     /*----------------------------------------------------------------*/
  667.     /* Local Variables                                                */
  668.     /*----------------------------------------------------------------*/
  669.     /*----------------------------------------------------------------*/
  670.     /* Code Body                                                      */
  671.     /*----------------------------------------------------------------*/
  672.     MMI_key_input_handler_function = f;
  673. }
  674. /*****************************************************************************
  675.  * FUNCTION
  676.  *  register_key_up_handler
  677.  * DESCRIPTION
  678.  *  Registers handler for the key up events of all keys
  679.  * PARAMETERS
  680.  *  f       [IN]        Function that is called whenever any key is released
  681.  * RETURNS
  682.  *  void
  683.  *****************************************************************************/
  684. void register_key_up_handler(void (*f) (MMI_key_code_type key_code))
  685. {
  686.     /*----------------------------------------------------------------*/
  687.     /* Local Variables                                                */
  688.     /*----------------------------------------------------------------*/
  689.     /*----------------------------------------------------------------*/
  690.     /* Code Body                                                      */
  691.     /*----------------------------------------------------------------*/
  692.     MMI_key_up_handler_function = f;
  693. }
  694. /*****************************************************************************
  695.  * FUNCTION
  696.  *  register_key_down_handler
  697.  * DESCRIPTION
  698.  *  Registers handler for the key down events of all keys
  699.  * PARAMETERS
  700.  *  f       [IN]        Function that is called whenever any key is pressed
  701.  * RETURNS
  702.  *  void
  703.  *****************************************************************************/
  704. void register_key_down_handler(void (*f) (MMI_key_code_type key_code))
  705. {
  706.     /*----------------------------------------------------------------*/
  707.     /* Local Variables                                                */
  708.     /*----------------------------------------------------------------*/
  709.     /*----------------------------------------------------------------*/
  710.     /* Code Body                                                      */
  711.     /*----------------------------------------------------------------*/
  712.     MMI_key_down_handler_function = f;
  713. }
  714. /*****************************************************************************
  715.  * FUNCTION
  716.  *  clear_key_input_handler
  717.  * DESCRIPTION
  718.  *  Clears the key input handler
  719.  * PARAMETERS
  720.  *  void
  721.  * RETURNS
  722.  *  void
  723.  *****************************************************************************/
  724. void clear_key_input_handler(void)
  725. {
  726.     /*----------------------------------------------------------------*/
  727.     /* Local Variables                                                */
  728.     /*----------------------------------------------------------------*/
  729.     /*----------------------------------------------------------------*/
  730.     /* Code Body                                                      */
  731.     /*----------------------------------------------------------------*/
  732.     MMI_key_input_handler_function = NULL;
  733. }
  734. /*****************************************************************************
  735.  * FUNCTION
  736.  *  clear_key_down_handler
  737.  * DESCRIPTION
  738.  *  Clears the key down handler
  739.  * PARAMETERS
  740.  *  void
  741.  * RETURNS
  742.  *  void
  743.  *****************************************************************************/
  744. void clear_key_down_handler(void)
  745. {
  746.     /*----------------------------------------------------------------*/
  747.     /* Local Variables                                                */
  748.     /*----------------------------------------------------------------*/
  749.     /*----------------------------------------------------------------*/
  750.     /* Code Body                                                      */
  751.     /*----------------------------------------------------------------*/
  752.     MMI_key_down_handler_function = NULL;
  753. }
  754. /*****************************************************************************
  755.  * FUNCTION
  756.  *  clear_key_up_handler
  757.  * DESCRIPTION
  758.  *  Clears the key up handler
  759.  * PARAMETERS
  760.  *  void
  761.  * RETURNS
  762.  *  void
  763.  *****************************************************************************/
  764. void clear_key_up_handler(void)
  765. {
  766.     /*----------------------------------------------------------------*/
  767.     /* Local Variables                                                */
  768.     /*----------------------------------------------------------------*/
  769.     /*----------------------------------------------------------------*/
  770.     /* Code Body                                                      */
  771.     /*----------------------------------------------------------------*/
  772.     MMI_key_up_handler_function = NULL;
  773. }
  774. /*----------------------------------------------------------------------------
  775.    The following functions are used internally and are not meant to be called
  776.    by other functions.
  777. ----------------------------------------------------------------------------*/
  778. /*****************************************************************************
  779.  * FUNCTION
  780.  *  MMI_key_input_handler
  781.  * DESCRIPTION
  782.  *  Handler key input events
  783.  * PARAMETERS
  784.  *  key_code        [IN]        
  785.  *  key_event       [IN]        
  786.  * RETURNS
  787.  *  void
  788.  *****************************************************************************/
  789. void MMI_key_input_handler(MMI_key_code_type key_code, MMI_key_event_type key_event)
  790. {
  791.     /*----------------------------------------------------------------*/
  792.     /* Local Variables                                                */
  793.     /*----------------------------------------------------------------*/
  794.     /*----------------------------------------------------------------*/
  795.     /* Code Body                                                      */
  796.     /*----------------------------------------------------------------*/
  797.     if (MMI_key_input_handler_function != NULL)
  798.     {
  799.         MMI_key_input_handler_function(key_code, key_event);
  800.     }
  801.     switch (key_event)
  802.     {
  803.         case KEY_EVENT_DOWN:
  804.             if (MMI_key_down_handler_function != NULL)
  805.             {
  806.                 MMI_key_down_handler_function(key_code);
  807.             }
  808.             break;
  809.         case KEY_EVENT_UP:
  810.             if (MMI_key_up_handler_function != NULL)
  811.             {
  812.                 MMI_key_up_handler_function(key_code);
  813.             }
  814.             break;
  815.     }
  816. }
  817. /*****************************************************************************
  818.  * FUNCTION
  819.  *  MMI_key_0_down
  820.  * DESCRIPTION
  821.  *  Handle key 0 pressed event
  822.  * PARAMETERS
  823.  *  void
  824.  * RETURNS
  825.  *  void
  826.  *****************************************************************************/
  827. void MMI_key_0_down(void)
  828. {
  829.     /*----------------------------------------------------------------*/
  830.     /* Local Variables                                                */
  831.     /*----------------------------------------------------------------*/
  832.     /*----------------------------------------------------------------*/
  833.     /* Code Body                                                      */
  834.     /*----------------------------------------------------------------*/
  835.     MMI_key_input_handler(KEY_0, KEY_EVENT_DOWN);
  836. }
  837. /*****************************************************************************
  838.  * FUNCTION
  839.  *  MMI_key_1_down
  840.  * DESCRIPTION
  841.  *  Handle key 1 pressed event
  842.  * PARAMETERS
  843.  *  void
  844.  * RETURNS
  845.  *  void
  846.  *****************************************************************************/
  847. void MMI_key_1_down(void)
  848. {
  849.     /*----------------------------------------------------------------*/
  850.     /* Local Variables                                                */
  851.     /*----------------------------------------------------------------*/
  852.     /*----------------------------------------------------------------*/
  853.     /* Code Body                                                      */
  854.     /*----------------------------------------------------------------*/
  855.     MMI_key_input_handler(KEY_1, KEY_EVENT_DOWN);
  856. }
  857. /*****************************************************************************
  858.  * FUNCTION
  859.  *  MMI_key_2_down
  860.  * DESCRIPTION
  861.  *  Handle key 2 pressed event
  862.  * PARAMETERS
  863.  *  void
  864.  * RETURNS
  865.  *  void
  866.  *****************************************************************************/
  867. void MMI_key_2_down(void)
  868. {
  869.     /*----------------------------------------------------------------*/
  870.     /* Local Variables                                                */
  871.     /*----------------------------------------------------------------*/
  872.     /*----------------------------------------------------------------*/
  873.     /* Code Body                                                      */
  874.     /*----------------------------------------------------------------*/
  875.     MMI_key_input_handler(KEY_2, KEY_EVENT_DOWN);
  876. }
  877. /*****************************************************************************
  878.  * FUNCTION
  879.  *  MMI_key_3_down
  880.  * DESCRIPTION
  881.  *  Handle key 3 pressed event
  882.  * PARAMETERS
  883.  *  void
  884.  * RETURNS
  885.  *  void
  886.  *****************************************************************************/
  887. void MMI_key_3_down(void)
  888. {
  889.     /*----------------------------------------------------------------*/
  890.     /* Local Variables                                                */
  891.     /*----------------------------------------------------------------*/
  892.     /*----------------------------------------------------------------*/
  893.     /* Code Body                                                      */
  894.     /*----------------------------------------------------------------*/
  895.     MMI_key_input_handler(KEY_3, KEY_EVENT_DOWN);
  896. }
  897. /*****************************************************************************
  898.  * FUNCTION
  899.  *  MMI_key_4_down
  900.  * DESCRIPTION
  901.  *  Handle key 4 pressed event
  902.  * PARAMETERS
  903.  *  void
  904.  * RETURNS
  905.  *  void
  906.  *****************************************************************************/
  907. void MMI_key_4_down(void)
  908. {
  909.     /*----------------------------------------------------------------*/
  910.     /* Local Variables                                                */
  911.     /*----------------------------------------------------------------*/
  912.     /*----------------------------------------------------------------*/
  913.     /* Code Body                                                      */
  914.     /*----------------------------------------------------------------*/
  915.     MMI_key_input_handler(KEY_4, KEY_EVENT_DOWN);
  916. }
  917. /*****************************************************************************
  918.  * FUNCTION
  919.  *  MMI_key_5_down
  920.  * DESCRIPTION
  921.  *  Handle key 5 pressed event
  922.  * PARAMETERS
  923.  *  void
  924.  * RETURNS
  925.  *  void
  926.  *****************************************************************************/
  927. void MMI_key_5_down(void)
  928. {
  929.     /*----------------------------------------------------------------*/
  930.     /* Local Variables                                                */
  931.     /*----------------------------------------------------------------*/
  932.     /*----------------------------------------------------------------*/
  933.     /* Code Body                                                      */
  934.     /*----------------------------------------------------------------*/
  935.     MMI_key_input_handler(KEY_5, KEY_EVENT_DOWN);
  936. }
  937. /*****************************************************************************
  938.  * FUNCTION
  939.  *  MMI_key_6_down
  940.  * DESCRIPTION
  941.  *  Handle key 6 pressed event
  942.  * PARAMETERS
  943.  *  void
  944.  * RETURNS
  945.  *  void
  946.  *****************************************************************************/
  947. void MMI_key_6_down(void)
  948. {
  949.     /*----------------------------------------------------------------*/
  950.     /* Local Variables                                                */
  951.     /*----------------------------------------------------------------*/
  952.     /*----------------------------------------------------------------*/
  953.     /* Code Body                                                      */
  954.     /*----------------------------------------------------------------*/
  955.     MMI_key_input_handler(KEY_6, KEY_EVENT_DOWN);
  956. }
  957. /*****************************************************************************
  958.  * FUNCTION
  959.  *  MMI_key_7_down
  960.  * DESCRIPTION
  961.  *  Handle key 7 pressed event
  962.  * PARAMETERS
  963.  *  void
  964.  * RETURNS
  965.  *  void
  966.  *****************************************************************************/
  967. void MMI_key_7_down(void)
  968. {
  969.     /*----------------------------------------------------------------*/
  970.     /* Local Variables                                                */
  971.     /*----------------------------------------------------------------*/
  972.     /*----------------------------------------------------------------*/
  973.     /* Code Body                                                      */
  974.     /*----------------------------------------------------------------*/
  975.     MMI_key_input_handler(KEY_7, KEY_EVENT_DOWN);
  976. }
  977. /*****************************************************************************
  978.  * FUNCTION
  979.  *  MMI_key_8_down
  980.  * DESCRIPTION
  981.  *  Handle key 8 pressed event
  982.  * PARAMETERS
  983.  *  void
  984.  * RETURNS
  985.  *  void
  986.  *****************************************************************************/
  987. void MMI_key_8_down(void)
  988. {
  989.     /*----------------------------------------------------------------*/
  990.     /* Local Variables                                                */
  991.     /*----------------------------------------------------------------*/
  992.     /*----------------------------------------------------------------*/
  993.     /* Code Body                                                      */
  994.     /*----------------------------------------------------------------*/
  995.     MMI_key_input_handler(KEY_8, KEY_EVENT_DOWN);
  996. }
  997. /*****************************************************************************
  998.  * FUNCTION
  999.  *  MMI_key_9_down
  1000.  * DESCRIPTION
  1001.  *  Handle key 9 pressed event
  1002.  * PARAMETERS
  1003.  *  void
  1004.  * RETURNS
  1005.  *  void
  1006.  *****************************************************************************/
  1007. void MMI_key_9_down(void)
  1008. {
  1009.     /*----------------------------------------------------------------*/
  1010.     /* Local Variables                                                */
  1011.     /*----------------------------------------------------------------*/
  1012.     /*----------------------------------------------------------------*/
  1013.     /* Code Body                                                      */
  1014.     /*----------------------------------------------------------------*/
  1015.     MMI_key_input_handler(KEY_9, KEY_EVENT_DOWN);
  1016. }
  1017. /* multitap for star and Pound */
  1018. /*****************************************************************************
  1019.  * FUNCTION
  1020.  *  MMI_key_star_down
  1021.  * DESCRIPTION
  1022.  *  Handle key star pressed event
  1023.  * PARAMETERS
  1024.  *  void
  1025.  * RETURNS
  1026.  *  void
  1027.  *****************************************************************************/
  1028. void MMI_key_star_down(void)
  1029. {
  1030.     /*----------------------------------------------------------------*/
  1031.     /* Local Variables                                                */
  1032.     /*----------------------------------------------------------------*/
  1033.     /*----------------------------------------------------------------*/
  1034.     /* Code Body                                                      */
  1035.     /*----------------------------------------------------------------*/
  1036.     MMI_key_input_handler(KEY_STAR, KEY_EVENT_DOWN);
  1037. }
  1038. /*****************************************************************************
  1039.  * FUNCTION
  1040.  *  MMI_key_pound_down
  1041.  * DESCRIPTION
  1042.  *  Handle key pound pressed event
  1043.  * PARAMETERS
  1044.  *  void
  1045.  * RETURNS
  1046.  *  void
  1047.  *****************************************************************************/
  1048. void MMI_key_pound_down(void)
  1049. {
  1050.     /*----------------------------------------------------------------*/
  1051.     /* Local Variables                                                */
  1052.     /*----------------------------------------------------------------*/
  1053.     /*----------------------------------------------------------------*/
  1054.     /* Code Body                                                      */
  1055.     /*----------------------------------------------------------------*/
  1056.     MMI_key_input_handler(KEY_POUND, KEY_EVENT_DOWN);
  1057. }
  1058. /*****************************************************************************
  1059.  * FUNCTION
  1060.  *  MMI_key_0_up
  1061.  * DESCRIPTION
  1062.  *  Handle key 0 release event
  1063.  * PARAMETERS
  1064.  *  void
  1065.  * RETURNS
  1066.  *  void
  1067.  *****************************************************************************/
  1068. void MMI_key_0_up(void)
  1069. {
  1070.     /*----------------------------------------------------------------*/
  1071.     /* Local Variables                                                */
  1072.     /*----------------------------------------------------------------*/
  1073.     /*----------------------------------------------------------------*/
  1074.     /* Code Body                                                      */
  1075.     /*----------------------------------------------------------------*/
  1076.     MMI_key_input_handler(KEY_0, KEY_EVENT_UP);
  1077. }
  1078. /*****************************************************************************
  1079.  * FUNCTION
  1080.  *  MMI_key_1_up
  1081.  * DESCRIPTION
  1082.  *  Handle key 1 release event
  1083.  * PARAMETERS
  1084.  *  void
  1085.  * RETURNS
  1086.  *  void
  1087.  *****************************************************************************/
  1088. void MMI_key_1_up(void)
  1089. {
  1090.     /*----------------------------------------------------------------*/
  1091.     /* Local Variables                                                */
  1092.     /*----------------------------------------------------------------*/
  1093.     /*----------------------------------------------------------------*/
  1094.     /* Code Body                                                      */
  1095.     /*----------------------------------------------------------------*/
  1096.     MMI_key_input_handler(KEY_1, KEY_EVENT_UP);
  1097. }
  1098. /*****************************************************************************
  1099.  * FUNCTION
  1100.  *  MMI_key_2_up
  1101.  * DESCRIPTION
  1102.  *  Handle key 2 release event
  1103.  * PARAMETERS
  1104.  *  void
  1105.  * RETURNS
  1106.  *  void
  1107.  *****************************************************************************/
  1108. void MMI_key_2_up(void)
  1109. {
  1110.     /*----------------------------------------------------------------*/
  1111.     /* Local Variables                                                */
  1112.     /*----------------------------------------------------------------*/
  1113.     /*----------------------------------------------------------------*/
  1114.     /* Code Body                                                      */
  1115.     /*----------------------------------------------------------------*/
  1116.     MMI_key_input_handler(KEY_2, KEY_EVENT_UP);
  1117. }
  1118. /*****************************************************************************
  1119.  * FUNCTION
  1120.  *  MMI_key_3_up
  1121.  * DESCRIPTION
  1122.  *  Handle key 3 release event
  1123.  * PARAMETERS
  1124.  *  void
  1125.  * RETURNS
  1126.  *  void
  1127.  *****************************************************************************/
  1128. void MMI_key_3_up(void)
  1129. {
  1130.     /*----------------------------------------------------------------*/
  1131.     /* Local Variables                                                */
  1132.     /*----------------------------------------------------------------*/
  1133.     /*----------------------------------------------------------------*/
  1134.     /* Code Body                                                      */
  1135.     /*----------------------------------------------------------------*/
  1136.     MMI_key_input_handler(KEY_3, KEY_EVENT_UP);
  1137. }
  1138. /*****************************************************************************
  1139.  * FUNCTION
  1140.  *  MMI_key_4_up
  1141.  * DESCRIPTION
  1142.  *  Handle key 4 release event
  1143.  * PARAMETERS
  1144.  *  void
  1145.  * RETURNS
  1146.  *  void
  1147.  *****************************************************************************/
  1148. void MMI_key_4_up(void)
  1149. {
  1150.     /*----------------------------------------------------------------*/
  1151.     /* Local Variables                                                */
  1152.     /*----------------------------------------------------------------*/
  1153.     /*----------------------------------------------------------------*/
  1154.     /* Code Body                                                      */
  1155.     /*----------------------------------------------------------------*/
  1156.     MMI_key_input_handler(KEY_4, KEY_EVENT_UP);
  1157. }
  1158. /*****************************************************************************
  1159.  * FUNCTION
  1160.  *  MMI_key_5_up
  1161.  * DESCRIPTION
  1162.  *  Handle key 5 release event
  1163.  * PARAMETERS
  1164.  *  void
  1165.  * RETURNS
  1166.  *  void
  1167.  *****************************************************************************/
  1168. void MMI_key_5_up(void)
  1169. {
  1170.     /*----------------------------------------------------------------*/
  1171.     /* Local Variables                                                */
  1172.     /*----------------------------------------------------------------*/
  1173.     /*----------------------------------------------------------------*/
  1174.     /* Code Body                                                      */
  1175.     /*----------------------------------------------------------------*/
  1176.     MMI_key_input_handler(KEY_5, KEY_EVENT_UP);
  1177. }
  1178. /*****************************************************************************
  1179.  * FUNCTION
  1180.  *  MMI_key_6_up
  1181.  * DESCRIPTION
  1182.  *  Handle key 6 release event
  1183.  * PARAMETERS
  1184.  *  void
  1185.  * RETURNS
  1186.  *  void
  1187.  *****************************************************************************/
  1188. void MMI_key_6_up(void)
  1189. {
  1190.     /*----------------------------------------------------------------*/
  1191.     /* Local Variables                                                */
  1192.     /*----------------------------------------------------------------*/
  1193.     /*----------------------------------------------------------------*/
  1194.     /* Code Body                                                      */
  1195.     /*----------------------------------------------------------------*/
  1196.     MMI_key_input_handler(KEY_6, KEY_EVENT_UP);
  1197. }
  1198. /*****************************************************************************
  1199.  * FUNCTION
  1200.  *  MMI_key_7_up
  1201.  * DESCRIPTION
  1202.  *  Handle key 7 release event
  1203.  * PARAMETERS
  1204.  *  void
  1205.  * RETURNS
  1206.  *  void
  1207.  *****************************************************************************/
  1208. void MMI_key_7_up(void)
  1209. {
  1210.     /*----------------------------------------------------------------*/
  1211.     /* Local Variables                                                */
  1212.     /*----------------------------------------------------------------*/
  1213.     /*----------------------------------------------------------------*/
  1214.     /* Code Body                                                      */
  1215.     /*----------------------------------------------------------------*/
  1216.     MMI_key_input_handler(KEY_7, KEY_EVENT_UP);
  1217. }
  1218. /*****************************************************************************
  1219.  * FUNCTION
  1220.  *  MMI_key_8_up
  1221.  * DESCRIPTION
  1222.  *  Handle key 8 release event
  1223.  * PARAMETERS
  1224.  *  void
  1225.  * RETURNS
  1226.  *  void
  1227.  *****************************************************************************/
  1228. void MMI_key_8_up(void)
  1229. {
  1230.     /*----------------------------------------------------------------*/
  1231.     /* Local Variables                                                */
  1232.     /*----------------------------------------------------------------*/
  1233.     /*----------------------------------------------------------------*/
  1234.     /* Code Body                                                      */
  1235.     /*----------------------------------------------------------------*/
  1236.     MMI_key_input_handler(KEY_8, KEY_EVENT_UP);
  1237. }
  1238. /*****************************************************************************
  1239.  * FUNCTION
  1240.  *  MMI_key_9_up
  1241.  * DESCRIPTION
  1242.  *  Handle key 9 release event
  1243.  * PARAMETERS
  1244.  *  void
  1245.  * RETURNS
  1246.  *  void
  1247.  *****************************************************************************/
  1248. void MMI_key_9_up(void)
  1249. {
  1250.     /*----------------------------------------------------------------*/
  1251.     /* Local Variables                                                */
  1252.     /*----------------------------------------------------------------*/
  1253.     /*----------------------------------------------------------------*/
  1254.     /* Code Body                                                      */
  1255.     /*----------------------------------------------------------------*/
  1256.     MMI_key_input_handler(KEY_9, KEY_EVENT_UP);
  1257. }
  1258. /* multitap for star and pound */
  1259. /*****************************************************************************
  1260.  * FUNCTION
  1261.  *  MMI_key_star_up
  1262.  * DESCRIPTION
  1263.  *  Handle key star release event
  1264.  * PARAMETERS
  1265.  *  void
  1266.  * RETURNS
  1267.  *  void
  1268.  *****************************************************************************/
  1269. void MMI_key_star_up(void)
  1270. {
  1271.     /*----------------------------------------------------------------*/
  1272.     /* Local Variables                                                */
  1273.     /*----------------------------------------------------------------*/
  1274.     /*----------------------------------------------------------------*/
  1275.     /* Code Body                                                      */
  1276.     /*----------------------------------------------------------------*/
  1277.     MMI_key_input_handler(KEY_STAR, KEY_EVENT_UP);
  1278. }
  1279. /*****************************************************************************
  1280.  * FUNCTION
  1281.  *  MMI_key_pound_up
  1282.  * DESCRIPTION
  1283.  *  Handle key pound release event
  1284.  * PARAMETERS
  1285.  *  void
  1286.  * RETURNS
  1287.  *  void
  1288.  *****************************************************************************/
  1289. void MMI_key_pound_up(void)
  1290. {
  1291.     /*----------------------------------------------------------------*/
  1292.     /* Local Variables                                                */
  1293.     /*----------------------------------------------------------------*/
  1294.     /*----------------------------------------------------------------*/
  1295.     /* Code Body                                                      */
  1296.     /*----------------------------------------------------------------*/
  1297.     MMI_key_input_handler(KEY_POUND, KEY_EVENT_UP);
  1298. }
  1299. /*****************************************************************************
  1300.  * FUNCTION
  1301.  *  register_MMI_key_input_extend_handler
  1302.  * DESCRIPTION
  1303.  *  Register key handlers for start and pound key.
  1304.  * PARAMETERS
  1305.  *  void
  1306.  * RETURNS
  1307.  *  void
  1308.  *****************************************************************************/
  1309. void register_MMI_key_input_extend_handler(void)
  1310. {
  1311.     /*----------------------------------------------------------------*/
  1312.     /* Local Variables                                                */
  1313.     /*----------------------------------------------------------------*/
  1314.     /*----------------------------------------------------------------*/
  1315.     /* Code Body                                                      */
  1316.     /*----------------------------------------------------------------*/
  1317.     SetKeyHandler(MMI_key_star_down, KEY_STAR, KEY_EVENT_DOWN);
  1318.     SetKeyHandler(MMI_key_star_up, KEY_STAR, KEY_EVENT_UP);
  1319.     SetKeyHandler(MMI_key_pound_down, KEY_POUND, KEY_EVENT_DOWN);
  1320.     SetKeyHandler(MMI_key_pound_up, KEY_POUND, KEY_EVENT_UP);
  1321. }
  1322. /*****************************************************************************
  1323.  * FUNCTION
  1324.  *  register_MMI_key_input_handler
  1325.  * DESCRIPTION
  1326.  *  Register key handlers for all digit keys
  1327.  * PARAMETERS
  1328.  *  void
  1329.  * RETURNS
  1330.  *  void
  1331.  *****************************************************************************/
  1332. void register_MMI_key_input_handler(void)
  1333. {
  1334.     /*----------------------------------------------------------------*/
  1335.     /* Local Variables                                                */
  1336.     /*----------------------------------------------------------------*/
  1337.     /*----------------------------------------------------------------*/
  1338.     /* Code Body                                                      */
  1339.     /*----------------------------------------------------------------*/
  1340.     SetKeyHandler(MMI_key_0_down, KEY_0, KEY_EVENT_DOWN);
  1341.     SetKeyHandler(MMI_key_1_down, KEY_1, KEY_EVENT_DOWN);
  1342.     SetKeyHandler(MMI_key_2_down, KEY_2, KEY_EVENT_DOWN);
  1343.     SetKeyHandler(MMI_key_3_down, KEY_3, KEY_EVENT_DOWN);
  1344.     SetKeyHandler(MMI_key_4_down, KEY_4, KEY_EVENT_DOWN);
  1345.     SetKeyHandler(MMI_key_5_down, KEY_5, KEY_EVENT_DOWN);
  1346.     SetKeyHandler(MMI_key_6_down, KEY_6, KEY_EVENT_DOWN);
  1347.     SetKeyHandler(MMI_key_7_down, KEY_7, KEY_EVENT_DOWN);
  1348.     SetKeyHandler(MMI_key_8_down, KEY_8, KEY_EVENT_DOWN);
  1349.     SetKeyHandler(MMI_key_9_down, KEY_9, KEY_EVENT_DOWN);
  1350.     SetKeyHandler(MMI_key_0_down, KEY_0, KEY_REPEAT);
  1351.     SetKeyHandler(MMI_key_1_down, KEY_1, KEY_REPEAT);
  1352.     SetKeyHandler(MMI_key_2_down, KEY_2, KEY_REPEAT);
  1353.     SetKeyHandler(MMI_key_3_down, KEY_3, KEY_REPEAT);
  1354.     SetKeyHandler(MMI_key_4_down, KEY_4, KEY_REPEAT);
  1355.     SetKeyHandler(MMI_key_5_down, KEY_5, KEY_REPEAT);
  1356.     SetKeyHandler(MMI_key_6_down, KEY_6, KEY_REPEAT);
  1357.     SetKeyHandler(MMI_key_7_down, KEY_7, KEY_REPEAT);
  1358.     SetKeyHandler(MMI_key_8_down, KEY_8, KEY_REPEAT);
  1359.     SetKeyHandler(MMI_key_9_down, KEY_9, KEY_REPEAT);
  1360.     SetKeyHandler(MMI_key_0_up, KEY_0, KEY_EVENT_UP);
  1361.     SetKeyHandler(MMI_key_1_up, KEY_1, KEY_EVENT_UP);
  1362.     SetKeyHandler(MMI_key_2_up, KEY_2, KEY_EVENT_UP);
  1363.     SetKeyHandler(MMI_key_3_up, KEY_3, KEY_EVENT_UP);
  1364.     SetKeyHandler(MMI_key_4_up, KEY_4, KEY_EVENT_UP);
  1365.     SetKeyHandler(MMI_key_5_up, KEY_5, KEY_EVENT_UP);
  1366.     SetKeyHandler(MMI_key_6_up, KEY_6, KEY_EVENT_UP);
  1367.     SetKeyHandler(MMI_key_7_up, KEY_7, KEY_EVENT_UP);
  1368.     SetKeyHandler(MMI_key_8_up, KEY_8, KEY_EVENT_UP);
  1369.     SetKeyHandler(MMI_key_9_up, KEY_9, KEY_EVENT_UP);
  1370. }
  1371. /*****************************************************************************
  1372.  * FUNCTION
  1373.  *  clear_MMI_key_input_handler
  1374.  * DESCRIPTION
  1375.  *  Clear key handlers for input
  1376.  * PARAMETERS
  1377.  *  void
  1378.  * RETURNS
  1379.  *  void
  1380.  *****************************************************************************/
  1381. void clear_MMI_key_input_handler(void)
  1382. {
  1383.     /*----------------------------------------------------------------*/
  1384.     /* Local Variables                                                */
  1385.     /*----------------------------------------------------------------*/
  1386.     /*----------------------------------------------------------------*/
  1387.     /* Code Body                                                      */
  1388.     /*----------------------------------------------------------------*/
  1389.     ClearKeyHandler(KEY_0, KEY_EVENT_DOWN);
  1390.     ClearKeyHandler(KEY_1, KEY_EVENT_DOWN);
  1391.     ClearKeyHandler(KEY_2, KEY_EVENT_DOWN);
  1392.     ClearKeyHandler(KEY_3, KEY_EVENT_DOWN);
  1393.     ClearKeyHandler(KEY_4, KEY_EVENT_DOWN);
  1394.     ClearKeyHandler(KEY_5, KEY_EVENT_DOWN);
  1395.     ClearKeyHandler(KEY_6, KEY_EVENT_DOWN);
  1396.     ClearKeyHandler(KEY_7, KEY_EVENT_DOWN);
  1397.     ClearKeyHandler(KEY_8, KEY_EVENT_DOWN);
  1398.     ClearKeyHandler(KEY_9, KEY_EVENT_DOWN);
  1399.     ClearKeyHandler(KEY_0, KEY_EVENT_UP);
  1400.     ClearKeyHandler(KEY_1, KEY_EVENT_UP);
  1401.     ClearKeyHandler(KEY_2, KEY_EVENT_UP);
  1402.     ClearKeyHandler(KEY_3, KEY_EVENT_UP);
  1403.     ClearKeyHandler(KEY_4, KEY_EVENT_UP);
  1404.     ClearKeyHandler(KEY_5, KEY_EVENT_UP);
  1405.     ClearKeyHandler(KEY_6, KEY_EVENT_UP);
  1406.     ClearKeyHandler(KEY_7, KEY_EVENT_UP);
  1407.     ClearKeyHandler(KEY_8, KEY_EVENT_UP);
  1408.     ClearKeyHandler(KEY_9, KEY_EVENT_UP);
  1409. #if defined(__MMI_MULTITAP_FOR_STAR_AND_POUND__)
  1410.     ClearKeyHandler(KEY_POUND, KEY_EVENT_DOWN);
  1411.     ClearKeyHandler(KEY_POUND, KEY_EVENT_UP);
  1412.     ClearKeyHandler(KEY_STAR, KEY_EVENT_DOWN);
  1413.     ClearKeyHandler(KEY_STAR, KEY_EVENT_UP);
  1414. #endif
  1415. }
  1416. /* Initialization / termination wrappers  */
  1417. /*****************************************************************************
  1418.  * FUNCTION
  1419.  *  wgui_init
  1420.  * DESCRIPTION
  1421.  *  Initializes the GUI wrappers
  1422.  * PARAMETERS
  1423.  *  void
  1424.  * RETURNS
  1425.  *  void
  1426.  *****************************************************************************/
  1427. void wgui_init(void)
  1428. {
  1429.     /*----------------------------------------------------------------*/
  1430.     /* Local Variables                                                */
  1431.     /*----------------------------------------------------------------*/
  1432.     /*----------------------------------------------------------------*/
  1433.     /* Code Body                                                      */
  1434.     /*----------------------------------------------------------------*/
  1435.     
  1436. #ifdef __MMI_FREETYPE_SETTING_SUPPORT__
  1437.     gui_freetype_set_size(PhnsetGetFreeTypeSetting());
  1438. #endif
  1439.     set_MMI_theme((MMI_theme*) MMI_themes[0]);
  1440.     gui_initialize_default_themes();
  1441. #if(!UI_DISABLE_EMS_INPUT_BOX)
  1442.     gui_intialize_EMS();
  1443. #endif 
  1444.     register_keyboard_key_handler(dummy_keyboard_key_handler);
  1445.     register_keyboard_input_handler(dummy_keyboard_input_handler);
  1446.     register_keyboard_global_key_handler(dummy_keyboard_key_handler);
  1447.     create_softkeys();
  1448.     create_menu_shortcut_handler();
  1449.     create_fixed_list();
  1450.     create_fixed_matrix();
  1451.     
  1452. #if defined(__MMI_VIRTUAL_KEYBOARD__)
  1453.     create_virtual_keyboard();
  1454. #endif /* defined(__MMI_VIRTUAL_KEYBOARD__) */
  1455.     clear_key_input_handler();
  1456.     clear_key_down_handler();
  1457.     clear_key_up_handler();
  1458.     initialize_status_icons();
  1459.     register_multiline_inputbox_input_callback(UI_dummy_function);
  1460. }
  1461. extern void UpdateUITheme(void);
  1462. /** Animation handle of title icon */
  1463. GDI_HANDLE MMI_title_icon_ani_handle = GDI_ERROR_HANDLE;
  1464. extern FuncPtr gExitFullScreenCallBack;
  1465. /*****************************************************************************
  1466.  * FUNCTION
  1467.  *  UI_common_screen_pre_exit
  1468.  * DESCRIPTION
  1469.  *  Failsafe screen exit function *before* screen exit function
  1470.  * PARAMETERS
  1471.  *  void
  1472.  * RETURNS
  1473.  *  void
  1474.  * REMARKS
  1475.  *  Some functions should not be invoked after screen exit function.
  1476.  *  (e.g. BLT on layers that are already released.)
  1477.  *****************************************************************************/
  1478. void UI_common_screen_pre_exit(void)
  1479. {
  1480.     /*----------------------------------------------------------------*/
  1481.     /* Local Variables                                                */
  1482.     /*----------------------------------------------------------------*/
  1483.     /*----------------------------------------------------------------*/
  1484.     /* Code Body                                                      */
  1485.     /*----------------------------------------------------------------*/
  1486.     /* suspend VRT as soon as possible when screen is exited */
  1487. #ifdef __MMI_VUI_ENGINE__
  1488.     vrt_canvas_suspend();
  1489. #endif    
  1490.     
  1491. #ifdef __MMI_TOUCH_SCREEN__
  1492.     mmi_pen_reset();
  1493. #endif 
  1494.     gui_pre_cleanup();
  1495.     if (!dm_is_activated())
  1496.     {
  1497.         dm_reset_context_ext();
  1498.     }
  1499. #ifdef __MMI_SCREEN_SWITCH_EFFECT__
  1500.     gui_screen_switch_effect_pre_exit_screen();
  1501. #endif    
  1502. }
  1503. /*****************************************************************************
  1504.  * FUNCTION
  1505.  *  UI_common_component_exit
  1506.  * DESCRIPTION
  1507.  *  Failsafe screen exit function *after* screen exit function
  1508.  * PARAMETERS
  1509.  *  void
  1510.  * RETURNS
  1511.  *  void
  1512.  *****************************************************************************/
  1513. void UI_common_component_exit(void)
  1514. {
  1515.     /*----------------------------------------------------------------*/
  1516.     /* Local Variables                                                */
  1517.     /*----------------------------------------------------------------*/
  1518.     /*----------------------------------------------------------------*/
  1519.     /* Code Body                                                      */
  1520.     /*----------------------------------------------------------------*/
  1521.     wgui_title_close();
  1522.     wgui_title_create();
  1523.     wgui_title_set_no_icon_shct(MMI_FALSE);
  1524.     wgui_title_set_thick(MMI_FALSE);
  1525.     hide_status_icon_bar(0);
  1526.     hide_status_icon_bar(1);
  1527.     register_hide_status_icon_bar(0, hide_status_icons_bar0);
  1528.     wgui_status_icon_reset_alpha_layer();
  1529.     wgui_status_icon_reset_all_status_icon_bar_layer();
  1530. #ifdef MMI_SHOW_STATUS_ICON_IN_TITLE 
  1531.     wgui_status_icon_integrated_enable(MMI_TRUE);
  1532.     wgui_status_icon_integrated_register_redraw(NULL);
  1533. #endif
  1534.     clear_category_screen_key_handlers();
  1535.     clear_left_softkey();
  1536.     clear_right_softkey();
  1537. #ifdef __MMI_WGUI_CSK_ENABLE__
  1538.     clear_softkey_display_functions(MMI_CENTER_SOFTKEY);
  1539.     ResetCenterSoftkey();
  1540. #endif
  1541.     /* Editor common exit handler */
  1542.     wgui_inputs_close();
  1543.     /* for some special screen do not resize list */
  1544.     resize_fixed_list(MMI_content_width, MMI_content_height);
  1545.     /* Reset the toggle transition effect when exit screen */
  1546. #ifdef __MMI_UI_HINT_TOGGLE_TRANSITION__
  1547.     wgui_reset_pop_up_description_transition();
  1548. #endif
  1549. }
  1550. /*****************************************************************************
  1551.  * FUNCTION
  1552.  *  UI_common_screen_exit
  1553.  * DESCRIPTION
  1554.  *  Failsafe screen exit function *after* screen exit function
  1555.  * PARAMETERS
  1556.  *  void
  1557.  * RETURNS
  1558.  *  void
  1559.  *****************************************************************************/
  1560. void UI_common_screen_exit(void)
  1561. {
  1562.     /*----------------------------------------------------------------*/
  1563.     /* Local Variables                                                */
  1564.     /*----------------------------------------------------------------*/
  1565.     gdi_handle main_base_layer;
  1566.     /*----------------------------------------------------------------*/
  1567.     /* Code Body                                                      */
  1568.     /*----------------------------------------------------------------*/      
  1569.     /* de-initialize gui effect */
  1570. #ifdef __MMI_UI_EFFECT_ENGINE__
  1571.     gui_effect_close();
  1572. #endif
  1573. #ifdef __MMI_SCREEN_SWITCH_EFFECT__
  1574.     gui_screen_switch_effect_pre_exit_category();
  1575. #endif
  1576.     
  1577. #ifdef __MMI_VIRTUAL_KEYBOARD__
  1578.     wgui_close_virtual_keyboard();
  1579. #endif
  1580.     if (ExitCategoryFunction != NULL)
  1581.     {
  1582.         ExitCategoryFunction();
  1583.     }
  1584. #if defined(__MMI_SCREEN_SWITCH_EFFECT__) || defined(GUI_LIST_MENU_SMOOTH_SCROLLING_BY_KEY) || defined(GUI_LIST_MENU_SMOOTH_SCROLLING_BY_PEN)
  1585.     gui_screen_switch_effect_post_exit_category();
  1586. #endif
  1587.     
  1588.     /* set default ABM source layer to the main base layer */
  1589.     gdi_layer_get_base_handle(&main_base_layer);
  1590.     gdi_set_alpha_blending_source_layer(main_base_layer);    
  1591.     
  1592. #ifdef __MMI_TOUCH_SCREEN__
  1593.     wgui_register_general_pen_handler();
  1594.     wgui_reset_list_item_selected_callback();
  1595.     wgui_reset_matrix_item_selected_callback();
  1596. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1597. mmi_imc_exit_screen();
  1598.     gui_cleanup();
  1599.     ClearHighlightHandler();
  1600.     gui_hide_animations();
  1601.     animation_handle = GDI_ERROR_HANDLE;
  1602.     if (MMI_title_icon_ani_handle != GDI_ERROR_HANDLE)
  1603.     {
  1604.         gdi_image_stop_animation(MMI_title_icon_ani_handle);
  1605.         MMI_title_icon_ani_handle = GDI_ERROR_HANDLE;
  1606.     }
  1607.     StopTimer(BLINKING_CURSOR);
  1608. #ifdef __MMI_THEMES_APPLICATION__
  1609. #ifndef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  1610.     UpdateUITheme();
  1611. #endif 
  1612. #endif /* __MMI_THEMES_APPLICATION__ */ 
  1613.     ExitCategoryFunction = MMI_dummy_function;
  1614.     RedrawCategoryFunction = MMI_dummy_function;
  1615.     GetCategoryHistory = dummy_get_history;
  1616.     GetCategoryHistorySize = dummy_get_history_size;
  1617. #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
  1618.     gui_unblock_list_effect();
  1619. #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */  
  1620.     /* set multilayer mask on/off */
  1621. #if defined (__GDI_MEMORY_PROFILE_2__)
  1622.     {
  1623.     #if defined(__MMI_SUBMENU_USE_MM_IMAGE__)
  1624.         gui_set_multilayer_mask(gui_get_multilayer_mask() | UI_MUL_BKG_MAINMENU | UI_MUL_BKG_SUBMENU);
  1625.         if (mmi_bootup_is_searching_or_idle_reached() == MMI_FALSE)
  1626.         {
  1627.             gui_set_multilayer_mask(gui_get_multilayer_mask() & (~UI_MUL_BKG_SUBMENU));
  1628.         }
  1629.         else
  1630.         {
  1631.             gui_set_multilayer_mask(gui_get_multilayer_mask() | UI_MUL_BKG_SUBMENU);
  1632.         }
  1633.     #else 
  1634.         gui_set_multilayer_mask(gui_get_multilayer_mask() & (~UI_MUL_BKG_MAINMENU) & (~UI_MUL_BKG_SUBMENU));
  1635.     #endif 
  1636.     }
  1637. #endif /* defined (__GDI_MEMORY_PROFILE_2__) */ 
  1638.     /* free all layer to be base layer */
  1639.     gui_free_multilayer_screen();
  1640.     gui_set_entry_new_screen(MMI_TRUE);
  1641.     /* redraw status */
  1642.     if (wgui_is_wallpaper_on_bottom())
  1643.     {
  1644.         gOnFullScreen = MMI_LEAVE_BG_ON_BOTTOM_SCREEN;
  1645.         wgui_reset_wallpaper_on_bottom();   /* support wallpaper on bottom */
  1646.     }
  1647.     gdi_image_gif_reset();
  1648.     gui_reset_clip();
  1649.     gui_reset_text_clip();
  1650.     reset_softkeys();
  1651.     
  1652. #if defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__) || defined (__MMI_MAINLCD_240X400__) || defined (__MMI_MAINLCD_320X240__)
  1653.     if (gExitFullScreenCallBack != NULL)
  1654.     {
  1655.         gExitFullScreenCallBack();
  1656.         gExitFullScreenCallBack = NULL;
  1657.     }
  1658. #endif /* defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__) || defined (__MMI_MAINLCD_240X400__) || defined (__MMI_MAINLCD_320X240__) */    
  1659. #ifdef __MMI_SCREEN_ROTATE__
  1660.     mmi_frm_reset_screen_rotation();
  1661. #endif 
  1662.     UI_common_component_exit();
  1663.     gui_setup_default_layout();
  1664. #ifndef __MTK_TARGET__    
  1665.     /* 
  1666.      * Notify MTE there is a screen switch.
  1667.      *
  1668.      * Actually, this is quite tricky. But to get the current screen refreshed for 
  1669.      * full screen applications, such as JAVA, WAP, camera, ... , and etc,
  1670.      * this is necessary.
  1671.      */
  1672.     mmi_mte_mmi_notify_new_screen();
  1673. #endif /* __MTK_TARGET__ */
  1674.     MMI_ASSERT(mmi_frm_scrmem_is_all_free());
  1675. }   /* end of UI_common_screen_exit */