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

MTK

开发平台:

C/C++

  1. /*******************************************************************************
  2. *  Modification Notice:
  3. *  --------------------------
  4. *  This software is modified by MediaTek Inc. and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *******************************************************************************/
  35.  /*******************************************************************************
  36.  * Filename:
  37.  * ---------
  38.  *   wgui_menu_shortcuts.c
  39.  *
  40.  * Project:
  41.  * --------
  42.  *   Maui_Software
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *  shortcuts related funtions
  47.  *
  48.  * Author:
  49.  * -------
  50.  * -------
  51.  *
  52.  *------------------------------------------------------------------------------
  53.  * $Log$
  54.  *
  55.  * removed!
  56.  * removed!
  57.  * 
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * 
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * 
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * 
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * 
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * 
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * 
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * using 5 pixels as gap
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * 
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * 
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * 
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * 
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * Fill with white color before draw title image because the image may be transparent.
  106.  *
  107.  ****************************************************************************/
  108.  /**
  109.  * Copyright Notice
  110.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  111.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  112.  *  (It is illegal to remove this copyright notice from this software or any
  113.  *  portion of it)
  114.  */
  115. /**********************************************************************************
  116.    Filename:      wgui_menu_shortcuts.c
  117.    Author:        manju
  118.    Date Created:  August-07-2002
  119.    Contains:      PixTel UI wrapper routines for Menu shortcuts
  120. **********************************************************************************/
  121. #include "gui_themes.h"
  122. #include "wgui_menu_shortcuts.h"
  123. #include "wgui_categories_util.h"
  124. #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  125. #include "MainMenuDef.h"
  126. #endif 
  127. extern BOOL r2lMMIFlag;
  128. /* Menu shortcut wrappers              */
  129. /* 
  130.  * Global Variable
  131.  */
  132. UI_shortcut_box_theme *current_shortcut_box_theme = NULL;
  133. U8 menu_shortcut_handler_display = 0;
  134. U8 disable_menu_shortcut_box_display = 0;
  135. single_line_input_box MMI_menu_shortcut_box;
  136. extern U16 title_bg_id;
  137. /*****************************************************************************
  138.  * FUNCTION
  139.  *  dummy_menu_goto_item
  140.  * DESCRIPTION
  141.  *  Dummy function used in MMI
  142.  * PARAMETERS
  143.  *  index       [IN]        
  144.  * RETURNS
  145.  *  void
  146.  *****************************************************************************/
  147. void dummy_menu_goto_item(S32 index)
  148. {
  149.     /*----------------------------------------------------------------*/
  150.     /* Local Variables                                                */
  151.     /*----------------------------------------------------------------*/
  152.     /*----------------------------------------------------------------*/
  153.     /* Code Body                                                      */
  154.     /*----------------------------------------------------------------*/
  155.     UI_UNUSED_PARAMETER(index);
  156. }
  157. /*****************************************************************************
  158.  * FUNCTION
  159.  *  dummy_hide_menu_shortcut
  160.  * DESCRIPTION
  161.  *  Dummy function used in MMI
  162.  * PARAMETERS
  163.  *  void
  164.  * RETURNS
  165.  *  void
  166.  *****************************************************************************/
  167. void dummy_hide_menu_shortcut(void)
  168. {
  169.     /*----------------------------------------------------------------*/
  170.     /* Local Variables                                                */
  171.     /*----------------------------------------------------------------*/
  172.     /*----------------------------------------------------------------*/
  173.     /* Code Body                                                      */
  174.     /*----------------------------------------------------------------*/
  175. }
  176. /* 
  177.  * Local Variable
  178.  */
  179. static UI_character_type MMI_list_shortcut_buffer[MMI_MENU_SHORTCUT_BUFFER_LENGTH];
  180. static S32 MMI_menu_shortcut_timeout = MMI_MENU_SHORTCUT_TIMEOUT;
  181. static U8 menu_shortcut_length = 3;
  182. /* Before BLT in menu_shortcut_handler_timeout() */
  183. static void (*menu_shortcut_goto_item) (S32 index) = dummy_menu_goto_item;
  184. /* After BLT in menu_shortcut_handler_timeout() */
  185. static void (*menu_shortcut_item_selected) (S32 index) = dummy_menu_goto_item;
  186. /* Callback to hide shortcut box */
  187. static void (*hide_menu_shortcut) (void) = dummy_hide_menu_shortcut;
  188. static S32 menu_shortcut_item_highlighted = 0;
  189. /* 
  190.  * Define
  191.  */
  192. #ifdef __MMI_MAINLCD_240X320__
  193. #define MMI_SHORTCUT_TEXT_BORDER_X_GAP 5
  194. #else 
  195. #define MMI_SHORTCUT_TEXT_BORDER_X_GAP 2
  196. #endif 
  197. /*****************************************************************************
  198.  * FUNCTION
  199.  *  menu_shortcut_handler_timeout
  200.  * DESCRIPTION
  201.  *  This function is called when the menu shortcut handler times out
  202.  *  
  203.  *  Internal function
  204.  * PARAMETERS
  205.  *  void
  206.  * RETURNS
  207.  *  void
  208.  *****************************************************************************/
  209. void menu_shortcut_handler_timeout(void)
  210. {
  211.     /*----------------------------------------------------------------*/
  212.     /* Local Variables                                                */
  213.     /*----------------------------------------------------------------*/
  214.     /*----------------------------------------------------------------*/
  215.     /* Code Body                                                      */
  216.     /*----------------------------------------------------------------*/
  217.     menu_shortcut_handler_display = 0;
  218.     gui_single_line_input_box_clear(&MMI_menu_shortcut_box);
  219.     gdi_layer_lock_frame_buffer();
  220.     hide_menu_shortcut();
  221.     gdi_layer_blt_previous(
  222.         MMI_title_x,
  223.         MMI_title_y,
  224.         MMI_title_x + MMI_title_width - 1,
  225.         MMI_title_y + MMI_title_height - 1);
  226.     menu_shortcut_goto_item(menu_shortcut_item_highlighted);
  227. #ifdef __MMI_UI_ANIMATED_TITLE_EFFECT__
  228.     if (is_enable_animated_title_effect())
  229.     {
  230.         wgui_start_animate_title();
  231.     }
  232. #endif /* __MMI_UI_ANIMATED_TITLE_EFFECT__ */ 
  233.     gdi_layer_unlock_frame_buffer();
  234.     /* BLT together with the previous BLT region */
  235.     gdi_layer_blt_previous(
  236.         MMI_content_x,
  237.         MMI_content_y,
  238.         MMI_content_x + MMI_content_width - 1,
  239.         MMI_content_y + MMI_content_height - 1);
  240.     menu_shortcut_item_selected(menu_shortcut_item_highlighted);
  241. }
  242. /*****************************************************************************
  243.  * FUNCTION
  244.  *  menu_shortcut_handler_keyinput
  245.  * DESCRIPTION
  246.  *  This function is called when a menu shortcut key is pressed
  247.  *  
  248.  *  Internal function
  249.  * PARAMETERS
  250.  *  c       [IN]        The character that is input
  251.  * RETURNS
  252.  *  void
  253.  *****************************************************************************/
  254. void menu_shortcut_handler_keyinput(UI_character_type c)
  255. {
  256.     /*----------------------------------------------------------------*/
  257.     /* Local Variables                                                */
  258.     /*----------------------------------------------------------------*/
  259.     S32 x, y;
  260.     /*----------------------------------------------------------------*/
  261.     /* Code Body                                                      */
  262.     /*----------------------------------------------------------------*/
  263. #ifdef __MMI_UI_ANIMATED_TITLE_EFFECT__
  264.     if (is_enable_animated_title_effect())
  265.     {
  266.         wgui_stop_animate_title();
  267.     }
  268. #endif /* __MMI_UI_ANIMATED_TITLE_EFFECT__ */ 
  269.     if (MMI_menu_shortcut_number <= 0)
  270.     {
  271.         return;
  272.     }
  273.     if (gui_single_line_input_box_test_overflow(&MMI_menu_shortcut_box))
  274.     {
  275.         menu_shortcut_handler_timeout();
  276.     }
  277.     else if (menu_shortcut_handler_display == 0 && c == '0' &&
  278.              gui_single_line_input_box_test_first_position(&MMI_menu_shortcut_box))
  279.     {
  280.         return;
  281.     }
  282.     else
  283.     {
  284.         S32 i;
  285.         if (menu_shortcut_handler_display == 0)
  286.         {
  287.             menu_shortcut_handler_display = 1;
  288.             gui_single_line_input_box_clear(&MMI_menu_shortcut_box);
  289.         }
  290.         gdi_layer_lock_frame_buffer();
  291.         gui_single_line_input_box_insert_character(&MMI_menu_shortcut_box, c);
  292.         i = gui_atoi((UI_string_type) MMI_menu_shortcut_box.text);
  293.         menu_shortcut_item_highlighted = i - 1;
  294.         gui_start_timer(MMI_menu_shortcut_timeout, menu_shortcut_handler_timeout);
  295.         if (!disable_menu_shortcut_box_display && MMI_title_icon2 == NULL)
  296.         {
  297.             gui_hide_menu_shortcut();
  298.             MMI_menu_shortcut_box.normal_text_color = current_shortcut_box_theme->active_text_color;
  299.             MMI_menu_shortcut_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_BACKGROUND;
  300.         #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  301.             gui_set_clip(
  302.                 MMI_menu_shortcut_box.x,
  303.                 MMI_menu_shortcut_box.y,
  304.                 MMI_menu_shortcut_box.x + MMI_menu_shortcut_box.width - 1,
  305.                 MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1);
  306.             if (GetActiveScreenId() == MAIN_MENU_SCREENID)
  307.             {
  308.                 gui_fill_rectangle(
  309.                     MMI_menu_shortcut_box.x,
  310.                     MMI_menu_shortcut_box.y,
  311.                     MMI_menu_shortcut_box.x + MMI_menu_shortcut_box.width - 1,
  312.                     MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1,
  313.                     (current_UI_theme->window_title_theme->active_filler->c));
  314.                 MMI_menu_shortcut_box.flags |= UI_SINGLE_LINE_INPUT_BOX_DISABLE_BACKGROUND;
  315.             }
  316.         #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
  317.         #ifdef __MMI_UI_DALMATIAN_STATUSBAR__
  318.             /* As area is refill on dalmatian so need to draw shortcut */
  319.             gui_set_clip(
  320.                 MMI_menu_shortcut_box.x,
  321.                 MMI_menu_shortcut_box.y,
  322.                 MMI_menu_shortcut_box.x + MMI_menu_shortcut_box.width - 1,
  323.                 MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1);
  324.             gui_draw_filled_area(
  325.                 MMI_title_x,
  326.                 MMI_title_y,
  327.                 MMI_title_x + MMI_title_width - 1,
  328.                 MMI_title_y + MMI_title_height - 1,
  329.                 current_UI_theme->window_title_theme->active_filler);
  330.         #ifdef __MMI_UI_ANIMATED_TITLE_EFFECT__
  331.             if (is_enable_animated_title_effect())
  332.             {
  333.                 wgui_draw_animate_title_image_frame_0(
  334.                     MMI_title_x,
  335.                     MMI_title_y,
  336.                     MMI_title_x + MMI_title_width - 1,
  337.                     MMI_title_y + MMI_title_height - 1);
  338.             }
  339.         #endif /* __MMI_UI_ANIMATED_TITLE_EFFECT__ */ 
  340.         #endif /* __MMI_UI_DALMATIAN_STATUSBAR__ */ 
  341.             if (r2lMMIFlag)
  342.             {
  343.                 x = MMI_menu_shortcut_box.x;
  344.                 y = MMI_menu_shortcut_box.y;
  345.                 move_menu_shortcut_handler(MMI_title_x, MMI_title_y);
  346.                 gui_show_single_line_input_box(&MMI_menu_shortcut_box);
  347.                 move_menu_shortcut_handler(MMI_title_width - MMI_menu_shortcut_box.width, MMI_title_y);
  348.             }
  349.             else
  350.             {
  351.                 gui_show_single_line_input_box(&MMI_menu_shortcut_box);
  352.             }
  353.             MMI_menu_shortcut_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_BACKGROUND;
  354.         #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  355.             if (GetActiveScreenId() == MAIN_MENU_SCREENID)
  356.             {
  357.                 MMI_menu_shortcut_box.flags &= ~UI_SINGLE_LINE_INPUT_BOX_DISABLE_BACKGROUND;
  358.             }
  359.         #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
  360.         }
  361.         gdi_layer_unlock_frame_buffer();
  362.         gdi_layer_blt_previous(
  363.             MMI_menu_shortcut_box.x,
  364.             MMI_menu_shortcut_box.y,
  365.             MMI_menu_shortcut_box.x + MMI_menu_shortcut_box.width - 1,
  366.             MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1);
  367.     }
  368. }
  369. /*----------------------------------------------------------------------------
  370.    The following functions are internally used and are not user callable.
  371. ----------------------------------------------------------------------------*/
  372. /*****************************************************************************
  373.  * FUNCTION
  374.  *  menu_shortcut_1_key_down
  375.  * DESCRIPTION
  376.  *  
  377.  * PARAMETERS
  378.  *  void
  379.  * RETURNS
  380.  *  void
  381.  *****************************************************************************/
  382. static void menu_shortcut_1_key_down(void)
  383. {
  384.     /*----------------------------------------------------------------*/
  385.     /* Local Variables                                                */
  386.     /*----------------------------------------------------------------*/
  387.     /*----------------------------------------------------------------*/
  388.     /* Code Body                                                      */
  389.     /*----------------------------------------------------------------*/
  390.     menu_shortcut_handler_keyinput((U8) '1');
  391. }
  392. /*****************************************************************************
  393.  * FUNCTION
  394.  *  menu_shortcut_2_key_down
  395.  * DESCRIPTION
  396.  *  
  397.  * PARAMETERS
  398.  *  void
  399.  * RETURNS
  400.  *  void
  401.  *****************************************************************************/
  402. static void menu_shortcut_2_key_down(void)
  403. {
  404.     /*----------------------------------------------------------------*/
  405.     /* Local Variables                                                */
  406.     /*----------------------------------------------------------------*/
  407.     /*----------------------------------------------------------------*/
  408.     /* Code Body                                                      */
  409.     /*----------------------------------------------------------------*/
  410.     menu_shortcut_handler_keyinput((U8) '2');
  411. }
  412. /*****************************************************************************
  413.  * FUNCTION
  414.  *  menu_shortcut_3_key_down
  415.  * DESCRIPTION
  416.  *  
  417.  * PARAMETERS
  418.  *  void
  419.  * RETURNS
  420.  *  void
  421.  *****************************************************************************/
  422. static void menu_shortcut_3_key_down(void)
  423. {
  424.     /*----------------------------------------------------------------*/
  425.     /* Local Variables                                                */
  426.     /*----------------------------------------------------------------*/
  427.     /*----------------------------------------------------------------*/
  428.     /* Code Body                                                      */
  429.     /*----------------------------------------------------------------*/
  430.     menu_shortcut_handler_keyinput((U8) '3');
  431. }
  432. /*****************************************************************************
  433.  * FUNCTION
  434.  *  menu_shortcut_4_key_down
  435.  * DESCRIPTION
  436.  *  
  437.  * PARAMETERS
  438.  *  void
  439.  * RETURNS
  440.  *  void
  441.  *****************************************************************************/
  442. static void menu_shortcut_4_key_down(void)
  443. {
  444.     /*----------------------------------------------------------------*/
  445.     /* Local Variables                                                */
  446.     /*----------------------------------------------------------------*/
  447.     /*----------------------------------------------------------------*/
  448.     /* Code Body                                                      */
  449.     /*----------------------------------------------------------------*/
  450.     menu_shortcut_handler_keyinput((U8) '4');
  451. }
  452. /*****************************************************************************
  453.  * FUNCTION
  454.  *  menu_shortcut_5_key_down
  455.  * DESCRIPTION
  456.  *  
  457.  * PARAMETERS
  458.  *  void
  459.  * RETURNS
  460.  *  void
  461.  *****************************************************************************/
  462. static void menu_shortcut_5_key_down(void)
  463. {
  464.     /*----------------------------------------------------------------*/
  465.     /* Local Variables                                                */
  466.     /*----------------------------------------------------------------*/
  467.     /*----------------------------------------------------------------*/
  468.     /* Code Body                                                      */
  469.     /*----------------------------------------------------------------*/
  470.     menu_shortcut_handler_keyinput((U8) '5');
  471. }
  472. /*****************************************************************************
  473.  * FUNCTION
  474.  *  menu_shortcut_6_key_down
  475.  * DESCRIPTION
  476.  *  
  477.  * PARAMETERS
  478.  *  void
  479.  * RETURNS
  480.  *  void
  481.  *****************************************************************************/
  482. static void menu_shortcut_6_key_down(void)
  483. {
  484.     /*----------------------------------------------------------------*/
  485.     /* Local Variables                                                */
  486.     /*----------------------------------------------------------------*/
  487.     /*----------------------------------------------------------------*/
  488.     /* Code Body                                                      */
  489.     /*----------------------------------------------------------------*/
  490.     menu_shortcut_handler_keyinput((U8) '6');
  491. }
  492. /*****************************************************************************
  493.  * FUNCTION
  494.  *  menu_shortcut_7_key_down
  495.  * DESCRIPTION
  496.  *  
  497.  * PARAMETERS
  498.  *  void
  499.  * RETURNS
  500.  *  void
  501.  *****************************************************************************/
  502. static void menu_shortcut_7_key_down(void)
  503. {
  504.     /*----------------------------------------------------------------*/
  505.     /* Local Variables                                                */
  506.     /*----------------------------------------------------------------*/
  507.     /*----------------------------------------------------------------*/
  508.     /* Code Body                                                      */
  509.     /*----------------------------------------------------------------*/
  510.     menu_shortcut_handler_keyinput((U8) '7');
  511. }
  512. /*****************************************************************************
  513.  * FUNCTION
  514.  *  menu_shortcut_8_key_down
  515.  * DESCRIPTION
  516.  *  
  517.  * PARAMETERS
  518.  *  void
  519.  * RETURNS
  520.  *  void
  521.  *****************************************************************************/
  522. static void menu_shortcut_8_key_down(void)
  523. {
  524.     /*----------------------------------------------------------------*/
  525.     /* Local Variables                                                */
  526.     /*----------------------------------------------------------------*/
  527.     /*----------------------------------------------------------------*/
  528.     /* Code Body                                                      */
  529.     /*----------------------------------------------------------------*/
  530.     menu_shortcut_handler_keyinput((U8) '8');
  531. }
  532. /*****************************************************************************
  533.  * FUNCTION
  534.  *  menu_shortcut_9_key_down
  535.  * DESCRIPTION
  536.  *  
  537.  * PARAMETERS
  538.  *  void
  539.  * RETURNS
  540.  *  void
  541.  *****************************************************************************/
  542. static void menu_shortcut_9_key_down(void)
  543. {
  544.     /*----------------------------------------------------------------*/
  545.     /* Local Variables                                                */
  546.     /*----------------------------------------------------------------*/
  547.     /*----------------------------------------------------------------*/
  548.     /* Code Body                                                      */
  549.     /*----------------------------------------------------------------*/
  550.     menu_shortcut_handler_keyinput((U8) '9');
  551. }
  552. /*****************************************************************************
  553.  * FUNCTION
  554.  *  menu_shortcut_0_key_down
  555.  * DESCRIPTION
  556.  *  
  557.  * PARAMETERS
  558.  *  void
  559.  * RETURNS
  560.  *  void
  561.  *****************************************************************************/
  562. static void menu_shortcut_0_key_down(void)
  563. {
  564.     /*----------------------------------------------------------------*/
  565.     /* Local Variables                                                */
  566.     /*----------------------------------------------------------------*/
  567.     /*----------------------------------------------------------------*/
  568.     /* Code Body                                                      */
  569.     /*----------------------------------------------------------------*/
  570.     menu_shortcut_handler_keyinput((U8) '0');
  571. }
  572. /*****************************************************************************
  573.  * FUNCTION
  574.  *  create_menu_shortcut_handler
  575.  * DESCRIPTION
  576.  *  Creates the menu shortcut handler
  577.  * PARAMETERS
  578.  *  void
  579.  * RETURNS
  580.  *  void
  581.  *****************************************************************************/
  582. void create_menu_shortcut_handler(void)
  583. {
  584.     /*----------------------------------------------------------------*/
  585.     /* Local Variables                                                */
  586.     /*----------------------------------------------------------------*/
  587.     /*----------------------------------------------------------------*/
  588.     /* Code Body                                                      */
  589.     /*----------------------------------------------------------------*/
  590.     set_MMI_singleline_inputbox_shortcut_indicator_theme();
  591.     gui_create_single_line_input_box_use_buffer(
  592.         &MMI_menu_shortcut_box,
  593.         MMI_title_x + MMI_title_width - 30,
  594.         MMI_title_y,
  595.         36,
  596.         20,
  597.         MMI_list_shortcut_buffer,
  598.         MMI_MENU_SHORTCUT_BUFFER_LENGTH / ENCODING_LENGTH);
  599. #ifdef __MMI_UI_DALMATIAN_STATUSBAR__
  600.     MMI_menu_shortcut_box.flags |=
  601.         (UI_SINGLE_LINE_INPUT_BOX_CENTER_Y | UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW |
  602.          UI_SINGLE_LINE_INPUT_BOX_CENTER_JUSTIFY | UI_SINGLE_LINE_INPUT_BOX_DISABLE_BACKGROUND);
  603. #else /* __MMI_UI_DALMATIAN_STATUSBAR__ */ 
  604.     MMI_menu_shortcut_box.flags |=
  605.         (UI_SINGLE_LINE_INPUT_BOX_CENTER_Y | UI_SINGLE_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW |
  606.          UI_SINGLE_LINE_INPUT_BOX_CENTER_JUSTIFY);
  607. #endif /* __MMI_UI_DALMATIAN_STATUSBAR__ */ 
  608.     set_MMI_singleline_inputbox_regular_theme();
  609. }
  610. /*****************************************************************************
  611.  * FUNCTION
  612.  *  menu_shortcut_keyboard_input_handler
  613.  * DESCRIPTION
  614.  *  Keyboard input (simulator) handler for menu shortcuts
  615.  *  
  616.  *  Internal function
  617.  * PARAMETERS
  618.  *  keyc        [IN]        
  619.  * RETURNS
  620.  *  void
  621.  *****************************************************************************/
  622. void menu_shortcut_keyboard_input_handler(S32 keyc)
  623. {
  624.     /*----------------------------------------------------------------*/
  625.     /* Local Variables                                                */
  626.     /*----------------------------------------------------------------*/
  627.     /*----------------------------------------------------------------*/
  628.     /* Code Body                                                      */
  629.     /*----------------------------------------------------------------*/
  630.     if (keyc >= '0' && keyc <= '9')
  631.     {
  632.         menu_shortcut_handler_keyinput((U8) keyc);
  633.     }
  634. }
  635. /*****************************************************************************
  636.  * FUNCTION
  637.  *  register_menu_shortcut_keys
  638.  * DESCRIPTION
  639.  *  Registers the keys used by the menu shortcut handler
  640.  * PARAMETERS
  641.  *  void
  642.  * RETURNS
  643.  *  void
  644.  *****************************************************************************/
  645. void register_menu_shortcut_keys(void)
  646. {
  647.     /*----------------------------------------------------------------*/
  648.     /* Local Variables                                                */
  649.     /*----------------------------------------------------------------*/
  650.     /*----------------------------------------------------------------*/
  651.     /* Code Body                                                      */
  652.     /*----------------------------------------------------------------*/
  653.     register_keyboard_input_handler(menu_shortcut_keyboard_input_handler);
  654.     SetKeyHandler(menu_shortcut_0_key_down, KEY_0, KEY_EVENT_DOWN);
  655.     SetKeyHandler(menu_shortcut_1_key_down, KEY_1, KEY_EVENT_DOWN);
  656.     SetKeyHandler(menu_shortcut_2_key_down, KEY_2, KEY_EVENT_DOWN);
  657.     SetKeyHandler(menu_shortcut_3_key_down, KEY_3, KEY_EVENT_DOWN);
  658.     SetKeyHandler(menu_shortcut_4_key_down, KEY_4, KEY_EVENT_DOWN);
  659.     SetKeyHandler(menu_shortcut_5_key_down, KEY_5, KEY_EVENT_DOWN);
  660.     SetKeyHandler(menu_shortcut_6_key_down, KEY_6, KEY_EVENT_DOWN);
  661.     SetKeyHandler(menu_shortcut_7_key_down, KEY_7, KEY_EVENT_DOWN);
  662.     SetKeyHandler(menu_shortcut_8_key_down, KEY_8, KEY_EVENT_DOWN);
  663.     SetKeyHandler(menu_shortcut_9_key_down, KEY_9, KEY_EVENT_DOWN);
  664. }
  665. /*****************************************************************************
  666.  * FUNCTION
  667.  *  register_menu_shortcut_handler
  668.  * DESCRIPTION
  669.  *  Registers the function to be called when a shortcut
  670.  *  is being entered.
  671.  * PARAMETERS
  672.  *  f               [IN]        Is the function that is called as the user enters each
  673.  *  digit(?)        [IN]        Of the shortcut number
  674.  *  is(?)           [IN]        The index number of the menu item's shortcut (zero based)
  675.  *  This(?)         [IN]        Function is called with the parameter i, which
  676.  * RETURNS
  677.  *  void
  678.  *****************************************************************************/
  679. void register_menu_shortcut_handler(void (*f) (S32 i))
  680. {
  681.     /*----------------------------------------------------------------*/
  682.     /* Local Variables                                                */
  683.     /*----------------------------------------------------------------*/
  684.     /*----------------------------------------------------------------*/
  685.     /* Code Body                                                      */
  686.     /*----------------------------------------------------------------*/
  687.     menu_shortcut_item_selected = dummy_menu_goto_item;
  688.     menu_shortcut_goto_item = f;
  689. }
  690. /*****************************************************************************
  691.  * FUNCTION
  692.  *  register_menu_shortcut_selected
  693.  * DESCRIPTION
  694.  *  Registers the function to be called when menuitem is selected.
  695.  * PARAMETERS
  696.  *  f           [IN]        Is the function that is called when menuitem is selected.
  697.  *  is(?)       [IN]        The index number of the menu item's shortcut (zero based)
  698.  *  This(?)     [IN]        Function is called with the parameter i, which
  699.  * RETURNS
  700.  *  void
  701.  *****************************************************************************/
  702. void register_menu_shortcut_selected(void (*f) (S32 i))
  703. {
  704.     /*----------------------------------------------------------------*/
  705.     /* Local Variables                                                */
  706.     /*----------------------------------------------------------------*/
  707.     /*----------------------------------------------------------------*/
  708.     /* Code Body                                                      */
  709.     /*----------------------------------------------------------------*/
  710.     menu_shortcut_item_selected = f;
  711. }
  712. /*****************************************************************************
  713.  * FUNCTION
  714.  *  register_menu_shortcut_selected_only
  715.  * DESCRIPTION
  716.  *  Registers the function to be called to load items on demand.
  717.  * PARAMETERS
  718.  *  f           [IN]        Is the function that is called to load items on demand.
  719.  *  is(?)       [IN]        The index number of the menu item's shortcut (zero based)
  720.  *  This(?)     [IN]        Function is called with the parameter i, which
  721.  * RETURNS
  722.  *  void
  723.  *****************************************************************************/
  724. /* for category184screen to load items on demand */
  725. void register_menu_shortcut_selected_only(void (*f) (S32 i))
  726. {
  727.     /*----------------------------------------------------------------*/
  728.     /* Local Variables                                                */
  729.     /*----------------------------------------------------------------*/
  730.     /*----------------------------------------------------------------*/
  731.     /* Code Body                                                      */
  732.     /*----------------------------------------------------------------*/
  733.     menu_shortcut_item_selected = f;
  734.     menu_shortcut_goto_item = dummy_menu_goto_item;
  735. }
  736. /*****************************************************************************
  737.  * FUNCTION
  738.  *  move_menu_shortcut_handler
  739.  * DESCRIPTION
  740.  *  Moves the menu shortcut indicator to a new position
  741.  * PARAMETERS
  742.  *  x       [IN]        Is the new left-top corner position
  743.  *  y       [IN]        Is the new left-top corner position
  744.  * RETURNS
  745.  *  void
  746.  *****************************************************************************/
  747. void move_menu_shortcut_handler(S32 x, S32 y)
  748. {
  749. #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  750.     /*----------------------------------------------------------------*/
  751.     /* Local Variables                                                */
  752.     /*----------------------------------------------------------------*/
  753.     /*----------------------------------------------------------------*/
  754.     /* Code Body                                                      */
  755.     /*----------------------------------------------------------------*/
  756.     if (GetActiveScreenId() == MAIN_MENU_SCREENID)
  757.     {
  758.         MMI_menu_shortcut_box.x = x - MMI_SIGNAL_WIDTH;
  759.     }
  760.     else
  761. #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
  762.     {
  763.         MMI_menu_shortcut_box.x = x;
  764.     }
  765.     MMI_menu_shortcut_box.y = y;
  766. }
  767. /*****************************************************************************
  768.  * FUNCTION
  769.  *  resize_menu_shortcut_handler
  770.  * DESCRIPTION
  771.  *  Resizes the menu shortcut indicator
  772.  * PARAMETERS
  773.  *  width       [IN]        Is the new width
  774.  *  height      [IN]        Is the new height
  775.  * RETURNS
  776.  *  void
  777.  *****************************************************************************/
  778. void resize_menu_shortcut_handler(S32 width, S32 height)
  779. {
  780.     /*----------------------------------------------------------------*/
  781.     /* Local Variables                                                */
  782.     /*----------------------------------------------------------------*/
  783.     /*----------------------------------------------------------------*/
  784.     /* Code Body                                                      */
  785.     /*----------------------------------------------------------------*/
  786.     gui_resize_single_line_input_box(&MMI_menu_shortcut_box, width, height);
  787. }
  788. /*****************************************************************************
  789.  * FUNCTION
  790.  *  override_menu_shortcut_default_region
  791.  * DESCRIPTION
  792.  *  Setup the background region where menu shortcut is drawn on it.
  793.  * PARAMETERS
  794.  *  x           [IN]        
  795.  *  y           [IN]        
  796.  *  width       [IN]        
  797.  *  height      [IN]        
  798.  * RETURNS
  799.  *  void
  800.  *****************************************************************************/
  801. void override_menu_shortcut_default_region(S32 x, S32 y, S32 width, S32 height)
  802. {
  803.     /*----------------------------------------------------------------*/
  804.     /* Local Variables                                                */
  805.     /*----------------------------------------------------------------*/
  806.     /*----------------------------------------------------------------*/
  807.     /* Code Body                                                      */
  808.     /*----------------------------------------------------------------*/
  809.     /* Deprecated function */
  810. }
  811. /*****************************************************************************
  812.  * FUNCTION
  813.  *  register_hide_menu_shortcut
  814.  * DESCRIPTION
  815.  *  Registers a function to be used to hide a menu shortcut
  816.  *  
  817.  *  gui_hide_menu_shortcut() does not really use it.
  818.  *  This is used only for hiding the inputbox when user press digit keys
  819.  * PARAMETERS
  820.  *  f                   [IN]        Is the function that is called when ever the menu shortcut
  821.  *  indicator(?)        [IN]        Needs to be hidden.
  822.  * RETURNS
  823.  *  void
  824.  *****************************************************************************/
  825. void register_hide_menu_shortcut(void (*f) (void))
  826. {
  827.     /*----------------------------------------------------------------*/
  828.     /* Local Variables                                                */
  829.     /*----------------------------------------------------------------*/
  830.     /*----------------------------------------------------------------*/
  831.     /* Code Body                                                      */
  832.     /*----------------------------------------------------------------*/
  833.     hide_menu_shortcut = f;
  834. }
  835. /*****************************************************************************
  836.  * FUNCTION
  837.  *  set_menu_shortcut_length
  838.  * DESCRIPTION
  839.  *  Sets the maximum number of digits the user can enter for a particular menu's shortcuts.
  840.  * PARAMETERS
  841.  *  l       [IN]        Is the maximum number of digits in the shortcut
  842.  * RETURNS
  843.  *  void
  844.  *****************************************************************************/
  845. void set_menu_shortcut_length(S32 l)
  846. {
  847.     /*----------------------------------------------------------------*/
  848.     /* Local Variables                                                */
  849.     /*----------------------------------------------------------------*/
  850.     /*----------------------------------------------------------------*/
  851.     /* Code Body                                                      */
  852.     /*----------------------------------------------------------------*/
  853.     MMI_menu_shortcut_box.allocated_length = (l + 1) * ENCODING_LENGTH;
  854.     MMI_menu_shortcut_box.available_length = (l + 1) * ENCODING_LENGTH;
  855.     menu_shortcut_length = (U8) l;
  856. }
  857. /*****************************************************************************
  858.  * FUNCTION
  859.  *  reset_menu_shortcut_handler
  860.  * DESCRIPTION
  861.  *  Clears keyboard and keypad handlers registerd with the menu shortcut handler.
  862.  *  Also clears the menu handling and hide functions.
  863.  * PARAMETERS
  864.  *  void
  865.  * RETURNS
  866.  *  void
  867.  *****************************************************************************/
  868. void reset_menu_shortcut_handler(void)
  869. {
  870.     /*----------------------------------------------------------------*/
  871.     /* Local Variables                                                */
  872.     /*----------------------------------------------------------------*/
  873.     /*----------------------------------------------------------------*/
  874.     /* Code Body                                                      */
  875.     /*----------------------------------------------------------------*/
  876.     gui_cancel_timer(menu_shortcut_handler_timeout);
  877.     menu_shortcut_item_selected = dummy_menu_goto_item;
  878.     menu_shortcut_goto_item = dummy_menu_goto_item;
  879.     hide_menu_shortcut = dummy_hide_menu_shortcut;
  880.     menu_shortcut_handler_display = 0;
  881.     gui_single_line_input_box_clear(&MMI_menu_shortcut_box);
  882.     clear_keyboard_input_handler();
  883.     ClearKeyHandler(KEY_0, KEY_EVENT_DOWN);
  884.     ClearKeyHandler(KEY_1, KEY_EVENT_DOWN);
  885.     ClearKeyHandler(KEY_2, KEY_EVENT_DOWN);
  886.     ClearKeyHandler(KEY_3, KEY_EVENT_DOWN);
  887.     ClearKeyHandler(KEY_4, KEY_EVENT_DOWN);
  888.     ClearKeyHandler(KEY_5, KEY_EVENT_DOWN);
  889.     ClearKeyHandler(KEY_6, KEY_EVENT_DOWN);
  890.     ClearKeyHandler(KEY_7, KEY_EVENT_DOWN);
  891.     ClearKeyHandler(KEY_8, KEY_EVENT_DOWN);
  892.     ClearKeyHandler(KEY_9, KEY_EVENT_DOWN);
  893. }
  894. /***************************************************************************** 
  895.  *
  896.  * Category-level functions
  897.  *
  898.  * The design is slightly different than the original design. 
  899.  *
  900.  *****************************************************************************/
  901. /*****************************************************************************
  902.  * FUNCTION
  903.  *  set_menu_item_count
  904.  * DESCRIPTION
  905.  *  Sets the number of digits allowed in the menu shortcut
  906.  *  handler. This is based on the number of items in the menu.
  907.  * PARAMETERS
  908.  *  n_items     [IN]        Is the number of menu items in a screen
  909.  * RETURNS
  910.  *  Width in pixels of the rectangle required to
  911.  *  display the menu shortcut number.
  912.  *****************************************************************************/
  913. S32 set_menu_item_count(S32 n_items)
  914. {
  915.     /*----------------------------------------------------------------*/
  916.     /* Local Variables                                                */
  917.     /*----------------------------------------------------------------*/
  918.     UI_character_type s[8];
  919.     S32 l, w;
  920.     UI_font_type f = UI_font;
  921.     /*----------------------------------------------------------------*/
  922.     /* Code Body                                                      */
  923.     /*----------------------------------------------------------------*/
  924.     gui_itoa(n_items, (UI_string_type) s, 10);
  925.     l = gui_strlen((UI_string_type) s);
  926.     set_menu_shortcut_length(l);
  927.     gui_set_font(&MMI_medium_font);
  928.     gui_measure_string((UI_string_type) s, &w, &l);
  929.     gui_set_font(f);
  930.     return w;
  931. }
  932. /*****************************************************************************
  933.  * FUNCTION
  934.  *  gui_hide_menu_shortcut
  935.  * DESCRIPTION
  936.  *  Hide the menu shortcut
  937.  * PARAMETERS
  938.  *  void
  939.  * RETURNS
  940.  *  void
  941.  *****************************************************************************/
  942. void gui_hide_menu_shortcut(void)
  943. {
  944. #ifdef __MMI_UI_ANIMATED_TITLE_EFFECT__
  945.     /*----------------------------------------------------------------*/
  946.     /* Local Variables                                                */
  947.     /*----------------------------------------------------------------*/
  948.     S32 iwidth, iheight;
  949.     /*----------------------------------------------------------------*/
  950.     /* Code Body                                                      */
  951.     /*----------------------------------------------------------------*/
  952.     gui_measure_image(get_image(IMG_TITLE_SCROLL), &iwidth, &iheight);
  953. #endif /* __MMI_UI_ANIMATED_TITLE_EFFECT__ */ 
  954.     if (MMI_disable_title_shortcut_display)
  955.     {
  956.         return;
  957.     }
  958.     if (MMI_menu_shortcut_number <= 0)
  959.     {
  960.         return;
  961.     }
  962.     gdi_layer_push_clip();
  963.     gdi_layer_lock_frame_buffer();
  964. #if defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__)
  965.     if ((gOnFullScreen & MMI_IN_FULL_SCREEN || gOnFullScreen & MMI_LEAVE_FULL_SCREEN) &&
  966.         !(gOnFullScreen & MMI_LEAVE_FULL_IDLE_SCREEN))
  967.     {
  968.         if (r2lMMIFlag)
  969.         {
  970.             /* In rotation mode, title width < screen width. */
  971.             gui_set_clip_with_bounding_box(
  972.                 MMI_title_x,
  973.                 MMI_menu_shortcut_box.y,
  974.                 MMI_title_x + MMI_menu_shortcut_box.width - 1,
  975.                 MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1,
  976.                 MMI_title_x,
  977.                 MMI_title_y,
  978.                 MMI_title_x + MMI_title_width - 1,
  979.                 MMI_title_y + MMI_title_height - 1);
  980.             if (wgui_is_wallpaper_on_bottom() == MMI_TRUE)
  981.             {
  982.                 gdi_draw_solid_rect(
  983.                     MMI_title_x,
  984.                     0,
  985.                     MMI_title_x + MMI_title_width - 1,
  986.                     MMI_title_height - 1,
  987.                     GDI_COLOR_TRANSPARENT);
  988.                 if (title_bg_id != 0)
  989.                 {
  990.                     gdi_image_draw_id(MMI_title_x, 0, title_bg_id);
  991.                 }
  992.                 else
  993.                 {
  994.                     gui_draw_filled_area(
  995.                         MMI_title_x,
  996.                         0,
  997.                         MMI_title_x + MMI_title_width - 1,
  998.                         MMI_title_height - 1,
  999.                         current_UI_theme->window_title_theme->active_filler);
  1000.                 }
  1001.             }
  1002.             else
  1003.             {
  1004.                 gdi_draw_solid_rect(
  1005.                     MMI_title_x,
  1006.                     0,
  1007.                     MMI_title_x + MMI_title_width - 1,
  1008.                     MMI_title_height - 1,
  1009.                     GDI_COLOR_WHITE);
  1010.                 gui_draw_filled_area(
  1011.                     MMI_title_x,
  1012.                     0,
  1013.                     MMI_title_x + MMI_title_width - 1,
  1014.                     MMI_title_height - 1,
  1015.                     current_UI_theme->window_title_theme->active_filler);
  1016.             }
  1017.         #ifdef __MMI_UI_ANIMATED_TITLE_EFFECT__
  1018.             if (is_enable_animated_title_effect())
  1019.             {
  1020.                 wgui_draw_animate_title_image_frame_0(
  1021.                     MMI_title_x,
  1022.                     0,
  1023.                     MMI_title_x + MMI_title_width - 1,
  1024.                     MMI_title_height - 1);
  1025.             }
  1026.         #endif /* __MMI_UI_ANIMATED_TITLE_EFFECT__ */ 
  1027.         }
  1028.         else
  1029.         {
  1030.             /* In rotation mode, title width < screen width. */
  1031.             gui_set_clip_with_bounding_box(
  1032.                 MMI_menu_shortcut_box.x,
  1033.                 MMI_menu_shortcut_box.y,
  1034.                 MMI_menu_shortcut_box.x + MMI_menu_shortcut_box.width - 1,
  1035.                 MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1,
  1036.                 MMI_title_x,
  1037.                 MMI_title_y,
  1038.                 MMI_title_x + MMI_title_width - 1,
  1039.                 MMI_title_y + MMI_title_height - 1);
  1040.             if (wgui_is_wallpaper_on_bottom() == MMI_TRUE)
  1041.             {
  1042.                 gdi_draw_solid_rect(
  1043.                     MMI_title_x,
  1044.                     0,
  1045.                     MMI_title_x + MMI_title_width - 1,
  1046.                     MMI_title_height - 1,
  1047.                     GDI_COLOR_TRANSPARENT);
  1048.                 if (title_bg_id != 0)
  1049.                 {
  1050.                     gdi_image_draw_id(MMI_title_x, 0, title_bg_id);
  1051.                 }
  1052.                 else
  1053.                 {
  1054.                     gui_draw_filled_area(
  1055.                         MMI_title_x,
  1056.                         0,
  1057.                         MMI_title_x + MMI_title_width - 1,
  1058.                         MMI_title_height - 1,
  1059.                         current_UI_theme->window_title_theme->active_filler);
  1060.                 }
  1061.             }
  1062.             else
  1063.             {
  1064.                 gdi_draw_solid_rect(
  1065.                     MMI_title_x,
  1066.                     0,
  1067.                     MMI_title_x + MMI_title_width - 1,
  1068.                     MMI_title_height - 1,
  1069.                     GDI_COLOR_WHITE);
  1070.                 gui_draw_filled_area(
  1071.                     MMI_title_x,
  1072.                     0,
  1073.                     MMI_title_x + MMI_title_width - 1,
  1074.                     MMI_title_height - 1,
  1075.                     current_UI_theme->window_title_theme->active_filler);
  1076.             }
  1077.         #ifdef __MMI_UI_ANIMATED_TITLE_EFFECT__
  1078.             if (is_enable_animated_title_effect())
  1079.             {
  1080.                 wgui_draw_animate_title_image_frame_0(
  1081.                     MMI_title_x,
  1082.                     0,
  1083.                     MMI_title_x + MMI_title_width - 1,
  1084.                     MMI_title_height - 1);
  1085.             }
  1086.         #endif /* __MMI_UI_ANIMATED_TITLE_EFFECT__ */ 
  1087.         }
  1088.     }
  1089.     else
  1090. #endif /* defined(__MMI_MAINLCD_176X220__) || defined (__MMI_MAINLCD_240X320__) */ 
  1091.     {
  1092.         if (r2lMMIFlag)
  1093.         {
  1094.             /* In rotation mode, title width < screen width. */
  1095.             gui_set_clip_with_bounding_box(
  1096.                 MMI_title_x,
  1097.                 MMI_menu_shortcut_box.y,
  1098.                 MMI_title_x + MMI_menu_shortcut_box.width - 1,
  1099.                 MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1,
  1100.                 MMI_title_x,
  1101.                 MMI_title_y,
  1102.                 MMI_title_x + MMI_title_width - 1,
  1103.                 MMI_title_y + MMI_title_height - 1);
  1104.             if (wgui_is_wallpaper_on_bottom() == MMI_TRUE)
  1105.             {
  1106.                 gdi_draw_solid_rect(
  1107.                     MMI_title_x,
  1108.                     MMI_title_y,
  1109.                     MMI_title_x + MMI_title_width - 1,
  1110.                     MMI_title_y + MMI_title_height - 1,
  1111.                     GDI_COLOR_TRANSPARENT);
  1112.                 if (title_bg_id != 0)
  1113.                 {
  1114.                     gdi_image_draw_id(MMI_title_x, MMI_title_y, title_bg_id);
  1115.                 }
  1116.                 else
  1117.                 {
  1118.                     gui_draw_filled_area(
  1119.                         MMI_title_x,
  1120.                         MMI_title_y,
  1121.                         MMI_title_x + MMI_title_width - 1,
  1122.                         MMI_title_y + MMI_title_height - 1,
  1123.                         current_UI_theme->window_title_theme->active_filler);
  1124.                 }
  1125.             }
  1126.             else
  1127.             {
  1128.                 gdi_draw_solid_rect(
  1129.                     MMI_title_x,
  1130.                     MMI_title_y,
  1131.                     MMI_title_x + MMI_title_width - 1,
  1132.                     MMI_title_y + MMI_title_height - 1,
  1133.                     GDI_COLOR_WHITE);
  1134.             #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  1135.                 if (GetActiveScreenId() == MAIN_MENU_SCREENID)
  1136.                 {
  1137.                     gui_fill_rectangle(
  1138.                         MMI_title_x,
  1139.                         MMI_title_y,
  1140.                         MMI_title_x + MMI_title_width - 1,
  1141.                         MMI_title_y + MMI_title_height - 1,
  1142.                         (current_UI_theme->window_title_theme->active_filler->c));
  1143.                 }
  1144.                 else
  1145.             #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
  1146.                 {
  1147.                     gui_draw_filled_area(
  1148.                         MMI_title_x,
  1149.                         MMI_title_y,
  1150.                         MMI_title_x + MMI_title_width - 1,
  1151.                         MMI_title_y + MMI_title_height - 1,
  1152.                         current_UI_theme->window_title_theme->active_filler);
  1153.                 }
  1154.             }
  1155.         #ifdef __MMI_UI_ANIMATED_TITLE_EFFECT__
  1156.             if (is_enable_animated_title_effect())
  1157.             {
  1158.                 wgui_draw_animate_title_image_frame_0(
  1159.                     MMI_title_x,
  1160.                     MMI_title_y,
  1161.                     MMI_title_x + MMI_title_width - 1,
  1162.                     MMI_title_y + MMI_title_height - 1);
  1163.             }
  1164.         #endif /* __MMI_UI_ANIMATED_TITLE_EFFECT__ */ 
  1165.         }
  1166.         else
  1167.         {
  1168.             /* In rotation mode, title width < screen width. */
  1169.             gui_set_clip_with_bounding_box(
  1170.                 MMI_menu_shortcut_box.x,
  1171.                 MMI_menu_shortcut_box.y,
  1172.                 MMI_menu_shortcut_box.x + MMI_menu_shortcut_box.width - 1,
  1173.                 MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1,
  1174.                 MMI_title_x,
  1175.                 MMI_title_y,
  1176.                 MMI_title_x + MMI_title_width - 1,
  1177.                 MMI_title_y + MMI_title_height - 1);
  1178.             if (wgui_is_wallpaper_on_bottom() == MMI_TRUE)
  1179.             {
  1180.                 gdi_draw_solid_rect(
  1181.                     MMI_title_x,
  1182.                     MMI_title_y,
  1183.                     MMI_title_x + MMI_title_width - 1,
  1184.                     MMI_title_y + MMI_title_height - 1,
  1185.                     GDI_COLOR_TRANSPARENT);
  1186.                 if (title_bg_id != 0)
  1187.                 {
  1188.                     gdi_image_draw_id(MMI_title_x, MMI_title_y, title_bg_id);
  1189.                 }
  1190.                 else
  1191.                 {
  1192.                     gui_draw_filled_area(
  1193.                         MMI_title_x,
  1194.                         MMI_title_y,
  1195.                         MMI_title_x + MMI_title_width - 1,
  1196.                         MMI_title_y + MMI_title_height - 1,
  1197.                         current_UI_theme->window_title_theme->active_filler);
  1198.                 }
  1199.             }
  1200.             else
  1201.             {
  1202.                 gdi_draw_solid_rect(
  1203.                     MMI_title_x,
  1204.                     MMI_title_y,
  1205.                     MMI_title_x + MMI_title_width - 1,
  1206.                     MMI_title_y + MMI_title_height - 1,
  1207.                     GDI_COLOR_WHITE);
  1208.             #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  1209.                 if (GetActiveScreenId() == MAIN_MENU_SCREENID)
  1210.                 {
  1211.                     gui_fill_rectangle(
  1212.                         MMI_title_x,
  1213.                         MMI_title_y,
  1214.                         MMI_title_x + MMI_title_width - 1,
  1215.                         MMI_title_y + MMI_title_height - 1,
  1216.                         (current_UI_theme->window_title_theme->active_filler->c));
  1217.                 }
  1218.                 else
  1219.             #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
  1220.                 {
  1221.                     gui_draw_filled_area(
  1222.                         MMI_title_x,
  1223.                         MMI_title_y,
  1224.                         MMI_title_x + MMI_title_width - 1,
  1225.                         MMI_title_y + MMI_title_height - 1,
  1226.                         current_UI_theme->window_title_theme->active_filler);
  1227.                 }
  1228.             #ifdef __MMI_UI_ANIMATED_TITLE_EFFECT__
  1229.                 if (is_enable_animated_title_effect())
  1230.                 {
  1231.                     wgui_draw_animate_title_image_frame_0(
  1232.                         MMI_title_x,
  1233.                         MMI_title_y,
  1234.                         MMI_title_x + MMI_title_width - 1,
  1235.                         MMI_title_y + MMI_title_height - 1);
  1236.                 }
  1237.             #endif /* __MMI_UI_ANIMATED_TITLE_EFFECT__ */ 
  1238.             }
  1239.         }
  1240.     }
  1241.     gdi_layer_pop_clip();
  1242.     gdi_layer_unlock_frame_buffer();
  1243.     gdi_layer_blt_previous(
  1244.         MMI_menu_shortcut_box.x,
  1245.         MMI_menu_shortcut_box.y,
  1246.         MMI_menu_shortcut_box.x + MMI_menu_shortcut_box.width,
  1247.         MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1);
  1248. }
  1249. /*****************************************************************************
  1250.  * FUNCTION
  1251.  *  show_menu_shortcut
  1252.  * DESCRIPTION
  1253.  *  Displays the shortcut number of the highlighted item
  1254.  * PARAMETERS
  1255.  *  void
  1256.  * RETURNS
  1257.  *  void
  1258.  *****************************************************************************/
  1259. void show_menu_shortcut(void)
  1260. {
  1261.     /*----------------------------------------------------------------*/
  1262.     /* Local Variables                                                */
  1263.     /*----------------------------------------------------------------*/
  1264.     UI_character_type s[16];
  1265.     stFontAttribute *f = (UI_font_type) (current_MMI_theme->title_text_font);
  1266.     S32 l, character_height;
  1267.     /*----------------------------------------------------------------*/
  1268.     /* Code Body                                                      */
  1269.     /*----------------------------------------------------------------*/
  1270.     if (MMI_disable_title_shortcut_display)
  1271.     {
  1272.         return;
  1273.     }
  1274.     if (MMI_menu_shortcut_number <= 0)
  1275.     {
  1276.         return;
  1277.     }
  1278.     gdi_layer_push_text_clip();
  1279.     gui_itoa(MMI_menu_shortcut_number, (UI_string_type) s, 10);
  1280.     gui_set_font(f);
  1281.     gdi_layer_set_text_clip(
  1282.         MMI_title_x,
  1283.         MMI_title_y,
  1284.         MMI_title_x + MMI_title_width - 1,
  1285.         MMI_title_y + MMI_title_height - 1);
  1286.     gui_set_text_color(current_shortcut_box_theme->normal_text_color);
  1287.     if (current_shortcut_box_theme->use_border)
  1288.     {
  1289.         gui_set_text_border_color(current_shortcut_box_theme->normal_text_border_color);
  1290.     }
  1291.     gui_measure_string((UI_string_type) s, &l, &character_height);
  1292.     if (!r2lMMIFlag)
  1293.     {
  1294.     #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  1295.         if (GetActiveScreenId() == MAIN_MENU_SCREENID)
  1296.         {
  1297.             gui_move_text_cursor(
  1298.                 MMI_title_x + MMI_title_width - l - MMI_SHORTCUT_TEXT_BORDER_X_GAP,
  1299.                 MMI_title_y + ((MMI_title_height) - (character_height + TITLE_TEXT_GAP)));
  1300.         }
  1301.         else
  1302.     #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
  1303.         {
  1304.             gui_move_text_cursor(
  1305.                 MMI_title_x + MMI_title_width - l - MMI_SHORTCUT_TEXT_BORDER_X_GAP,
  1306.                 MMI_title_y + ((MMI_title_height >> 1) - (character_height >> 1)));
  1307.         }
  1308.     }
  1309.     else
  1310.     {
  1311.     #ifdef __MMI_UI_TECHNO_STATUS_ICON__
  1312.         if (GetActiveScreenId() == MAIN_MENU_SCREENID)
  1313.         {
  1314.             gui_move_text_cursor(
  1315.                 MMI_title_x + MMI_SHORTCUT_TEXT_BORDER_X_GAP + l,
  1316.                 MMI_title_y + ((MMI_title_height) - (character_height + TITLE_TEXT_GAP)));
  1317.         }
  1318.         else
  1319.     #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */ 
  1320.         {
  1321.             gui_move_text_cursor(
  1322.                 MMI_title_x + MMI_SHORTCUT_TEXT_BORDER_X_GAP + l,
  1323.                 MMI_title_y + ((MMI_title_height >> 1) - (character_height >> 1)));
  1324.         }
  1325.     }
  1326.     gui_set_line_height(character_height);
  1327.     if (current_shortcut_box_theme->use_border)
  1328.     {
  1329.         gui_print_bordered_text(s);
  1330.     }
  1331.     else
  1332.     {
  1333.         gui_print_text(s);
  1334.     }
  1335.     gui_pop_text_clip();
  1336. }
  1337. /*****************************************************************************
  1338.  * FUNCTION
  1339.  *  gui_redraw_menu_shortcut
  1340.  * DESCRIPTION
  1341.  *  Displays the shortcut number of the highlighted item
  1342.  * PARAMETERS
  1343.  *  void
  1344.  * RETURNS
  1345.  *  void
  1346.  *****************************************************************************/
  1347. void gui_redraw_menu_shortcut(void)
  1348. {
  1349.     /*----------------------------------------------------------------*/
  1350.     /* Local Variables                                                */
  1351.     /*----------------------------------------------------------------*/
  1352.     /* PMT VIKAS START 20051209 */
  1353. #ifdef TITLE_TRANSITION_WITH_PREVIOUS_TITLE_MOVEMENT
  1354.     S32 temp_menu_shortcut;
  1355. #endif 
  1356.     /*----------------------------------------------------------------*/
  1357.     /* Code Body                                                      */
  1358.     /*----------------------------------------------------------------*/
  1359.     /* PMT VIKAS END 20051209 */
  1360.     gdi_layer_lock_frame_buffer();
  1361.     gui_hide_menu_shortcut();
  1362.     /* PMT VIKAS START 20051209 */
  1363. #ifdef TITLE_TRANSITION_WITH_PREVIOUS_TITLE_MOVEMENT
  1364.     if (get_prev_menu_shortcut() != -1)
  1365.     {
  1366.         temp_menu_shortcut = MMI_menu_shortcut_number;
  1367.         MMI_menu_shortcut_number = get_prev_menu_shortcut();
  1368.     }
  1369. #endif /* TITLE_TRANSITION_WITH_PREVIOUS_TITLE_MOVEMENT */ 
  1370.     /* PMT VIKAS END 20051209 */
  1371.     show_menu_shortcut();
  1372.     /* PMT VIKAS START 20051209 */
  1373. #ifdef TITLE_TRANSITION_WITH_PREVIOUS_TITLE_MOVEMENT
  1374.     if (get_prev_menu_shortcut() != -1)
  1375.     {
  1376.         MMI_menu_shortcut_number = temp_menu_shortcut;
  1377.         reset_prev_menu_shortcut();
  1378.     }
  1379. #endif /* TITLE_TRANSITION_WITH_PREVIOUS_TITLE_MOVEMENT */ 
  1380.     /* PMT VIKAS END 20051209 */
  1381.     gdi_layer_unlock_frame_buffer();
  1382.     if (r2lMMIFlag)
  1383.     {
  1384.         gdi_layer_blt_previous(
  1385.             MMI_title_x,
  1386.             MMI_menu_shortcut_box.y,
  1387.             MMI_title_x + MMI_menu_shortcut_box.width - 1,
  1388.             MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1);
  1389.     }
  1390.     else
  1391.     {
  1392.         gdi_layer_blt_previous(
  1393.             MMI_menu_shortcut_box.x,
  1394.             MMI_menu_shortcut_box.y,
  1395.             MMI_menu_shortcut_box.x + MMI_menu_shortcut_box.width,
  1396.             MMI_menu_shortcut_box.y + MMI_menu_shortcut_box.height - 1);
  1397.     }
  1398. }