wgui.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:61k
源码类别:

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.  * removed!
  92.  *
  93.  * removed!
  94.  * removed!
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  */
  99. /**********************************************************************************
  100.    Filename:      wgui.c
  101.    Author:        manju
  102.    Date Created:  August-07-2002
  103.    Contains:      PixTel UI wrapper routines
  104.                Contains several parts and has been split to multiple
  105.                code files. See other files named wgui_*.c and wgui_*.h
  106.                This file contains common functions and data.
  107. **********************************************************************************/
  108. /* Include: MMI header file */
  109. #include "gui_config.h"
  110. #include "gui_themes.h"
  111. #include "wgui.h"
  112. #include "wgui_softkeys.h"
  113. #include "wgui_menu_shortcuts.h"
  114. #include "wgui_fixed_menus.h"
  115. #include "wgui_fixed_menuitems.h"
  116. #include "wgui_status_icons.h"
  117. #include "wgui_inputs.h"
  118. #include "wgui_virtual_keyboard.h"
  119. #include "IdleAppDef.h"
  120. #include "wgui_categories.h"
  121. #include "Gui_Setting.h"
  122. #include "UCS2prot.h"
  123. #include "FunAndGamesDefs.h"
  124. #include "NVRAMType.h"
  125. #include "NVRAMProt.h"
  126. #include "NVRAMEnum.h"
  127. #if(!UI_DISABLE_EMS_INPUT_BOX)
  128. #include "gui_ems.h"
  129. #endif 
  130. /* 
  131.  * removed!
  132.  */
  133. static void (*MMI_keyboard_key_handler) (S32 vkey_code, S32 key_state) = NULL;
  134. static void (*MMI_keyboard_input_handler) (S32 vkey_code) = NULL;
  135. static void (*MMI_keyboard_global_key_handler) (S32 vkey_code, S32 key_state) = NULL;
  136. static void (*MMI_keyboard_global_input_handler) (S32 vkey_code) = NULL;
  137. static void (*MMI_key_input_handler_function) (MMI_key_code_type key_code, MMI_key_event_type key_event);
  138. static void (*MMI_key_down_handler_function) (MMI_key_code_type key_code);
  139. static void (*MMI_key_up_handler_function) (MMI_key_code_type key_code);
  140. /* 
  141.  * removed!
  142.  */
  143. U8 MMI_disable_title_shortcut_display = 0;
  144. S32 MMI_status_bar_height;
  145. S32 MMI_content_x;
  146. S32 MMI_content_y;
  147. S32 MMI_content_width;
  148. S32 MMI_content_height;
  149. extern MMI_theme theme_Default;
  150. extern MMI_theme **MMI_themes;
  151. /* 
  152.  * removed!
  153.  */
  154. /*****************************************************************************
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  * removed!
  159.  * removed!
  160.  * removed!
  161.  * removed!
  162.  * removed!
  163.  *****************************************************************************/
  164. void MMI_dummy_function(void)
  165. {
  166.     /*----------------------------------------------------------------*/
  167.     /* Local Variables                                                */
  168.     /*----------------------------------------------------------------*/
  169.     /*----------------------------------------------------------------*/
  170.     /* Code Body                                                      */
  171.     /*----------------------------------------------------------------*/
  172. }
  173. /* Functions for keyboard Support   */
  174. /*****************************************************************************
  175.  * FUNCTION
  176.  *  dummy_keyboard_key_handler
  177.  * DESCRIPTION
  178.  *  Dummy keyboard key handler
  179.  * PARAMETERS
  180.  *  vkey_code       [IN]        Key_code
  181.  *  key_state       [IN]        Key_state
  182.  * RETURNS
  183.  *  void
  184.  *****************************************************************************/
  185. void dummy_keyboard_key_handler(S32 vkey_code, S32 key_state)
  186. {
  187.     /*----------------------------------------------------------------*/
  188.     /* Local Variables                                                */
  189.     /*----------------------------------------------------------------*/
  190.     /*----------------------------------------------------------------*/
  191.     /* Code Body                                                      */
  192.     /*----------------------------------------------------------------*/
  193.     UI_UNUSED_PARAMETER(vkey_code);
  194.     UI_UNUSED_PARAMETER(key_state);
  195. }
  196. /*****************************************************************************
  197.  * FUNCTION
  198.  *  dummy_keyboard_input_handler
  199.  * DESCRIPTION
  200.  *  Dummy keyboard input handler
  201.  * PARAMETERS
  202.  *  vkey_code       [IN]        Key_code
  203.  * RETURNS
  204.  *  void
  205.  *****************************************************************************/
  206. void dummy_keyboard_input_handler(S32 vkey_code)
  207. {
  208.     /*----------------------------------------------------------------*/
  209.     /* Local Variables                                                */
  210.     /*----------------------------------------------------------------*/
  211.     /*----------------------------------------------------------------*/
  212.     /* Code Body                                                      */
  213.     /*----------------------------------------------------------------*/
  214.     UI_UNUSED_PARAMETER(vkey_code);
  215. }
  216. /*****************************************************************************
  217.  * FUNCTION
  218.  *  keyboard_key_handler
  219.  * DESCRIPTION
  220.  *  Handles key events (UP/DOWN)
  221.  * PARAMETERS
  222.  *  vkey_code       [IN]        Key's scan code
  223.  *  key_state       [IN]        Key's state (up or down)
  224.  * RETURNS
  225.  *  void
  226.  *****************************************************************************/
  227. void keyboard_key_handler(S32 vkey_code, S32 key_state)
  228. {
  229.     /*----------------------------------------------------------------*/
  230.     /* Local Variables                                                */
  231.     /*----------------------------------------------------------------*/
  232.     U8 state = 0;
  233.     /*----------------------------------------------------------------*/
  234.     /* Code Body                                                      */
  235.     /*----------------------------------------------------------------*/
  236.     /* Perform scan code and key state mapping here */
  237.     if (key_state == KEYBOARD_KEY_DOWN)
  238.     {
  239.         state = 1;
  240.     }
  241.     else if (key_state == KEYBOARD_KEY_UP)
  242.     {
  243.         state = 0;
  244.     }
  245.     if (MMI_keyboard_key_handler != NULL)
  246.     {
  247.         MMI_keyboard_key_handler(vkey_code, state);
  248.     }
  249. }
  250. /*****************************************************************************
  251.  * FUNCTION
  252.  *  keyboard_input_handler
  253.  * DESCRIPTION
  254.  *  Handles keyboard input
  255.  * PARAMETERS
  256.  *  vkey_code       [IN]        Key's character code (ASCII)
  257.  * RETURNS
  258.  *  void
  259.  *****************************************************************************/
  260. void keyboard_input_handler(S32 vkey_code)
  261. {
  262.     /*----------------------------------------------------------------*/
  263.     /* Local Variables                                                */
  264.     /*----------------------------------------------------------------*/
  265.     /*----------------------------------------------------------------*/
  266.     /* Code Body                                                      */
  267.     /*----------------------------------------------------------------*/
  268.     if (MMI_keyboard_input_handler != NULL)
  269.     {
  270.         MMI_keyboard_input_handler(vkey_code);
  271.     }
  272. }
  273. /*****************************************************************************
  274.  * FUNCTION
  275.  *  keyboard_global_key_handler
  276.  * DESCRIPTION
  277.  *  Handles key events (UP/DOWN)
  278.  * PARAMETERS
  279.  *  vkey_code       [IN]        Key's scan code
  280.  *  key_state       [IN]        Key's state (up or down)
  281.  * RETURNS
  282.  *  void
  283.  *****************************************************************************/
  284. void keyboard_global_key_handler(S32 vkey_code, S32 key_state)
  285. {
  286.     /*----------------------------------------------------------------*/
  287.     /* Local Variables                                                */
  288.     /*----------------------------------------------------------------*/
  289.     U8 state = 0;
  290.     /*----------------------------------------------------------------*/
  291.     /* Code Body                                                      */
  292.     /*----------------------------------------------------------------*/
  293.     /* Perform scan code and key state mapping here */
  294.     if (key_state == KEYBOARD_KEY_DOWN)
  295.     {
  296.         state = 1;
  297.     }
  298.     else if (key_state == KEYBOARD_KEY_UP)
  299.     {
  300.         state = 0;
  301.     }
  302.     if (MMI_keyboard_global_key_handler != NULL)
  303.     {
  304.         MMI_keyboard_global_key_handler(vkey_code, state);
  305.     }
  306. }
  307. /*****************************************************************************
  308.  * FUNCTION
  309.  *  keyboard_global_input_handler
  310.  * DESCRIPTION
  311.  *  Handles keyboard input
  312.  * PARAMETERS
  313.  *  vkey_code       [IN]        Key's character code (ASCII)
  314.  * RETURNS
  315.  *  void
  316.  *****************************************************************************/
  317. void keyboard_global_input_handler(S32 vkey_code)
  318. {
  319.     /*----------------------------------------------------------------*/
  320.     /* Local Variables                                                */
  321.     /*----------------------------------------------------------------*/
  322.     /*----------------------------------------------------------------*/
  323.     /* Code Body                                                      */
  324.     /*----------------------------------------------------------------*/
  325.     if (MMI_keyboard_global_input_handler != NULL)
  326.     {
  327.         MMI_keyboard_global_input_handler(vkey_code);
  328.     }
  329. }
  330. /*****************************************************************************
  331.  * FUNCTION
  332.  *  register_keyboard_key_handler
  333.  * DESCRIPTION
  334.  *  Registers a function to be called for key handling
  335.  * PARAMETERS
  336.  *  f       [IN]        Function to be called for key handling
  337.  * RETURNS
  338.  *  void
  339.  *****************************************************************************/
  340. void register_keyboard_key_handler(void (*f) (S32 vkey_code, S32 key_state))
  341. {
  342.     /*----------------------------------------------------------------*/
  343.     /* Local Variables                                                */
  344.     /*----------------------------------------------------------------*/
  345.     /*----------------------------------------------------------------*/
  346.     /* Code Body                                                      */
  347.     /*----------------------------------------------------------------*/
  348.     MMI_keyboard_key_handler = f;
  349. }
  350. /*****************************************************************************
  351.  * FUNCTION
  352.  *  register_keyboard_input_handler
  353.  * DESCRIPTION
  354.  *  Registers a function to be called for key input
  355.  * PARAMETERS
  356.  *  f       [IN]        Function that is called upon key events
  357.  * RETURNS
  358.  *  void
  359.  *****************************************************************************/
  360. void register_keyboard_input_handler(void (*f) (S32 vkey_code))
  361. {
  362.     /*----------------------------------------------------------------*/
  363.     /* Local Variables                                                */
  364.     /*----------------------------------------------------------------*/
  365.     /*----------------------------------------------------------------*/
  366.     /* Code Body                                                      */
  367.     /*----------------------------------------------------------------*/
  368.     MMI_keyboard_input_handler = f;
  369. }
  370. /*****************************************************************************
  371.  * FUNCTION
  372.  *  register_keyboard_global_key_handler
  373.  * DESCRIPTION
  374.  *  Registers a function to be called for key handling
  375.  * PARAMETERS
  376.  *  f       [IN]        Function that is called upon key events
  377.  * RETURNS
  378.  *  void
  379.  *****************************************************************************/
  380. void register_keyboard_global_key_handler(void (*f) (S32 vkey_code, S32 key_state))
  381. {
  382.     /*----------------------------------------------------------------*/
  383.     /* Local Variables                                                */
  384.     /*----------------------------------------------------------------*/
  385.     /*----------------------------------------------------------------*/
  386.     /* Code Body                                                      */
  387.     /*----------------------------------------------------------------*/
  388.     MMI_keyboard_global_key_handler = f;
  389. }
  390. /*****************************************************************************
  391.  * FUNCTION
  392.  *  register_keyboard_global_input_handler
  393.  * DESCRIPTION
  394.  *  Register_keyboard_global_input_handler
  395.  * PARAMETERS
  396.  *  f       [IN]        Function that is called upon key events
  397.  * RETURNS
  398.  *  void
  399.  *****************************************************************************/
  400. void register_keyboard_global_input_handler(void (*f) (S32 vkey_code))
  401. {
  402.     /*----------------------------------------------------------------*/
  403.     /* Local Variables                                                */
  404.     /*----------------------------------------------------------------*/
  405.     /*----------------------------------------------------------------*/
  406.     /* Code Body                                                      */
  407.     /*----------------------------------------------------------------*/
  408.     MMI_keyboard_global_input_handler = f;
  409. }
  410. /*****************************************************************************
  411.  * FUNCTION
  412.  *  clear_keyboard_key_handler
  413.  * DESCRIPTION
  414.  *  Clears the function called to handle key events
  415.  * PARAMETERS
  416.  *  void
  417.  * RETURNS
  418.  *  void
  419.  *****************************************************************************/
  420. void clear_keyboard_key_handler(void)
  421. {
  422.     /*----------------------------------------------------------------*/
  423.     /* Local Variables                                                */
  424.     /*----------------------------------------------------------------*/
  425.     /*----------------------------------------------------------------*/
  426.     /* Code Body                                                      */
  427.     /*----------------------------------------------------------------*/
  428.     MMI_keyboard_key_handler = dummy_keyboard_key_handler;
  429. }
  430. /*****************************************************************************
  431.  * FUNCTION
  432.  *  clear_keyboard_input_handler
  433.  * DESCRIPTION
  434.  *  Clears the function called to handle key input
  435.  * PARAMETERS
  436.  *  void
  437.  * RETURNS
  438.  *  void
  439.  *****************************************************************************/
  440. void clear_keyboard_input_handler(void)
  441. {
  442.     /*----------------------------------------------------------------*/
  443.     /* Local Variables                                                */
  444.     /*----------------------------------------------------------------*/
  445.     /*----------------------------------------------------------------*/
  446.     /* Code Body                                                      */
  447.     /*----------------------------------------------------------------*/
  448.     MMI_keyboard_input_handler = dummy_keyboard_input_handler;
  449. }
  450. /*****************************************************************************
  451.  * FUNCTION
  452.  *  clear_keyboard_global_key_handler
  453.  * DESCRIPTION
  454.  *  Clears the function called to handle key events
  455.  * PARAMETERS
  456.  *  void
  457.  * RETURNS
  458.  *  void
  459.  *****************************************************************************/
  460. void clear_keyboard_global_key_handler(void)
  461. {
  462.     /*----------------------------------------------------------------*/
  463.     /* Local Variables                                                */
  464.     /*----------------------------------------------------------------*/
  465.     /*----------------------------------------------------------------*/
  466.     /* Code Body                                                      */
  467.     /*----------------------------------------------------------------*/
  468.     MMI_keyboard_global_key_handler = dummy_keyboard_key_handler;
  469. }
  470. /*****************************************************************************
  471.  * FUNCTION
  472.  *  clear_keyboard_global_input_handler
  473.  * DESCRIPTION
  474.  *  Clears the function called to handle key input
  475.  * PARAMETERS
  476.  *  void
  477.  * RETURNS
  478.  *  void
  479.  *****************************************************************************/
  480. void clear_keyboard_global_input_handler(void)
  481. {
  482.     /*----------------------------------------------------------------*/
  483.     /* Local Variables                                                */
  484.     /*----------------------------------------------------------------*/
  485.     /*----------------------------------------------------------------*/
  486.     /* Code Body                                                      */
  487.     /*----------------------------------------------------------------*/
  488.     MMI_keyboard_global_input_handler = dummy_keyboard_input_handler;
  489. }
  490. /* Key handling wrappers      */
  491. /*****************************************************************************
  492.  * FUNCTION
  493.  *  clear_key_handlers
  494.  * DESCRIPTION
  495.  *  Clears the key handlers
  496.  * PARAMETERS
  497.  *  void
  498.  * RETURNS
  499.  *  void
  500.  *****************************************************************************/
  501. void clear_key_handlers(void)
  502. {
  503.     /*----------------------------------------------------------------*/
  504.     /* Local Variables                                                */
  505.     /*----------------------------------------------------------------*/
  506.     /*----------------------------------------------------------------*/
  507.     /* Code Body                                                      */
  508.     /*----------------------------------------------------------------*/
  509.     clear_softkey_handler(KEY_LSK);
  510.     clear_softkey_handler(KEY_RSK);
  511. #ifdef __MMI_WGUI_CSK_ENABLE__
  512.     clear_softkey_handler(KEY_CSK);
  513. #endif 
  514.     register_keyboard_key_handler(dummy_keyboard_key_handler);
  515.     register_keyboard_input_handler(dummy_keyboard_input_handler);
  516.     register_keyboard_global_input_handler(dummy_keyboard_input_handler);
  517.     ClearInputEventHandler(MMI_DEVICE_KEY);
  518. }
  519. /*****************************************************************************
  520.  * FUNCTION
  521.  *  clear_category_screen_key_handlers
  522.  * DESCRIPTION
  523.  *  Clears the key handlers used in category screen
  524.  * PARAMETERS
  525.  *  void
  526.  * RETURNS
  527.  *  void
  528.  *****************************************************************************/
  529. void clear_category_screen_key_handlers(void)
  530. {
  531.     /*----------------------------------------------------------------*/
  532.     /* Local Variables                                                */
  533.     /*----------------------------------------------------------------*/
  534.     /*----------------------------------------------------------------*/
  535.     /* Code Body                                                      */
  536.     /*----------------------------------------------------------------*/
  537.     clear_softkey_handler(KEY_LSK);
  538.     clear_softkey_handler(KEY_RSK);
  539. #ifdef __MMI_WGUI_CSK_ENABLE__
  540.     clear_softkey_handler(KEY_CSK);
  541. #endif 
  542.     register_keyboard_key_handler(dummy_keyboard_key_handler);
  543.     register_keyboard_input_handler(dummy_keyboard_input_handler);
  544. }
  545. /*****************************************************************************
  546.  * FUNCTION
  547.  *  register_key_input_handler
  548.  * DESCRIPTION
  549.  *  Registers a key input handler for a keypad key
  550.  * PARAMETERS
  551.  *  f       [IN]        Function that is called on receiving key events
  552.  * RETURNS
  553.  *  void
  554.  *****************************************************************************/
  555. void register_key_input_handler(void (*f) (MMI_key_code_type key_code, MMI_key_event_type key_event))
  556. {
  557.     /*----------------------------------------------------------------*/
  558.     /* Local Variables                                                */
  559.     /*----------------------------------------------------------------*/
  560.     /*----------------------------------------------------------------*/
  561.     /* Code Body                                                      */
  562.     /*----------------------------------------------------------------*/
  563.     MMI_key_input_handler_function = f;
  564. }
  565. /*****************************************************************************
  566.  * FUNCTION
  567.  *  register_key_up_handler
  568.  * DESCRIPTION
  569.  *  Registers handler for the key up events of all keys
  570.  * PARAMETERS
  571.  *  f       [IN]        Function that is called whenever any key is released
  572.  * RETURNS
  573.  *  void
  574.  *****************************************************************************/
  575. void register_key_up_handler(void (*f) (MMI_key_code_type key_code))
  576. {
  577.     /*----------------------------------------------------------------*/
  578.     /* Local Variables                                                */
  579.     /*----------------------------------------------------------------*/
  580.     /*----------------------------------------------------------------*/
  581.     /* Code Body                                                      */
  582.     /*----------------------------------------------------------------*/
  583.     MMI_key_up_handler_function = f;
  584. }
  585. /*****************************************************************************
  586.  * FUNCTION
  587.  *  register_key_down_handler
  588.  * DESCRIPTION
  589.  *  Registers handler for the key down events of all keys
  590.  * PARAMETERS
  591.  *  f       [IN]        Function that is called whenever any key is pressed
  592.  * RETURNS
  593.  *  void
  594.  *****************************************************************************/
  595. void register_key_down_handler(void (*f) (MMI_key_code_type key_code))
  596. {
  597.     /*----------------------------------------------------------------*/
  598.     /* Local Variables                                                */
  599.     /*----------------------------------------------------------------*/
  600.     /*----------------------------------------------------------------*/
  601.     /* Code Body                                                      */
  602.     /*----------------------------------------------------------------*/
  603.     MMI_key_down_handler_function = f;
  604. }
  605. /*****************************************************************************
  606.  * FUNCTION
  607.  *  clear_key_input_handler
  608.  * DESCRIPTION
  609.  *  Clears the key input handler
  610.  * PARAMETERS
  611.  *  void
  612.  * RETURNS
  613.  *  void
  614.  *****************************************************************************/
  615. void clear_key_input_handler(void)
  616. {
  617.     /*----------------------------------------------------------------*/
  618.     /* Local Variables                                                */
  619.     /*----------------------------------------------------------------*/
  620.     /*----------------------------------------------------------------*/
  621.     /* Code Body                                                      */
  622.     /*----------------------------------------------------------------*/
  623.     MMI_key_input_handler_function = NULL;
  624. }
  625. /*****************************************************************************
  626.  * FUNCTION
  627.  *  clear_key_down_handler
  628.  * DESCRIPTION
  629.  *  Clears the key down handler
  630.  * PARAMETERS
  631.  *  void
  632.  * RETURNS
  633.  *  void
  634.  *****************************************************************************/
  635. void clear_key_down_handler(void)
  636. {
  637.     /*----------------------------------------------------------------*/
  638.     /* Local Variables                                                */
  639.     /*----------------------------------------------------------------*/
  640.     /*----------------------------------------------------------------*/
  641.     /* Code Body                                                      */
  642.     /*----------------------------------------------------------------*/
  643.     MMI_key_down_handler_function = NULL;
  644. }
  645. /*****************************************************************************
  646.  * FUNCTION
  647.  *  clear_key_up_handler
  648.  * DESCRIPTION
  649.  *  Clears the key up handler
  650.  * PARAMETERS
  651.  *  void
  652.  * RETURNS
  653.  *  void
  654.  *****************************************************************************/
  655. void clear_key_up_handler(void)
  656. {
  657.     /*----------------------------------------------------------------*/
  658.     /* Local Variables                                                */
  659.     /*----------------------------------------------------------------*/
  660.     /*----------------------------------------------------------------*/
  661.     /* Code Body                                                      */
  662.     /*----------------------------------------------------------------*/
  663.     MMI_key_up_handler_function = NULL;
  664. }
  665. /*----------------------------------------------------------------------------
  666.    The following functions are used internally and are not meant to be called
  667.    by other functions.
  668. ----------------------------------------------------------------------------*/
  669. /*****************************************************************************
  670.  * FUNCTION
  671.  *  MMI_key_input_handler
  672.  * DESCRIPTION
  673.  *  Handler key input events
  674.  * PARAMETERS
  675.  *  key_code        [IN]        
  676.  *  key_event       [IN]        
  677.  * RETURNS
  678.  *  void
  679.  *****************************************************************************/
  680. void MMI_key_input_handler(MMI_key_code_type key_code, MMI_key_event_type key_event)
  681. {
  682.     /*----------------------------------------------------------------*/
  683.     /* Local Variables                                                */
  684.     /*----------------------------------------------------------------*/
  685.     /*----------------------------------------------------------------*/
  686.     /* Code Body                                                      */
  687.     /*----------------------------------------------------------------*/
  688.     if (MMI_key_input_handler_function != NULL)
  689.     {
  690.         MMI_key_input_handler_function(key_code, key_event);
  691.     }
  692.     switch (key_event)
  693.     {
  694.         case KEY_EVENT_DOWN:
  695.             if (MMI_key_down_handler_function != NULL)
  696.             {
  697.                 MMI_key_down_handler_function(key_code);
  698.             }
  699.             break;
  700.         case KEY_EVENT_UP:
  701.             if (MMI_key_up_handler_function != NULL)
  702.             {
  703.                 MMI_key_up_handler_function(key_code);
  704.             }
  705.             break;
  706.     }
  707. }
  708. /*****************************************************************************
  709.  * FUNCTION
  710.  *  MMI_key_0_down
  711.  * DESCRIPTION
  712.  *  Handle key 0 pressed event
  713.  * PARAMETERS
  714.  *  void
  715.  * RETURNS
  716.  *  void
  717.  *****************************************************************************/
  718. void MMI_key_0_down(void)
  719. {
  720.     /*----------------------------------------------------------------*/
  721.     /* Local Variables                                                */
  722.     /*----------------------------------------------------------------*/
  723.     /*----------------------------------------------------------------*/
  724.     /* Code Body                                                      */
  725.     /*----------------------------------------------------------------*/
  726.     MMI_key_input_handler(KEY_0, KEY_EVENT_DOWN);
  727. }
  728. /*****************************************************************************
  729.  * FUNCTION
  730.  *  MMI_key_1_down
  731.  * DESCRIPTION
  732.  *  Handle key 1 pressed event
  733.  * PARAMETERS
  734.  *  void
  735.  * RETURNS
  736.  *  void
  737.  *****************************************************************************/
  738. void MMI_key_1_down(void)
  739. {
  740.     /*----------------------------------------------------------------*/
  741.     /* Local Variables                                                */
  742.     /*----------------------------------------------------------------*/
  743.     /*----------------------------------------------------------------*/
  744.     /* Code Body                                                      */
  745.     /*----------------------------------------------------------------*/
  746.     MMI_key_input_handler(KEY_1, KEY_EVENT_DOWN);
  747. }
  748. /*****************************************************************************
  749.  * FUNCTION
  750.  *  MMI_key_2_down
  751.  * DESCRIPTION
  752.  *  Handle key 2 pressed event
  753.  * PARAMETERS
  754.  *  void
  755.  * RETURNS
  756.  *  void
  757.  *****************************************************************************/
  758. void MMI_key_2_down(void)
  759. {
  760.     /*----------------------------------------------------------------*/
  761.     /* Local Variables                                                */
  762.     /*----------------------------------------------------------------*/
  763.     /*----------------------------------------------------------------*/
  764.     /* Code Body                                                      */
  765.     /*----------------------------------------------------------------*/
  766.     MMI_key_input_handler(KEY_2, KEY_EVENT_DOWN);
  767. }
  768. /*****************************************************************************
  769.  * FUNCTION
  770.  *  MMI_key_3_down
  771.  * DESCRIPTION
  772.  *  Handle key 3 pressed event
  773.  * PARAMETERS
  774.  *  void
  775.  * RETURNS
  776.  *  void
  777.  *****************************************************************************/
  778. void MMI_key_3_down(void)
  779. {
  780.     /*----------------------------------------------------------------*/
  781.     /* Local Variables                                                */
  782.     /*----------------------------------------------------------------*/
  783.     /*----------------------------------------------------------------*/
  784.     /* Code Body                                                      */
  785.     /*----------------------------------------------------------------*/
  786.     MMI_key_input_handler(KEY_3, KEY_EVENT_DOWN);
  787. }
  788. /*****************************************************************************
  789.  * FUNCTION
  790.  *  MMI_key_4_down
  791.  * DESCRIPTION
  792.  *  Handle key 4 pressed event
  793.  * PARAMETERS
  794.  *  void
  795.  * RETURNS
  796.  *  void
  797.  *****************************************************************************/
  798. void MMI_key_4_down(void)
  799. {
  800.     /*----------------------------------------------------------------*/
  801.     /* Local Variables                                                */
  802.     /*----------------------------------------------------------------*/
  803.     /*----------------------------------------------------------------*/
  804.     /* Code Body                                                      */
  805.     /*----------------------------------------------------------------*/
  806.     MMI_key_input_handler(KEY_4, KEY_EVENT_DOWN);
  807. }
  808. /*****************************************************************************
  809.  * FUNCTION
  810.  *  MMI_key_5_down
  811.  * DESCRIPTION
  812.  *  Handle key 5 pressed event
  813.  * PARAMETERS
  814.  *  void
  815.  * RETURNS
  816.  *  void
  817.  *****************************************************************************/
  818. void MMI_key_5_down(void)
  819. {
  820.     /*----------------------------------------------------------------*/
  821.     /* Local Variables                                                */
  822.     /*----------------------------------------------------------------*/
  823.     /*----------------------------------------------------------------*/
  824.     /* Code Body                                                      */
  825.     /*----------------------------------------------------------------*/
  826.     MMI_key_input_handler(KEY_5, KEY_EVENT_DOWN);
  827. }
  828. /*****************************************************************************
  829.  * FUNCTION
  830.  *  MMI_key_6_down
  831.  * DESCRIPTION
  832.  *  Handle key 6 pressed event
  833.  * PARAMETERS
  834.  *  void
  835.  * RETURNS
  836.  *  void
  837.  *****************************************************************************/
  838. void MMI_key_6_down(void)
  839. {
  840.     /*----------------------------------------------------------------*/
  841.     /* Local Variables                                                */
  842.     /*----------------------------------------------------------------*/
  843.     /*----------------------------------------------------------------*/
  844.     /* Code Body                                                      */
  845.     /*----------------------------------------------------------------*/
  846.     MMI_key_input_handler(KEY_6, KEY_EVENT_DOWN);
  847. }
  848. /*****************************************************************************
  849.  * FUNCTION
  850.  *  MMI_key_7_down
  851.  * DESCRIPTION
  852.  *  Handle key 7 pressed event
  853.  * PARAMETERS
  854.  *  void
  855.  * RETURNS
  856.  *  void
  857.  *****************************************************************************/
  858. void MMI_key_7_down(void)
  859. {
  860.     /*----------------------------------------------------------------*/
  861.     /* Local Variables                                                */
  862.     /*----------------------------------------------------------------*/
  863.     /*----------------------------------------------------------------*/
  864.     /* Code Body                                                      */
  865.     /*----------------------------------------------------------------*/
  866.     MMI_key_input_handler(KEY_7, KEY_EVENT_DOWN);
  867. }
  868. /*****************************************************************************
  869.  * FUNCTION
  870.  *  MMI_key_8_down
  871.  * DESCRIPTION
  872.  *  Handle key 8 pressed event
  873.  * PARAMETERS
  874.  *  void
  875.  * RETURNS
  876.  *  void
  877.  *****************************************************************************/
  878. void MMI_key_8_down(void)
  879. {
  880.     /*----------------------------------------------------------------*/
  881.     /* Local Variables                                                */
  882.     /*----------------------------------------------------------------*/
  883.     /*----------------------------------------------------------------*/
  884.     /* Code Body                                                      */
  885.     /*----------------------------------------------------------------*/
  886.     MMI_key_input_handler(KEY_8, KEY_EVENT_DOWN);
  887. }
  888. /*****************************************************************************
  889.  * FUNCTION
  890.  *  MMI_key_9_down
  891.  * DESCRIPTION
  892.  *  Handle key 9 pressed event
  893.  * PARAMETERS
  894.  *  void
  895.  * RETURNS
  896.  *  void
  897.  *****************************************************************************/
  898. void MMI_key_9_down(void)
  899. {
  900.     /*----------------------------------------------------------------*/
  901.     /* Local Variables                                                */
  902.     /*----------------------------------------------------------------*/
  903.     /*----------------------------------------------------------------*/
  904.     /* Code Body                                                      */
  905.     /*----------------------------------------------------------------*/
  906.     MMI_key_input_handler(KEY_9, KEY_EVENT_DOWN);
  907. }
  908. /* multitap for star and Pound */
  909. /*****************************************************************************
  910.  * FUNCTION
  911.  *  MMI_key_star_down
  912.  * DESCRIPTION
  913.  *  Handle key star pressed event
  914.  * PARAMETERS
  915.  *  void
  916.  * RETURNS
  917.  *  void
  918.  *****************************************************************************/
  919. void MMI_key_star_down(void)
  920. {
  921.     /*----------------------------------------------------------------*/
  922.     /* Local Variables                                                */
  923.     /*----------------------------------------------------------------*/
  924.     /*----------------------------------------------------------------*/
  925.     /* Code Body                                                      */
  926.     /*----------------------------------------------------------------*/
  927.     MMI_key_input_handler(KEY_STAR, KEY_EVENT_DOWN);
  928. }
  929. /*****************************************************************************
  930.  * FUNCTION
  931.  *  MMI_key_pound_down
  932.  * DESCRIPTION
  933.  *  Handle key pound pressed event
  934.  * PARAMETERS
  935.  *  void
  936.  * RETURNS
  937.  *  void
  938.  *****************************************************************************/
  939. void MMI_key_pound_down(void)
  940. {
  941.     /*----------------------------------------------------------------*/
  942.     /* Local Variables                                                */
  943.     /*----------------------------------------------------------------*/
  944.     /*----------------------------------------------------------------*/
  945.     /* Code Body                                                      */
  946.     /*----------------------------------------------------------------*/
  947.     MMI_key_input_handler(KEY_POUND, KEY_EVENT_DOWN);
  948. }
  949. /*****************************************************************************
  950.  * FUNCTION
  951.  *  MMI_key_0_up
  952.  * DESCRIPTION
  953.  *  Handle key 0 release event
  954.  * PARAMETERS
  955.  *  void
  956.  * RETURNS
  957.  *  void
  958.  *****************************************************************************/
  959. void MMI_key_0_up(void)
  960. {
  961.     /*----------------------------------------------------------------*/
  962.     /* Local Variables                                                */
  963.     /*----------------------------------------------------------------*/
  964.     /*----------------------------------------------------------------*/
  965.     /* Code Body                                                      */
  966.     /*----------------------------------------------------------------*/
  967.     MMI_key_input_handler(KEY_0, KEY_EVENT_UP);
  968. }
  969. /*****************************************************************************
  970.  * FUNCTION
  971.  *  MMI_key_1_up
  972.  * DESCRIPTION
  973.  *  Handle key 1 release event
  974.  * PARAMETERS
  975.  *  void
  976.  * RETURNS
  977.  *  void
  978.  *****************************************************************************/
  979. void MMI_key_1_up(void)
  980. {
  981.     /*----------------------------------------------------------------*/
  982.     /* Local Variables                                                */
  983.     /*----------------------------------------------------------------*/
  984.     /*----------------------------------------------------------------*/
  985.     /* Code Body                                                      */
  986.     /*----------------------------------------------------------------*/
  987.     MMI_key_input_handler(KEY_1, KEY_EVENT_UP);
  988. }
  989. /*****************************************************************************
  990.  * FUNCTION
  991.  *  MMI_key_2_up
  992.  * DESCRIPTION
  993.  *  Handle key 2 release event
  994.  * PARAMETERS
  995.  *  void
  996.  * RETURNS
  997.  *  void
  998.  *****************************************************************************/
  999. void MMI_key_2_up(void)
  1000. {
  1001.     /*----------------------------------------------------------------*/
  1002.     /* Local Variables                                                */
  1003.     /*----------------------------------------------------------------*/
  1004.     /*----------------------------------------------------------------*/
  1005.     /* Code Body                                                      */
  1006.     /*----------------------------------------------------------------*/
  1007.     MMI_key_input_handler(KEY_2, KEY_EVENT_UP);
  1008. }
  1009. /*****************************************************************************
  1010.  * FUNCTION
  1011.  *  MMI_key_3_up
  1012.  * DESCRIPTION
  1013.  *  Handle key 3 release event
  1014.  * PARAMETERS
  1015.  *  void
  1016.  * RETURNS
  1017.  *  void
  1018.  *****************************************************************************/
  1019. void MMI_key_3_up(void)
  1020. {
  1021.     /*----------------------------------------------------------------*/
  1022.     /* Local Variables                                                */
  1023.     /*----------------------------------------------------------------*/
  1024.     /*----------------------------------------------------------------*/
  1025.     /* Code Body                                                      */
  1026.     /*----------------------------------------------------------------*/
  1027.     MMI_key_input_handler(KEY_3, KEY_EVENT_UP);
  1028. }
  1029. /*****************************************************************************
  1030.  * FUNCTION
  1031.  *  MMI_key_4_up
  1032.  * DESCRIPTION
  1033.  *  Handle key 4 release event
  1034.  * PARAMETERS
  1035.  *  void
  1036.  * RETURNS
  1037.  *  void
  1038.  *****************************************************************************/
  1039. void MMI_key_4_up(void)
  1040. {
  1041.     /*----------------------------------------------------------------*/
  1042.     /* Local Variables                                                */
  1043.     /*----------------------------------------------------------------*/
  1044.     /*----------------------------------------------------------------*/
  1045.     /* Code Body                                                      */
  1046.     /*----------------------------------------------------------------*/
  1047.     MMI_key_input_handler(KEY_4, KEY_EVENT_UP);
  1048. }
  1049. /*****************************************************************************
  1050.  * FUNCTION
  1051.  *  MMI_key_5_up
  1052.  * DESCRIPTION
  1053.  *  Handle key 5 release event
  1054.  * PARAMETERS
  1055.  *  void
  1056.  * RETURNS
  1057.  *  void
  1058.  *****************************************************************************/
  1059. void MMI_key_5_up(void)
  1060. {
  1061.     /*----------------------------------------------------------------*/
  1062.     /* Local Variables                                                */
  1063.     /*----------------------------------------------------------------*/
  1064.     /*----------------------------------------------------------------*/
  1065.     /* Code Body                                                      */
  1066.     /*----------------------------------------------------------------*/
  1067.     MMI_key_input_handler(KEY_5, KEY_EVENT_UP);
  1068. }
  1069. /*****************************************************************************
  1070.  * FUNCTION
  1071.  *  MMI_key_6_up
  1072.  * DESCRIPTION
  1073.  *  Handle key 6 release event
  1074.  * PARAMETERS
  1075.  *  void
  1076.  * RETURNS
  1077.  *  void
  1078.  *****************************************************************************/
  1079. void MMI_key_6_up(void)
  1080. {
  1081.     /*----------------------------------------------------------------*/
  1082.     /* Local Variables                                                */
  1083.     /*----------------------------------------------------------------*/
  1084.     /*----------------------------------------------------------------*/
  1085.     /* Code Body                                                      */
  1086.     /*----------------------------------------------------------------*/
  1087.     MMI_key_input_handler(KEY_6, KEY_EVENT_UP);
  1088. }
  1089. /*****************************************************************************
  1090.  * FUNCTION
  1091.  *  MMI_key_7_up
  1092.  * DESCRIPTION
  1093.  *  Handle key 7 release event
  1094.  * PARAMETERS
  1095.  *  void
  1096.  * RETURNS
  1097.  *  void
  1098.  *****************************************************************************/
  1099. void MMI_key_7_up(void)
  1100. {
  1101.     /*----------------------------------------------------------------*/
  1102.     /* Local Variables                                                */
  1103.     /*----------------------------------------------------------------*/
  1104.     /*----------------------------------------------------------------*/
  1105.     /* Code Body                                                      */
  1106.     /*----------------------------------------------------------------*/
  1107.     MMI_key_input_handler(KEY_7, KEY_EVENT_UP);
  1108. }
  1109. /*****************************************************************************
  1110.  * FUNCTION
  1111.  *  MMI_key_8_up
  1112.  * DESCRIPTION
  1113.  *  Handle key 8 release event
  1114.  * PARAMETERS
  1115.  *  void
  1116.  * RETURNS
  1117.  *  void
  1118.  *****************************************************************************/
  1119. void MMI_key_8_up(void)
  1120. {
  1121.     /*----------------------------------------------------------------*/
  1122.     /* Local Variables                                                */
  1123.     /*----------------------------------------------------------------*/
  1124.     /*----------------------------------------------------------------*/
  1125.     /* Code Body                                                      */
  1126.     /*----------------------------------------------------------------*/
  1127.     MMI_key_input_handler(KEY_8, KEY_EVENT_UP);
  1128. }
  1129. /*****************************************************************************
  1130.  * FUNCTION
  1131.  *  MMI_key_9_up
  1132.  * DESCRIPTION
  1133.  *  Handle key 9 release event
  1134.  * PARAMETERS
  1135.  *  void
  1136.  * RETURNS
  1137.  *  void
  1138.  *****************************************************************************/
  1139. void MMI_key_9_up(void)
  1140. {
  1141.     /*----------------------------------------------------------------*/
  1142.     /* Local Variables                                                */
  1143.     /*----------------------------------------------------------------*/
  1144.     /*----------------------------------------------------------------*/
  1145.     /* Code Body                                                      */
  1146.     /*----------------------------------------------------------------*/
  1147.     MMI_key_input_handler(KEY_9, KEY_EVENT_UP);
  1148. }
  1149. /* multitap for star and pound */
  1150. /*****************************************************************************
  1151.  * FUNCTION
  1152.  *  MMI_key_star_up
  1153.  * DESCRIPTION
  1154.  *  Handle key star release event
  1155.  * PARAMETERS
  1156.  *  void
  1157.  * RETURNS
  1158.  *  void
  1159.  *****************************************************************************/
  1160. void MMI_key_star_up(void)
  1161. {
  1162.     /*----------------------------------------------------------------*/
  1163.     /* Local Variables                                                */
  1164.     /*----------------------------------------------------------------*/
  1165.     /*----------------------------------------------------------------*/
  1166.     /* Code Body                                                      */
  1167.     /*----------------------------------------------------------------*/
  1168.     MMI_key_input_handler(KEY_STAR, KEY_EVENT_UP);
  1169. }
  1170. /*****************************************************************************
  1171.  * FUNCTION
  1172.  *  MMI_key_pound_up
  1173.  * DESCRIPTION
  1174.  *  Handle key pound release event
  1175.  * PARAMETERS
  1176.  *  void
  1177.  * RETURNS
  1178.  *  void
  1179.  *****************************************************************************/
  1180. void MMI_key_pound_up(void)
  1181. {
  1182.     /*----------------------------------------------------------------*/
  1183.     /* Local Variables                                                */
  1184.     /*----------------------------------------------------------------*/
  1185.     /*----------------------------------------------------------------*/
  1186.     /* Code Body                                                      */
  1187.     /*----------------------------------------------------------------*/
  1188.     MMI_key_input_handler(KEY_POUND, KEY_EVENT_UP);
  1189. }
  1190. #ifdef __MMI_MULTITAP_THAI__
  1191. /*****************************************************************************
  1192.  * FUNCTION
  1193.  *  register_MMI_key_input_extend_handler
  1194.  * DESCRIPTION
  1195.  *  Register key handlers for start and pound key.
  1196.  * PARAMETERS
  1197.  *  void
  1198.  * RETURNS
  1199.  *  void
  1200.  *****************************************************************************/
  1201. void register_MMI_key_input_extend_handler(void)
  1202. {
  1203.     /*----------------------------------------------------------------*/
  1204.     /* Local Variables                                                */
  1205.     /*----------------------------------------------------------------*/
  1206.     /*----------------------------------------------------------------*/
  1207.     /* Code Body                                                      */
  1208.     /*----------------------------------------------------------------*/
  1209.     SetKeyHandler(MMI_key_star_down, KEY_STAR, KEY_EVENT_DOWN);
  1210.     SetKeyHandler(MMI_key_star_up, KEY_STAR, KEY_EVENT_UP);
  1211.     SetKeyHandler(MMI_key_pound_down, KEY_POUND, KEY_EVENT_DOWN);
  1212.     SetKeyHandler(MMI_key_pound_up, KEY_POUND, KEY_EVENT_UP);
  1213. }
  1214. #endif /* __MMI_MULTITAP_THAI__ */ 
  1215. /*****************************************************************************
  1216.  * FUNCTION
  1217.  *  register_MMI_key_input_handler
  1218.  * DESCRIPTION
  1219.  *  Register key handlers for all digit keys
  1220.  * PARAMETERS
  1221.  *  void
  1222.  * RETURNS
  1223.  *  void
  1224.  *****************************************************************************/
  1225. void register_MMI_key_input_handler(void)
  1226. {
  1227.     /*----------------------------------------------------------------*/
  1228.     /* Local Variables                                                */
  1229.     /*----------------------------------------------------------------*/
  1230.     /*----------------------------------------------------------------*/
  1231.     /* Code Body                                                      */
  1232.     /*----------------------------------------------------------------*/
  1233.     SetKeyHandler(MMI_key_0_down, KEY_0, KEY_EVENT_DOWN);
  1234.     SetKeyHandler(MMI_key_1_down, KEY_1, KEY_EVENT_DOWN);
  1235.     SetKeyHandler(MMI_key_2_down, KEY_2, KEY_EVENT_DOWN);
  1236.     SetKeyHandler(MMI_key_3_down, KEY_3, KEY_EVENT_DOWN);
  1237.     SetKeyHandler(MMI_key_4_down, KEY_4, KEY_EVENT_DOWN);
  1238.     SetKeyHandler(MMI_key_5_down, KEY_5, KEY_EVENT_DOWN);
  1239.     SetKeyHandler(MMI_key_6_down, KEY_6, KEY_EVENT_DOWN);
  1240.     SetKeyHandler(MMI_key_7_down, KEY_7, KEY_EVENT_DOWN);
  1241.     SetKeyHandler(MMI_key_8_down, KEY_8, KEY_EVENT_DOWN);
  1242.     SetKeyHandler(MMI_key_9_down, KEY_9, KEY_EVENT_DOWN);
  1243.     SetKeyHandler(MMI_key_0_down, KEY_0, KEY_REPEAT);
  1244.     SetKeyHandler(MMI_key_1_down, KEY_1, KEY_REPEAT);
  1245.     SetKeyHandler(MMI_key_2_down, KEY_2, KEY_REPEAT);
  1246.     SetKeyHandler(MMI_key_3_down, KEY_3, KEY_REPEAT);
  1247.     SetKeyHandler(MMI_key_4_down, KEY_4, KEY_REPEAT);
  1248.     SetKeyHandler(MMI_key_5_down, KEY_5, KEY_REPEAT);
  1249.     SetKeyHandler(MMI_key_6_down, KEY_6, KEY_REPEAT);
  1250.     SetKeyHandler(MMI_key_7_down, KEY_7, KEY_REPEAT);
  1251.     SetKeyHandler(MMI_key_8_down, KEY_8, KEY_REPEAT);
  1252.     SetKeyHandler(MMI_key_9_down, KEY_9, KEY_REPEAT);
  1253.     SetKeyHandler(MMI_key_0_up, KEY_0, KEY_EVENT_UP);
  1254.     SetKeyHandler(MMI_key_1_up, KEY_1, KEY_EVENT_UP);
  1255.     SetKeyHandler(MMI_key_2_up, KEY_2, KEY_EVENT_UP);
  1256.     SetKeyHandler(MMI_key_3_up, KEY_3, KEY_EVENT_UP);
  1257.     SetKeyHandler(MMI_key_4_up, KEY_4, KEY_EVENT_UP);
  1258.     SetKeyHandler(MMI_key_5_up, KEY_5, KEY_EVENT_UP);
  1259.     SetKeyHandler(MMI_key_6_up, KEY_6, KEY_EVENT_UP);
  1260.     SetKeyHandler(MMI_key_7_up, KEY_7, KEY_EVENT_UP);
  1261.     SetKeyHandler(MMI_key_8_up, KEY_8, KEY_EVENT_UP);
  1262.     SetKeyHandler(MMI_key_9_up, KEY_9, KEY_EVENT_UP);
  1263. }
  1264. /*****************************************************************************
  1265.  * FUNCTION
  1266.  *  register_MMI_stroke_key_input_handler
  1267.  * DESCRIPTION
  1268.  *  Register key handlers for stroke input type
  1269.  * PARAMETERS
  1270.  *  void
  1271.  * RETURNS
  1272.  *  void
  1273.  *****************************************************************************/
  1274. void register_MMI_stroke_key_input_handler(void)
  1275. {
  1276. #if defined(__MMI_T9__)
  1277.     /*----------------------------------------------------------------*/
  1278.     /* Local Variables                                                */
  1279.     /*----------------------------------------------------------------*/
  1280.     /*----------------------------------------------------------------*/
  1281.     /* Code Body                                                      */
  1282.     /*----------------------------------------------------------------*/
  1283.     SetKeyHandler(UI_dummy_function, KEY_0, KEY_EVENT_DOWN);
  1284.     SetKeyHandler(MMI_key_1_down, KEY_1, KEY_EVENT_DOWN);
  1285.     SetKeyHandler(MMI_key_2_down, KEY_2, KEY_EVENT_DOWN);
  1286.     SetKeyHandler(MMI_key_3_down, KEY_3, KEY_EVENT_DOWN);
  1287.     SetKeyHandler(MMI_key_4_down, KEY_4, KEY_EVENT_DOWN);
  1288.     SetKeyHandler(MMI_key_5_down, KEY_5, KEY_EVENT_DOWN);
  1289.     SetKeyHandler(UI_dummy_function, KEY_6, KEY_EVENT_DOWN);
  1290.     SetKeyHandler(UI_dummy_function, KEY_7, KEY_EVENT_DOWN);
  1291.     SetKeyHandler(UI_dummy_function, KEY_8, KEY_EVENT_DOWN);
  1292.     SetKeyHandler(UI_dummy_function, KEY_9, KEY_EVENT_DOWN);
  1293.     SetKeyHandler(UI_dummy_function, KEY_0, KEY_REPEAT);
  1294.     SetKeyHandler(MMI_key_1_down, KEY_1, KEY_REPEAT);
  1295.     SetKeyHandler(MMI_key_2_down, KEY_2, KEY_REPEAT);
  1296.     SetKeyHandler(MMI_key_3_down, KEY_3, KEY_REPEAT);
  1297.     SetKeyHandler(MMI_key_4_down, KEY_4, KEY_REPEAT);
  1298.     SetKeyHandler(MMI_key_5_down, KEY_5, KEY_REPEAT);
  1299.     SetKeyHandler(UI_dummy_function, KEY_6, KEY_REPEAT);
  1300.     SetKeyHandler(UI_dummy_function, KEY_7, KEY_REPEAT);
  1301.     SetKeyHandler(UI_dummy_function, KEY_8, KEY_REPEAT);
  1302.     SetKeyHandler(UI_dummy_function, KEY_9, KEY_REPEAT);
  1303.     SetKeyHandler(UI_dummy_function, KEY_0, KEY_EVENT_UP);
  1304.     SetKeyHandler(MMI_key_1_up, KEY_1, KEY_EVENT_UP);
  1305.     SetKeyHandler(MMI_key_2_up, KEY_2, KEY_EVENT_UP);
  1306.     SetKeyHandler(MMI_key_3_up, KEY_3, KEY_EVENT_UP);
  1307.     SetKeyHandler(MMI_key_4_up, KEY_4, KEY_EVENT_UP);
  1308.     SetKeyHandler(MMI_key_5_up, KEY_5, KEY_EVENT_UP);
  1309.     SetKeyHandler(UI_dummy_function, KEY_6, KEY_EVENT_UP);
  1310.     SetKeyHandler(UI_dummy_function, KEY_7, KEY_EVENT_UP);
  1311.     SetKeyHandler(UI_dummy_function, KEY_8, KEY_EVENT_UP);
  1312.     SetKeyHandler(UI_dummy_function, KEY_9, KEY_EVENT_UP);
  1313. #elif defined(__MMI_ZI__)
  1314.     SetKeyHandler(UI_dummy_function, KEY_0, KEY_EVENT_DOWN);
  1315.     SetKeyHandler(MMI_key_1_down, KEY_1, KEY_EVENT_DOWN);
  1316.     SetKeyHandler(MMI_key_2_down, KEY_2, KEY_EVENT_DOWN);
  1317.     SetKeyHandler(MMI_key_3_down, KEY_3, KEY_EVENT_DOWN);
  1318.     SetKeyHandler(MMI_key_4_down, KEY_4, KEY_EVENT_DOWN);
  1319.     SetKeyHandler(MMI_key_5_down, KEY_5, KEY_EVENT_DOWN);
  1320.     SetKeyHandler(MMI_key_6_down, KEY_6, KEY_EVENT_DOWN);
  1321.     SetKeyHandler(MMI_key_7_down, KEY_7, KEY_EVENT_DOWN);
  1322.     SetKeyHandler(UI_dummy_function, KEY_8, KEY_EVENT_DOWN);
  1323.     SetKeyHandler(MMI_key_9_down, KEY_9, KEY_EVENT_DOWN);
  1324.     SetKeyHandler(UI_dummy_function, KEY_0, KEY_REPEAT);
  1325.     SetKeyHandler(MMI_key_1_down, KEY_1, KEY_REPEAT);
  1326.     SetKeyHandler(MMI_key_2_down, KEY_2, KEY_REPEAT);
  1327.     SetKeyHandler(MMI_key_3_down, KEY_3, KEY_REPEAT);
  1328.     SetKeyHandler(MMI_key_4_down, KEY_4, KEY_REPEAT);
  1329.     SetKeyHandler(MMI_key_5_down, KEY_5, KEY_REPEAT);
  1330.     SetKeyHandler(MMI_key_6_down, KEY_6, KEY_REPEAT);
  1331.     SetKeyHandler(MMI_key_7_down, KEY_7, KEY_REPEAT);
  1332.     SetKeyHandler(UI_dummy_function, KEY_8, KEY_REPEAT);
  1333.     SetKeyHandler(MMI_key_9_down, KEY_9, KEY_REPEAT);
  1334.     SetKeyHandler(UI_dummy_function, KEY_0, KEY_EVENT_UP);
  1335.     SetKeyHandler(MMI_key_1_up, KEY_1, KEY_EVENT_UP);
  1336.     SetKeyHandler(MMI_key_2_up, KEY_2, KEY_EVENT_UP);
  1337.     SetKeyHandler(MMI_key_3_up, KEY_3, KEY_EVENT_UP);
  1338.     SetKeyHandler(MMI_key_4_up, KEY_4, KEY_EVENT_UP);
  1339.     SetKeyHandler(MMI_key_5_up, KEY_5, KEY_EVENT_UP);
  1340.     SetKeyHandler(MMI_key_6_up, KEY_6, KEY_EVENT_UP);
  1341.     SetKeyHandler(MMI_key_7_up, KEY_7, KEY_EVENT_UP);
  1342.     SetKeyHandler(UI_dummy_function, KEY_8, KEY_EVENT_UP);
  1343.     SetKeyHandler(MMI_key_9_up, KEY_9, KEY_EVENT_UP);
  1344. //KP Jerry add on 2007-3-8 start
  1345. #elif defined(__MMI_CSTAR__)
  1346.     SetKeyHandler(UI_dummy_function, KEY_0, KEY_EVENT_DOWN);
  1347.     SetKeyHandler(MMI_key_1_down, KEY_1, KEY_EVENT_DOWN);
  1348.     SetKeyHandler(MMI_key_2_down, KEY_2, KEY_EVENT_DOWN);
  1349.     SetKeyHandler(MMI_key_3_down, KEY_3, KEY_EVENT_DOWN);
  1350.     SetKeyHandler(MMI_key_4_down, KEY_4, KEY_EVENT_DOWN);
  1351.     SetKeyHandler(MMI_key_5_down, KEY_5, KEY_EVENT_DOWN);
  1352.     SetKeyHandler(UI_dummy_function, KEY_6, KEY_EVENT_DOWN);
  1353.     SetKeyHandler(UI_dummy_function, KEY_7, KEY_EVENT_DOWN);
  1354.     SetKeyHandler(UI_dummy_function, KEY_8, KEY_EVENT_DOWN);
  1355.     SetKeyHandler(UI_dummy_function, KEY_9, KEY_EVENT_DOWN);
  1356.     SetKeyHandler(UI_dummy_function, KEY_0, KEY_REPEAT);
  1357.     SetKeyHandler(MMI_key_1_down, KEY_1, KEY_REPEAT);
  1358.     SetKeyHandler(MMI_key_2_down, KEY_2, KEY_REPEAT);
  1359.     SetKeyHandler(MMI_key_3_down, KEY_3, KEY_REPEAT);
  1360.     SetKeyHandler(MMI_key_4_down, KEY_4, KEY_REPEAT);
  1361.     SetKeyHandler(MMI_key_5_down, KEY_5, KEY_REPEAT);
  1362.     SetKeyHandler(UI_dummy_function, KEY_6, KEY_REPEAT);
  1363.     SetKeyHandler(UI_dummy_function, KEY_7, KEY_REPEAT);
  1364.     SetKeyHandler(UI_dummy_function, KEY_8, KEY_REPEAT);
  1365.     SetKeyHandler(UI_dummy_function, KEY_9, KEY_REPEAT);
  1366.     SetKeyHandler(UI_dummy_function, KEY_0, KEY_EVENT_UP);
  1367.     SetKeyHandler(MMI_key_1_up, KEY_1, KEY_EVENT_UP);
  1368.     SetKeyHandler(MMI_key_2_up, KEY_2, KEY_EVENT_UP);
  1369.     SetKeyHandler(MMI_key_3_up, KEY_3, KEY_EVENT_UP);
  1370.     SetKeyHandler(MMI_key_4_up, KEY_4, KEY_EVENT_UP);
  1371.     SetKeyHandler(MMI_key_5_up, KEY_5, KEY_EVENT_UP);
  1372.     SetKeyHandler(UI_dummy_function, KEY_6, KEY_EVENT_UP);
  1373.     SetKeyHandler(UI_dummy_function, KEY_7, KEY_EVENT_UP);
  1374.     SetKeyHandler(UI_dummy_function, KEY_8, KEY_EVENT_UP);
  1375.     SetKeyHandler(UI_dummy_function, KEY_9, KEY_EVENT_UP);
  1376. //KP Jerry add on 2007-3-8 end
  1377. #elif defined(__MMI_ITAP__)
  1378. /* under construction !*/
  1379. /* under construction !*/
  1380. /* under construction !*/
  1381. /* under construction !*/
  1382. /* under construction !*/
  1383. /* under construction !*/
  1384. /* under construction !*/
  1385. /* under construction !*/
  1386. /* under construction !*/
  1387. /* under construction !*/
  1388. /* under construction !*/
  1389. /* under construction !*/
  1390. /* under construction !*/
  1391. /* under construction !*/
  1392. /* under construction !*/
  1393. /* under construction !*/
  1394. /* under construction !*/
  1395. /* under construction !*/
  1396. /* under construction !*/
  1397. /* under construction !*/
  1398. /* under construction !*/
  1399. /* under construction !*/
  1400. /* under construction !*/
  1401. /* under construction !*/
  1402. /* under construction !*/
  1403. /* under construction !*/
  1404. /* under construction !*/
  1405. /* under construction !*/
  1406. /* under construction !*/
  1407. /* under construction !*/
  1408. /* under construction !*/
  1409. /* under construction !*/
  1410. #endif 
  1411. }
  1412. /*****************************************************************************
  1413.  * FUNCTION
  1414.  *  clear_MMI_key_input_handler
  1415.  * DESCRIPTION
  1416.  *  Clear key handlers for input
  1417.  * PARAMETERS
  1418.  *  void
  1419.  * RETURNS
  1420.  *  void
  1421.  *****************************************************************************/
  1422. void clear_MMI_key_input_handler(void)
  1423. {
  1424.     /*----------------------------------------------------------------*/
  1425.     /* Local Variables                                                */
  1426.     /*----------------------------------------------------------------*/
  1427.     /*----------------------------------------------------------------*/
  1428.     /* Code Body                                                      */
  1429.     /*----------------------------------------------------------------*/
  1430.     ClearKeyHandler(KEY_0, KEY_EVENT_DOWN);
  1431.     ClearKeyHandler(KEY_1, KEY_EVENT_DOWN);
  1432.     ClearKeyHandler(KEY_2, KEY_EVENT_DOWN);
  1433.     ClearKeyHandler(KEY_3, KEY_EVENT_DOWN);
  1434.     ClearKeyHandler(KEY_4, KEY_EVENT_DOWN);
  1435.     ClearKeyHandler(KEY_5, KEY_EVENT_DOWN);
  1436.     ClearKeyHandler(KEY_6, KEY_EVENT_DOWN);
  1437.     ClearKeyHandler(KEY_7, KEY_EVENT_DOWN);
  1438.     ClearKeyHandler(KEY_8, KEY_EVENT_DOWN);
  1439.     ClearKeyHandler(KEY_9, KEY_EVENT_DOWN);
  1440.     ClearKeyHandler(KEY_0, KEY_EVENT_UP);
  1441.     ClearKeyHandler(KEY_1, KEY_EVENT_UP);
  1442.     ClearKeyHandler(KEY_2, KEY_EVENT_UP);
  1443.     ClearKeyHandler(KEY_3, KEY_EVENT_UP);
  1444.     ClearKeyHandler(KEY_4, KEY_EVENT_UP);
  1445.     ClearKeyHandler(KEY_5, KEY_EVENT_UP);
  1446.     ClearKeyHandler(KEY_6, KEY_EVENT_UP);
  1447.     ClearKeyHandler(KEY_7, KEY_EVENT_UP);
  1448.     ClearKeyHandler(KEY_8, KEY_EVENT_UP);
  1449.     ClearKeyHandler(KEY_9, KEY_EVENT_UP);
  1450. }
  1451. /* Initialization / termination wrappers  */
  1452. /*****************************************************************************
  1453.  * FUNCTION
  1454.  *  wgui_init
  1455.  * DESCRIPTION
  1456.  *  Initializes the GUI wrappers
  1457.  * PARAMETERS
  1458.  *  void
  1459.  * RETURNS
  1460.  *  void
  1461.  *****************************************************************************/
  1462. void wgui_init(void)
  1463. {
  1464.     /*----------------------------------------------------------------*/
  1465.     /* Local Variables                                                */
  1466.     /*----------------------------------------------------------------*/
  1467.     /*----------------------------------------------------------------*/
  1468.     /* Code Body                                                      */
  1469.     /*----------------------------------------------------------------*/
  1470.     set_MMI_theme((MMI_theme*) MMI_themes[0]);
  1471.     gui_initialize_default_themes();
  1472. #if(!UI_DISABLE_EMS_INPUT_BOX)
  1473.     gui_intialize_EMS();
  1474. #endif 
  1475.     register_keyboard_key_handler(dummy_keyboard_key_handler);
  1476.     register_keyboard_input_handler(dummy_keyboard_input_handler);
  1477.     register_keyboard_global_key_handler(dummy_keyboard_key_handler);
  1478.     create_softkeys();
  1479.     create_menu_shortcut_handler();
  1480.     create_fixed_list();
  1481.     create_fixed_matrix();
  1482.     create_multitaps();
  1483.     create_virtual_keyboard();
  1484.     clear_key_input_handler();
  1485.     clear_key_down_handler();
  1486.     clear_key_up_handler();
  1487.     initialize_status_icons();
  1488.     hide_multitap = UI_dummy_function;
  1489.     register_multiline_inputbox_input_callback(UI_dummy_function);
  1490. }