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

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.  *
  37.  * Filename:
  38.  * ---------
  39.  *   wgui_touch_screen.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   wgui-level functions for touch screen.
  48.  *
  49.  * 
  50.  *
  51.  * Author:
  52.  * -------
  53.  * -------
  54.  *
  55.  *============================================================================
  56.  *             HISTORY
  57.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  58.  *------------------------------------------------------------------------------
  59.  * removed!
  60.  *
  61.  * removed!
  62.  * removed!
  63.  * removed!
  64.  *
  65.  * removed!
  66.  * removed!
  67.  * removed!
  68.  *
  69.  * removed!
  70.  * removed!
  71.  * removed!
  72.  *
  73.  * removed!
  74.  * removed!
  75.  * removed!
  76.  *
  77.  * removed!
  78.  * removed!
  79.  * removed!
  80.  *
  81.  * removed!
  82.  * removed!
  83.  * removed!
  84.  *
  85.  * removed!
  86.  * removed!
  87.  * removed!
  88.  *
  89.  * removed!
  90.  * removed!
  91.  * removed!
  92.  *
  93.  * removed!
  94.  * removed!
  95.  * removed!
  96.  *
  97.  * removed!
  98.  * removed!
  99.  * removed!
  100.  *
  101.  * removed!
  102.  * removed!
  103.  * removed!
  104.  *
  105.  * removed!
  106.  * removed!
  107.  * removed!
  108.  *
  109.  * removed!
  110.  * removed!
  111.  * removed!
  112.  *
  113.  * removed!
  114.  * removed!
  115.  * removed!
  116.  *
  117.  * removed!
  118.  * removed!
  119.  * removed!
  120.  *
  121.  * removed!
  122.  * removed!
  123.  * removed!
  124.  *
  125.  * removed!
  126.  * removed!
  127.  * removed!
  128.  *
  129.  * removed!
  130.  * removed!
  131.  * removed!
  132.  *
  133.  * removed!
  134.  * removed!
  135.  * removed!
  136.  *
  137.  * removed!
  138.  * removed!
  139.  * removed!
  140.  *
  141.  *------------------------------------------------------------------------------
  142.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  143.  *============================================================================
  144.  ****************************************************************************/
  145. #include "MMI_features.h"
  146. #if defined(__MMI_TOUCH_SCREEN__)
  147. #include "stdC.h"
  148. #include "PixtelDataTypes.h"
  149. #include "gui_data_types.h"
  150. #include "wgui_softkeys.h"
  151. #include "kal_non_specific_general_types.h"     /* needed for TouchScreenGprot.h */
  152. #include "wgui_touch_screen.h"
  153. #include "TouchScreenGprot.h"   /* for Touch Screen */
  154. #include "gui_buttons.h"
  155. #include "wgui_fixed_menus.h"
  156. #include "gui_asyncdynamic_menus.h"
  157. #include "DebugInitDef.h"
  158. #include "CommonScreens.h"
  159. #include "CustDataRes.h"
  160. #include "gui_custom_menus.h"
  161. #include "gui_calendar.h"
  162. #include "wgui_calendar.h"
  163. #include "wgui_status_icons.h"
  164. #include "wgui_tab_bars.h"
  165. #include "gui_ems.h"
  166. #include "Calculator.h"
  167. #include "wgui_draw_manager.h"
  168. #ifdef __MMI_STOPWATCH__
  169. #include "Stopwatchgexdcl.h"
  170. #include "stopwatchprot.h"
  171. #include "wgui_categories_stopwatch.h"
  172. #endif /* __MMI_STOPWATCH__ */ 
  173. #include "ProfilingEngine.h"
  174. #ifdef __J2ME__
  175. extern void jui_widget_refresh_lcd(S32 x1, S32 y1, S32 x2, S32 y2);
  176. #endif 
  177. /***************************************************************************** 
  178. * Golbal Variable
  179. *****************************************************************************/
  180. /***************************************************************************** 
  181. * Golbal Function
  182. *****************************************************************************/
  183. MMI_BOOL wgui_null_pen_hdlr(mmi_pen_point_struct point);
  184. mmi_pen_handler wgui_category_control_area_pen_handlers[MMI_PEN_EVENT_TYPE_MAX];
  185. mmi_pen_handler wgui_category_control_area2_pen_handlers[MMI_PEN_EVENT_TYPE_MAX];
  186. mmi_pen_handler wgui_image_pen_handlers[DM_MAX_IMAGES][MMI_PEN_EVENT_TYPE_MAX];
  187. /***************************************************************************** 
  188. * Local Variable
  189. *****************************************************************************/
  190. static U16 g_pen_to_control;    /* indicate which control receive pen events */
  191. /* 
  192.  * In draw manager, some controls have more than one elements.
  193.  * We need to know which element is selected 
  194.  */
  195. static U16 g_pen_to_control_index = 0;
  196. /***************************************************************************** 
  197. * Local Function
  198. *****************************************************************************/
  199. /***************************************************************************** 
  200. * Extern Global  Variables
  201. *****************************************************************************/
  202. extern icontext_button MMI_softkeys[];
  203. extern UI_EMS_input_box MMI_EMS_inputbox;
  204. /***************************************************************************** 
  205. * Extern Global  Function
  206. *****************************************************************************/
  207. extern void (*redraw_current_inline_item) (void);
  208. extern void redraw_EMS_inputbox(void);
  209. /*****************************************************************************
  210.  * FUNCTION
  211.  *  wgui_execute_dm_category_control_area_pen_handler
  212.  * DESCRIPTION
  213.  *  Execute category control area pen handlers
  214.  * PARAMETERS
  215.  *  pen_event_type          [IN]        
  216.  *  point                   [IN]        Pen position
  217.  *  key_event_type(?)       [IN]        - KEY_EVENT_DOWN, KEY_EVENT_UP, KEY_LONG_PRESS
  218.  * RETURNS
  219.  *  void
  220.  *****************************************************************************/
  221. static MMI_BOOL wgui_execute_dm_category_control_area_pen_handler(U16 pen_event_type, mmi_pen_point_struct point)
  222. {
  223.     /*----------------------------------------------------------------*/
  224.     /* Local Variables                                                */
  225.     /*----------------------------------------------------------------*/
  226.     /*----------------------------------------------------------------*/
  227.     /* Code Body                                                      */
  228.     /*----------------------------------------------------------------*/
  229.     MMI_ASSERT(pen_event_type < MMI_PEN_EVENT_TYPE_MAX);
  230.     if (wgui_category_control_area_pen_handlers[pen_event_type] != NULL)
  231.     {
  232.         return wgui_category_control_area_pen_handlers[pen_event_type] (point);
  233.     }
  234.     else
  235.     {
  236.         return MMI_FALSE;
  237.     }
  238. }
  239. /*****************************************************************************
  240.  * FUNCTION
  241.  *  wgui_execute_dm_category_control_area2_pen_handler
  242.  * DESCRIPTION
  243.  *  Execute category control area pen handlers
  244.  * PARAMETERS
  245.  *  pen_event_type          [IN]        
  246.  *  point                   [IN]        Pen position
  247.  *  key_event_type(?)       [IN]        - KEY_EVENT_DOWN, KEY_EVENT_UP, KEY_LONG_PRESS
  248.  * RETURNS
  249.  *  void
  250.  *****************************************************************************/
  251. static MMI_BOOL wgui_execute_dm_category_control_area2_pen_handler(U16 pen_event_type, mmi_pen_point_struct point)
  252. {
  253.     /*----------------------------------------------------------------*/
  254.     /* Local Variables                                                */
  255.     /*----------------------------------------------------------------*/
  256.     /*----------------------------------------------------------------*/
  257.     /* Code Body                                                      */
  258.     /*----------------------------------------------------------------*/
  259.     MMI_ASSERT(pen_event_type < MMI_PEN_EVENT_TYPE_MAX);
  260.     if (wgui_category_control_area2_pen_handlers[pen_event_type] != NULL)
  261.     {
  262.         return wgui_category_control_area2_pen_handlers[pen_event_type] (point);
  263.     }
  264.     else
  265.     {
  266.         return MMI_FALSE;
  267.     }
  268. }
  269. /*****************************************************************************
  270.  * FUNCTION
  271.  *  wgui_execute_dm_image_pen_handler
  272.  * DESCRIPTION
  273.  *  Execute category control area pen handlers
  274.  * PARAMETERS
  275.  *  img_idx                 [IN]        Index of image controlled by draw manager
  276.  *  pen_event_type          [IN]        
  277.  *  point                   [IN]        Pen position
  278.  *  key_event_type(?)       [IN]        - KEY_EVENT_DOWN, KEY_EVENT_UP, KEY_LONG_PRESS
  279.  * RETURNS
  280.  *  void
  281.  *****************************************************************************/
  282. static MMI_BOOL wgui_execute_dm_image_pen_handler(U16 img_idx, U16 pen_event_type, mmi_pen_point_struct point)
  283. {
  284.     /*----------------------------------------------------------------*/
  285.     /* Local Variables                                                */
  286.     /*----------------------------------------------------------------*/
  287.     /*----------------------------------------------------------------*/
  288.     /* Code Body                                                      */
  289.     /*----------------------------------------------------------------*/
  290.     MMI_ASSERT(img_idx < dm_get_image_count());
  291.     MMI_ASSERT(pen_event_type < MMI_PEN_EVENT_TYPE_MAX);
  292.     if (wgui_image_pen_handlers[img_idx][pen_event_type] != NULL)
  293.     {
  294.         return wgui_image_pen_handlers[img_idx][pen_event_type] (point);
  295.     }
  296.     else
  297.     {
  298.         return MMI_FALSE;
  299.     }
  300. }
  301. /*****************************************************************************
  302.  * FUNCTION
  303.  *  wgui_pen_execute_LSK_handler
  304.  * DESCRIPTION
  305.  *  Execute left softkey handler from pen
  306.  * PARAMETERS
  307.  *  key_type        [IN]        - KEY_EVENT_DOWN, KEY_EVENT_UP, KEY_LONG_PRESS
  308.  * RETURNS
  309.  *  void
  310.  *****************************************************************************/
  311. static void wgui_pen_execute_LSK_handler(U16 key_type)
  312. {
  313.     /*----------------------------------------------------------------*/
  314.     /* Local Variables                                                */
  315.     /*----------------------------------------------------------------*/
  316.     /*----------------------------------------------------------------*/
  317.     /* Code Body                                                      */
  318.     /*----------------------------------------------------------------*/
  319.     /* In MMI convention, applications typically clear key handlers before sending requests to other tasks, 
  320.        which avoid re-entrance of protocol handler */
  321.     if (GetKeyHandler(KEY_LSK, key_type))
  322.     {
  323.         /* Some softkey handlers use GetkeyInfo() */
  324.         SetkeyInfo(KEY_LSK, key_type);
  325.         execute_softkey_function(key_type, MMI_LEFT_SOFTKEY);
  326.     }
  327. }
  328. /*****************************************************************************
  329.  * FUNCTION
  330.  *  wgui_pen_execute_RSK_handler
  331.  * DESCRIPTION
  332.  *  Execute right softkey handler from pen
  333.  * PARAMETERS
  334.  *  key_type        [IN]        
  335.  * RETURNS
  336.  *  void
  337.  *****************************************************************************/
  338. static void wgui_pen_execute_RSK_handler(U16 key_type)
  339. {
  340.     /*----------------------------------------------------------------*/
  341.     /* Local Variables                                                */
  342.     /*----------------------------------------------------------------*/
  343.     /*----------------------------------------------------------------*/
  344.     /* Code Body                                                      */
  345.     /*----------------------------------------------------------------*/
  346.     /* In MMI convention, applications typically clear key handlers before sending requests to other tasks, 
  347.        which avoid re-entrance of protocol handler */
  348.     if (GetKeyHandler(KEY_RSK, key_type))
  349.     {
  350.         /* Some softkey handlers use GetkeyInfo() */
  351.         SetkeyInfo(KEY_RSK, key_type);
  352.         execute_softkey_function(key_type, MMI_RIGHT_SOFTKEY);
  353.     }
  354. }
  355. #ifdef __MMI_WGUI_CSK_ENABLE__
  356. /*****************************************************************************
  357.  * FUNCTION
  358.  *  wgui_pen_execute_CSK_handler
  359.  * DESCRIPTION
  360.  *  Execute center softkey handler from pen
  361.  * PARAMETERS
  362.  *  key_type        [IN]        
  363.  * RETURNS
  364.  *  void
  365.  *****************************************************************************/
  366. static void wgui_pen_execute_CSK_handler(U16 key_type)
  367. {
  368.     /*----------------------------------------------------------------*/
  369.     /* Local Variables                                                */
  370.     /*----------------------------------------------------------------*/
  371.     /*----------------------------------------------------------------*/
  372.     /* Code Body                                                      */
  373.     /*----------------------------------------------------------------*/
  374.     /* In MMI convention, applications typically clear key handlers before sending requests to other tasks, 
  375.        which avoid re-entrance of protocol handler */
  376.     if (GetKeyHandler(KEY_CSK, key_type))
  377.     {
  378.         /* Some softkey handlers use GetkeyInfo() */
  379.         SetkeyInfo(KEY_CSK, key_type);
  380.         execute_softkey_function(key_type, MMI_CENTER_SOFTKEY);
  381.     }
  382. }
  383. #endif /* __MMI_WGUI_CSK_ENABLE__ */ 
  384. /*****************************************************************************
  385.  * FUNCTION
  386.  *  wgui_pen_redraw_inline_editor
  387.  * DESCRIPTION
  388.  *  Redraw inline editor
  389.  * PARAMETERS
  390.  *  void
  391.  * RETURNS
  392.  *  void
  393.  *****************************************************************************/
  394. static void wgui_pen_redraw_inline_editor(void)
  395. {
  396.     /*----------------------------------------------------------------*/
  397.     /* Local Variables                                                */
  398.     /*----------------------------------------------------------------*/
  399.     /*----------------------------------------------------------------*/
  400.     /* Code Body                                                      */
  401.     /*----------------------------------------------------------------*/
  402.     redraw_fixed_list();
  403.     redraw_current_inline_item();
  404. }
  405. /*****************************************************************************
  406.  * FUNCTION
  407.  *  wgui_general_pen_down_hdlr
  408.  * DESCRIPTION
  409.  *  General Pen Down event handler.
  410.  * PARAMETERS
  411.  *  point       [IN]        
  412.  * RETURNS
  413.  *  void
  414.  *****************************************************************************/
  415. void wgui_general_pen_down_hdlr(mmi_pen_point_struct point)
  416. {
  417.     /*----------------------------------------------------------------*/
  418.     /* Local Variables                                                */
  419.     /*----------------------------------------------------------------*/
  420.     S32 u8CtrlCt = 0;
  421.     S32 u8NoOfUICtrls = 0;
  422.     S16 *UICtrlAccessPtr_p = NULL, *DeafultCoordinateSet_p = NULL;
  423.     dm_cat_scr_info_struct dm_cat_scr_info;
  424.     S32 idx = 0;
  425.     U8 *control_set_ptr = NULL;
  426.     BOOL ret;
  427.     gui_button_pen_enum button_event;
  428.     gui_list_pen_enum menu_event;
  429.     gui_matrix_pen_enum matrix_event;
  430.     gui_inline_pen_enum inline_event;
  431.     gui_slide_control_pen_event_enum slide_event;
  432.     gui_pen_event_param_struct param;
  433.     gui_3D_circular_menu_pen_enum circular_event;
  434.     gui_calendar_pen_enum calendar_event;
  435.     wgui_status_icon_bar_pen_enum status_icon_bar_event;
  436.     S16 status_icon_id;
  437.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  438.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  439.     S16 dm_image_index = -1;
  440.     S16 dm_button_index = -1;
  441.     /*----------------------------------------------------------------*/
  442.     /* Code Body                                                      */
  443.     /*----------------------------------------------------------------*/
  444.     /* to reset dm_data when screen changes */
  445.     if (g_dm_data.s32CatId == 0)
  446.     {
  447.         g_pen_to_control = NONE;
  448.         g_pen_to_control_index = 0;
  449.         return;
  450.     }
  451.     control_set_ptr = dm_search_control_set((U16) g_dm_data.s32CatId, &DeafultCoordinateSet_p);
  452.     /* First element in Category-Controls map specifies the number of controls */
  453.     u8NoOfUICtrls = control_set_ptr[0];
  454.     UICtrlAccessPtr_p = dm_search_coordinate_set(g_dm_data.s32ScrId);
  455.     if (UICtrlAccessPtr_p == NULL)
  456.     {
  457.         UICtrlAccessPtr_p = DeafultCoordinateSet_p;
  458.     }
  459.    /*************************************************************************
  460.    If dm_search_coordinate_set returns NULL, then there must be Default Coordinate Set.
  461.    *************************************************************************/
  462.     MMI_ASSERT(UICtrlAccessPtr_p != NULL);
  463.     /* Fist element in coordinate set specifies the coordinates of complete category screen */
  464.     UICtrlAccessPtr_p = dm_get_cat_scr_coordinates(UICtrlAccessPtr_p, &dm_cat_scr_info);
  465.     /* Start from the toppest components */
  466.     for (u8CtrlCt = u8NoOfUICtrls; u8CtrlCt > 0; u8CtrlCt--)
  467.     {
  468.         switch (control_set_ptr[u8CtrlCt])
  469.         {
  470.             case DM_LIST1:
  471.             case DM_TYPICAL_STOPWATCH:
  472.                 /* redraw_fixed_list */
  473.                 MMI_fixed_list_menu.pen_redraw_menu_function = show_fixed_list;
  474.                 gui_vertical_scrollbar_set_pen_self_scroll(&MMI_fixed_list_menu.vbar, MMI_TRUE);
  475.                 gui_fixed_list_menu_set_pen_scroll_delay(&MMI_fixed_list_menu, 0);
  476.                 ret = gui_fixed_list_menu_translate_pen_event(
  477.                         &MMI_fixed_list_menu,
  478.                         MMI_PEN_EVENT_DOWN,
  479.                         point.x,
  480.                         point.y,
  481.                         &menu_event);
  482.                 if (ret)
  483.                 {
  484.                     g_pen_to_control = DM_LIST1;
  485.                     if (menu_event == GUI_LIST_PEN_HIGHLIGHT_CHANGED || menu_event == GUI_LIST_PEN_NEED_REDRAW)
  486.                     {
  487.                     #ifdef __MMI_INTERACTIVE_PROFILNG__
  488.                         mmi_frm_profiling_delay_start_timer(MMI_FRM_PROFILING_DELAY_LIST_HIGHLIGHT);
  489.                     #endif
  490.                     
  491.                         MMI_fixed_list_menu.pen_redraw_menu_function();
  492.                         
  493.                     #ifdef __MMI_INTERACTIVE_PROFILNG__
  494.                         mmi_frm_profiling_delay_perform(MMI_FRM_PROFILING_DELAY_LIST_HIGHLIGHT);
  495.                     #endif
  496.                     }
  497.                     return;
  498.                 }
  499.                 break;
  500.             case DM_BASE_CONTROL_SET1:
  501.             case DM_BASE_CONTROL_SET2:
  502.             case DM_BUTTON_BAR1:
  503.             case DM_LSK:
  504.             case DM_RSK:
  505.                 if (!(g_dm_data.s32flags & DM_NO_SOFTKEY))
  506.                 {
  507.                     /* LSK */
  508.                     ret = gui_icontext_button_translate_pen_event(
  509.                             &MMI_softkeys[MMI_LEFT_SOFTKEY],
  510.                             MMI_PEN_EVENT_DOWN,
  511.                             point.x,
  512.                             point.y,
  513.                             &button_event);
  514.                     if (ret)
  515.                     {
  516.                         g_pen_to_control = DM_LSK;
  517.                         if (button_event == GUI_BUTTON_PEN_DOWN)
  518.                         {
  519.                             wgui_pen_execute_LSK_handler(KEY_EVENT_DOWN);
  520.                         }
  521.                         return;
  522.                     }
  523.                     /* RSK */
  524.                     ret = gui_icontext_button_translate_pen_event(
  525.                             &MMI_softkeys[MMI_RIGHT_SOFTKEY],
  526.                             MMI_PEN_EVENT_DOWN,
  527.                             point.x,
  528.                             point.y,
  529.                             &button_event);
  530.                     if (ret)
  531.                     {
  532.                         g_pen_to_control = DM_RSK;
  533.                         if (button_event == GUI_BUTTON_PEN_DOWN)
  534.                         {
  535.                             wgui_pen_execute_RSK_handler(KEY_EVENT_DOWN);
  536.                         }
  537.                         return;
  538.                     }
  539.                 #ifdef __MMI_WGUI_CSK_ENABLE__
  540.                     /* CSK */
  541.                     ret = gui_icontext_button_translate_pen_event(
  542.                             &MMI_softkeys[MMI_CENTER_SOFTKEY],
  543.                             MMI_PEN_EVENT_DOWN,
  544.                             point.x,
  545.                             point.y,
  546.                             &button_event);
  547.                     if (ret)
  548.                     {
  549.                         g_pen_to_control = DM_CSK;
  550.                         if (button_event == GUI_BUTTON_PEN_DOWN)
  551.                         {
  552.                             wgui_pen_execute_CSK_handler(KEY_EVENT_DOWN);
  553.                         }
  554.                         return;
  555.                     }
  556.                 #endif /* __MMI_WGUI_CSK_ENABLE__ */ 
  557.                 }
  558.                 ret = wgui_status_icon_translate_pen_event(
  559.                         MMI_PEN_EVENT_DOWN,
  560.                         point.x,
  561.                         point.y,
  562.                         &status_icon_id,
  563.                         &status_icon_bar_event);
  564.                 if (ret)
  565.                 {
  566.                     g_pen_to_control = DM_STATUS_BAR1;
  567.                     return;
  568.                 }
  569.                 break;
  570.             case DM_MATRIX_MENU1:
  571.                 ret = gui_fixed_matrix_menu_translate_pen_event(
  572.                         &MMI_fixed_matrix_menu,
  573.                         MMI_PEN_EVENT_DOWN,
  574.                         point.x,
  575.                         point.y,
  576.                         &matrix_event);
  577.                 if (ret)
  578.                 {
  579.                     g_pen_to_control = DM_MATRIX_MENU1;
  580.                     if (matrix_event == GUI_MATRIX_PEN_HIGHLIGHT_CHANGED || matrix_event == GUI_MATRIX_PEN_NEED_REDRAW)
  581.                     {
  582.                     #ifdef __MMI_INTERACTIVE_PROFILNG__
  583.                         mmi_frm_profiling_delay_start_timer(MMI_FRM_PROFILING_DELAY_MATRIX_HIGHLIGHT);
  584.                     #endif
  585.                     
  586.                         show_fixed_matrix();
  587.                         
  588.                     #ifdef __MMI_INTERACTIVE_PROFILNG__
  589.                         mmi_frm_profiling_delay_perform(MMI_FRM_PROFILING_DELAY_MATRIX_HIGHLIGHT);
  590.                     #endif
  591.                     }
  592.                     return;
  593.                 }
  594.                 break;
  595.             case DM_DYNAMIC_LIST1:
  596.                 MMI_fixed_list_menu.pen_redraw_menu_function = show_dynamic_list;
  597.                 gui_vertical_scrollbar_set_pen_self_scroll(&MMI_fixed_list_menu.vbar, MMI_TRUE);
  598.                 gui_fixed_list_menu_set_pen_scroll_delay(&MMI_fixed_list_menu, GUI_DYNAMIC_LIST_PEN_SCROLL_DELAY);
  599.                 ret = gui_dynamic_list_menu_translate_pen_event(
  600.                         &MMI_fixed_list_menu,
  601.                         MMI_PEN_EVENT_DOWN,
  602.                         point.x,
  603.                         point.y,
  604.                         &menu_event);
  605.                 if (ret)
  606.                 {
  607.                     g_pen_to_control = DM_DYNAMIC_LIST1;
  608.                     if (menu_event == GUI_LIST_PEN_HIGHLIGHT_CHANGED || menu_event == GUI_LIST_PEN_NEED_REDRAW)
  609.                     {
  610.                         MMI_fixed_list_menu.pen_redraw_menu_function();
  611.                     }
  612.                     return;
  613.                 }
  614.                 break;
  615.             case DM_ASYNCDYNAMIC_LIST1:
  616.                 MMI_fixed_list_menu.pen_redraw_menu_function = show_asyncdynamic_list;
  617.                 gui_vertical_scrollbar_set_pen_self_scroll(&MMI_fixed_list_menu.vbar, MMI_TRUE);
  618.                 gui_fixed_list_menu_set_pen_scroll_delay(&MMI_fixed_list_menu, GUI_DYNAMIC_LIST_PEN_SCROLL_DELAY);
  619.                 ret = gui_asyncdynamic_list_menu_translate_pen_event(
  620.                         &MMI_fixed_list_menu,
  621.                         MMI_PEN_EVENT_DOWN,
  622.                         point.x,
  623.                         point.y,
  624.                         &menu_event);
  625.                 if (ret)
  626.                 {
  627.                     g_pen_to_control = DM_ASYNCDYNAMIC_LIST1;
  628.                     if (menu_event == GUI_LIST_PEN_HIGHLIGHT_CHANGED || menu_event == GUI_LIST_PEN_NEED_REDRAW)
  629.                     {
  630.                         MMI_fixed_list_menu.pen_redraw_menu_function();
  631.                     }
  632.                     return;
  633.                 }
  634.                 break;
  635.             case DM_INLINE_FIXED_LIST1:
  636.                 MMI_fixed_list_menu.pen_redraw_menu_function = wgui_pen_redraw_inline_editor;
  637.                 /* 
  638.                  * The scroll offset of inline editor might be different than the scroll value of scrollbar
  639.                  * due to the restrictions of inline editor.
  640.                  */
  641.                 gui_vertical_scrollbar_set_pen_self_scroll(&MMI_fixed_list_menu.vbar, MMI_FALSE);
  642.                 gui_fixed_list_menu_set_pen_scroll_delay(&MMI_fixed_list_menu, 0);
  643.                 ret = gui_inline_translate_pen_event(
  644.                         &MMI_fixed_list_menu,
  645.                         MMI_PEN_EVENT_DOWN,
  646.                         point.x,
  647.                         point.y,
  648.                         &inline_event);
  649.                 if (ret)
  650.                 {
  651.                     g_pen_to_control = DM_INLINE_FIXED_LIST1;
  652.                     if (inline_event == GUI_INLINE_PEN_NEED_REDRAW)
  653.                     {
  654.                         MMI_fixed_list_menu.pen_redraw_menu_function();
  655.                     }
  656.                     return;
  657.                 }
  658.                 break;
  659.             case DM_SLIDE_CONTROL:
  660.             {
  661.                 extern S32 dm_slide_control_count;
  662.                 for (idx = 0; idx < dm_slide_control_count; idx++)
  663.                 {
  664.                     ret = wgui_slide_control_translate_pen_event(
  665.                             &MMI_slide_control[idx],
  666.                             MMI_PEN_EVENT_DOWN,
  667.                             point.x,
  668.                             point.y,
  669.                             &slide_event,
  670.                             &param);
  671.                     if (ret)
  672.                     {
  673.                         g_pen_to_control = DM_SLIDE_CONTROL;
  674.                         if (MMI_current_slide_control != &MMI_slide_control[idx])
  675.                         {
  676.                             gui_lock_double_buffer();
  677.                             /* Redraw previous focused slide */
  678.                             wgui_hide_slide_control_focus();
  679.                             wgui_show_slide_control();
  680.                             /* Draw current focused slide */
  681.                             wgui_slide_control_set_focus(&MMI_slide_control[idx]);
  682.                             wgui_show_slide_control_focus();
  683.                             if (slide_event == GUI_SLIDE_CONTROL_PEN_JUMP_TO_I)
  684.                             {
  685.                                 wgui_slide_control_set_value(param._u.i);
  686.                             }
  687.                             else
  688.                             {
  689.                                 wgui_show_slide_control();
  690.                             }
  691.                             gui_unlock_double_buffer();
  692.                             gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  693.                         }
  694.                         else
  695.                         {
  696.                             if (slide_event == GUI_SLIDE_CONTROL_PEN_JUMP_TO_I)
  697.                             {
  698.                                 wgui_show_slide_control_focus();
  699.                                 wgui_slide_control_set_value(param._u.i);
  700.                             }
  701.                         }
  702.                         return;
  703.                     }
  704.                 }
  705.                 break;
  706.             }
  707.             case DM_CALENDAR:
  708.                 ret = wgui_calendar_translate_pen_event(
  709.                         &MMI_calendar_control,
  710.                         MMI_PEN_EVENT_DOWN,
  711.                         point.x,
  712.                         point.y,
  713.                         &calendar_event);
  714.                 if (ret)
  715.                 {
  716.                     g_pen_to_control = DM_CALENDAR;
  717.                     return;
  718.                 }
  719.                 break;
  720.             case DM_CIRCULAR_MENU1:
  721.                 ret = gui_3D_circular_menu_translate_pen_event(
  722.                         &wgui_CM3D_menu,
  723.                         MMI_PEN_EVENT_DOWN,
  724.                         point.x,
  725.                         point.y,
  726.                         &circular_event);
  727.                 if (ret)
  728.                 {
  729.                     g_pen_to_control = DM_CIRCULAR_MENU1;
  730.                     if (circular_event == GUI_3D_CIRCULAR_MENU_PEN_GOTO_NEXT)
  731.                     {
  732.                         circular_3d_menu_next();
  733.                     }
  734.                     else if (circular_event == GUI_3D_CIRCULAR_MENU_PEN_GOTO_PREVIOUS)
  735.                     {
  736.                         circular_3d_menu_previous();
  737.                     }
  738.                     return;
  739.                 }
  740.                 break;
  741.             case DM_HORIZONTAL_TAB_BAR:
  742.                 ret = wgui_general_pen_horizontal_tab_bar_hdlr(point, MMI_PEN_EVENT_DOWN);
  743.                 if (ret)
  744.                 {
  745.                     g_pen_to_control = DM_HORIZONTAL_TAB_BAR;
  746.                     return;
  747.                 }
  748.                 break;
  749.             #ifdef __MMI_STOPWATCH__
  750.             case DM_NWAY_STOPWATCH:
  751.             {
  752.                 S32 index;
  753.                 if (wgui_stopwatch_pen_down_hdlr(point, &index) == MMI_TRUE)
  754.                 {
  755.                     g_pen_to_control = DM_NWAY_STOPWATCH;
  756.                     gStopwatchAppInfo.currentTimerIndex = index;
  757.                     StartIndexTimer();
  758.                     start_multipurpose_list_watch((U8) index);
  759.                 }
  760.             }
  761.                 break;
  762.             #endif /* __MMI_STOPWATCH__ */ 
  763.             case DM_MULTILINE_INPUTBOX1:
  764.             {
  765.                 if (MMI_multiline_inputbox.flags & UI_MULTI_LINE_INPUT_BOX_VIEW_MODE)
  766.                 {
  767.                     ret = gui_multi_line_input_box_translate_pen_event(
  768.                             &MMI_multiline_inputbox,
  769.                             MMI_PEN_EVENT_DOWN,
  770.                             point.x,
  771.                             point.y,
  772.                             &multi_line_input_box_event);
  773.                     if (ret)
  774.                     {
  775.                         g_pen_to_control = DM_MULTILINE_INPUTBOX1;
  776.                         return;
  777.                     }
  778.                 }
  779.             }
  780.                 break;
  781.             case DM_EMS_INPUTBOX1:
  782.             {
  783.                 if (MMI_EMS_inputbox.flags & UI_EMS_INPUT_BOX_VIEW_MODE)
  784.                 {
  785.                     ret = gui_EMS_input_box_translate_pen_event(
  786.                             &MMI_EMS_inputbox,
  787.                             MMI_PEN_EVENT_DOWN,
  788.                             point.x,
  789.                             point.y,
  790.                             &EMS_input_box_event);
  791.                     if (ret)
  792.                     {
  793.                     /*
  794.                     #ifdef __MMI_MESSAGES_EMS__
  795.                         EMS_cancel_object_focus();
  796.                     #endif 
  797.                     */
  798.                         g_pen_to_control = DM_EMS_INPUTBOX1;
  799.                         return;
  800.                     }
  801.                 }
  802.             }
  803.                 break;
  804.             case DM_DIALER_INPUT_BOX1:
  805.             {
  806.                 if (PEN_CHECK_BOUND
  807.                     (point.x, point.y, MMI_dialer_inputbox.x, MMI_dialer_inputbox.y, MMI_dialer_inputbox.width,
  808.                      MMI_dialer_inputbox.height))
  809.                 {
  810.                     g_pen_to_control = DM_DIALER_INPUT_BOX1;
  811.                     gui_show_dialer_input_box_ext(&MMI_dialer_inputbox, point.x, point.y);
  812.                     show_dialer_inputbox();
  813.                     return;
  814.                 }
  815.             }
  816.                 break;
  817.             case DM_IMAGE:
  818.                 /* If there are more than one draw manager object in control set, we only need to scan all image once */
  819.                 if (dm_image_index == -1)   /* first time for DM_IMAGE */
  820.                 {
  821.                     for (dm_image_index = 0; dm_image_index < dm_get_image_count(); dm_image_index++)
  822.                     {
  823.                         if (dm_check_image_bound(dm_image_index, point))
  824.                         {
  825.                             if (wgui_execute_dm_image_pen_handler(dm_image_index, MMI_PEN_EVENT_DOWN, point))
  826.                             {
  827.                                 g_pen_to_control = DM_IMAGE;
  828.                                 g_pen_to_control_index = dm_image_index;
  829.                                 return;
  830.                             }
  831.                         }
  832.                     }
  833.                 }
  834.                 break;
  835.             case DM_BUTTON:
  836.                 if (dm_button_index == -1)  /* first time for DM_BUTTON */
  837.                 {
  838.                     for (dm_button_index = 0; dm_button_index < dm_get_button_count(); dm_button_index++)
  839.                     {
  840.                         ret = gui_icontext_button_translate_pen_event(
  841.                                 dm_get_button(dm_button_index),
  842.                                 MMI_PEN_EVENT_DOWN,
  843.                                 point.x,
  844.                                 point.y,
  845.                                 &button_event);
  846.                         if (ret)
  847.                         {
  848.                             g_pen_to_control = DM_BUTTON;
  849.                             g_pen_to_control_index = dm_button_index;
  850.                             if (button_event == GUI_BUTTON_PEN_DOWN)
  851.                             {
  852.                                 dm_execute_button_handler(dm_button_index, KEY_EVENT_DOWN);
  853.                             }
  854.                             return;
  855.                         }
  856.                     }
  857.                 }
  858.                 break;
  859.             case DM_CATEGORY_CONTROLLED_AREA:
  860.                 if (wgui_execute_dm_category_control_area_pen_handler(KEY_EVENT_DOWN, point) == MMI_TRUE)
  861.                 {
  862.                     g_pen_to_control = DM_CATEGORY_CONTROLLED_AREA;
  863.                     return;
  864.                 }
  865.                 break;
  866.             case DM_CATEGORY_CONTROLLED_AREA2:
  867.                 if (wgui_execute_dm_category_control_area2_pen_handler(KEY_EVENT_DOWN, point) == MMI_TRUE)
  868.                 {
  869.                     g_pen_to_control = DM_CATEGORY_CONTROLLED_AREA2;
  870.                     return;
  871.                 }
  872.                 break;
  873.             default:
  874.                 g_pen_to_control = NONE;
  875.                 break;
  876.         }
  877.     }
  878. }
  879. /*****************************************************************************
  880.  * FUNCTION
  881.  *  wgui_general_pen_move_hdlr
  882.  * DESCRIPTION
  883.  *  General Pen Move event handler.
  884.  * PARAMETERS
  885.  *  point       [IN]        
  886.  * RETURNS
  887.  *  void
  888.  *****************************************************************************/
  889. void wgui_general_pen_move_hdlr(mmi_pen_point_struct point)
  890. {
  891.     /*----------------------------------------------------------------*/
  892.     /* Local Variables                                                */
  893.     /*----------------------------------------------------------------*/
  894.     gui_button_pen_enum button_event;
  895.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  896.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  897.     wgui_status_icon_bar_pen_enum status_icon_bar_event;
  898.     S16 status_icon_id;
  899.     /*----------------------------------------------------------------*/
  900.     /* Code Body                                                      */
  901.     /*----------------------------------------------------------------*/
  902.     if (g_pen_to_control == DM_LSK)
  903.     {
  904.         gui_icontext_button_translate_pen_event(
  905.             &MMI_softkeys[MMI_LEFT_SOFTKEY],
  906.             MMI_PEN_EVENT_MOVE,
  907.             point.x,
  908.             point.y,
  909.             &button_event);
  910.     }
  911.     else if (g_pen_to_control == DM_RSK)
  912.     {
  913.         gui_icontext_button_translate_pen_event(
  914.             &MMI_softkeys[MMI_RIGHT_SOFTKEY],
  915.             MMI_PEN_EVENT_MOVE,
  916.             point.x,
  917.             point.y,
  918.             &button_event);
  919.     }
  920. #ifdef __MMI_WGUI_CSK_ENABLE__
  921.     else if (g_pen_to_control == DM_CSK)
  922.     {
  923.         gui_icontext_button_translate_pen_event(
  924.             &MMI_softkeys[MMI_CENTER_SOFTKEY],
  925.             MMI_PEN_EVENT_MOVE,
  926.             point.x,
  927.             point.y,
  928.             &button_event);
  929.     }
  930. #endif /* __MMI_WGUI_CSK_ENABLE__ */ 
  931.     else if (g_pen_to_control == DM_STATUS_BAR1)
  932.     {
  933.         wgui_status_icon_translate_pen_event(
  934.             MMI_PEN_EVENT_MOVE,
  935.             point.x,
  936.             point.y,
  937.             &status_icon_id,
  938.             &status_icon_bar_event);
  939.     }
  940.     else if (g_pen_to_control == DM_LIST1)
  941.     {
  942.         wgui_general_pen_list_menu_hdlr(point, MMI_PEN_EVENT_MOVE);
  943.     }
  944.     else if (g_pen_to_control == DM_INLINE_FIXED_LIST1)
  945.     {
  946.         wgui_general_pen_inline_hdlr(point, MMI_PEN_EVENT_MOVE);
  947.     }
  948.     else if (g_pen_to_control == DM_DYNAMIC_LIST1)
  949.     {
  950.         wgui_general_pen_dynamic_list_menu_hdlr(point, MMI_PEN_EVENT_MOVE);
  951.     }
  952.     else if (g_pen_to_control == DM_ASYNCDYNAMIC_LIST1)
  953.     {
  954.         wgui_general_pen_asyncdynamic_list_menu_hdlr(point, MMI_PEN_EVENT_MOVE);
  955.     }
  956.     else if (g_pen_to_control == DM_MATRIX_MENU1)
  957.     {
  958.         wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_MOVE);
  959.     }
  960.     else if (g_pen_to_control == DM_SLIDE_CONTROL)
  961.     {
  962.         wgui_general_pen_slide_control_hdlr(point, MMI_PEN_EVENT_MOVE);
  963.     }
  964.     else if (g_pen_to_control == DM_CALENDAR)
  965.     {
  966.         wgui_general_pen_calendar_hdlr(point, MMI_PEN_EVENT_MOVE);
  967.     }
  968.     else if (g_pen_to_control == DM_CIRCULAR_MENU1)
  969.     {
  970.         wgui_general_pen_3D_circular_menu_hdlr(point, MMI_PEN_EVENT_MOVE);
  971.     }
  972.     else if (g_pen_to_control == DM_HORIZONTAL_TAB_BAR)
  973.     {
  974.         wgui_general_pen_horizontal_tab_bar_hdlr(point, MMI_PEN_EVENT_MOVE);
  975.     }
  976.     else if (g_pen_to_control == DM_MULTILINE_INPUTBOX1)
  977.     {
  978.         gui_multi_line_input_box_translate_pen_event(
  979.             &MMI_multiline_inputbox,
  980.             MMI_PEN_EVENT_MOVE,
  981.             point.x,
  982.             point.y,
  983.             &multi_line_input_box_event);
  984.     }
  985.     else if (g_pen_to_control == DM_EMS_INPUTBOX1)
  986.     {
  987.         gui_EMS_input_box_translate_pen_event(
  988.             &MMI_EMS_inputbox,
  989.             MMI_PEN_EVENT_MOVE,
  990.             point.x,
  991.             point.y,
  992.             &EMS_input_box_event);
  993.     }
  994.     else if (g_pen_to_control == DM_TYPICAL_STOPWATCH)
  995.     {
  996.         wgui_general_pen_list_menu_hdlr(point, MMI_PEN_EVENT_MOVE);
  997.     }
  998.     else if (g_pen_to_control == DM_DIALER_INPUT_BOX1)
  999.     {
  1000.         if (PEN_CHECK_BOUND
  1001.             (point.x, point.y, MMI_dialer_inputbox.x, MMI_dialer_inputbox.y, MMI_dialer_inputbox.width,
  1002.              MMI_dialer_inputbox.height))
  1003.         {
  1004.             g_pen_to_control = DM_DIALER_INPUT_BOX1;
  1005.             gui_show_dialer_input_box_ext(&MMI_dialer_inputbox, point.x, point.y);
  1006.             show_dialer_inputbox();
  1007.             return;
  1008.         }
  1009.     }
  1010.     else if (g_pen_to_control == DM_BUTTON)
  1011.     {
  1012.         gui_icontext_button_translate_pen_event(
  1013.             dm_get_button(g_pen_to_control_index),
  1014.             MMI_PEN_EVENT_MOVE,
  1015.             point.x,
  1016.             point.y,
  1017.             &button_event);
  1018.     }
  1019.     else if (g_pen_to_control == DM_CATEGORY_CONTROLLED_AREA)
  1020.     {
  1021.         wgui_execute_dm_category_control_area_pen_handler(MMI_PEN_EVENT_MOVE, point);
  1022.     }
  1023.     else if (g_pen_to_control == DM_CATEGORY_CONTROLLED_AREA2)
  1024.     {
  1025.         wgui_execute_dm_category_control_area2_pen_handler(MMI_PEN_EVENT_MOVE, point);
  1026.     }
  1027. }
  1028. /*****************************************************************************
  1029.  * FUNCTION
  1030.  *  wgui_general_pen_up_hdlr
  1031.  * DESCRIPTION
  1032.  *  General Pen Up event handler.
  1033.  * PARAMETERS
  1034.  *  point       [IN]        
  1035.  * RETURNS
  1036.  *  void
  1037.  *****************************************************************************/
  1038. void wgui_general_pen_up_hdlr(mmi_pen_point_struct point)
  1039. {
  1040.     /*----------------------------------------------------------------*/
  1041.     /* Local Variables                                                */
  1042.     /*----------------------------------------------------------------*/
  1043.     gui_button_pen_enum button_event;
  1044.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  1045.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  1046.     wgui_status_icon_bar_pen_enum status_icon_bar_event;
  1047.     S16 status_icon_id;
  1048.     /*----------------------------------------------------------------*/
  1049.     /* Code Body                                                      */
  1050.     /*----------------------------------------------------------------*/
  1051.     if (g_pen_to_control == DM_LSK)
  1052.     {
  1053.         gui_icontext_button_translate_pen_event(
  1054.             &MMI_softkeys[MMI_LEFT_SOFTKEY],
  1055.             MMI_PEN_EVENT_UP,
  1056.             point.x,
  1057.             point.y,
  1058.             &button_event);
  1059.         if (button_event == GUI_BUTTON_PEN_UP_INSIDE)
  1060.         {
  1061.             wgui_pen_execute_LSK_handler(KEY_EVENT_UP);
  1062.         }
  1063.     }
  1064.     else if (g_pen_to_control == DM_RSK)
  1065.     {
  1066.         gui_icontext_button_translate_pen_event(
  1067.             &MMI_softkeys[MMI_RIGHT_SOFTKEY],
  1068.             MMI_PEN_EVENT_UP,
  1069.             point.x,
  1070.             point.y,
  1071.             &button_event);
  1072.         if (button_event == GUI_BUTTON_PEN_UP_INSIDE)
  1073.         {
  1074.             wgui_pen_execute_RSK_handler(KEY_EVENT_UP);
  1075.         }
  1076.     }
  1077. #ifdef __MMI_WGUI_CSK_ENABLE__
  1078.     else if (g_pen_to_control == DM_CSK)
  1079.     {
  1080.         gui_icontext_button_translate_pen_event(
  1081.             &MMI_softkeys[MMI_CENTER_SOFTKEY],
  1082.             MMI_PEN_EVENT_UP,
  1083.             point.x,
  1084.             point.y,
  1085.             &button_event);
  1086.         if (button_event == GUI_BUTTON_PEN_UP_INSIDE)
  1087.         {
  1088.             wgui_pen_execute_CSK_handler(KEY_EVENT_UP);
  1089.         }
  1090.     }
  1091. #endif /* __MMI_WGUI_CSK_ENABLE__ */ 
  1092.     else if (g_pen_to_control == DM_STATUS_BAR1)
  1093.     {
  1094.         wgui_status_icon_translate_pen_event(
  1095.             MMI_PEN_EVENT_UP,
  1096.             point.x,
  1097.             point.y,
  1098.             &status_icon_id,
  1099.             &status_icon_bar_event);
  1100.         if (status_icon_bar_event == WGUI_STATUS_ICON_BAR_PEN_SELECT_ICON)      /* select an icon */
  1101.         {
  1102.             wgui_execute_status_icon_pen_event_hdlr(status_icon_id, WGUI_STATUS_ICON_BAR_PEN_SELECT_ICON);
  1103.         }
  1104.     }
  1105.     else if (g_pen_to_control == DM_LIST1)
  1106.     {
  1107.         wgui_general_pen_list_menu_hdlr(point, MMI_PEN_EVENT_UP);
  1108.     }
  1109.     else if (g_pen_to_control == DM_INLINE_FIXED_LIST1)
  1110.     {
  1111.         wgui_general_pen_inline_hdlr(point, MMI_PEN_EVENT_UP);
  1112.     }
  1113.     else if (g_pen_to_control == DM_DYNAMIC_LIST1)
  1114.     {
  1115.         wgui_general_pen_dynamic_list_menu_hdlr(point, MMI_PEN_EVENT_UP);
  1116.     }
  1117.     else if (g_pen_to_control == DM_ASYNCDYNAMIC_LIST1)
  1118.     {
  1119.         wgui_general_pen_asyncdynamic_list_menu_hdlr(point, MMI_PEN_EVENT_UP);
  1120.     }
  1121.     else if (g_pen_to_control == DM_MATRIX_MENU1)
  1122.     {
  1123.         wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_UP);
  1124.     }
  1125.     else if (g_pen_to_control == DM_SLIDE_CONTROL)
  1126.     {
  1127.         wgui_general_pen_slide_control_hdlr(point, MMI_PEN_EVENT_UP);
  1128.     }
  1129.     else if (g_pen_to_control == DM_CALENDAR)
  1130.     {
  1131.         wgui_general_pen_calendar_hdlr(point, MMI_PEN_EVENT_UP);
  1132.     }
  1133.     else if (g_pen_to_control == DM_CIRCULAR_MENU1)
  1134.     {
  1135.         wgui_general_pen_3D_circular_menu_hdlr(point, MMI_PEN_EVENT_UP);
  1136.     }
  1137.     else if (g_pen_to_control == DM_HORIZONTAL_TAB_BAR)
  1138.     {
  1139.         wgui_general_pen_horizontal_tab_bar_hdlr(point, MMI_PEN_EVENT_UP);
  1140.     }
  1141.     else if (g_pen_to_control == DM_MULTILINE_INPUTBOX1)
  1142.     {
  1143.         gui_multi_line_input_box_translate_pen_event(
  1144.             &MMI_multiline_inputbox,
  1145.             MMI_PEN_EVENT_UP,
  1146.             point.x,
  1147.             point.y,
  1148.             &multi_line_input_box_event);
  1149.     }
  1150.     else if (g_pen_to_control == DM_EMS_INPUTBOX1)
  1151.     {
  1152.         gui_EMS_input_box_translate_pen_event(
  1153.             &MMI_EMS_inputbox,
  1154.             MMI_PEN_EVENT_UP,
  1155.             point.x,
  1156.             point.y,
  1157.             &EMS_input_box_event);
  1158.         if (GUI_EMS_INPUT_BOX_PEN_TEXT_UP == EMS_input_box_event)
  1159.         {
  1160.             if (GUI_EMS_INPUT_BOX_PEN_SCROLL_BAR != EMS_input_box_event)
  1161.             {
  1162.                 gui_show_EMS_input_box_ext(&MMI_EMS_inputbox, point.x, point.y);
  1163.                 redraw_EMS_inputbox();
  1164.             }
  1165.         }
  1166.     }
  1167.     else if (g_pen_to_control == DM_TYPICAL_STOPWATCH)
  1168.     {
  1169.         wgui_general_pen_list_menu_hdlr(point, MMI_PEN_EVENT_UP);
  1170.     }
  1171.     else if (g_pen_to_control == DM_DIALER_INPUT_BOX1)
  1172.     {
  1173.         /* CURRENTLY DO NOTHING */
  1174.     }
  1175.     else if (g_pen_to_control == DM_IMAGE)
  1176.     {
  1177.         wgui_execute_dm_image_pen_handler(g_pen_to_control_index, MMI_PEN_EVENT_UP, point);
  1178.     }
  1179.     else if (g_pen_to_control == DM_BUTTON)
  1180.     {
  1181.         gui_icontext_button_translate_pen_event(
  1182.             dm_get_button(g_pen_to_control_index),
  1183.             MMI_PEN_EVENT_UP,
  1184.             point.x,
  1185.             point.y,
  1186.             &button_event);
  1187.         if (button_event == GUI_BUTTON_PEN_UP_INSIDE)
  1188.         {
  1189.             dm_execute_button_handler(g_pen_to_control_index, KEY_EVENT_UP);
  1190.         }
  1191.     }
  1192.     else if (g_pen_to_control == DM_CATEGORY_CONTROLLED_AREA)
  1193.     {
  1194.         wgui_execute_dm_category_control_area_pen_handler(MMI_PEN_EVENT_UP, point);
  1195.     }
  1196.     else if (g_pen_to_control == DM_CATEGORY_CONTROLLED_AREA2)
  1197.     {
  1198.         wgui_execute_dm_category_control_area2_pen_handler(MMI_PEN_EVENT_UP, point);
  1199.     }
  1200.     g_pen_to_control = NONE;
  1201. }
  1202. /*****************************************************************************
  1203.  * FUNCTION
  1204.  *  wgui_general_pen_abort_hdlr
  1205.  * DESCRIPTION
  1206.  *  General Pen Abort event handler.
  1207.  * PARAMETERS
  1208.  *  point       [IN]        
  1209.  * RETURNS
  1210.  *  void
  1211.  *****************************************************************************/
  1212. void wgui_general_pen_abort_hdlr(mmi_pen_point_struct point)
  1213. {
  1214.     /*----------------------------------------------------------------*/
  1215.     /* Local Variables                                                */
  1216.     /*----------------------------------------------------------------*/
  1217.     gui_button_pen_enum button_event;
  1218.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  1219.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  1220.     wgui_status_icon_bar_pen_enum status_icon_bar_event;
  1221.     S16 status_icon_id;
  1222.     /*----------------------------------------------------------------*/
  1223.     /* Code Body                                                      */
  1224.     /*----------------------------------------------------------------*/
  1225.     if (g_pen_to_control == DM_LSK)
  1226.     {
  1227.         gui_icontext_button_translate_pen_event(
  1228.             &MMI_softkeys[MMI_LEFT_SOFTKEY],
  1229.             MMI_PEN_EVENT_ABORT,
  1230.             point.x,
  1231.             point.y,
  1232.             &button_event);
  1233.     }
  1234.     else if (g_pen_to_control == DM_RSK)
  1235.     {
  1236.         gui_icontext_button_translate_pen_event(
  1237.             &MMI_softkeys[MMI_RIGHT_SOFTKEY],
  1238.             MMI_PEN_EVENT_ABORT,
  1239.             point.x,
  1240.             point.y,
  1241.             &button_event);
  1242.     }
  1243. #ifdef __MMI_WGUI_CSK_ENABLE__
  1244.     else if (g_pen_to_control == DM_CSK)
  1245.     {
  1246.         gui_icontext_button_translate_pen_event(
  1247.             &MMI_softkeys[MMI_CENTER_SOFTKEY],
  1248.             MMI_PEN_EVENT_ABORT,
  1249.             point.x,
  1250.             point.y,
  1251.             &button_event);
  1252.     }
  1253. #endif /* __MMI_WGUI_CSK_ENABLE__ */ 
  1254.     else if (g_pen_to_control == DM_STATUS_BAR1)
  1255.     {
  1256.         wgui_status_icon_translate_pen_event(
  1257.             MMI_PEN_EVENT_ABORT,
  1258.             point.x,
  1259.             point.y,
  1260.             &status_icon_id,
  1261.             &status_icon_bar_event);
  1262.     }
  1263.     else if (g_pen_to_control == DM_LIST1)
  1264.     {
  1265.         wgui_general_pen_list_menu_hdlr(point, MMI_PEN_EVENT_ABORT);
  1266.     }
  1267.     else if (g_pen_to_control == DM_INLINE_FIXED_LIST1)
  1268.     {
  1269.         wgui_general_pen_inline_hdlr(point, MMI_PEN_EVENT_ABORT);
  1270.     }
  1271.     else if (g_pen_to_control == DM_DYNAMIC_LIST1)
  1272.     {
  1273.         wgui_general_pen_dynamic_list_menu_hdlr(point, MMI_PEN_EVENT_ABORT);
  1274.     }
  1275.     else if (g_pen_to_control == DM_ASYNCDYNAMIC_LIST1)
  1276.     {
  1277.         wgui_general_pen_asyncdynamic_list_menu_hdlr(point, MMI_PEN_EVENT_ABORT);
  1278.     }
  1279.     else if (g_pen_to_control == DM_MATRIX_MENU1)
  1280.     {
  1281.         wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_ABORT);
  1282.     }
  1283.     else if (g_pen_to_control == DM_SLIDE_CONTROL)
  1284.     {
  1285.         wgui_general_pen_slide_control_hdlr(point, MMI_PEN_EVENT_ABORT);
  1286.     }
  1287.     else if (g_pen_to_control == DM_CALENDAR)
  1288.     {
  1289.         wgui_general_pen_calendar_hdlr(point, MMI_PEN_EVENT_ABORT);
  1290.     }
  1291.     else if (g_pen_to_control == DM_CIRCULAR_MENU1)
  1292.     {
  1293.         wgui_general_pen_3D_circular_menu_hdlr(point, MMI_PEN_EVENT_ABORT);
  1294.     }
  1295.     else if (g_pen_to_control == DM_HORIZONTAL_TAB_BAR)
  1296.     {
  1297.         wgui_general_pen_horizontal_tab_bar_hdlr(point, MMI_PEN_EVENT_ABORT);
  1298.     }
  1299.     else if (g_pen_to_control == DM_MULTILINE_INPUTBOX1)
  1300.     {
  1301.         gui_multi_line_input_box_translate_pen_event(
  1302.             &MMI_multiline_inputbox,
  1303.             MMI_PEN_EVENT_ABORT,
  1304.             point.x,
  1305.             point.y,
  1306.             &multi_line_input_box_event);
  1307.     }
  1308.     else if (g_pen_to_control == DM_EMS_INPUTBOX1)
  1309.     {
  1310.         gui_EMS_input_box_translate_pen_event(
  1311.             &MMI_EMS_inputbox,
  1312.             MMI_PEN_EVENT_ABORT,
  1313.             point.x,
  1314.             point.y,
  1315.             &EMS_input_box_event);
  1316.     }
  1317.     else if (g_pen_to_control == DM_DIALER_INPUT_BOX1)
  1318.     {
  1319.         /* CURRENTLY DO NOTHING */
  1320.     }
  1321.     else if (g_pen_to_control == DM_CATEGORY_CONTROLLED_AREA)
  1322.     {
  1323.         wgui_execute_dm_category_control_area_pen_handler(MMI_PEN_EVENT_ABORT, point);
  1324.     }
  1325.     else if (g_pen_to_control == DM_CATEGORY_CONTROLLED_AREA2)
  1326.     {
  1327.         wgui_execute_dm_category_control_area2_pen_handler(MMI_PEN_EVENT_ABORT, point);
  1328.     }
  1329.     g_pen_to_control = NONE;
  1330. }
  1331. /*****************************************************************************
  1332.  * FUNCTION
  1333.  *  wgui_general_pen_long_tap_hdlr
  1334.  * DESCRIPTION
  1335.  *  General Pen Long Tap event handler.
  1336.  * PARAMETERS
  1337.  *  point       [IN]        
  1338.  * RETURNS
  1339.  *  void
  1340.  *****************************************************************************/
  1341. void wgui_general_pen_long_tap_hdlr(mmi_pen_point_struct point)
  1342. {
  1343.     /*----------------------------------------------------------------*/
  1344.     /* Local Variables                                                */
  1345.     /*----------------------------------------------------------------*/
  1346.     gui_button_pen_enum button_event;
  1347.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  1348.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  1349.     wgui_status_icon_bar_pen_enum status_icon_bar_event;
  1350.     S16 status_icon_id;
  1351.     /*----------------------------------------------------------------*/
  1352.     /* Code Body                                                      */
  1353.     /*----------------------------------------------------------------*/
  1354.     if (g_pen_to_control == DM_LSK)
  1355.     {
  1356.         gui_icontext_button_translate_pen_event(
  1357.             &MMI_softkeys[MMI_LEFT_SOFTKEY],
  1358.             MMI_PEN_EVENT_LONG_TAP,
  1359.             point.x,
  1360.             point.y,
  1361.             &button_event);
  1362.         if (button_event == GUI_BUTTON_PEN_LONGTAP)
  1363.         {
  1364.             wgui_pen_execute_LSK_handler(KEY_LONG_PRESS);
  1365.         }
  1366.     }
  1367.     else if (g_pen_to_control == DM_RSK)
  1368.     {
  1369.         gui_icontext_button_translate_pen_event(
  1370.             &MMI_softkeys[MMI_RIGHT_SOFTKEY],
  1371.             MMI_PEN_EVENT_LONG_TAP,
  1372.             point.x,
  1373.             point.y,
  1374.             &button_event);
  1375.         if (button_event == GUI_BUTTON_PEN_LONGTAP)
  1376.         {
  1377.             wgui_pen_execute_RSK_handler(KEY_LONG_PRESS);
  1378.         }
  1379.     }
  1380. #ifdef __MMI_WGUI_CSK_ENABLE__
  1381.     else if (g_pen_to_control == DM_CSK)
  1382.     {
  1383.         gui_icontext_button_translate_pen_event(
  1384.             &MMI_softkeys[MMI_CENTER_SOFTKEY],
  1385.             MMI_PEN_EVENT_LONG_TAP,
  1386.             point.x,
  1387.             point.y,
  1388.             &button_event);
  1389.         if (button_event == GUI_BUTTON_PEN_LONGTAP)
  1390.         {
  1391.             /* Some softkey handlers use GetkeyInfo() */
  1392.             SetkeyInfo(KEY_CSK, KEY_LONG_PRESS);
  1393.             if (GetKeyHandler(KEY_CSK, KEY_LONG_PRESS) != NULL)
  1394.             {
  1395.                 ExecuteCurrKeyHandler(KEY_CSK, KEY_LONG_PRESS);
  1396.             }
  1397.         }
  1398.     }
  1399. #endif /* __MMI_WGUI_CSK_ENABLE__ */ 
  1400.     else if (g_pen_to_control == DM_STATUS_BAR1)
  1401.     {
  1402.         wgui_status_icon_translate_pen_event(
  1403.             MMI_PEN_EVENT_LONG_TAP,
  1404.             point.x,
  1405.             point.y,
  1406.             &status_icon_id,
  1407.             &status_icon_bar_event);
  1408.         if (status_icon_bar_event == WGUI_STATUS_ICON_BAR_PEN_LONG_PRESS_ICON)
  1409.         {
  1410.             wgui_execute_status_icon_pen_event_hdlr(status_icon_id, WGUI_STATUS_ICON_BAR_PEN_LONG_PRESS_ICON);
  1411.         }
  1412.     }
  1413.     else if (g_pen_to_control == DM_LIST1)
  1414.     {
  1415.         wgui_general_pen_list_menu_hdlr(point, MMI_PEN_EVENT_LONG_TAP);
  1416.     }
  1417.     else if (g_pen_to_control == DM_INLINE_FIXED_LIST1)
  1418.     {
  1419.         wgui_general_pen_inline_hdlr(point, MMI_PEN_EVENT_LONG_TAP);
  1420.     }
  1421.     else if (g_pen_to_control == DM_DYNAMIC_LIST1)
  1422.     {
  1423.         wgui_general_pen_dynamic_list_menu_hdlr(point, MMI_PEN_EVENT_LONG_TAP);
  1424.     }
  1425.     else if (g_pen_to_control == DM_ASYNCDYNAMIC_LIST1)
  1426.     {
  1427.         wgui_general_pen_asyncdynamic_list_menu_hdlr(point, MMI_PEN_EVENT_LONG_TAP);
  1428.     }
  1429.     else if (g_pen_to_control == DM_MATRIX_MENU1)
  1430.     {
  1431.         wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_LONG_TAP);
  1432.     }
  1433.     else if (g_pen_to_control == DM_SLIDE_CONTROL)
  1434.     {
  1435.         wgui_general_pen_slide_control_hdlr(point, MMI_PEN_EVENT_LONG_TAP);
  1436.     }
  1437.     else if (g_pen_to_control == DM_CALENDAR)
  1438.     {
  1439.         wgui_general_pen_calendar_hdlr(point, MMI_PEN_EVENT_LONG_TAP);
  1440.     }
  1441.     else if (g_pen_to_control == DM_CIRCULAR_MENU1)
  1442.     {
  1443.         wgui_general_pen_3D_circular_menu_hdlr(point, MMI_PEN_EVENT_LONG_TAP);
  1444.     }
  1445.     else if (g_pen_to_control == DM_HORIZONTAL_TAB_BAR)
  1446.     {
  1447.         wgui_general_pen_horizontal_tab_bar_hdlr(point, MMI_PEN_EVENT_LONG_TAP);
  1448.     }
  1449.     else if (g_pen_to_control == DM_MULTILINE_INPUTBOX1)
  1450.     {
  1451.         gui_multi_line_input_box_translate_pen_event(
  1452.             &MMI_multiline_inputbox,
  1453.             MMI_PEN_EVENT_LONG_TAP,
  1454.             point.x,
  1455.             point.y,
  1456.             &multi_line_input_box_event);
  1457.     }
  1458.     else if (g_pen_to_control == DM_EMS_INPUTBOX1)
  1459.     {
  1460.         gui_EMS_input_box_translate_pen_event(
  1461.             &MMI_EMS_inputbox,
  1462.             MMI_PEN_EVENT_LONG_TAP,
  1463.             point.x,
  1464.             point.y,
  1465.             &EMS_input_box_event);
  1466.     }
  1467.     else if (g_pen_to_control == DM_DIALER_INPUT_BOX1)
  1468.     {
  1469.         /* CURRENTLY DO NOTHING */
  1470.     }
  1471.     else if (g_pen_to_control == DM_IMAGE)
  1472.     {
  1473.         wgui_execute_dm_image_pen_handler(g_pen_to_control_index, MMI_PEN_EVENT_LONG_TAP, point);
  1474.     }
  1475.     else if (g_pen_to_control == DM_BUTTON)
  1476.     {
  1477.         gui_icontext_button_translate_pen_event(
  1478.             dm_get_button(g_pen_to_control_index),
  1479.             MMI_PEN_EVENT_LONG_TAP,
  1480.             point.x,
  1481.             point.y,
  1482.             &button_event);
  1483.         if (button_event == GUI_BUTTON_PEN_LONGTAP)
  1484.         {
  1485.             dm_execute_button_handler(g_pen_to_control_index, KEY_EVENT_LONG_PRESS);
  1486.         }
  1487.     }
  1488.     else if (g_pen_to_control == DM_CATEGORY_CONTROLLED_AREA)
  1489.     {
  1490.         wgui_execute_dm_category_control_area_pen_handler(KEY_EVENT_LONG_PRESS, point);
  1491.     }
  1492.     else if (g_pen_to_control == DM_CATEGORY_CONTROLLED_AREA2)
  1493.     {
  1494.         wgui_execute_dm_category_control_area2_pen_handler(KEY_EVENT_LONG_PRESS, point);
  1495.     }
  1496. }
  1497. /*****************************************************************************
  1498.  * FUNCTION
  1499.  *  wgui_general_pen_repeat_hdlr
  1500.  * DESCRIPTION
  1501.  *  General Pen Repeat event handler.
  1502.  * PARAMETERS
  1503.  *  point       [IN]        
  1504.  * RETURNS
  1505.  *  void
  1506.  *****************************************************************************/
  1507. void wgui_general_pen_repeat_hdlr(mmi_pen_point_struct point)
  1508. {
  1509.     /*----------------------------------------------------------------*/
  1510.     /* Local Variables                                                */
  1511.     /*----------------------------------------------------------------*/
  1512.     gui_button_pen_enum button_event;
  1513.     gui_multi_line_input_box_pen_enum multi_line_input_box_event;
  1514.     gui_EMS_input_box_pen_enum EMS_input_box_event;
  1515.     wgui_status_icon_bar_pen_enum status_icon_bar_event;
  1516.     S16 status_icon_id;
  1517.     /*----------------------------------------------------------------*/
  1518.     /* Code Body                                                      */
  1519.     /*----------------------------------------------------------------*/
  1520.     if (g_pen_to_control == DM_LSK)
  1521.     {
  1522.         gui_icontext_button_translate_pen_event(
  1523.             &MMI_softkeys[MMI_LEFT_SOFTKEY],
  1524.             MMI_PEN_EVENT_REPEAT,
  1525.             point.x,
  1526.             point.y,
  1527.             &button_event);
  1528.         if (button_event == GUI_BUTTON_PEN_LONGTAP)
  1529.         {
  1530.             /* wgui_pen_execute_LSK_handler(KEY_LONG_PRESS); */
  1531.         }
  1532.     }
  1533.     else if (g_pen_to_control == DM_RSK)
  1534.     {
  1535.         gui_icontext_button_translate_pen_event(
  1536.             &MMI_softkeys[MMI_RIGHT_SOFTKEY],
  1537.             MMI_PEN_EVENT_REPEAT,
  1538.             point.x,
  1539.             point.y,
  1540.             &button_event);
  1541.         if (button_event == GUI_BUTTON_PEN_LONGTAP)
  1542.         {
  1543.             /* wgui_pen_execute_RSK_handler(KEY_LONG_PRESS); */
  1544.         }
  1545.     }
  1546. #ifdef __MMI_WGUI_CSK_ENABLE__
  1547.     else if (g_pen_to_control == DM_CSK)
  1548.     {
  1549.         gui_icontext_button_translate_pen_event(
  1550.             &MMI_softkeys[MMI_CENTER_SOFTKEY],
  1551.             MMI_PEN_EVENT_REPEAT,
  1552.             point.x,
  1553.             point.y,
  1554.             &button_event);
  1555.     }
  1556. #endif /* __MMI_WGUI_CSK_ENABLE__ */ 
  1557.     else if (g_pen_to_control == DM_STATUS_BAR1)
  1558.     {
  1559.         wgui_status_icon_translate_pen_event(
  1560.             MMI_PEN_EVENT_REPEAT,
  1561.             point.x,
  1562.             point.y,
  1563.             &status_icon_id,
  1564.             &status_icon_bar_event);
  1565.         if (status_icon_bar_event == WGUI_STATUS_ICON_BAR_PEN_LONG_PRESS_ICON)  /* long press on an icon */
  1566.         {
  1567.             wgui_execute_status_icon_pen_event_hdlr(status_icon_id, WGUI_STATUS_ICON_BAR_PEN_LONG_PRESS_ICON);
  1568.         }
  1569.     }
  1570.     else if (g_pen_to_control == DM_LIST1)
  1571.     {
  1572.         wgui_general_pen_list_menu_hdlr(point, MMI_PEN_EVENT_REPEAT);
  1573.     }
  1574.     else if (g_pen_to_control == DM_INLINE_FIXED_LIST1)
  1575.     {
  1576.         wgui_general_pen_inline_hdlr(point, MMI_PEN_EVENT_REPEAT);
  1577.     }
  1578.     else if (g_pen_to_control == DM_DYNAMIC_LIST1)
  1579.     {
  1580.         wgui_general_pen_dynamic_list_menu_hdlr(point, MMI_PEN_EVENT_REPEAT);
  1581.     }
  1582.     else if (g_pen_to_control == DM_ASYNCDYNAMIC_LIST1)
  1583.     {
  1584.         wgui_general_pen_asyncdynamic_list_menu_hdlr(point, MMI_PEN_EVENT_REPEAT);
  1585.     }
  1586.     else if (g_pen_to_control == DM_MATRIX_MENU1)
  1587.     {
  1588.         wgui_general_pen_matrix_menu_hdlr(point, MMI_PEN_EVENT_REPEAT);
  1589.     }
  1590.     else if (g_pen_to_control == DM_SLIDE_CONTROL)
  1591.     {
  1592.         wgui_general_pen_slide_control_hdlr(point, MMI_PEN_EVENT_REPEAT);
  1593.     }
  1594.     else if (g_pen_to_control == DM_CALENDAR)
  1595.     {
  1596.         wgui_general_pen_calendar_hdlr(point, MMI_PEN_EVENT_REPEAT);
  1597.     }
  1598.     else if (g_pen_to_control == DM_CIRCULAR_MENU1)
  1599.     {
  1600.         wgui_general_pen_3D_circular_menu_hdlr(point, MMI_PEN_EVENT_REPEAT);
  1601.     }
  1602.     else if (g_pen_to_control == DM_HORIZONTAL_TAB_BAR)
  1603.     {
  1604.         wgui_general_pen_horizontal_tab_bar_hdlr(point, MMI_PEN_EVENT_REPEAT);
  1605.     }
  1606.     else if (g_pen_to_control == DM_MULTILINE_INPUTBOX1)
  1607.     {
  1608.         gui_multi_line_input_box_translate_pen_event(
  1609.             &MMI_multiline_inputbox,
  1610.             MMI_PEN_EVENT_REPEAT,
  1611.             point.x,
  1612.             point.y,
  1613.             &multi_line_input_box_event);
  1614.     }
  1615.     else if (g_pen_to_control == DM_EMS_INPUTBOX1)
  1616.     {
  1617.         gui_EMS_input_box_translate_pen_event(
  1618.             &MMI_EMS_inputbox,
  1619.             MMI_PEN_EVENT_REPEAT,
  1620.             point.x,
  1621.             point.y,
  1622.             &EMS_input_box_event);
  1623.     }
  1624.     else if (g_pen_to_control == DM_DIALER_INPUT_BOX1)
  1625.     {
  1626.         /* CURRENTLY DO NOTHING */
  1627.     }
  1628.     else if (g_pen_to_control == DM_IMAGE)
  1629.     {
  1630.         wgui_execute_dm_image_pen_handler(g_pen_to_control_index, MMI_PEN_EVENT_REPEAT, point);
  1631.     }
  1632.     else if (g_pen_to_control == DM_BUTTON)
  1633.     {
  1634.         gui_icontext_button_translate_pen_event(
  1635.             dm_get_button(g_pen_to_control_index),
  1636.             MMI_PEN_EVENT_REPEAT,
  1637.             point.x,
  1638.             point.y,
  1639.             &button_event);
  1640.         if (button_event == GUI_BUTTON_PEN_REPEAT)
  1641.         {
  1642.             dm_execute_button_handler(g_pen_to_control_index, KEY_EVENT_REPEAT);
  1643.         }
  1644.     }
  1645.     else if (g_pen_to_control == DM_CATEGORY_CONTROLLED_AREA)
  1646.     {
  1647.         wgui_execute_dm_category_control_area_pen_handler(MMI_PEN_EVENT_REPEAT, point);
  1648.     }
  1649.     else if (g_pen_to_control == DM_CATEGORY_CONTROLLED_AREA2)
  1650.     {
  1651.         wgui_execute_dm_category_control_area2_pen_handler(MMI_PEN_EVENT_REPEAT, point);
  1652.     }
  1653. }
  1654. /*****************************************************************************
  1655.  * FUNCTION
  1656.  *  wgui_general_pen_list_menu_hdlr
  1657.  * DESCRIPTION
  1658.  *  General list menu event handler.
  1659.  * PARAMETERS
  1660.  *  point           [IN]        Pen point
  1661.  *  pen_event       [IN]        Pen event type
  1662.  * RETURNS
  1663.  *  void
  1664.  *****************************************************************************/
  1665. MMI_BOOL wgui_general_pen_list_menu_hdlr(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  1666. {
  1667.     /*----------------------------------------------------------------*/
  1668.     /* Local Variables                                                */
  1669.     /*----------------------------------------------------------------*/
  1670.     gui_list_pen_enum menu_event;
  1671.     BOOL ret;
  1672.     /*----------------------------------------------------------------*/
  1673.     /* Code Body                                                      */
  1674.     /*----------------------------------------------------------------*/
  1675.     ret = gui_fixed_list_menu_translate_pen_event(&MMI_fixed_list_menu, pen_event, point.x, point.y, &menu_event);
  1676.     if (!ret)
  1677.     {
  1678.         return MMI_FALSE;
  1679.     }
  1680.     if (menu_event == GUI_LIST_PEN_HIGHLIGHT_CHANGED ||
  1681.         menu_event == GUI_LIST_PEN_NEED_REDRAW || menu_event == GUI_LIST_PEN_ITEM_SELECTED)
  1682.     {
  1683.     #ifdef __MMI_INTERACTIVE_PROFILNG__
  1684.         mmi_frm_profiling_delay_start_timer(MMI_FRM_PROFILING_DELAY_LIST_HIGHLIGHT);
  1685.     #endif
  1686.     
  1687.         MMI_fixed_list_menu.pen_redraw_menu_function();
  1688.         
  1689.     #ifdef __MMI_INTERACTIVE_PROFILNG__
  1690.         mmi_frm_profiling_delay_perform(MMI_FRM_PROFILING_DELAY_LIST_HIGHLIGHT);
  1691.     #endif
  1692.     }
  1693.     if (menu_event == GUI_LIST_PEN_ITEM_SELECTED)
  1694.     {
  1695.         if (MMI_fixed_list_menu.pen_event_current_selected_callback_function != NULL)
  1696.         {
  1697.             MMI_fixed_list_menu.pen_event_current_selected_callback_function();
  1698.         }
  1699.         else
  1700.         {
  1701.             wgui_pen_execute_LSK_handler(KEY_EVENT_UP);
  1702.         }
  1703.     }
  1704. #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  1705.     if (menu_event == GUI_ICONTEXT_PEN_TWO_LINE_NEXT)
  1706.     {
  1707.         ExecuteCurrKeyHandler(KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  1708.     }
  1709.     else if (menu_event == GUI_ICONTEXT_PEN_TWO_LINE_PREVIOUS)
  1710.     {
  1711.         ExecuteCurrKeyHandler(KEY_LEFT_ARROW,KEY_EVENT_DOWN);
  1712.     }
  1713. #endif /* __MMI_UI_TWO_LINE_MENUITEM_STYLES__ */
  1714.     return MMI_TRUE;
  1715. }
  1716. /*****************************************************************************
  1717.  * FUNCTION
  1718.  *  wgui_general_pen_inline_hdlr
  1719.  * DESCRIPTION
  1720.  *  General inline list event handler.
  1721.  * PARAMETERS
  1722.  *  point           [IN]        Pen point
  1723.  *  pen_event       [IN]        Pen event type
  1724.  * RETURNS
  1725.  *  void
  1726.  *****************************************************************************/
  1727. MMI_BOOL wgui_general_pen_inline_hdlr(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  1728. {
  1729.     /*----------------------------------------------------------------*/
  1730.     /* Local Variables                                                */
  1731.     /*----------------------------------------------------------------*/
  1732.     gui_inline_pen_enum inline_event;
  1733.     BOOL ret;
  1734.     /*----------------------------------------------------------------*/
  1735.     /* Code Body                                                      */
  1736.     /*----------------------------------------------------------------*/
  1737.     ret = gui_inline_translate_pen_event(&MMI_fixed_list_menu, pen_event, point.x, point.y, &inline_event);
  1738.     if (!ret)
  1739.     {
  1740.         return MMI_FALSE;
  1741.     }
  1742.     if (inline_event == GUI_INLINE_PEN_NEED_REDRAW)
  1743.     {
  1744.         MMI_fixed_list_menu.pen_redraw_menu_function();
  1745.     }
  1746.     else if (inline_event == GUI_INLINE_PEN_ITEM_SELECTED)
  1747.     {
  1748.         wgui_pen_execute_LSK_handler(KEY_EVENT_UP);
  1749.     }
  1750.     return MMI_TRUE;
  1751. }
  1752. /*****************************************************************************
  1753.  * FUNCTION
  1754.  *  wgui_general_pen_calendar_hdlr
  1755.  * DESCRIPTION
  1756.  *  General calendar event handler.
  1757.  * PARAMETERS
  1758.  *  point           [IN]        Pen point
  1759.  *  pen_event       [IN]        Pen event type
  1760.  * RETURNS
  1761.  *  void
  1762.  *****************************************************************************/
  1763. MMI_BOOL wgui_general_pen_calendar_hdlr(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  1764. {
  1765.     /*----------------------------------------------------------------*/
  1766.     /* Local Variables                                                */
  1767.     /*----------------------------------------------------------------*/
  1768.     gui_calendar_pen_enum calendar_event;
  1769.     BOOL ret;
  1770.     /*----------------------------------------------------------------*/
  1771.     /* Code Body                                                      */
  1772.     /*----------------------------------------------------------------*/
  1773.     ret = wgui_calendar_translate_pen_event(&MMI_calendar_control, pen_event, point.x, point.y, &calendar_event);
  1774.     if (calendar_event == GUI_CALENDAR_PEN_ITEM_SELECTED)
  1775.     {
  1776.         wgui_pen_execute_LSK_handler(KEY_EVENT_UP);
  1777.     }
  1778.     return ret;
  1779. }
  1780. /*****************************************************************************
  1781.  * FUNCTION
  1782.  *  wgui_general_pen_dynamic_list_menu_hdlr
  1783.  * DESCRIPTION
  1784.  *  General dynamic list menu event handler.
  1785.  * PARAMETERS
  1786.  *  point           [IN]        Pen point
  1787.  *  pen_event       [IN]        Pen event type
  1788.  * RETURNS
  1789.  *  void
  1790.  *****************************************************************************/
  1791. MMI_BOOL wgui_general_pen_dynamic_list_menu_hdlr(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  1792. {
  1793.     /*----------------------------------------------------------------*/
  1794.     /* Local Variables                                                */
  1795.     /*----------------------------------------------------------------*/
  1796.     gui_list_pen_enum menu_event;
  1797.     BOOL ret;
  1798.     /*----------------------------------------------------------------*/
  1799.     /* Code Body                                                      */
  1800.     /*----------------------------------------------------------------*/
  1801.     ret = gui_dynamic_list_menu_translate_pen_event(&MMI_fixed_list_menu, pen_event, point.x, point.y, &menu_event);
  1802.     if (!ret)
  1803.     {
  1804.         return MMI_FALSE;
  1805.     }
  1806.     if (menu_event == GUI_LIST_PEN_HIGHLIGHT_CHANGED ||
  1807.         menu_event == GUI_LIST_PEN_NEED_REDRAW || menu_event == GUI_LIST_PEN_ITEM_SELECTED)
  1808.     {
  1809.         MMI_fixed_list_menu.pen_redraw_menu_function();
  1810.     }
  1811.     if (menu_event == GUI_LIST_PEN_ITEM_SELECTED)
  1812.     {
  1813.         if (MMI_fixed_list_menu.pen_event_current_selected_callback_function != NULL)
  1814.         {
  1815.             MMI_fixed_list_menu.pen_event_current_selected_callback_function();
  1816.         }
  1817.         else
  1818.         {
  1819.             wgui_pen_execute_LSK_handler(KEY_EVENT_UP);
  1820.         }
  1821.     }
  1822. #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
  1823.     if (menu_event == GUI_LIST_PEN_TWO_LINE_NEXT)
  1824.     {
  1825.         ExecuteCurrKeyHandler(KEY_RIGHT_ARROW,KEY_EVENT_DOWN);
  1826.     }
  1827.     else if (menu_event == GUI_LIST_PEN_TWO_LINE_PREVIOUS)
  1828.     {
  1829.         ExecuteCurrKeyHandler(KEY_LEFT_ARROW,KEY_EVENT_DOWN);
  1830.     }
  1831. #endif /* __MMI_UI_TWO_LINE_MENUITEM_STYLES__ */
  1832.     return MMI_TRUE;
  1833. }
  1834. /*****************************************************************************
  1835.  * FUNCTION
  1836.  *  wgui_general_pen_asyncdynamic_list_menu_hdlr
  1837.  * DESCRIPTION
  1838.  *  General asyncdynamic list menu event handler.
  1839.  * PARAMETERS
  1840.  *  point           [IN]        Pen point
  1841.  *  pen_event       [IN]        Pen event type
  1842.  * RETURNS
  1843.  *  void
  1844.  *****************************************************************************/
  1845. MMI_BOOL wgui_general_pen_asyncdynamic_list_menu_hdlr(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  1846. {
  1847.     /*----------------------------------------------------------------*/
  1848.     /* Local Variables                                                */
  1849.     /*----------------------------------------------------------------*/
  1850.     gui_list_pen_enum menu_event;
  1851.     BOOL ret;
  1852.     /*----------------------------------------------------------------*/
  1853.     /* Code Body                                                      */
  1854.     /*----------------------------------------------------------------*/
  1855.     ret = gui_asyncdynamic_list_menu_translate_pen_event(
  1856.             &MMI_fixed_list_menu,
  1857.             pen_event,
  1858.             point.x,
  1859.             point.y,
  1860.             &menu_event);
  1861.     if (!ret)
  1862.     {
  1863.         return MMI_FALSE;
  1864.     }
  1865.     if (menu_event == GUI_LIST_PEN_HIGHLIGHT_CHANGED ||
  1866.         menu_event == GUI_LIST_PEN_NEED_REDRAW || menu_event == GUI_LIST_PEN_ITEM_SELECTED)
  1867.     {
  1868.         MMI_fixed_list_menu.pen_redraw_menu_function();
  1869.     }
  1870.     if (menu_event == GUI_LIST_PEN_ITEM_SELECTED)
  1871.     {
  1872.         if (MMI_fixed_list_menu.pen_event_current_selected_callback_function != NULL)
  1873.         {
  1874.             MMI_fixed_list_menu.pen_event_current_selected_callback_function();
  1875.         }
  1876.         else
  1877.         {
  1878.             wgui_pen_execute_LSK_handler(KEY_EVENT_UP);
  1879.         }
  1880.     }
  1881.     return MMI_TRUE;
  1882. }
  1883. /*****************************************************************************
  1884.  * FUNCTION
  1885.  *  wgui_general_pen_matrix_menu_hdlr
  1886.  * DESCRIPTION
  1887.  *  General matrix menu event handler.
  1888.  * PARAMETERS
  1889.  *  point           [IN]        Pen point
  1890.  *  pen_event       [IN]        Pen event type
  1891.  * RETURNS
  1892.  *  void
  1893.  *****************************************************************************/
  1894. MMI_BOOL wgui_general_pen_matrix_menu_hdlr(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  1895. {
  1896.     /*----------------------------------------------------------------*/
  1897.     /* Local Variables                                                */
  1898.     /*----------------------------------------------------------------*/
  1899.     gui_matrix_pen_enum menu_event;
  1900.     BOOL ret;
  1901.     /*----------------------------------------------------------------*/
  1902.     /* Code Body                                                      */
  1903.     /*----------------------------------------------------------------*/
  1904.     ret = gui_fixed_matrix_menu_translate_pen_event(&MMI_fixed_matrix_menu, pen_event, point.x, point.y, &menu_event);
  1905.     if (!ret)
  1906.     {
  1907.         return MMI_FALSE;
  1908.     }
  1909.     if (menu_event == GUI_MATRIX_PEN_HIGHLIGHT_CHANGED ||
  1910.         menu_event == GUI_MATRIX_PEN_NEED_REDRAW || menu_event == GUI_MATRIX_PEN_ITEM_SELECTED)
  1911.     {
  1912.     #ifdef __MMI_INTERACTIVE_PROFILNG__
  1913.         mmi_frm_profiling_delay_start_timer(MMI_FRM_PROFILING_DELAY_MATRIX_HIGHLIGHT);
  1914.     #endif
  1915.     
  1916.         gui_lock_double_buffer();
  1917.         show_fixed_matrix();
  1918.         gui_unlock_double_buffer();
  1919.         gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1920.         
  1921.     #ifdef __MMI_INTERACTIVE_PROFILNG__
  1922.         mmi_frm_profiling_delay_perform(MMI_FRM_PROFILING_DELAY_MATRIX_HIGHLIGHT);
  1923.     #endif
  1924.     }
  1925.     if (menu_event == GUI_MATRIX_PEN_ITEM_SELECTED)
  1926.     {
  1927.         if (MMI_fixed_matrix_menu.pen_event_current_selected_callback_function != NULL)
  1928.         {
  1929.             MMI_fixed_matrix_menu.pen_event_current_selected_callback_function();
  1930.         }
  1931.         else
  1932.         {
  1933.             wgui_pen_execute_LSK_handler(KEY_EVENT_UP);
  1934.         }
  1935.     }
  1936.     return MMI_TRUE;
  1937. }
  1938. /*****************************************************************************
  1939.  * FUNCTION
  1940.  *  wgui_general_pen_slide_control_hdlr
  1941.  * DESCRIPTION
  1942.  *  General slide control event handler.
  1943.  * PARAMETERS
  1944.  *  point           [IN]        Pen point
  1945.  *  pen_event       [IN]        Pen event type
  1946.  * RETURNS
  1947.  *  void
  1948.  *****************************************************************************/
  1949. MMI_BOOL wgui_general_pen_slide_control_hdlr(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  1950. {
  1951.     /*----------------------------------------------------------------*/
  1952.     /* Local Variables                                                */
  1953.     /*----------------------------------------------------------------*/
  1954.     gui_slide_control_pen_event_enum slide_event;
  1955.     gui_pen_event_param_struct param;
  1956.     BOOL ret;
  1957.     /*----------------------------------------------------------------*/
  1958.     /* Code Body                                                      */
  1959.     /*----------------------------------------------------------------*/
  1960.     ret = wgui_slide_control_translate_pen_event(
  1961.             MMI_current_slide_control,
  1962.             pen_event,
  1963.             point.x,
  1964.             point.y,
  1965.             &slide_event,
  1966.             &param);
  1967.     if (!ret)
  1968.     {
  1969.         return MMI_FALSE;
  1970.     }
  1971.     if (slide_event == GUI_SLIDE_CONTROL_PEN_JUMP_TO_I)
  1972.     {
  1973.         wgui_slide_control_set_value(param._u.i);
  1974.     }
  1975.     return MMI_TRUE;
  1976. }
  1977. /*****************************************************************************
  1978.  * FUNCTION
  1979.  *  wgui_general_pen_3D_circular_menu_hdlr
  1980.  * DESCRIPTION
  1981.  *  General 3D circular menu event handler.
  1982.  * PARAMETERS
  1983.  *  point           [IN]        Pen point
  1984.  *  pen_event       [IN]        Pen event type
  1985.  * RETURNS
  1986.  *  void
  1987.  *****************************************************************************/
  1988. MMI_BOOL wgui_general_pen_3D_circular_menu_hdlr(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  1989. {
  1990.     /*----------------------------------------------------------------*/
  1991.     /* Local Variables                                                */
  1992.     /*----------------------------------------------------------------*/
  1993.     gui_3D_circular_menu_pen_enum circular_event;
  1994.     BOOL ret;
  1995.     /*----------------------------------------------------------------*/
  1996.     /* Code Body                                                      */
  1997.     /*----------------------------------------------------------------*/
  1998.     ret = gui_3D_circular_menu_translate_pen_event(&wgui_CM3D_menu, pen_event, point.x, point.y, &circular_event);
  1999.     if (!ret)
  2000.     {
  2001.         return MMI_FALSE;
  2002.     }
  2003.     if (circular_event == GUI_3D_CIRCULAR_MENU_PEN_GOTO_NEXT)
  2004.     {
  2005.         circular_3d_menu_next();
  2006.     }
  2007.     else if (circular_event == GUI_3D_CIRCULAR_MENU_PEN_GOTO_PREVIOUS)
  2008.     {
  2009.         circular_3d_menu_previous();
  2010.     }
  2011.     else if (circular_event == GUI_3D_CIRCULAR_MENU_PEN_ITEM_SELECTED)
  2012.     {
  2013.         wgui_pen_execute_LSK_handler(KEY_EVENT_UP);
  2014.     }
  2015.     return MMI_TRUE;
  2016. }
  2017. /*****************************************************************************
  2018.  * FUNCTION
  2019.  *  wgui_general_pen_horizontal_tab_bar_hdlr
  2020.  * DESCRIPTION
  2021.  *  General horizontal rab bar event handler.
  2022.  * PARAMETERS
  2023.  *  point           [IN]        Pen point
  2024.  *  pen_event       [IN]        Pen event type
  2025.  * RETURNS
  2026.  *  void
  2027.  *****************************************************************************/
  2028. MMI_BOOL wgui_general_pen_horizontal_tab_bar_hdlr(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  2029. {
  2030.     /*----------------------------------------------------------------*/
  2031.     /* Local Variables                                                */
  2032.     /*----------------------------------------------------------------*/
  2033.     /*----------------------------------------------------------------*/
  2034.     /* Code Body                                                      */
  2035.     /*----------------------------------------------------------------*/
  2036.     return wgui_horizontal_tab_bar_translate_pen_event(pen_event, point.x, point.y);
  2037. }
  2038. /*****************************************************************************
  2039.  * FUNCTION
  2040.  *  wgui_register_pen_up_handler
  2041.  * DESCRIPTION
  2042.  *  Register global Pen event handlers.
  2043.  * PARAMETERS
  2044.  *  pen_up_hdlr     [IN]        pen_move_hdlr, pen_abort_hdlr
  2045.  * RETURNS
  2046.  *  void
  2047.  *****************************************************************************/
  2048. void wgui_register_pen_up_handler(mmi_pen_hdlr pen_up_hdlr)
  2049. {
  2050.     /*----------------------------------------------------------------*/
  2051.     /* Local Variables                                                */
  2052.     /*----------------------------------------------------------------*/
  2053.     /*----------------------------------------------------------------*/
  2054.     /* Code Body                                                      */
  2055.     /*----------------------------------------------------------------*/
  2056.     if (pen_up_hdlr != NULL)
  2057.     {
  2058.         mmi_pen_register_up_handler(pen_up_hdlr);
  2059.     }
  2060.     else
  2061.     {
  2062.         MMI_ASSERT(pen_up_hdlr != NULL);
  2063.     }
  2064. }
  2065. /*****************************************************************************
  2066.  * FUNCTION
  2067.  *  wgui_register_pen_down_handler
  2068.  * DESCRIPTION
  2069.  *  Register global Pen event handlers.
  2070.  * PARAMETERS
  2071.  *  pen_down_hdlr       [IN]        pen_up_hdlr, pen_move_hdlr, pen_abort_hdlr
  2072.  * RETURNS
  2073.  *  void
  2074.  *****************************************************************************/
  2075. void wgui_register_pen_down_handler(mmi_pen_hdlr pen_down_hdlr)
  2076. {
  2077.     /*----------------------------------------------------------------*/
  2078.     /* Local Variables                                                */
  2079.     /*----------------------------------------------------------------*/
  2080.     /*----------------------------------------------------------------*/
  2081.     /* Code Body                                                      */
  2082.     /*----------------------------------------------------------------*/
  2083.     if (pen_down_hdlr != NULL)
  2084.     {
  2085.         mmi_pen_register_down_handler(pen_down_hdlr);
  2086.     }
  2087.     else
  2088.     {
  2089.         MMI_ASSERT(pen_down_hdlr != NULL);
  2090.     }
  2091. }
  2092. /*****************************************************************************
  2093.  * FUNCTION
  2094.  *  wgui_register_pen_move_handler
  2095.  * DESCRIPTION
  2096.  *  Register global Pen event handlers.
  2097.  * PARAMETERS
  2098.  *  pen_move_hdlr       [IN]        pen_abort_hdlr
  2099.  * RETURNS
  2100.  *  void
  2101.  *****************************************************************************/
  2102. void wgui_register_pen_move_handler(mmi_pen_hdlr pen_move_hdlr)
  2103. {
  2104.     /*----------------------------------------------------------------*/
  2105.     /* Local Variables                                                */
  2106.     /*----------------------------------------------------------------*/
  2107.     /*----------------------------------------------------------------*/
  2108.     /* Code Body                                                      */
  2109.     /*----------------------------------------------------------------*/
  2110.     if (pen_move_hdlr != NULL)
  2111.     {
  2112.         mmi_pen_register_move_handler(pen_move_hdlr);
  2113.     }
  2114.     else
  2115.     {
  2116.         MMI_ASSERT(pen_move_hdlr != NULL);
  2117.     }
  2118. }
  2119. /*****************************************************************************
  2120.  * FUNCTION
  2121.  *  wgui_register_pen_abort_handler
  2122.  * DESCRIPTION
  2123.  *  Register global Pen event handlers.
  2124.  * PARAMETERS
  2125.  *  pen_abort_hdlr      [IN]        
  2126.  * RETURNS
  2127.  *  void
  2128.  *****************************************************************************/
  2129. void wgui_register_pen_abort_handler(mmi_pen_hdlr pen_abort_hdlr)
  2130. {
  2131.     /*----------------------------------------------------------------*/
  2132.     /* Local Variables                                                */
  2133.     /*----------------------------------------------------------------*/
  2134.     /*----------------------------------------------------------------*/
  2135.     /* Code Body                                                      */
  2136.     /*----------------------------------------------------------------*/
  2137.     if (pen_abort_hdlr != NULL)
  2138.     {
  2139.         mmi_pen_register_abort_handler(pen_abort_hdlr);
  2140.     }
  2141.     else
  2142.     {
  2143.         MMI_ASSERT(pen_abort_hdlr != NULL);
  2144.     }
  2145. }
  2146. /*****************************************************************************
  2147.  * FUNCTION
  2148.  *  wgui_register_pen_repeat_handler
  2149.  * DESCRIPTION
  2150.  *  Register global Pen event handlers.
  2151.  * PARAMETERS
  2152.  *  pen_repeat_hdlr     [IN]        
  2153.  *  pen_down_hdlr, pen_up_hdlr, pen_move_hdlr, pen_abort_hdlr(?)
  2154.  * RETURNS
  2155.  *  void
  2156.  *****************************************************************************/
  2157. void wgui_register_pen_repeat_handler(mmi_pen_hdlr pen_repeat_hdlr)
  2158. {
  2159.     /*----------------------------------------------------------------*/
  2160.     /* Local Variables                                                */
  2161.     /*----------------------------------------------------------------*/
  2162.     /*----------------------------------------------------------------*/
  2163.     /* Code Body                                                      */
  2164.     /*----------------------------------------------------------------*/
  2165.     if (pen_repeat_hdlr != NULL)
  2166.     {
  2167.         mmi_pen_register_repeat_handler(pen_repeat_hdlr);
  2168.     }
  2169.     else
  2170.     {
  2171.         MMI_ASSERT(pen_repeat_hdlr != NULL);
  2172.     }
  2173. }
  2174. /*****************************************************************************
  2175.  * FUNCTION
  2176.  *  wgui_register_pen_long_tap_handler
  2177.  * DESCRIPTION
  2178.  *  Register global Pen event handlers.
  2179.  * PARAMETERS
  2180.  *  pen_long_tap_hdlr       [IN]        
  2181.  *  pen_down_hdlr, pen_up_hdlr, pen_move_hdlr, pen_abort_hdlr(?)
  2182.  * RETURNS
  2183.  *  void
  2184.  *****************************************************************************/
  2185. void wgui_register_pen_long_tap_handler(mmi_pen_hdlr pen_long_tap_hdlr)
  2186. {
  2187.     /*----------------------------------------------------------------*/
  2188.     /* Local Variables                                                */
  2189.     /*----------------------------------------------------------------*/
  2190.     /*----------------------------------------------------------------*/
  2191.     /* Code Body                                                      */
  2192.     /*----------------------------------------------------------------*/
  2193.     if (pen_long_tap_hdlr != NULL)
  2194.     {
  2195.         mmi_pen_register_long_tap_handler(pen_long_tap_hdlr);
  2196.     }
  2197.     else
  2198.     {
  2199.         MMI_ASSERT(pen_long_tap_hdlr != NULL);
  2200.     }
  2201. }
  2202. /*****************************************************************************
  2203.  * FUNCTION
  2204.  *  wgui_register_general_pen_handler
  2205.  * DESCRIPTION
  2206.  *  Register general global Pen event handlers.
  2207.  * PARAMETERS
  2208.  *  void
  2209.  * RETURNS
  2210.  *  void
  2211.  *****************************************************************************/
  2212. void wgui_register_general_pen_handler(void)
  2213. {
  2214.     /*----------------------------------------------------------------*/
  2215.     /* Local Variables                                                */
  2216.     /*----------------------------------------------------------------*/
  2217.     /*----------------------------------------------------------------*/
  2218.     /* Code Body                                                      */
  2219.     /*----------------------------------------------------------------*/
  2220.     mmi_pen_register_up_handler(wgui_general_pen_up_hdlr);
  2221.     mmi_pen_register_down_handler(wgui_general_pen_down_hdlr);
  2222.     mmi_pen_register_move_handler(wgui_general_pen_move_hdlr);
  2223.     mmi_pen_register_abort_handler(wgui_general_pen_abort_hdlr);
  2224.     mmi_pen_register_repeat_handler(wgui_general_pen_repeat_hdlr);
  2225.     mmi_pen_register_long_tap_handler(wgui_general_pen_long_tap_hdlr);
  2226. }
  2227. /*****************************************************************************
  2228.  * FUNCTION
  2229.  *  wgui_empty_pen_handler
  2230.  * DESCRIPTION
  2231.  *  empty Pen event handlers.
  2232.  * PARAMETERS
  2233.  *  point       [IN]        
  2234.  * RETURNS
  2235.  *  void
  2236.  *****************************************************************************/
  2237. void wgui_empty_pen_handler(mmi_pen_point_struct point)
  2238. {
  2239.     /*----------------------------------------------------------------*/
  2240.     /* Local Variables                                                */
  2241.     /*----------------------------------------------------------------*/
  2242.     /*----------------------------------------------------------------*/
  2243.     /* Code Body                                                      */
  2244.     /*----------------------------------------------------------------*/
  2245.     UI_UNUSED_PARAMETER(point);
  2246.     return;
  2247. }
  2248. /*****************************************************************************
  2249.  * FUNCTION
  2250.  *  wgui_clear_pen_handlers
  2251.  * DESCRIPTION
  2252.  *  Clear general global Pen event handlers.
  2253.  * PARAMETERS
  2254.  *  void
  2255.  * RETURNS
  2256.  *  void
  2257.  *****************************************************************************/
  2258. void wgui_clear_pen_handlers(void)
  2259. {
  2260.     /*----------------------------------------------------------------*/
  2261.     /* Local Variables                                                */
  2262.     /*----------------------------------------------------------------*/
  2263.     /*----------------------------------------------------------------*/
  2264.     /* Code Body                                                      */
  2265.     /*----------------------------------------------------------------*/
  2266.     mmi_pen_register_up_handler(wgui_empty_pen_handler);
  2267.     mmi_pen_register_down_handler(wgui_empty_pen_handler);
  2268.     mmi_pen_register_move_handler(wgui_empty_pen_handler);
  2269.     mmi_pen_register_abort_handler(wgui_empty_pen_handler);
  2270.     mmi_pen_register_repeat_handler(wgui_empty_pen_handler);
  2271.     mmi_pen_register_long_tap_handler(wgui_empty_pen_handler);
  2272. }
  2273. /*****************************************************************************
  2274.  * FUNCTION
  2275.  *  wgui_null_pen_hdlr
  2276.  * DESCRIPTION
  2277.  *  dummy pen event handler.
  2278.  * PARAMETERS
  2279.  *  point       [IN]        
  2280.  * RETURNS
  2281.  *  void
  2282.  *****************************************************************************/
  2283. MMI_BOOL wgui_null_pen_hdlr(mmi_pen_point_struct point)
  2284. {
  2285.     /*----------------------------------------------------------------*/
  2286.     /* Local Variables                                                */
  2287.     /*----------------------------------------------------------------*/
  2288.     /*----------------------------------------------------------------*/
  2289.     /* Code Body                                                      */
  2290.     /*----------------------------------------------------------------*/
  2291.     UI_UNUSED_PARAMETER(point);
  2292.     return FALSE;
  2293. }
  2294. /*****************************************************************************
  2295.  * FUNCTION
  2296.  *  wgui_reset_category_screen_control_pen_handler
  2297.  * DESCRIPTION
  2298.  *  Reset pen handler functions for category screen contrl area.
  2299.  * PARAMETERS
  2300.  *  void
  2301.  * RETURNS
  2302.  *  void
  2303.  *****************************************************************************/
  2304. void wgui_reset_category_screen_control_pen_handler(void)
  2305. {
  2306.     /*----------------------------------------------------------------*/
  2307.     /* Local Variables                                                */
  2308.     /*----------------------------------------------------------------*/
  2309.     U8 idx = 0;
  2310.     /*----------------------------------------------------------------*/
  2311.     /* Code Body                                                      */
  2312.     /*----------------------------------------------------------------*/
  2313.     for (idx = 0; idx < MMI_PEN_EVENT_TYPE_MAX; idx++)
  2314.     {
  2315.         wgui_category_control_area_pen_handlers[idx] = wgui_null_pen_hdlr;
  2316.         wgui_category_control_area2_pen_handlers[idx] = wgui_null_pen_hdlr;
  2317.     }
  2318. }
  2319. /*****************************************************************************
  2320.  * FUNCTION
  2321.  *  wgui_register_category_screen_control_area_pen_handlers
  2322.  * DESCRIPTION
  2323.  *  Register pen handler functions for category screen contrl area.
  2324.  * PARAMETERS
  2325.  *  pen_fp          [IN]        Pen handler function
  2326.  *  event_type      [IN]        Pen event type
  2327.  * RETURNS
  2328.  *  void
  2329.  *****************************************************************************/
  2330. void wgui_register_category_screen_control_area_pen_handlers(mmi_pen_handler pen_fp, mmi_pen_event_type_enum event_type)
  2331. {
  2332.     /*----------------------------------------------------------------*/
  2333.     /* Local Variables                                                */
  2334.     /*----------------------------------------------------------------*/
  2335.     /*----------------------------------------------------------------*/
  2336.     /* Code Body                                                      */
  2337.     /*----------------------------------------------------------------*/
  2338.     /* event_type should be one of the events for touch panel */
  2339.     MMI_ASSERT(event_type > -1 && event_type < MMI_PEN_EVENT_TYPE_MAX);
  2340.     wgui_category_control_area_pen_handlers[event_type] = pen_fp;
  2341. }
  2342. /*****************************************************************************
  2343.  * FUNCTION
  2344.  *  wgui_register_category_screen_control_area2_pen_handlers
  2345.  * DESCRIPTION
  2346.  *  Register pen handler functions for category screen contrl area2.
  2347.  * PARAMETERS
  2348.  *  pen_fp          [IN]        Pen handler function
  2349.  *  event_type      [IN]        Pen event type
  2350.  * RETURNS
  2351.  *  void
  2352.  *****************************************************************************/
  2353. void wgui_register_category_screen_control_area2_pen_handlers(
  2354.         mmi_pen_handler pen_fp,
  2355.         mmi_pen_event_type_enum event_type)
  2356. {
  2357.     /*----------------------------------------------------------------*/
  2358.     /* Local Variables                                                */
  2359.     /*----------------------------------------------------------------*/
  2360.     /*----------------------------------------------------------------*/
  2361.     /* Code Body                                                      */
  2362.     /*----------------------------------------------------------------*/
  2363.     /* event_type should be one of the events for touch panel */
  2364.     MMI_ASSERT(event_type > -1 && event_type < MMI_PEN_EVENT_TYPE_MAX);
  2365.     wgui_category_control_area2_pen_handlers[event_type] = pen_fp;
  2366. }
  2367. /*****************************************************************************
  2368.  * FUNCTION
  2369.  *  wgui_reset_image_control_pen_handler
  2370.  * DESCRIPTION
  2371.  *  reset pen event handler function for image controls
  2372.  * PARAMETERS
  2373.  *  void
  2374.  * RETURNS
  2375.  *  void
  2376.  *****************************************************************************/
  2377. void wgui_reset_image_control_pen_handler(void)
  2378. {
  2379.     /*----------------------------------------------------------------*/
  2380.     /* Local Variables                                                */
  2381.     /*----------------------------------------------------------------*/
  2382.     S32 img_idx = 0, event_type = 0;
  2383.     /*----------------------------------------------------------------*/
  2384.     /* Code Body                                                      */
  2385.     /*----------------------------------------------------------------*/
  2386.     for (img_idx = 0; img_idx < DM_MAX_IMAGES; img_idx++)
  2387.         for (event_type = 0; event_type < MMI_PEN_EVENT_TYPE_MAX; event_type++)
  2388.         {
  2389.             wgui_image_pen_handlers[img_idx][event_type] = wgui_null_pen_hdlr;
  2390.         }
  2391. }
  2392. /*****************************************************************************
  2393.  * FUNCTION
  2394.  *  wgui_register_image_control_pen_handlers
  2395.  * DESCRIPTION
  2396.  *  register pen event handler function for image controls
  2397.  * PARAMETERS
  2398.  *  index           [IN]        Image index
  2399.  *  pen_fp          [IN]        Pen handler function
  2400.  *  event_type      [IN]        Pen event type
  2401.  * RETURNS
  2402.  *  void
  2403.  *****************************************************************************/
  2404. void wgui_register_image_control_pen_handlers(S32 index, mmi_pen_handler pen_fp, mmi_pen_event_type_enum event_type)
  2405. {
  2406.     /*----------------------------------------------------------------*/
  2407.     /* Local Variables                                                */
  2408.     /*----------------------------------------------------------------*/
  2409.     /*----------------------------------------------------------------*/
  2410.     /* Code Body                                                      */
  2411.     /*----------------------------------------------------------------*/
  2412.     /* index should not bigger than max number of images supported by draw manager */
  2413.     MMI_ASSERT(index < DM_MAX_IMAGES);
  2414.     /* event_type should be one of the events for touch panel */
  2415.     MMI_ASSERT(event_type > -1 && event_type < MMI_PEN_EVENT_TYPE_MAX);
  2416.     wgui_image_pen_handlers[index][event_type] = pen_fp;
  2417. }
  2418. /*****************************************************************************
  2419.  * FUNCTION
  2420.  *  wgui_test_object_position
  2421.  * DESCRIPTION
  2422.  *  test if the pen inside one object.
  2423.  * PARAMETERS
  2424.  *  pos     [IN]        Pen position
  2425.  *  obj     [IN]        Position info. of one object.
  2426.  * RETURNS
  2427.  *  void
  2428.  *****************************************************************************/
  2429. MMI_BOOL wgui_test_object_position(mmi_pen_point_struct pos, wgui_component_info_struct obj)
  2430. {
  2431.     /*----------------------------------------------------------------*/
  2432.     /* Local Variables                                                */
  2433.     /*----------------------------------------------------------------*/
  2434.     S32 pos_x = pos.x, pos_y = pos.y;
  2435.     S32 obj_x1 = 0, obj_y1 = 0, obj_x2 = 0, obj_y2 = 0;
  2436.     /*----------------------------------------------------------------*/
  2437.     /* Code Body                                                      */
  2438.     /*----------------------------------------------------------------*/
  2439.     obj_x1 = obj.pos_x;
  2440.     obj_x2 = obj.pos_x + obj.width - 1;//052206 NITZ category Calvin
  2441.     obj_y1 = obj.pos_y;
  2442.     obj_y2 = obj.pos_y + obj.height - 1;
  2443.     if (pos_x >= obj_x1 && pos_x <= obj_x2 && pos_y >= obj_y1 && pos_y <= obj_y2)       /* within object */
  2444.     {
  2445.         return MMI_TRUE;
  2446.     }
  2447.     else
  2448.     {
  2449.         return MMI_FALSE;
  2450.     }
  2451. }
  2452. /*****************************************************************************
  2453.  * FUNCTION
  2454.  *  wgui_test_image_object_position
  2455.  * DESCRIPTION
  2456.  *  test if the pen inside one image object.
  2457.  * PARAMETERS
  2458.  *  pos         [IN]        Pen position
  2459.  *  pos_x       [IN]        X-coordnate of the iamge
  2460.  *  pos_y       [IN]        Y-coordnate of the iamge
  2461.  *  img_ptr     [IN]        Iamge
  2462.  * RETURNS
  2463.  *  void
  2464.  *****************************************************************************/
  2465. MMI_BOOL wgui_test_image_object_position(mmi_pen_point_struct pos, S32 pos_x, S32 pos_y, PU8 img_ptr)
  2466. {
  2467.     /*----------------------------------------------------------------*/
  2468.     /* Local Variables                                                */
  2469.     /*----------------------------------------------------------------*/
  2470.     S32 img_width = 0, img_height = 0;
  2471.     wgui_component_info_struct obj;
  2472.     /*----------------------------------------------------------------*/
  2473.     /* Code Body                                                      */
  2474.     /*----------------------------------------------------------------*/
  2475.     gdi_image_get_dimension(img_ptr, &img_width, &img_height);
  2476.     obj.pos_x = pos_x;
  2477.     obj.pos_y = pos_y;
  2478.     obj.width = img_width;
  2479.     obj.height = img_height;
  2480.     return wgui_test_object_position(pos, obj);
  2481. }
  2482. /*****************************************************************************
  2483.  * FUNCTION
  2484.  *  wgui_test_lsk_position
  2485.  * DESCRIPTION
  2486.  *  test if the pen inside LSK.
  2487.  * PARAMETERS
  2488.  *  pos     [IN]        Pen position
  2489.  * RETURNS
  2490.  *  void
  2491.  *****************************************************************************/
  2492. MMI_BOOL wgui_test_lsk_position(mmi_pen_point_struct pos)
  2493. {
  2494.     /*----------------------------------------------------------------*/
  2495.     /* Local Variables                                                */
  2496.     /*----------------------------------------------------------------*/
  2497.     S32 pos_x = pos.x, pos_y = pos.y;
  2498.     S32 obj_x1 = 0, obj_y1 = 0, obj_x2 = 0, obj_y2 = 0;
  2499.     /*----------------------------------------------------------------*/
  2500.     /* Code Body                                                      */
  2501.     /*----------------------------------------------------------------*/
  2502.     obj_x1 = MMI_softkeys[MMI_LEFT_SOFTKEY].x + MMI_softkeys[MMI_LEFT_SOFTKEY].text_x;
  2503.     obj_x2 = obj_x1 + MMI_softkeys[MMI_LEFT_SOFTKEY].text_width;
  2504.     obj_y1 = MMI_softkeys[MMI_LEFT_SOFTKEY].y + MMI_softkeys[MMI_LEFT_SOFTKEY].text_y;
  2505.     obj_y2 = obj_y1 + MMI_softkeys[MMI_LEFT_SOFTKEY].text_height;
  2506.     if (pos_x >= obj_x1 && pos_x <= obj_x2 && pos_y >= obj_y1 && pos_y <= obj_y2)       /* within object */
  2507.     {
  2508.         return MMI_TRUE;
  2509.     }
  2510.     else
  2511.     {
  2512.         return MMI_FALSE;
  2513.     }
  2514. }
  2515. /*****************************************************************************
  2516.  * FUNCTION
  2517.  *  wgui_test_rsk_position
  2518.  * DESCRIPTION
  2519.  *  test if the pen inside RSK.
  2520.  * PARAMETERS
  2521.  *  pos     [IN]        Pen position
  2522.  * RETURNS
  2523.  *  void
  2524.  *****************************************************************************/
  2525. MMI_BOOL wgui_test_rsk_position(mmi_pen_point_struct pos)
  2526. {
  2527.     /*----------------------------------------------------------------*/
  2528.     /* Local Variables                                                */
  2529.     /*----------------------------------------------------------------*/
  2530.     S32 pos_x = pos.x, pos_y = pos.y;
  2531.     S32 obj_x1 = 0, obj_y1 = 0, obj_x2 = 0, obj_y2 = 0;
  2532.     /*----------------------------------------------------------------*/
  2533.     /* Code Body                                                      */
  2534.     /*----------------------------------------------------------------*/
  2535.     obj_x1 = MMI_softkeys[MMI_RIGHT_SOFTKEY].x + MMI_softkeys[MMI_RIGHT_SOFTKEY].text_x;
  2536.     obj_x2 = obj_x1 + MMI_softkeys[MMI_RIGHT_SOFTKEY].text_width;
  2537.     obj_y1 = MMI_softkeys[MMI_RIGHT_SOFTKEY].y + MMI_softkeys[MMI_RIGHT_SOFTKEY].text_y;
  2538.     obj_y2 = obj_y1 + MMI_softkeys[MMI_RIGHT_SOFTKEY].text_height;
  2539.     if (pos_x >= obj_x1 && pos_x <= obj_x2 && pos_y >= obj_y1 && pos_y <= obj_y2)       /* within object */
  2540.     {
  2541.         return MMI_TRUE;
  2542.     }
  2543.     else
  2544.     {
  2545.         return MMI_FALSE;
  2546.     }
  2547. }
  2548. /*****************************************************************************
  2549.  * FUNCTION
  2550.  *  wgui_register_list_item_selected_callback
  2551.  * DESCRIPTION
  2552.  *  register the callback function when a menuitem is selected.(for one specific menuitem)
  2553.  * PARAMETERS
  2554.  *  pen_event_selected_callback_function        [IN]        Callback function
  2555.  * RETURNS
  2556.  *  void
  2557.  *****************************************************************************/
  2558. void wgui_register_list_item_selected_callback(void (*pen_event_selected_callback_function) (void))
  2559. {
  2560.     /*----------------------------------------------------------------*/
  2561.     /* Local Variables                                                */
  2562.     /*----------------------------------------------------------------*/
  2563.     /*----------------------------------------------------------------*/
  2564.     /* Code Body                                                      */
  2565.     /*----------------------------------------------------------------*/
  2566.     MMI_fixed_list_menu.pen_event_current_selected_callback_function = pen_event_selected_callback_function;
  2567.     MMI_fixed_list_menu.pen_event_default_selected_callback_function = NULL;
  2568. }
  2569. /*****************************************************************************
  2570.  * FUNCTION
  2571.  *  wgui_register_list_item_selected_callback_all
  2572.  * DESCRIPTION
  2573.  *  register the callback function when a menuitem is selected.(apply to all menuitem)
  2574.  * PARAMETERS
  2575.  *  pen_event_selected_callback_function        [IN]        Callback function
  2576.  * RETURNS
  2577.  *  void
  2578.  *****************************************************************************/
  2579. void wgui_register_list_item_selected_callback_all(void (*pen_event_selected_callback_function) (void))
  2580. {
  2581.     /*----------------------------------------------------------------*/
  2582.     /* Local Variables                                                */
  2583.     /*----------------------------------------------------------------*/
  2584.     /*----------------------------------------------------------------*/
  2585.     /* Code Body                                                      */
  2586.     /*----------------------------------------------------------------*/
  2587.     MMI_fixed_list_menu.pen_event_current_selected_callback_function = pen_event_selected_callback_function;
  2588.     MMI_fixed_list_menu.pen_event_default_selected_callback_function = pen_event_selected_callback_function;
  2589. }
  2590. /*****************************************************************************
  2591.  * FUNCTION
  2592.  *  wgui_reset_list_item_selected_callback
  2593.  * DESCRIPTION
  2594.  *  reset the callback function when a menuitem is selected.
  2595.  * PARAMETERS
  2596.  *  void
  2597.  * RETURNS
  2598.  *  void
  2599.  *****************************************************************************/
  2600. void wgui_reset_list_item_selected_callback(void)
  2601. {
  2602.     /*----------------------------------------------------------------*/
  2603.     /* Local Variables                                                */
  2604.     /*----------------------------------------------------------------*/
  2605.     /*----------------------------------------------------------------*/
  2606.     /* Code Body                                                      */
  2607.     /*----------------------------------------------------------------*/
  2608.     MMI_fixed_list_menu.pen_event_current_selected_callback_function = NULL;
  2609.     MMI_fixed_list_menu.pen_event_default_selected_callback_function = NULL;
  2610. }
  2611. /*****************************************************************************
  2612.  * FUNCTION
  2613.  *  wgui_reset_matrix_item_selected_callback
  2614.  * DESCRIPTION
  2615.  *  reset the callback function when a menuitem is selected.
  2616.  * PARAMETERS
  2617.  *  void
  2618.  * RETURNS
  2619.  *  void
  2620.  *****************************************************************************/
  2621. void wgui_reset_matrix_item_selected_callback(void)
  2622. {
  2623.     /*----------------------------------------------------------------*/
  2624.     /* Local Variables                                                */
  2625.     /*----------------------------------------------------------------*/
  2626.     /*----------------------------------------------------------------*/
  2627.     /* Code Body                                                      */
  2628.     /*----------------------------------------------------------------*/
  2629.     MMI_fixed_matrix_menu.pen_event_current_selected_callback_function = NULL;
  2630.     MMI_fixed_matrix_menu.pen_event_default_selected_callback_function = NULL;
  2631. }
  2632. /*****************************************************************************
  2633.  * FUNCTION
  2634.  *  wgui_register_matrix_item_selected_callback
  2635.  * DESCRIPTION
  2636.  *  register the callback function when a menuitem is selected.(for one specific menuitem)
  2637.  * PARAMETERS
  2638.  *  pen_event_selected_callback_function        [IN]        Callback function
  2639.  * RETURNS
  2640.  *  void
  2641.  *****************************************************************************/
  2642. void wgui_register_matrix_item_selected_callback(void (*pen_event_selected_callback_function) (void))
  2643. {
  2644.     /*----------------------------------------------------------------*/
  2645.     /* Local Variables                                                */
  2646.     /*----------------------------------------------------------------*/
  2647.     /*----------------------------------------------------------------*/
  2648.     /* Code Body                                                      */
  2649.     /*----------------------------------------------------------------*/
  2650.     MMI_fixed_matrix_menu.pen_event_current_selected_callback_function = pen_event_selected_callback_function;
  2651.     MMI_fixed_matrix_menu.pen_event_default_selected_callback_function = NULL;
  2652. }
  2653. /*****************************************************************************
  2654.  * FUNCTION
  2655.  *  wgui_register_matrix_item_selected_callback_all
  2656.  * DESCRIPTION
  2657.  *  register the callback function when a menuitem is selected.(apply to all menuitem)
  2658.  * PARAMETERS
  2659.  *  pen_event_selected_callback_function        [IN]        Callback function
  2660.  * RETURNS
  2661.  *  void
  2662.  *****************************************************************************/
  2663. void wgui_register_matrix_item_selected_callback_all(void (*pen_event_selected_callback_function) (void))
  2664. {
  2665.     /*----------------------------------------------------------------*/
  2666.     /* Local Variables                                                */
  2667.     /*----------------------------------------------------------------*/
  2668.     /*----------------------------------------------------------------*/
  2669.     /* Code Body                                                      */
  2670.     /*----------------------------------------------------------------*/
  2671.     MMI_fixed_matrix_menu.pen_event_current_selected_callback_function = pen_event_selected_callback_function;
  2672.     MMI_fixed_matrix_menu.pen_event_default_selected_callback_function = pen_event_selected_callback_function;
  2673. }
  2674. #ifdef __J2ME__
  2675. /*****************************************************************************
  2676.  * FUNCTION
  2677.  *  j2me_get_category_index_by_position
  2678.  * DESCRIPTION
  2679.  *  
  2680.  * PARAMETERS
  2681.  *  pen_event       [IN]        
  2682.  *  point           [IN]        
  2683.  *  is_selected     [?]         
  2684.  * RETURNS
  2685.  *  
  2686.  *****************************************************************************/
  2687. int j2me_get_category_index_by_position(int pen_event, mmi_pen_point_struct point, kal_bool *is_selected)
  2688. {
  2689.     /*----------------------------------------------------------------*/
  2690.     /* Local Variables                                                */
  2691.     /*----------------------------------------------------------------*/
  2692.     gui_list_pen_enum menu_event;
  2693.     BOOL ret;
  2694.     /*----------------------------------------------------------------*/
  2695.     /* Code Body                                                      */
  2696.     /*----------------------------------------------------------------*/
  2697.     ret = gui_fixed_list_menu_translate_pen_event(&MMI_fixed_list_menu, pen_event, point.x, point.y, &menu_event);
  2698.     if (!ret)   /* Not in list menu */
  2699.     {
  2700.         return MMI_FALSE;
  2701.     }
  2702.     if (menu_event == GUI_LIST_PEN_HIGHLIGHT_CHANGED ||
  2703.         menu_event == GUI_LIST_PEN_NEED_REDRAW || menu_event == GUI_LIST_PEN_ITEM_SELECTED)
  2704.     {
  2705.         gui_lock_double_buffer();
  2706.         redraw_fixed_list();
  2707.         gui_unlock_double_buffer();
  2708.         /* gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height -1); */
  2709.         jui_widget_refresh_lcd(0, 0, UI_device_width - 1, UI_device_height - 1);
  2710.     }
  2711.     if (menu_event == GUI_LIST_PEN_ITEM_SELECTED)
  2712.     {
  2713.         *is_selected = KAL_TRUE;
  2714.     }
  2715.     else
  2716.     {
  2717.         *is_selected = KAL_FALSE;
  2718.     }
  2719.     return MMI_fixed_list_menu.highlighted_item;
  2720. }
  2721. #endif /* __J2ME__ */ 
  2722. #endif /* defined(__MMI_TOUCH_SCREEN__) */