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

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_categories_demo.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   Maui_Software
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  Temporarily unused categories.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  *------------------------------------------------------------------------------
  72.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  73.  *============================================================================
  74.  ****************************************************************************/
  75. /*****************************************************************************
  76.  * FUNCTION
  77.  *  RedrawCategory3Screen
  78.  * DESCRIPTION
  79.  *  Redraws the category3 screen
  80.  * PARAMETERS
  81.  *  void
  82.  * RETURNS
  83.  *  void
  84.  *****************************************************************************/
  85. void RedrawCategory3Screen(void)
  86. {
  87.     /*----------------------------------------------------------------*/
  88.     /* Local Variables                                                */
  89.     /*----------------------------------------------------------------*/
  90.     /*----------------------------------------------------------------*/
  91.     /* Code Body                                                      */
  92.     /*----------------------------------------------------------------*/
  93. #if(UI_DOUBLE_BUFFER_SUPPORT)
  94.     gui_lock_double_buffer();
  95. #endif 
  96.     clear_buttonbar();
  97.     draw_title();
  98.     show_fixed_list();
  99.     show_softkey_background();
  100.     show_left_softkey();
  101.     show_right_softkey();
  102. #if(UI_DOUBLE_BUFFER_SUPPORT)
  103.     gui_unlock_double_buffer();
  104.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  105. #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
  106. }
  107. /*****************************************************************************
  108.  * FUNCTION
  109.  *  ShowCategory3Screen
  110.  * DESCRIPTION
  111.  *  Redraws the category3 screen
  112.  * PARAMETERS
  113.  *  title                   [IN]        Title for the screen
  114.  *  title_icon              [IN]        Icon shown with the title
  115.  *  left_softkey            [IN]        Left softkey label
  116.  *  left_softkey_icon       [IN]        Icon for the left softkey
  117.  *  right_softkey           [IN]        Right softkey label
  118.  *  right_softkey_icon      [IN]        Icon for the right softkey
  119.  *  number_of_items         [IN]        Number of items
  120.  *  list_of_items           [IN]        List of text items (Each row has one
  121.  *  list_of_icons1          [IN]        Icon list (there are 5 icon columns)
  122.  *  list_of_icons2          [IN]        List for second column of icons
  123.  *  list_of_icons3          [IN]        List for third column of icons
  124.  *  list_of_icons4          [IN]        List for fourth column of icons
  125.  *  list_of_icons5          [IN]        List for fifth column of icons
  126.  *  highlighted_item        [IN]        Item to be highlighted by default (if there is no history)
  127.  *  history_buffer          [IN]        History buffer
  128.  *  text(?)                 [IN]        Column) Note: This is an array of
  129.  *  strings(?)              [IN]        And not string IDs.
  130.  * RETURNS
  131.  *  void
  132.  *****************************************************************************/
  133. void ShowCategory3Screen(
  134.         U16 title,
  135.         U16 title_icon,
  136.         U16 left_softkey,
  137.         U16 left_softkey_icon,
  138.         U16 right_softkey,
  139.         U16 right_softkey_icon,
  140.         S32 number_of_items,
  141.         U8 **list_of_items,
  142.         U16 *list_of_icons1,
  143.         U16 *list_of_icons2,
  144.         U16 *list_of_icons3,
  145.         U16 *list_of_icons4,
  146.         U16 *list_of_icons5,
  147.         S32 highlighted_item,
  148.         U8 *history_buffer)
  149. {
  150.     /*----------------------------------------------------------------*/
  151.     /* Local Variables                                                */
  152.     /*----------------------------------------------------------------*/
  153.     S32 i, shortcut_width, text_width;
  154.     U8 h_flag;
  155.     /*----------------------------------------------------------------*/
  156.     /* Code Body                                                      */
  157.     /*----------------------------------------------------------------*/
  158.     ADD_SCREEN_STRINGS((3, title, left_softkey, right_softkey));
  159.     ADD_SCREEN_IMAGES((3, title_icon, left_softkey_icon, right_softkey_icon));
  160.     APPEND_SCREEN_IMAGE_LIST(number_of_items, (U16*) list_of_icons1);
  161.     APPEND_SCREEN_IMAGE_LIST(number_of_items, (U16*) list_of_icons2);
  162.     APPEND_SCREEN_IMAGE_LIST(number_of_items, (U16*) list_of_icons3);
  163.     APPEND_SCREEN_IMAGE_LIST(number_of_items, (U16*) list_of_icons4);
  164.     APPEND_SCREEN_IMAGE_LIST(number_of_items, (U16*) list_of_icons5);
  165.     /* ADD_SCREEN_MENUS((1,1000)); */
  166. #if(UI_DOUBLE_BUFFER_SUPPORT)
  167.     gui_lock_double_buffer();
  168. #endif 
  169.     MMI_menu_shortcut_number = -1;
  170.     clear_category_screen_key_handlers();
  171.     resize_fixed_list(MMI_content_width, MMI_content_height + 2);
  172.     /* MTK Leo added, to hide icon on BW_MMI */
  173. #ifdef __BW_MMI__
  174.     create_fixed_icontext_list_menuitems(1, 0);
  175.     text_width = (UI_device_width - MMI_fixed_list_menu.vbar.width);
  176.     set_fixed_icontext_list_text_coordinates(0, 2, 0, text_width, MMI_MENUITEM_HEIGHT);
  177.     associate_fixed_icontext_list_list();
  178.     for (i = 0; i < number_of_items; i++)
  179.     {
  180.         fixed_icontext_list_item_insert(i);
  181.         add_fixed_icontext_list_item_text(i, 0, (UI_string_type) list_of_items[i]);
  182.     }
  183. #else /* __BW_MMI__ */ 
  184.     create_fixed_icontext_list_menuitems(1, 5);
  185.     text_width = (UI_device_width - MMI_fixed_list_menu.vbar.width - 57);
  186.     set_fixed_icontext_list_text_coordinates(0, 2, 0, text_width, 18);
  187.     set_fixed_icontext_list_icon_coordinates(0, text_width + 0, 0, 9, 18);
  188.     set_fixed_icontext_list_icon_coordinates(1, text_width + 10, 0, 9, 18);
  189.     set_fixed_icontext_list_icon_coordinates(2, text_width + 20, 0, 9, 18);
  190.     set_fixed_icontext_list_icon_coordinates(3, text_width + 30, 0, 9, 18);
  191.     set_fixed_icontext_list_icon_coordinates(4, text_width + 40, 0, 9, 18);
  192.     associate_fixed_icontext_list_list();
  193.     for (i = 0; i < number_of_items; i++)
  194.     {
  195.         fixed_icontext_list_item_insert(i);
  196.         add_fixed_icontext_list_item_text(i, 0, (UI_string_type) list_of_items[i]);
  197.         add_fixed_icontext_list_item_icon(i, 0, get_image(list_of_icons1[i]));
  198.         add_fixed_icontext_list_item_icon(i, 1, get_image(list_of_icons2[i]));
  199.         add_fixed_icontext_list_item_icon(i, 2, get_image(list_of_icons3[i]));
  200.         add_fixed_icontext_list_item_icon(i, 3, get_image(list_of_icons4[i]));
  201.         add_fixed_icontext_list_item_icon(i, 4, get_image(list_of_icons5[i]));
  202.     }
  203. #endif /* __BW_MMI__ */ 
  204.     MMI_current_menu_type = LIST_MENU;
  205.     register_fixed_list_shortcut_handler();
  206.     register_fixed_list_keys();
  207.     shortcut_width = set_menu_item_count(number_of_items) + 7;
  208.     resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  209.     move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, 0);
  210.     register_hide_menu_shortcut(draw_title);
  211.     move_fixed_list(0, MMI_title_height);
  212.     resize_fixed_list(MMI_content_width, MMI_content_height + 2);
  213.     resize_fixed_list_to_content_height();
  214.     register_fixed_list_highlight_handler(standard_list_highlight_handler);
  215.     change_left_softkey(left_softkey, left_softkey_icon);
  216.     change_right_softkey(right_softkey, right_softkey_icon);
  217.     clear_left_softkey();
  218.     clear_right_softkey();
  219.     register_left_softkey_handler();
  220.     register_right_softkey_handler();
  221.     register_default_hide_softkeys();
  222.     MMI_title_string = (UI_string_type) get_string(title);
  223.     MMI_title_icon = (PU8) get_image(title_icon);
  224.     /* MTK Leo added, to set text align on BW_MMI */
  225. #ifdef __BW_MMI__
  226.     MMI_fixed_icontext_list_menuitem.flags |= UI_MENUITEM_LEFT_JUSTIFY;
  227. #else 
  228.     MMI_fixed_icontext_list_menuitem.flags |= UI_MENUITEM_RIGHT_JUSTIFY;
  229. #endif 
  230.     /* MTK Leo end */
  231.     h_flag = set_list_menu_category_history(MMI_CATEGORY3_ID, history_buffer);
  232.     if (h_flag)
  233.     {
  234.         fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  235.     }
  236.     else
  237.     {
  238.         fixed_list_goto_item_no_redraw(highlighted_item);
  239.     }
  240.     resize_fixed_icontext_list_menuitems_to_list_width();
  241. #if(UI_DOUBLE_BUFFER_SUPPORT)
  242.     gui_unlock_double_buffer();
  243. #endif 
  244.     ExitCategoryFunction = ExitCategory3Screen;
  245.     RedrawCategoryFunction = RedrawCategory3Screen;
  246.     GetCategoryHistory = GetCategory3History;
  247.     GetCategoryHistorySize = GetCategory3HistorySize;
  248.     RedrawCategory3Screen();
  249. }
  250. /*****************************************************************************
  251.  * FUNCTION
  252.  *  ExitCategory3Screen
  253.  * DESCRIPTION
  254.  *  Exits the category3 screen
  255.  * PARAMETERS
  256.  *  void
  257.  * RETURNS
  258.  *  void
  259.  *****************************************************************************/
  260. void ExitCategory3Screen(void)
  261. {
  262.     /*----------------------------------------------------------------*/
  263.     /* Local Variables                                                */
  264.     /*----------------------------------------------------------------*/
  265.     /*----------------------------------------------------------------*/
  266.     /* Code Body                                                      */
  267.     /*----------------------------------------------------------------*/
  268.     ClearHighlightHandler();
  269.     reset_softkeys();
  270.     reset_menu_shortcut_handler();
  271.     reset_fixed_list();
  272.     ExitCategoryFunction = MMI_dummy_function;
  273.     RedrawCategoryFunction = MMI_dummy_function;
  274.     GetCategoryHistory = dummy_get_history;
  275.     GetCategoryHistorySize = dummy_get_history_size;
  276. }
  277. /*****************************************************************************
  278.  * FUNCTION
  279.  *  GetCategory3HistorySize
  280.  * DESCRIPTION
  281.  *  Gets the size of the history buffer for the category3 screen
  282.  * PARAMETERS
  283.  *  void
  284.  * RETURNS
  285.  *  size of history buffer in U8s
  286.  *****************************************************************************/
  287. S32 GetCategory3HistorySize(void)
  288. {
  289.     /*----------------------------------------------------------------*/
  290.     /* Local Variables                                                */
  291.     /*----------------------------------------------------------------*/
  292.     /*----------------------------------------------------------------*/
  293.     /* Code Body                                                      */
  294.     /*----------------------------------------------------------------*/
  295.     return (sizeof(list_menu_category_history));
  296. }
  297. /*****************************************************************************
  298.  * FUNCTION
  299.  *  GetCategory3History
  300.  * DESCRIPTION
  301.  *  Gets the history buffer for the category3 screen
  302.  * PARAMETERS
  303.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  304.  * RETURNS
  305.  *  pointer to the history buffer
  306.  *****************************************************************************/
  307. U8 *GetCategory3History(U8 *history_buffer)
  308. {
  309.     /*----------------------------------------------------------------*/
  310.     /* Local Variables                                                */
  311.     /*----------------------------------------------------------------*/
  312.     /*----------------------------------------------------------------*/
  313.     /* Code Body                                                      */
  314.     /*----------------------------------------------------------------*/
  315.     get_list_menu_category_history(MMI_CATEGORY3_ID, history_buffer);
  316.     return (history_buffer);
  317. }
  318. /*****************************************************************************
  319.  * FUNCTION
  320.  *  RedrawCategory4Screen
  321.  * DESCRIPTION
  322.  *  Redraws the category4 screen
  323.  * PARAMETERS
  324.  *  void
  325.  * RETURNS
  326.  *  void
  327.  *****************************************************************************/
  328. void RedrawCategory4Screen(void)
  329. {
  330.     /*----------------------------------------------------------------*/
  331.     /* Local Variables                                                */
  332.     /*----------------------------------------------------------------*/
  333.     color c;
  334.     stFontAttribute f = UI_DEFAULT_FONT;
  335.     /*----------------------------------------------------------------*/
  336.     /* Code Body                                                      */
  337.     /*----------------------------------------------------------------*/
  338. #if(UI_DOUBLE_BUFFER_SUPPORT)
  339.     gui_lock_double_buffer();
  340. #endif 
  341.     MMI_menu_shortcut_number = -1;
  342.     clear_screen();
  343.     draw_title();
  344.     gui_set_clip(0, 0, UI_device_width - 1, UI_device_height - 1);
  345.     gui_set_text_clip(0, 0, UI_device_width - 1, UI_device_height - 1);
  346.     c.r = 0;
  347.     c.g = 0;
  348.     c.b = 0;
  349.     c.alpha = 100;
  350.     gui_set_font(&f);
  351.     gui_set_text_color(c);
  352.     show_fixed_list();
  353.     show_softkey_background();
  354.     /* CODE ADDED VANDANA MEHTANI 13 JUNE */
  355.     show_left_softkey();
  356.     /* CODE ENDED VANDANA MEHTANI */
  357.     show_right_softkey();
  358. #if(UI_DOUBLE_BUFFER_SUPPORT)
  359.     gui_unlock_double_buffer();
  360.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  361. #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
  362. }
  363. /*****************************************************************************
  364.  * FUNCTION
  365.  *  Cat4_fixed_list_previous
  366.  * DESCRIPTION
  367.  *  move to previous menu item
  368.  * PARAMETERS
  369.  *  void
  370.  * RETURNS
  371.  *  void
  372.  *****************************************************************************/
  373. void Cat4_fixed_list_previous(void)
  374. {
  375.     /*----------------------------------------------------------------*/
  376.     /* Local Variables                                                */
  377.     /*----------------------------------------------------------------*/
  378.     /*----------------------------------------------------------------*/
  379.     /* Code Body                                                      */
  380.     /*----------------------------------------------------------------*/
  381.     if (MMI_fixed_list_menu.highlighted_item > MMI_fixed_list_menu.first_displayed_item)
  382.     {
  383.         MMI_fixed_list_menu.highlighted_item = MMI_fixed_list_menu.first_displayed_item;
  384.     }
  385.     fixed_list_goto_previous_item();
  386. }
  387. /*****************************************************************************
  388.  * FUNCTION
  389.  *  Cat4_fixed_list_next
  390.  * DESCRIPTION
  391.  *  move to next  menu item
  392.  * PARAMETERS
  393.  *  void
  394.  * RETURNS
  395.  *  void
  396.  *****************************************************************************/
  397. void Cat4_fixed_list_next(void)
  398. {
  399.     /*----------------------------------------------------------------*/
  400.     /* Local Variables                                                */
  401.     /*----------------------------------------------------------------*/
  402.     /*----------------------------------------------------------------*/
  403.     /* Code Body                                                      */
  404.     /*----------------------------------------------------------------*/
  405.     if (MMI_fixed_list_menu.highlighted_item < MMI_fixed_list_menu.last_displayed_item)
  406.     {
  407.         MMI_fixed_list_menu.highlighted_item = MMI_fixed_list_menu.last_displayed_item;
  408.     }
  409.     fixed_list_goto_next_item();
  410. }
  411. /*****************************************************************************
  412.  * FUNCTION
  413.  *  Cat4_fixed_list_key_handler
  414.  * DESCRIPTION
  415.  *  handle up and down key of fixed menu list
  416.  * PARAMETERS
  417.  *  vkey_code       [IN]        Key code
  418.  *  key_state       [IN]        Key state
  419.  * RETURNS
  420.  *  void
  421.  *****************************************************************************/
  422. void Cat4_fixed_list_key_handler(S32 vkey_code, S32 key_state)
  423. {
  424. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  425.     /*----------------------------------------------------------------*/
  426.     /* Local Variables                                                */
  427.     /*----------------------------------------------------------------*/
  428.     /*----------------------------------------------------------------*/
  429.     /* Code Body                                                      */
  430.     /*----------------------------------------------------------------*/
  431.     if (key_state)
  432.     {
  433.         switch (vkey_code)
  434.         {
  435.             case 38:
  436.                 Cat4_fixed_list_previous();
  437.                 break;
  438.             case 40:
  439.                 Cat4_fixed_list_next();
  440.                 break;
  441.         }
  442.     }
  443. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  444.     UI_UNUSED_PARAMETER(vkey_code);
  445.     UI_UNUSED_PARAMETER(key_state);
  446. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  447. }
  448. /*****************************************************************************
  449.  * FUNCTION
  450.  *  register_Cat4_fixed_list_keys
  451.  * DESCRIPTION
  452.  *  set key handlers of fixed menu list
  453.  * PARAMETERS
  454.  *  void
  455.  * RETURNS
  456.  *  void
  457.  *****************************************************************************/
  458. void register_Cat4_fixed_list_keys(void)
  459. {
  460.     /*----------------------------------------------------------------*/
  461.     /* Local Variables                                                */
  462.     /*----------------------------------------------------------------*/
  463.     /*----------------------------------------------------------------*/
  464.     /* Code Body                                                      */
  465.     /*----------------------------------------------------------------*/
  466.     register_keyboard_key_handler(Cat4_fixed_list_key_handler);
  467.     SetKeyHandler(Cat4_fixed_list_previous, KEY_UP_ARROW, KEY_EVENT_DOWN);
  468.     SetKeyHandler(Cat4_fixed_list_next, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  469.     SetKeyHandler(Cat4_fixed_list_previous, KEY_VOL_UP, KEY_EVENT_DOWN);
  470.     SetKeyHandler(Cat4_fixed_list_next, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  471. }
  472. /*****************************************************************************
  473.  * FUNCTION
  474.  *  Cat4_hide_fixed_list
  475.  * DESCRIPTION
  476.  *  hide fixed list
  477.  * PARAMETERS
  478.  *  void
  479.  * RETURNS
  480.  *  void
  481.  *****************************************************************************/
  482. void Cat4_hide_fixed_list(void)
  483. {
  484.     /*----------------------------------------------------------------*/
  485.     /* Local Variables                                                */
  486.     /*----------------------------------------------------------------*/
  487.     color c = gui_color(255, 255, 255);
  488.     /*----------------------------------------------------------------*/
  489.     /* Code Body                                                      */
  490.     /*----------------------------------------------------------------*/
  491.     gui_reset_clip();
  492.     gui_fill_rectangle(
  493.         MMI_fixed_list_menu.x,
  494.         MMI_fixed_list_menu.y,
  495.         MMI_fixed_list_menu.x + MMI_fixed_list_menu.width - 1,
  496.         MMI_fixed_list_menu.y + MMI_fixed_list_menu.height - 1,
  497.         c);
  498. }
  499. /*****************************************************************************
  500.  * FUNCTION
  501.  *  ShowCategory4Screen
  502.  * DESCRIPTION
  503.  *  Displays the category4 screen
  504.  * PARAMETERS
  505.  *  title                   [IN]        Title for the screen
  506.  *  title_icon              [IN]        Icon shown with the title
  507.  *  left_softkey            [IN]        
  508.  *  left_softkey_icon       [IN]        
  509.  *  right_softkey           [IN]        Right softkey label
  510.  *  right_softkey_icon      [IN]        Icon for the right softkey
  511.  *  number_of_items         [IN]        Number of items
  512.  *  list_of_items           [IN]        
  513.  *  list_of_icons           [IN]        List of icon items (Each row has one icon item)
  514.  *  history_buffer          [IN]        History buffer
  515.  *  STRING(?)               [IN]        *     list_of_text_items,  List of text items (Each row has one text item).
  516.  *  Note(?)                 [IN]        These are strings and not string IDs.
  517.  * RETURNS
  518.  *  void
  519.  *****************************************************************************/
  520. void ShowCategory4Screen(
  521.         U16 title,
  522.         U16 title_icon,
  523.         U16 left_softkey,
  524.         U16 left_softkey_icon,
  525.         U16 right_softkey,
  526.         U16 right_softkey_icon,
  527.         S32 number_of_items,
  528.         U8 **list_of_items,
  529.         U16 *list_of_icons,
  530.         U8 *history_buffer)
  531. {
  532.     /*----------------------------------------------------------------*/
  533.     /* Local Variables                                                */
  534.     /*----------------------------------------------------------------*/
  535.     S32 i;
  536.     /*----------------------------------------------------------------*/
  537.     /* Code Body                                                      */
  538.     /*----------------------------------------------------------------*/
  539.     ADD_SCREEN_STRINGS((2, title, right_softkey));
  540.     ADD_SCREEN_IMAGES((2, title_icon, right_softkey_icon));
  541.     APPEND_SCREEN_IMAGE_LIST(number_of_items, (U16*) list_of_icons);
  542.     UI_UNUSED_PARAMETER(history_buffer);
  543. #if(UI_DOUBLE_BUFFER_SUPPORT)
  544.     gui_lock_double_buffer();
  545. #endif 
  546.     MMI_menu_shortcut_number = -1;
  547.     clear_category_screen_key_handlers();
  548.     /* CODE ADDED VANDANA MEHTANI 13 JUNE */
  549.     change_left_softkey(left_softkey, left_softkey_icon);
  550.     /* CODE ENDED VANDANA MEHTANI */
  551.     change_right_softkey(right_softkey, right_softkey_icon);
  552.     clear_left_softkey();
  553.     clear_right_softkey();
  554.     /* CODE ADDED VANDANA MEHTANI 13 JUNE */
  555.     register_left_softkey_handler();
  556.     /* CODE ENDED VANDANA MEHTANI */
  557.     register_right_softkey_handler();
  558.     register_default_hide_softkeys();
  559.     MMI_title_string = (UI_string_type) get_string(title);
  560.     MMI_title_icon = (PU8) get_image(title_icon);
  561.     create_fixed_icontext_menuitems();
  562.     resize_fixed_list(MMI_content_width, MMI_content_height + 6);
  563.     associate_fixed_icontext_list();
  564.     for (i = 0; i < number_of_items; i++)
  565.     {
  566.         /* MTK Leo added, not display icon on BW_MMI */
  567.     #ifdef __BW_MMI__
  568.         add_fixed_icontext_item((UI_string_type) list_of_items[i], get_image(0));
  569.     #else 
  570.         add_fixed_icontext_item((UI_string_type) list_of_items[i], get_image(list_of_icons[i]));
  571.     #endif 
  572.         /* MTK Leo end */
  573.     }
  574.     MMI_disable_title_shortcut_display = 1;
  575.     MMI_current_menu_type = LIST_MENU;
  576.     /* fixed_list_disable_looping(); */
  577.     /* code added vandana m */
  578.     /* register_Cat4_fixed_list_keys(); */
  579.     register_fixed_list_keys();
  580.     /* code ended vandanam */
  581.     move_fixed_list(0, MMI_title_height);
  582.     resize_fixed_list(MMI_content_width, MMI_content_height + 6);
  583.     gui_move_vertical_scrollbar(&MMI_fixed_list_menu.vbar, MMI_fixed_list_menu.vbar.x - 3, MMI_fixed_list_menu.vbar.y);
  584.     register_fixed_list_highlight_handler(standard_list_highlight_handler);
  585.     MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_BACKGROUND;
  586.     register_hide_fixed_list(Cat4_hide_fixed_list);
  587.     /* MMI_fixed_icontext_menuitem.flags|=UI_MENUITEM_DISABLE_HIGHLIGHT; */
  588.     set_list_menu_category_history(MMI_CATEGORY6_ID, history_buffer);
  589.     set_fixed_icontext_positions(18, 0, 1, 0);
  590.     resize_fixed_list_to_content_height();
  591.     fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  592.     resize_fixed_icontext_menuitems_to_list_width();
  593. #if(UI_DOUBLE_BUFFER_SUPPORT)
  594.     gui_unlock_double_buffer();
  595. #endif 
  596.     ExitCategoryFunction = ExitCategory4Screen;
  597.     RedrawCategoryFunction = RedrawCategory4Screen;
  598.     GetCategoryHistory = GetCategory4History;
  599.     GetCategoryHistorySize = GetCategory4HistorySize;
  600.     RedrawCategory4Screen();
  601. }
  602. /*****************************************************************************
  603.  * FUNCTION
  604.  *  ExitCategory4Screen
  605.  * DESCRIPTION
  606.  *  Exits the category4 screen
  607.  * PARAMETERS
  608.  *  void
  609.  * RETURNS
  610.  *  void
  611.  *****************************************************************************/
  612. void ExitCategory4Screen(void)
  613. {
  614.     /*----------------------------------------------------------------*/
  615.     /* Local Variables                                                */
  616.     /*----------------------------------------------------------------*/
  617.     /*----------------------------------------------------------------*/
  618.     /* Code Body                                                      */
  619.     /*----------------------------------------------------------------*/
  620.     reset_fixed_list();
  621.     /* fixed_list_enable_looping(); */
  622.     ExitCategoryFunction = MMI_dummy_function;
  623.     RedrawCategoryFunction = MMI_dummy_function;
  624.     GetCategoryHistory = dummy_get_history;
  625.     GetCategoryHistorySize = dummy_get_history_size;
  626. }
  627. /*****************************************************************************
  628.  * FUNCTION
  629.  *  GetCategory4HistorySize
  630.  * DESCRIPTION
  631.  *  Gets the size of the history buffer for category4 screen
  632.  * PARAMETERS
  633.  *  void
  634.  * RETURNS
  635.  *  size in U8s of the history buffer
  636.  *****************************************************************************/
  637. S32 GetCategory4HistorySize(void)
  638. {
  639.     /*----------------------------------------------------------------*/
  640.     /* Local Variables                                                */
  641.     /*----------------------------------------------------------------*/
  642.     /*----------------------------------------------------------------*/
  643.     /* Code Body                                                      */
  644.     /*----------------------------------------------------------------*/
  645.     return (0);
  646. }
  647. /*****************************************************************************
  648.  * FUNCTION
  649.  *  GetCategory4History
  650.  * DESCRIPTION
  651.  *  Gets the history buffer for category4 screen
  652.  * PARAMETERS
  653.  *  history_buffer      [IN]        Is the buffer where the history data is to be stored (pre-allocated)
  654.  * RETURNS
  655.  *  pointer to the history buffer
  656.  *****************************************************************************/
  657. U8 *GetCategory4History(U8 *history_buffer)
  658. {
  659.     /*----------------------------------------------------------------*/
  660.     /* Local Variables                                                */
  661.     /*----------------------------------------------------------------*/
  662.     /*----------------------------------------------------------------*/
  663.     /* Code Body                                                      */
  664.     /*----------------------------------------------------------------*/
  665.     return (history_buffer);
  666. }
  667. /*****************************************************************************
  668.  * FUNCTION
  669.  *  RedrawCategory10Value
  670.  * DESCRIPTION
  671.  *  Redraws the category10 screen
  672.  * PARAMETERS
  673.  *  void
  674.  * RETURNS
  675.  *  void
  676.  *****************************************************************************/
  677. #define MAX_CATEGORY_10_VALUE_STRINGS     10
  678. UI_string_type MMI_singleline_display_strings[MAX_CATEGORY_10_VALUE_STRINGS];
  679. S32 Cat10ValueIndex = 0;
  680. void RedrawCategory10Value(void)
  681. {
  682.     /*----------------------------------------------------------------*/
  683.     /* Local Variables                                                */
  684.     /*----------------------------------------------------------------*/
  685.     stFontAttribute f = UI_DEFAULT_FONT;
  686.     color c = gui_color(255, 255, 255);
  687.     S32 w, y = MMI_fixed_list_menu.y + MMI_fixed_list_menu.height + 16;
  688.     UI_string_type s;
  689.     /*----------------------------------------------------------------*/
  690.     /* Code Body                                                      */
  691.     /*----------------------------------------------------------------*/
  692.     if ((Cat10ValueIndex < 0) || (Cat10ValueIndex > MMI_fixed_list_menu.n_items - 1))
  693.     {
  694.         Cat10ValueIndex = 0;
  695.     }
  696.     s = MMI_singleline_display_strings[Cat10ValueIndex];
  697.     gui_reset_text_clip();
  698.     w = gui_get_string_width(s);
  699.     gui_set_clip(2, y, UI_device_width - 2, y + 20);
  700.     gui_draw_filled_area(
  701.         0,
  702.         MMI_title_height,
  703.         UI_device_width - 1,
  704.         MMI_title_height + MMI_content_height - 1,
  705.         MMI_fixed_list_menu.normal_filler);
  706.     /* MTK Elvis for R2L characters */
  707.     if (r2lMMIFlag)
  708.     {
  709.         gui_move_text_cursor((UI_device_width >> 1) - (w >> 1) + w, y);
  710.     }
  711.     else
  712.     {
  713.         gui_move_text_cursor((UI_device_width >> 1) - (w >> 1), y);
  714.     }
  715.     /* MTk end */
  716.     gui_set_font(&f);
  717.     c = gui_color(0, 0, 0);
  718.     gui_set_text_color(c);
  719.     gui_print_text(s);
  720. #if(UI_DOUBLE_BUFFER_SUPPORT)
  721.     gui_BLT_double_buffer(0, y, UI_device_width - 1, y + 20);
  722. #endif 
  723. }
  724. /*****************************************************************************
  725.  * FUNCTION
  726.  *  RedrawCategory10Screen
  727.  * DESCRIPTION
  728.  *  
  729.  * PARAMETERS
  730.  *  void
  731.  * RETURNS
  732.  *  void
  733.  *****************************************************************************/
  734. void RedrawCategory10Screen(void)
  735. {
  736.     /*----------------------------------------------------------------*/
  737.     /* Local Variables                                                */
  738.     /*----------------------------------------------------------------*/
  739.     /*----------------------------------------------------------------*/
  740.     /* Code Body                                                      */
  741.     /*----------------------------------------------------------------*/
  742. #if(UI_DOUBLE_BUFFER_SUPPORT)
  743.     gui_lock_double_buffer();
  744. #endif 
  745.     clear_screen();
  746.     draw_title();
  747.     gui_reset_clip();
  748.     gui_draw_filled_area(
  749.         0,
  750.         MMI_title_height,
  751.         UI_device_width - 1,
  752.         MMI_title_height + MMI_content_height - 1,
  753.         MMI_fixed_list_menu.normal_filler);
  754.     gui_show_image(
  755.         MMI_fixed_list_menu.x + MMI_fixed_list_menu.width - 1,
  756.         MMI_fixed_list_menu.y,
  757.         get_image(THEME_0_SCROLL_UP_DOWN_IMAGE_ID));
  758.     show_fixed_list();
  759.     RedrawCategory10Value();
  760.     show_softkey_background();
  761.     show_left_softkey();
  762.     show_right_softkey();
  763. #if(UI_DOUBLE_BUFFER_SUPPORT)
  764.     gui_unlock_double_buffer();
  765.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  766. #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
  767. }
  768. /*****************************************************************************
  769.  * FUNCTION
  770.  *  Cat10_list_highlight_handler
  771.  * DESCRIPTION
  772.  *  System Highlight handler
  773.  * PARAMETERS
  774.  *  item_index      [IN]        
  775.  * RETURNS
  776.  *  void
  777.  *****************************************************************************/
  778. void Cat10_list_highlight_handler(S32 item_index)
  779. {
  780.     /*----------------------------------------------------------------*/
  781.     /* Local Variables                                                */
  782.     /*----------------------------------------------------------------*/
  783.     /*----------------------------------------------------------------*/
  784.     /* Code Body                                                      */
  785.     /*----------------------------------------------------------------*/
  786.     MMI_menu_shortcut_number = item_index + 1;
  787.     Cat10ValueIndex = item_index;
  788.     MMI_highlighted_item_text = get_item_text(item_index);
  789.     if (!menu_shortcut_handler_display)
  790.     {
  791.         gui_redraw_menu_shortcut();
  792.     }
  793.     RedrawCategory10Value();
  794.     MMI_list_highlight_handler(item_index);
  795. }
  796. /*****************************************************************************
  797.  * FUNCTION
  798.  *  ShowCategory10Screen
  799.  * DESCRIPTION
  800.  *  Displays the category10 screen
  801.  * PARAMETERS
  802.  *  title                   [IN]        Title for the screen
  803.  *  title_icon              [IN]        Icon shown with the title
  804.  *  left_softkey            [IN]        Left softkey label
  805.  *  left_softkey_icon       [IN]        Icon for the left softkey
  806.  *  right_softkey           [IN]        Right softkey label
  807.  *  right_softkey_icon      [IN]        Icon for the right softkey
  808.  *  number_of_items         [IN]        Number of items
  809.  *  list_of_items           [IN]        List of text items values
  810.  *  list_of_strings         [IN]        
  811.  *  highlighted_item        [IN]        
  812.  *  history_buffer          [IN]        History buffer
  813.  * RETURNS
  814.  *  void
  815.  *****************************************************************************/
  816. void ShowCategory10Screen(
  817.         U16 title,
  818.         U16 title_icon,
  819.         U16 left_softkey,
  820.         U16 left_softkey_icon,
  821.         U16 right_softkey,
  822.         U16 right_softkey_icon,
  823.         S32 number_of_items,
  824.         U16 *list_of_items,
  825.         U8 **list_of_strings,
  826.         S32 highlighted_item,
  827.         U8 *history_buffer)
  828. {
  829.     /*----------------------------------------------------------------*/
  830.     /* Local Variables                                                */
  831.     /*----------------------------------------------------------------*/
  832.     S32 i, j, shortcut_width;
  833.     U8 h_flag;
  834.     S32 item_height = 18;
  835.     /*----------------------------------------------------------------*/
  836.     /* Code Body                                                      */
  837.     /*----------------------------------------------------------------*/
  838.     ADD_SCREEN_STRINGS((3, title, left_softkey, right_softkey));
  839.     APPEND_SCREEN_STRING_LIST(number_of_items, (U16*) list_of_items);
  840.     ADD_SCREEN_IMAGES((3, title_icon, left_softkey_icon, right_softkey_icon));
  841. #if(UI_DOUBLE_BUFFER_SUPPORT)
  842.     gui_lock_double_buffer();
  843. #endif 
  844.     clear_category_screen_key_handlers();
  845.     resize_fixed_list(MMI_content_width - 12, item_height + 8);
  846.     MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_SCROLLBAR;
  847.     create_fixed_text_menuitems();
  848.     associate_fixed_text_list();
  849.     for (i = 0; i < number_of_items; i++)
  850.     {
  851.         MMI_singleline_display_strings[i] = (UI_string_type) list_of_strings[i];
  852.         add_fixed_text_item(get_string(list_of_items[i]));
  853.     }
  854.     j = gui_strlen(MMI_singleline_display_strings[0]) + 1;
  855.     MMI_current_menu_type = LIST_MENU;
  856.     register_fixed_list_shortcut_handler();
  857.     register_fixed_list_keys();
  858.     shortcut_width = set_menu_item_count(number_of_items) + 7;
  859.     resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  860.     move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, 0);
  861.     register_hide_menu_shortcut(draw_title);
  862.     move_fixed_list(0, MMI_title_height + 20);
  863.     resize_fixed_text_menuitems(0, item_height);
  864.     gui_resize_fixed_list_menu(&MMI_fixed_list_menu, MMI_content_width - 12, MMI_DROPDOWN_MENUITEM_HEIGHT + 4);
  865.     register_fixed_list_highlight_handler(Cat10_list_highlight_handler);
  866.     change_left_softkey(left_softkey, left_softkey_icon);
  867.     change_right_softkey(right_softkey, right_softkey_icon);
  868.     clear_left_softkey();
  869.     clear_right_softkey();
  870.     register_left_softkey_handler();
  871.     register_right_softkey_handler();
  872.     register_default_hide_softkeys();
  873.     MMI_title_string = (UI_string_type) get_string(title);
  874.     MMI_title_icon = (PU8) get_image(title_icon);
  875.     h_flag = set_list_menu_category_history(MMI_CATEGORY10_ID, history_buffer);
  876.     if (h_flag)
  877.     {
  878.         fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  879.     }
  880.     else
  881.     {
  882.         fixed_list_goto_item_no_redraw(highlighted_item);
  883.     }
  884. #if(UI_DOUBLE_BUFFER_SUPPORT)
  885.     gui_unlock_double_buffer();
  886. #endif 
  887.     ExitCategoryFunction = ExitCategory10Screen;
  888.     RedrawCategoryFunction = RedrawCategory10Screen;
  889.     GetCategoryHistory = GetCategory10History;
  890.     GetCategoryHistorySize = GetCategory10HistorySize;
  891.     RedrawCategory10Screen();
  892. }
  893. /*****************************************************************************
  894.  * FUNCTION
  895.  *  ExitCategory10Screen
  896.  * DESCRIPTION
  897.  *  Exits the category10 screen
  898.  * PARAMETERS
  899.  *  void
  900.  * RETURNS
  901.  *  void
  902.  *****************************************************************************/
  903. void ExitCategory10Screen(void)
  904. {
  905.     /*----------------------------------------------------------------*/
  906.     /* Local Variables                                                */
  907.     /*----------------------------------------------------------------*/
  908.     /*----------------------------------------------------------------*/
  909.     /* Code Body                                                      */
  910.     /*----------------------------------------------------------------*/
  911.     ClearHighlightHandler();
  912.     reset_softkeys();
  913.     reset_menu_shortcut_handler();
  914.     reset_fixed_list();
  915.     ExitCategoryFunction = MMI_dummy_function;
  916.     RedrawCategoryFunction = MMI_dummy_function;
  917.     GetCategoryHistory = dummy_get_history;
  918.     GetCategoryHistorySize = dummy_get_history_size;
  919. }
  920. /*****************************************************************************
  921.  * FUNCTION
  922.  *  GetCategory10HistorySize
  923.  * DESCRIPTION
  924.  *  Gets the history buffer size for category10 screen
  925.  * PARAMETERS
  926.  *  void
  927.  * RETURNS
  928.  *  size in U8s of the history buffer
  929.  *****************************************************************************/
  930. S32 GetCategory10HistorySize(void)
  931. {
  932.     /*----------------------------------------------------------------*/
  933.     /* Local Variables                                                */
  934.     /*----------------------------------------------------------------*/
  935.     /*----------------------------------------------------------------*/
  936.     /* Code Body                                                      */
  937.     /*----------------------------------------------------------------*/
  938.     return (sizeof(list_menu_category_history));
  939. }
  940. /*****************************************************************************
  941.  * FUNCTION
  942.  *  GetCategory10History
  943.  * DESCRIPTION
  944.  *  Gets the history buffer for category10 screen
  945.  * PARAMETERS
  946.  *  history_buffer      [IN]        Is a pointer to the buffer where the history data
  947.  *  is(?)               [IN]        To be stored      (pre-allocated)
  948.  * RETURNS
  949.  *  pointer to the history buffer
  950.  *****************************************************************************/
  951. U8 *GetCategory10History(U8 *history_buffer)
  952. {
  953.     /*----------------------------------------------------------------*/
  954.     /* Local Variables                                                */
  955.     /*----------------------------------------------------------------*/
  956.     /*----------------------------------------------------------------*/
  957.     /* Code Body                                                      */
  958.     /*----------------------------------------------------------------*/
  959.     get_list_menu_category_history(MMI_CATEGORY10_ID, history_buffer);
  960.     return (history_buffer);
  961. }
  962. #if defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__)
  963. /*****************************************************************************
  964.  * FUNCTION
  965.  *  RedrawCategory17Screen
  966.  * DESCRIPTION
  967.  *  Redraws the MO_call screen
  968.  * PARAMETERS
  969.  *  void
  970.  * RETURNS
  971.  *  void
  972.  *****************************************************************************/
  973. void RedrawCategory17Screen()
  974. {
  975.     /*----------------------------------------------------------------*/
  976.     /* Local Variables                                                */
  977.     /*----------------------------------------------------------------*/
  978.     UI_filled_area *bg_filler;
  979.     S32 image_width;
  980.     S32 image_height;
  981.     S32 image_offset_x;
  982.     S32 image_offset_y;
  983.     S32 string_width;
  984.     S32 string_height;
  985.     S32 string_offset_x;
  986.     /*----------------------------------------------------------------*/
  987.     /* Code Body                                                      */
  988.     /*----------------------------------------------------------------*/
  989.     gui_lock_double_buffer();
  990.     UI_set_main_LCD_graphics_context();
  991.     gui_hide_animations();
  992.     /* fill with theme background color */
  993.     bg_filler = current_MMI_theme->CM_screen_background_filler;
  994.     gui_reset_clip();
  995.     gui_draw_filled_area(0, 0, UI_device_width - 1, UI_device_height - 1, bg_filler);
  996.     show_status_icons();
  997. #ifndef __MMI_CM_SCREEN_HIDE_DATE_TIME__
  998.     if (wgui_image_clip_y1 == main_LCD_dt_object.time.y + main_LCD_dt_object.time.height + 2)
  999.     {
  1000.         CM_screens_draw_date_time_bar();
  1001.         show_main_LCD_dt_display();
  1002.     }
  1003. #endif /* __MMI_CM_SCREEN_HIDE_DATE_TIME__ */ 
  1004.     if (Painty1 == 1)   /* from id */
  1005.     {
  1006.         gui_set_clip(wgui_image_clip_x1, wgui_image_clip_y1, wgui_image_clip_x2, wgui_image_clip_y2);
  1007.         /* TODO, may apply to Justin's GDI resizer */
  1008.         /* currently align at center of clip region */
  1009.         gdi_image_get_dimension(_MMI_animated_icon, &image_width, &image_height);
  1010.         image_offset_x = (wgui_image_clip_x2 - wgui_image_clip_x1 - image_width) >> 1;
  1011.         image_offset_x += wgui_image_clip_x1;
  1012.         image_offset_y = (wgui_image_clip_y2 - wgui_image_clip_y1 - image_height) >> 1;
  1013.         image_offset_y += wgui_image_clip_y1 - 6;
  1014.         gdi_image_draw_animation(image_offset_x, image_offset_y, _MMI_animated_icon, NULL);
  1015.     }
  1016.     else if (Painty1 == 2)  /* from file */
  1017.     {
  1018.         gui_set_clip(wgui_image_clip_x1, wgui_image_clip_y1, wgui_image_clip_x2, wgui_image_clip_y2);
  1019.         gdi_image_get_dimension_file((PS8) _MMI_animated_icon_name, &image_width, &image_height);
  1020.         image_offset_x = (wgui_image_clip_x2 - wgui_image_clip_x1 - image_width) >> 1;
  1021.         image_offset_x += wgui_image_clip_x1;
  1022.         image_offset_y = (wgui_image_clip_y2 - wgui_image_clip_y1 - image_height) >> 1;
  1023.         image_offset_y += wgui_image_clip_y1;
  1024.         gdi_image_draw_file(image_offset_x, image_offset_y, (PS8) _MMI_animated_icon_name);
  1025.     }
  1026.     /* wgui_show_transparent_animation(); */
  1027.     if (MMI_message_string)
  1028.     {
  1029.         gui_set_font(current_MMI_theme->title_text_font);
  1030.         gui_measure_string(MMI_message_string, &string_width, &string_height);
  1031.         if (string_width < UI_device_width)
  1032.         {
  1033.             string_offset_x = (UI_device_width >> 1) - (string_width >> 1);
  1034.         }
  1035.         gui_set_text_clip(string_offset_x, CM_y, (UI_device_width - 1), (CM_y + string_height));
  1036.         gui_move_text_cursor(string_offset_x, CM_y);
  1037.         gui_show_scrolling_text(&CM_scrolling_text);
  1038.     }
  1039.     show_multiline_inputbox();  /* "Calling..." String */
  1040.     show_softkey_background();
  1041.     show_left_softkey();
  1042.     show_right_softkey();
  1043.     gui_unlock_double_buffer();
  1044.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1045. }
  1046. /*****************************************************************************
  1047.  * FUNCTION
  1048.  *  ShowCategory17Screen
  1049.  * DESCRIPTION
  1050.  *  Displays the MO_calling screen
  1051.  * PARAMETERS
  1052.  *  left_softkey                [IN]        Left softkey label
  1053.  *  left_softkey_icon           [IN]        Icon for the left softkey
  1054.  *  right_softkey               [IN]        Right softkey label
  1055.  *  right_softkey_icon          [IN]        Icon for the right softkey
  1056.  *  NotificationStringId        [IN]        
  1057.  *  NameOrNumber                [?]         
  1058.  *  imageId                     [IN]        
  1059.  *  image_file_pp               [IN]        
  1060.  *  history_buffer              [IN]        History buffer
  1061.  *  STRING(?)                   [IN]        *     Name or Number text, Name or Number text
  1062.  *  MMI_ID_TYPE(?)              [IN]        Image to be displayed   Picture tag associated eith the name
  1063.  * RETURNS
  1064.  *  void
  1065.  *****************************************************************************/
  1066. void ShowCategory17Screen(
  1067.         U16 left_softkey,
  1068.         U16 left_softkey_icon,
  1069.         U16 right_softkey,
  1070.         U16 right_softkey_icon,
  1071.         U16 NotificationStringId,
  1072.         U8 *NameOrNumber,
  1073.         U16 imageId,
  1074.         S8 **image_file_pp,
  1075.         U8 *history_buffer)
  1076. {
  1077.     /*----------------------------------------------------------------*/
  1078.     /* Local Variables                                                */
  1079.     /*----------------------------------------------------------------*/
  1080.     S32 y, iwidth, iheight, fh, ty2, h;
  1081.     S32 text_width;
  1082.     S32 text_height;
  1083.     S32 text_offset_x;
  1084.     S32 text_offset_y;
  1085.     S32 image_offset_x, image_offset_y;
  1086.     S32 image_spacing;
  1087.     S32 text_spaing;
  1088.     S32 str_len;
  1089.     UI_string_type str;
  1090.     PU8 image_ptr;
  1091.     S32 string_width, string_height;
  1092.     S32 image_width, image_height;
  1093.     S32 sw, sh;
  1094.     /*----------------------------------------------------------------*/
  1095.     /* Code Body                                                      */
  1096.     /*----------------------------------------------------------------*/
  1097.     /* spacing pixel from boundry */
  1098.     image_spacing = 2;
  1099.     text_spaing = 2;
  1100.     UI_UNUSED_PARAMETER(history_buffer);
  1101.     ADD_SCREEN_STRINGS((3, title_id, left_softkey, right_softkey));
  1102.     ADD_SCREEN_IMAGES((3, left_softkey_icon, right_softkey_icon, imageId));
  1103.     /* lock double buffer */
  1104.     gui_lock_double_buffer();
  1105.     clear_key_handlers();
  1106.     clear_left_softkey();
  1107.     clear_right_softkey();
  1108.     change_left_softkey(left_softkey, left_softkey_icon);
  1109.     change_right_softkey(right_softkey, right_softkey_icon);
  1110.     register_left_softkey_handler();
  1111.     register_right_softkey_handler();
  1112.     register_default_hide_softkeys();
  1113.     MMI_disable_title_shortcut_display = 1;
  1114.     set_main_LCD_dt_date_hide_function(CM_screens_hide_date_time_display);
  1115.     set_main_LCD_dt_time_hide_function(CM_screens_hide_date_time_display);
  1116.     set_dt_display(DT_MT_CALL_SCREEN);
  1117.     MMI_title_icon = NULL;
  1118.     /* draw title */
  1119.     ShowStatusIconsTitle();
  1120.    /****************************************************************************
  1121.    *  String above message string. (Calling...)
  1122.    *****************************************************************************/
  1123.     str = get_string(NotificationStringId);
  1124.     /* gui_measure_image(img,&iwidth,&iheight); */
  1125.     create_multiline_inputbox_set_buffer(str, gui_strlen((UI_string_type) str), gui_strlen((UI_string_type) str), 0);
  1126.     MMI_multiline_inputbox.flags |=
  1127.         UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND |
  1128.         UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY;
  1129.     MMI_multiline_inputbox.text_font = &MMI_medium_font;
  1130.     show_multiline_inputbox_no_draw();
  1131.     fh = get_multiline_inputbox_line_height();
  1132.     resize_multiline_inputbox(UI_device_width, fh + MULTILINE_INPUTBOX_HEIGHT_PAD);
  1133.     y = UI_device_height - MMI_button_bar_height - (fh * 2 + MULTILINE_INPUTBOX_HEIGHT_PAD);
  1134.     move_multiline_inputbox(0, y);
  1135.    /****************************************************************************
  1136.    *  Message String                                                               
  1137.    *****************************************************************************/
  1138.     if (NameOrNumber)
  1139.     {
  1140.         MMI_message_string = (UI_string_type) NameOrNumber;
  1141.     }
  1142.     else
  1143.     {
  1144.         MMI_message_string = NULL;
  1145.     }
  1146.     gui_set_font(&MMI_default_font);
  1147.     gui_measure_string(MMI_message_string, &string_width, &string_height);
  1148.     text_offset_x = (UI_device_width >> 1) - (string_width >> 1);
  1149.     if (text_offset_x < 1)
  1150.     {
  1151.         text_offset_x = 1;
  1152.     }
  1153.     text_offset_y = UI_device_height - MMI_button_bar_height - string_height - text_spaing;
  1154.     text_width = string_width;
  1155.     if (text_width > (UI_device_width - text_spaing * 2))
  1156.     {
  1157.         text_width = UI_device_width - text_spaing * 2;
  1158.     }
  1159.     text_height = string_height;
  1160.     gui_create_scrolling_text(
  1161.         &CM_scrolling_text,
  1162.         text_offset_x,
  1163.         text_offset_y,
  1164.         text_width,
  1165.         text_height,
  1166.         MMI_message_string,
  1167.         CM_scrolling_text_timer_callback,
  1168.         CM_draw_scrolling_text_background,
  1169.         gui_color(0, 0, 0),
  1170.         gui_color(255, 255, 255));
  1171.     CM_scrolling_text.flags &= ~UI_SCROLLING_TEXT_BORDERED_TEXT;
  1172.     CM_y = text_offset_y;
  1173.    /****************************************************************************
  1174.    *  Image Icon                                                               
  1175.    *****************************************************************************/
  1176.     /* prepare image */
  1177.     /* 
  1178.      * use Painty1 flag to indicate image from file or image form id 
  1179.      * Panity = 0  -> Nothing
  1180.      * Painty = 1  -> From id 
  1181.      * Painty = 2  -> From file 
  1182.      */
  1183.     Painty1 = 0;
  1184.     image_ptr = get_image(imageId);
  1185.     gui_measure_image(image_ptr, &image_width, &image_height);
  1186.     image_offset_y = MMI_status_bar_height +
  1187.         main_LCD_dt_object.date.height + main_LCD_dt_object.time.height + image_spacing;
  1188.     image_offset_x = (UI_device_width >> 1) - (image_width >> 1);
  1189.     wgui_image_clip_x1 = image_spacing;
  1190.     wgui_image_clip_x2 = UI_device_width - 1 - image_spacing;
  1191.     wgui_image_clip_y1 = main_LCD_dt_object.time.y + main_LCD_dt_object.time.height + image_spacing;
  1192.     wgui_image_clip_y2 = text_offset_y - image_spacing;
  1193.     /* it is an error if try to display string from both source */
  1194.     MMI_ASSERT((imageId == 0) || (image_file_pp == NULL));
  1195.     if (imageId != 0)
  1196.     {
  1197.         Painty1 = 1;
  1198.         _MMI_animated_icon = image_ptr;
  1199.     }
  1200.     if (image_file_pp != NULL)
  1201.     {
  1202.         Painty1 = 2;
  1203.         /* store file name */
  1204.         _MMI_animated_icon_name = (PU8) * image_file_pp;
  1205.     }
  1206.     gui_unlock_double_buffer();
  1207.     RedrawCategoryFunction = RedrawCategory17Screen;
  1208.     ExitCategoryFunction = ExitCategory17Screen;
  1209.     GetCategoryHistory = dummy_get_history;
  1210.     GetCategoryHistorySize = dummy_get_history_size;
  1211.     RedrawCategory17Screen();
  1212. }
  1213. #else /* defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__) */ 
  1214. /*****************************************************************************
  1215.  * FUNCTION
  1216.  *  RedrawCategory17Screen
  1217.  * DESCRIPTION
  1218.  *  redraw category 17 screen
  1219.  * PARAMETERS
  1220.  *  void
  1221.  * RETURNS
  1222.  *  void
  1223.  *****************************************************************************/
  1224. void RedrawCategory17Screen(void)
  1225. {
  1226.     /*----------------------------------------------------------------*/
  1227.     /* Local Variables                                                */
  1228.     /*----------------------------------------------------------------*/
  1229.     color bc;
  1230.     S32 width = 0, x = 0;
  1231. #if(0)  /* Now reads color from the theme structure  */
  1232. //micha1021 Chicago Feature 6
  1233. #ifdef __MMI_DEFAULT_THEME_3__
  1234. color c={206,206,206,100};
  1235. #endif
  1236. #else /* (0) */ 
  1237.     UI_filled_area *f = current_MMI_theme->CM_screen_background_filler;
  1238. #endif /* (0) */ 
  1239.     /*----------------------------------------------------------------*/
  1240.     /* Code Body                                                      */
  1241.     /*----------------------------------------------------------------*/
  1242. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1243.     gui_lock_double_buffer();
  1244. #endif 
  1245.     gui_hide_animations();
  1246. #if(0)  /* Now reads color from the theme structure  */
  1247. //micha1021 Chicago Feature 6
  1248. #ifdef __MMI_DEFAULT_THEME_3__
  1249. pixtel_UI_reset_clip();
  1250. pixtel_UI_fill_rectangle(0,0,UI_device_width-1,UI_device_height-1,c);
  1251. #else
  1252. clear_screen();
  1253. #endif
  1254. #else /* (0) */ 
  1255.     gui_reset_clip();
  1256.     gui_draw_filled_area(0, 0, UI_device_width - 1, UI_device_height - 1, f);
  1257. #endif /* (0) */ 
  1258.     /* MTK Leo add */
  1259. #ifndef __BW_MMI__
  1260.     show_status_icons();
  1261. #endif 
  1262.     /* MTK Leo end */
  1263.     UI_set_main_LCD_graphics_context();
  1264.     gui_set_clip(wgui_image_clip_x1, wgui_image_clip_y1, wgui_image_clip_x2, wgui_image_clip_y2);
  1265.     wgui_show_transparent_animation();
  1266.     /* MTK Leo add 1225 */
  1267.     if (wgui_image_clip_y1 == main_LCD_dt_object.time.y + main_LCD_dt_object.time.height + 1)
  1268.     {   /* ref:Showcategory17Screen */
  1269.         CM_screens_draw_date_time_bar();
  1270.     #ifndef __MMI_CM_SCREEN_HIDE_DATE_TIME__
  1271.         show_main_LCD_dt_display();
  1272.         show_multiline_inputbox();
  1273.     #endif /* __MMI_CM_SCREEN_HIDE_DATE_TIME__ */ 
  1274.     }
  1275.     /* MTK Leo end 1225 */
  1276.     bc = gui_color(0, 0, 0);
  1277.     gui_set_text_color(bc);
  1278.     gui_set_font(current_MMI_theme->title_text_font);
  1279.     gui_measure_string(MMI_message_string, &width, &CM_text_height);
  1280.     if (width < UI_device_width)
  1281.     {
  1282.         x = (UI_device_width >> 1) - (width >> 1);
  1283.     }
  1284.     else
  1285.     {
  1286.     #if(0)
  1287. CM_text_width=width;
  1288. x=CM_text_offset_x=CM_TEXT_SCROLL_X;
  1289. pixtel_UI_start_timer(CATEGORY17_TEXT_SCROLL_WAIT,handle_category17_text_scroll);
  1290.     #endif /* (0) */ 
  1291.     }
  1292.     /* gui_pop_clip(); */
  1293.     gui_set_text_clip(x, CM_y, (UI_device_width - 1), (CM_y + CM_text_height));
  1294.     gui_move_text_cursor(x, CM_y);
  1295. #if(0)
  1296. pixtel_UI_print_text(MMI_message_string);
  1297. #else /* (0) */ 
  1298.     gui_show_scrolling_text(&CM_scrolling_text);
  1299. #endif /* (0) */ 
  1300.     show_softkey_background();
  1301.     show_left_softkey();
  1302.     show_right_softkey();
  1303. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1304.     gui_unlock_double_buffer();
  1305.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1306. #endif /* (UI_DOUBLE_BUFFER_SUPPORT) */ 
  1307. }
  1308. /*****************************************************************************
  1309.  * FUNCTION
  1310.  *  ShowCategory17Screen
  1311.  * DESCRIPTION
  1312.  *  Displays the MO_calling screen
  1313.  * PARAMETERS
  1314.  *  left_softkey                [IN]        Left softkey label
  1315.  *  left_softkey_icon           [IN]        Icon for the left softkey
  1316.  *  right_softkey               [IN]        Right softkey label
  1317.  *  right_softkey_icon          [IN]        Icon for the right softkey
  1318.  *  NotificationStringId        [IN]        
  1319.  *  NameOrNumber                [?]         
  1320.  *  imageId                     [IN]        
  1321.  *  history_buffer              [IN]        History buffer
  1322.  *  STRING(?)                   [IN]        *     Name or Number text, Name or Number text
  1323.  *  MMI_ID_TYPE(?)              [IN]        Image to be displayed   Picture tag associated eith the name
  1324.  * RETURNS
  1325.  *  void
  1326.  *****************************************************************************/
  1327. void ShowCategory17Screen(
  1328.         U16 left_softkey,
  1329.         U16 left_softkey_icon,
  1330.         U16 right_softkey,
  1331.         U16 right_softkey_icon,
  1332.         U16 NotificationStringId,
  1333.         U8 *NameOrNumber,
  1334.         U16 imageId,
  1335.         U8 *history_buffer)
  1336. {
  1337.     /*----------------------------------------------------------------*/
  1338.     /* Local Variables                                                */
  1339.     /*----------------------------------------------------------------*/
  1340.     S32 fh, y, iwidth, iheight;
  1341.     PU8 img = get_image(imageId);
  1342.     UI_string_type str;
  1343.     S32 sw, sh;
  1344.     S32 tx, ty, tw, th;
  1345.     UI_font_type f = MMI_multiline_inputbox.text_font;
  1346.     /*----------------------------------------------------------------*/
  1347.     /* Code Body                                                      */
  1348.     /*----------------------------------------------------------------*/
  1349.     ADD_SCREEN_STRINGS((2, left_softkey, right_softkey));
  1350.     ADD_SCREEN_IMAGES((2, left_softkey_icon, right_softkey_icon));
  1351.     UI_UNUSED_PARAMETER(history_buffer);
  1352. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1353.     gui_lock_double_buffer();
  1354. #endif 
  1355.     clear_key_handlers();
  1356.     clear_left_softkey();
  1357.     clear_right_softkey();
  1358.     change_left_softkey(left_softkey, left_softkey_icon);
  1359.     change_right_softkey(right_softkey, right_softkey_icon);
  1360.     register_left_softkey_handler();
  1361.     register_right_softkey_handler();
  1362.     register_default_hide_softkeys();
  1363.     ShowStatusIconsTitle();
  1364.     set_main_LCD_dt_date_hide_function(CM_screens_hide_date_time_display);
  1365.     set_main_LCD_dt_time_hide_function(CM_screens_hide_date_time_display);
  1366.     set_dt_display(DT_MO_CALLING_SCREEN);
  1367.     show_main_LCD_dt_display();
  1368.     str = get_string(NotificationStringId);
  1369.     gui_measure_image(img, &iwidth, &iheight);
  1370.     create_multiline_inputbox_set_buffer(str, gui_strlen((UI_string_type) str), gui_strlen((UI_string_type) str), 0);
  1371.     MMI_multiline_inputbox.flags |=
  1372.         UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND |
  1373.         UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY;
  1374.     MMI_message_string = (UI_string_type) NameOrNumber;
  1375.     MMI_multiline_inputbox.text_font = &MMI_medium_font;
  1376.     show_multiline_inputbox_no_draw();
  1377.     fh = get_multiline_inputbox_line_height();
  1378.     resize_multiline_inputbox(UI_device_width, fh + MULTILINE_INPUTBOX_HEIGHT_PAD);
  1379.     y = UI_device_height - MMI_button_bar_height - (fh * 2 + MULTILINE_INPUTBOX_HEIGHT_PAD);
  1380.     move_multiline_inputbox(0, y);
  1381.     wgui_image_clip_x1 = 0;
  1382.     wgui_image_clip_x2 = UI_device_width - 1;
  1383.     wgui_image_clip_y1 = MMI_status_bar_height + main_LCD_dt_object.date.height + main_LCD_dt_object.time.height + 1;
  1384.     wgui_image_clip_y2 = MMI_multiline_inputbox.y - 1;
  1385.     /* MTK Leo add 1225 */
  1386.     if (wgui_image_clip_y2 - wgui_image_clip_y1 < iheight)
  1387.     {   /* There is no enough space to show calling image... */
  1388.         wgui_image_clip_y1 = MMI_status_bar_height + 2;
  1389.         y = UI_device_height - MMI_button_bar_height - (fh + MULTILINE_INPUTBOX_HEIGHT_PAD);
  1390.         move_multiline_inputbox(0, y);
  1391.         wgui_image_clip_y2 = MMI_multiline_inputbox.y - 1;
  1392.     }
  1393.     else
  1394.     {
  1395.         set_dt_display(DT_MO_CALLING_SCREEN);
  1396.     }
  1397.     /* MTK Leo end 1225 */
  1398.     y = wgui_image_clip_y1 + ((wgui_image_clip_y2 - wgui_image_clip_y1 - iheight) >> 1);
  1399.     if (y > MMI_multiline_inputbox.y)
  1400.     {
  1401.         y = MMI_multiline_inputbox.y - iheight;
  1402.     }
  1403.     wgui_set_animation_image_y((UI_device_width >> 1), y, img);
  1404.     CM_y = UI_device_height - MMI_button_bar_height - fh - 2;   /* (MMI_multiline_inputbox.y + MMI_multiline_inputbox.height + 1); */
  1405.     gui_set_font(&MMI_default_font);
  1406.     gui_measure_string(MMI_message_string, &sw, &sh);
  1407.     tx = (UI_device_width >> 1) - (sw >> 1);
  1408.     if (tx < 1)
  1409.     {
  1410.         tx = 1;
  1411.     }
  1412.     ty = CM_y;
  1413.     tw = sw;
  1414.     if (tw > (UI_device_width - 2))
  1415.     {
  1416.         tw = UI_device_width - 2;
  1417.     }
  1418.     th = sh;
  1419.     gui_create_scrolling_text(
  1420.         &CM_scrolling_text,
  1421.         tx,
  1422.         ty,
  1423.         tw,
  1424.         th,
  1425.         MMI_message_string,
  1426.         CM_scrolling_text_timer_callback,
  1427.         CM_draw_scrolling_text_background,
  1428.         gui_color(0, 0, 0),
  1429.         gui_color(255, 255, 255));
  1430.     CM_scrolling_text.flags &= ~UI_SCROLLING_TEXT_BORDERED_TEXT;
  1431. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1432.     gui_unlock_double_buffer();
  1433. #endif 
  1434.     RedrawCategoryFunction = RedrawCategory17Screen;
  1435.     ExitCategoryFunction = ExitCategory17Screen;
  1436.     GetCategoryHistory = dummy_get_history;
  1437.     GetCategoryHistorySize = dummy_get_history_size;
  1438.     RedrawCategory17Screen();
  1439.     MMI_multiline_inputbox.text_font = f;
  1440. }
  1441. #endif /* defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__) */ 
  1442. /*****************************************************************************
  1443.  * FUNCTION
  1444.  *  ExitCategory17Screen
  1445.  * DESCRIPTION
  1446.  *  Exits the MO_calling screen
  1447.  * PARAMETERS
  1448.  *  void
  1449.  * RETURNS
  1450.  *  void
  1451.  *****************************************************************************/
  1452. void ExitCategory17Screen()
  1453. {
  1454.     /*----------------------------------------------------------------*/
  1455.     /* Local Variables                                                */
  1456.     /*----------------------------------------------------------------*/
  1457.     /*----------------------------------------------------------------*/
  1458.     /* Code Body                                                      */
  1459.     /*----------------------------------------------------------------*/
  1460. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1461.     gui_lock_double_buffer();
  1462. #endif 
  1463.     UI_set_main_LCD_graphics_context();
  1464.     gui_cancel_timer(CM_scrolling_text_timer_callback);
  1465.     gui_cancel_timer(handle_category17_text_scroll);
  1466.     close_main_LCD_dt_display();
  1467.     gui_hide_animations();
  1468.     close_status_icons();
  1469.     reset_softkeys();
  1470.     reset_multitaps();
  1471.     reset_multiline_inputbox();
  1472. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1473.     gui_unlock_double_buffer();
  1474. #endif 
  1475.     ExitCategoryFunction = MMI_dummy_function;
  1476.     RedrawCategoryFunction = MMI_dummy_function;
  1477.     GetCategoryHistory = dummy_get_history;
  1478.     GetCategoryHistorySize = dummy_get_history_size;
  1479. }
  1480. /*****************************************************************************
  1481.  * FUNCTION
  1482.  *  RedrawCategory23Screen
  1483.  * DESCRIPTION
  1484.  *  Redraws the SMS inbox category screen
  1485.  * PARAMETERS
  1486.  *  void
  1487.  * RETURNS
  1488.  *  void
  1489.  *****************************************************************************/
  1490. void RedrawCategory23Screen(void)
  1491. {
  1492.     /*----------------------------------------------------------------*/
  1493.     /* Local Variables                                                */
  1494.     /*----------------------------------------------------------------*/
  1495.     /*----------------------------------------------------------------*/
  1496.     /* Code Body                                                      */
  1497.     /*----------------------------------------------------------------*/
  1498.     gui_lock_double_buffer();
  1499.     clear_buttonbar();
  1500.     show_title_status_icon();
  1501.     draw_title();
  1502.     show_fixed_list();
  1503.     show_softkey_background();
  1504.     show_left_softkey();
  1505.     show_right_softkey();
  1506.     gui_unlock_double_buffer();
  1507.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1508. }
  1509. /*****************************************************************************
  1510.  * FUNCTION
  1511.  *  ShowCategory23Screen
  1512.  * DESCRIPTION
  1513.  *  Redraws the SMS inbox category screen
  1514.  * PARAMETERS
  1515.  *  title                   [IN]        Title for the screen
  1516.  *  title_icon              [IN]        Icon shown with the title
  1517.  *  left_softkey            [IN]        Left softkey label
  1518.  *  left_softkey_icon       [IN]        Icon for the left softkey
  1519.  *  right_softkey           [IN]        Right softkey label
  1520.  *  right_softkey_icon      [IN]        Icon for the right softkey
  1521.  *  number_of_items         [IN]        Number of items
  1522.  *  list_of_items1          [IN]        List of text items (Each row has two
  1523.  *  list_of_items2          [IN]        (Array of strings and not string IDs)
  1524.  *  list_of_icons1          [IN]        Icon list
  1525.  *  highlighted_item        [IN]        Default item to be highlighted (if there is no history)
  1526.  *  history_buffer          [IN]        History buffer
  1527.  *  text(?)                 [IN]        Columns) Note: This is an array of
  1528.  *  strings(?)              [IN]        And not string IDs.
  1529.  * RETURNS
  1530.  *  void
  1531.  *****************************************************************************/
  1532. void ShowCategory23Screen(
  1533.         U16 title,
  1534.         U16 title_icon,
  1535.         U16 left_softkey,
  1536.         U16 left_softkey_icon,
  1537.         U16 right_softkey,
  1538.         U16 right_softkey_icon,
  1539.         S32 number_of_items,
  1540.         U8 **list_of_items1,
  1541.         U8 **list_of_items2,
  1542.         U16 *list_of_icons1,
  1543.         S32 highlighted_item,
  1544.         U8 *history_buffer)
  1545. {
  1546.     /*----------------------------------------------------------------*/
  1547.     /* Local Variables                                                */
  1548.     /*----------------------------------------------------------------*/
  1549.     S32 i, shortcut_width, text_width, icon_position, text_position1;
  1550.     U8 h_flag;
  1551.     /*----------------------------------------------------------------*/
  1552.     /* Code Body                                                      */
  1553.     /*----------------------------------------------------------------*/
  1554. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1555.     gui_lock_double_buffer();
  1556. #endif 
  1557.     MMI_menu_shortcut_number = -1;
  1558.     clear_category_screen_key_handlers();
  1559.     resize_fixed_list(MMI_content_width, MMI_content_height + 2);
  1560.     /* MTK Leo added, to remove icons on menuitems */
  1561. #ifdef __BW_MMI__
  1562.     create_fixed_icontext_list_menuitems(2, 0);
  1563.     text_width = UI_device_width - MMI_fixed_list_menu.vbar.width;
  1564. #else /* __BW_MMI__ */ 
  1565.     create_fixed_icontext_list_menuitems(2, 1);
  1566.     text_width = UI_device_width - 64 - MMI_fixed_list_menu.vbar.width;
  1567. #endif /* __BW_MMI__ */ 
  1568.     /* MTK Leo end */
  1569.     text_position1 = 20 + text_width;
  1570.     icon_position = 1;
  1571.     /* MTK Leo added, to remove icons on menuitems */
  1572. #ifdef __BW_MMI__
  1573.     set_fixed_icontext_list_text_coordinates(0, 0, 0, 10, 18);
  1574.     set_fixed_icontext_list_text_coordinates(1, 12, 0, 12 + text_width, 18);
  1575. #else /* __BW_MMI__ */ 
  1576.     set_fixed_icontext_list_text_coordinates(0, 18, 0, text_width, 18);
  1577.     set_fixed_icontext_list_text_coordinates(1, text_position1, 0, 36, 18);
  1578.     set_fixed_icontext_list_icon_coordinates(0, icon_position, 0, 16, 18);
  1579. #endif /* __BW_MMI__ */ 
  1580.     /* MTK Leo end */
  1581.     associate_fixed_icontext_list_list();
  1582.     for (i = 0; i < number_of_items; i++)
  1583.     {
  1584.         fixed_icontext_list_item_insert(i);
  1585.         add_fixed_icontext_list_item_text(i, 0, (UI_string_type) list_of_items1[i]);
  1586.         add_fixed_icontext_list_item_text(i, 1, (UI_string_type) list_of_items2[i]);
  1587.         add_fixed_icontext_list_item_icon(i, 0, wgui_get_list_menu_icon(i, list_of_icons1[i]));
  1588.     }
  1589.     MMI_current_menu_type = LIST_MENU;
  1590.     register_fixed_list_shortcut_handler();
  1591.     register_fixed_list_keys();
  1592.     shortcut_width = set_menu_item_count(number_of_items) + 7;
  1593.     resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  1594.     move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  1595.     register_hide_menu_shortcut(gui_redraw_menu_shortcut);
  1596.     move_fixed_list(0, (MMI_title_y + MMI_title_height));
  1597.     resize_fixed_list(MMI_content_width, MMI_content_height + 2);
  1598.     resize_fixed_list_to_content_height();
  1599.     register_fixed_list_highlight_handler(standard_list_highlight_handler);
  1600.     change_left_softkey(left_softkey, left_softkey_icon);
  1601.     change_right_softkey(right_softkey, right_softkey_icon);
  1602.     clear_left_softkey();
  1603.     clear_right_softkey();
  1604.     register_left_softkey_handler();
  1605.     register_right_softkey_handler();
  1606.     register_default_hide_softkeys();
  1607.     MMI_title_string = (UI_string_type) get_string(title);
  1608.     MMI_title_icon = (PU8) get_image(title_icon);
  1609.     h_flag = set_list_menu_category_history(MMI_CATEGORY23_ID, history_buffer);
  1610.     if (h_flag)
  1611.     {
  1612.         fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  1613.     }
  1614.     else
  1615.     {
  1616.         fixed_list_goto_item_no_redraw(highlighted_item);
  1617.     }
  1618.     resize_fixed_icontext_list_menuitems_to_list_width();
  1619. #if(UI_DOUBLE_BUFFER_SUPPORT)
  1620.     gui_unlock_double_buffer();
  1621. #endif 
  1622.     ExitCategoryFunction = ExitCategory23Screen;
  1623.     RedrawCategoryFunction = RedrawCategory23Screen;
  1624.     GetCategoryHistory = GetCategory23History;
  1625.     GetCategoryHistorySize = GetCategory23HistorySize;
  1626.     RedrawCategory23Screen();
  1627. }
  1628. /*****************************************************************************
  1629.  * FUNCTION
  1630.  *  ExitCategory23Screen
  1631.  * DESCRIPTION
  1632.  *  Exits the SMS inbox category screen
  1633.  * PARAMETERS
  1634.  *  void
  1635.  * RETURNS
  1636.  *  void
  1637.  *****************************************************************************/
  1638. void ExitCategory23Screen(void)
  1639. {
  1640.     /*----------------------------------------------------------------*/
  1641.     /* Local Variables                                                */
  1642.     /*----------------------------------------------------------------*/
  1643.     /*----------------------------------------------------------------*/
  1644.     /* Code Body                                                      */
  1645.     /*----------------------------------------------------------------*/
  1646.     ClearHighlightHandler();
  1647.     reset_softkeys();
  1648.     reset_menu_shortcut_handler();
  1649.     reset_fixed_list();
  1650.     ExitCategoryFunction = MMI_dummy_function;
  1651.     RedrawCategoryFunction = MMI_dummy_function;
  1652.     GetCategoryHistory = dummy_get_history;
  1653.     GetCategoryHistorySize = dummy_get_history_size;
  1654. }
  1655. /*****************************************************************************
  1656.  * FUNCTION
  1657.  *  GetCategory23HistorySize
  1658.  * DESCRIPTION
  1659.  *  Gets the size of the history buffer for the SMS inbox screen
  1660.  * PARAMETERS
  1661.  *  void
  1662.  * RETURNS
  1663.  *  size of history buffer in U8s
  1664.  *****************************************************************************/
  1665. S32 GetCategory23HistorySize(void)
  1666. {
  1667.     /*----------------------------------------------------------------*/
  1668.     /* Local Variables                                                */
  1669.     /*----------------------------------------------------------------*/
  1670.     /*----------------------------------------------------------------*/
  1671.     /* Code Body                                                      */
  1672.     /*----------------------------------------------------------------*/
  1673.     return (sizeof(list_menu_category_history));
  1674. }
  1675. /*****************************************************************************
  1676.  * FUNCTION
  1677.  *  GetCategory23History
  1678.  * DESCRIPTION
  1679.  *  Gets the history buffer for the SMS inbox screen
  1680.  * PARAMETERS
  1681.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  1682.  * RETURNS
  1683.  *  pointer to the history buffer
  1684.  *****************************************************************************/
  1685. U8 *GetCategory23History(U8 *history_buffer)
  1686. {
  1687.     /*----------------------------------------------------------------*/
  1688.     /* Local Variables                                                */
  1689.     /*----------------------------------------------------------------*/
  1690.     /*----------------------------------------------------------------*/
  1691.     /* Code Body                                                      */
  1692.     /*----------------------------------------------------------------*/
  1693.     get_list_menu_category_history(MMI_CATEGORY23_ID, history_buffer);
  1694.     return (history_buffer);
  1695. }
  1696. /*****************************************************************************
  1697.  * FUNCTION
  1698.  *  RedrawCategory24Screen
  1699.  * DESCRIPTION
  1700.  *  Redraws the SMS outbox category screen
  1701.  * PARAMETERS
  1702.  *  void
  1703.  * RETURNS
  1704.  *  void
  1705.  *****************************************************************************/
  1706. void RedrawCategory24Screen(void)
  1707. {
  1708.     /*----------------------------------------------------------------*/
  1709.     /* Local Variables                                                */
  1710.     /*----------------------------------------------------------------*/
  1711.     /*----------------------------------------------------------------*/
  1712.     /* Code Body                                                      */
  1713.     /*----------------------------------------------------------------*/
  1714.     gui_lock_double_buffer();
  1715.     clear_buttonbar();
  1716.     show_title_status_icon();
  1717.     draw_title();
  1718.     show_fixed_list();
  1719.     show_softkey_background();
  1720.     show_left_softkey();
  1721.     show_right_softkey();
  1722.     gui_unlock_double_buffer();
  1723.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1724. }
  1725. /*****************************************************************************
  1726.  * FUNCTION
  1727.  *  ShowCategory24Screen
  1728.  * DESCRIPTION
  1729.  *  Redraws the SMS outbox category screen
  1730.  * PARAMETERS
  1731.  *  title                   [IN]        Title for the screen
  1732.  *  title_icon              [IN]        Icon shown with the title
  1733.  *  left_softkey            [IN]        Left softkey label
  1734.  *  left_softkey_icon       [IN]        Icon for the left softkey
  1735.  *  right_softkey           [IN]        Right softkey label
  1736.  *  right_softkey_icon      [IN]        Icon for the right softkey
  1737.  *  number_of_items         [IN]        Number of items
  1738.  *  list_of_items1          [IN]        List of text items (Each row has one
  1739.  *  list_of_icons1          [IN]        Icon list
  1740.  *  highlighted_item        [IN]        Default item to be highlighted (if there is no history)
  1741.  *  history_buffer          [IN]        History buffer
  1742.  *  text(?)                 [IN]        Column) Note: This is an array of
  1743.  *  strings(?)              [IN]        And not string IDs.
  1744.  * RETURNS
  1745.  *  void
  1746.  *****************************************************************************/
  1747. void ShowCategory24Screen(
  1748.         U16 title,
  1749.         U16 title_icon,
  1750.         U16 left_softkey,
  1751.         U16 left_softkey_icon,
  1752.         U16 right_softkey,
  1753.         U16 right_softkey_icon,
  1754.         S32 number_of_items,
  1755.         U8 **list_of_items1,
  1756.         U16 *list_of_icons1,
  1757.         S32 highlighted_item,
  1758.         U8 *history_buffer)
  1759. {
  1760.     /*----------------------------------------------------------------*/
  1761.     /* Local Variables                                                */
  1762.     /*----------------------------------------------------------------*/
  1763.     S32 i, shortcut_width, text_width, icon_position;
  1764.     U8 h_flag;
  1765.     /*----------------------------------------------------------------*/
  1766.     /* Code Body                                                      */
  1767.     /*----------------------------------------------------------------*/
  1768.     gui_lock_double_buffer();
  1769.     MMI_menu_shortcut_number = -1;
  1770.     clear_category_screen_key_handlers();
  1771.     resize_fixed_list(MMI_content_width, MMI_content_height + 2);
  1772.     create_fixed_icontext_list_menuitems(1, 1);
  1773.     text_width = UI_device_width - 28 - MMI_fixed_list_menu.vbar.width;
  1774.     icon_position = 1;
  1775.     set_fixed_icontext_list_text_coordinates(0, 18, 0, text_width, 18);
  1776.     set_fixed_icontext_list_icon_coordinates(0, icon_position, 0, 16, 18);
  1777.     associate_fixed_icontext_list_list();
  1778.     for (i = 0; i < number_of_items; i++)
  1779.     {
  1780.         fixed_icontext_list_item_insert(i);
  1781.         add_fixed_icontext_list_item_text(i, 0, (UI_string_type) list_of_items1[i]);
  1782.         add_fixed_icontext_list_item_icon(i, 0, wgui_get_list_menu_icon(i, list_of_icons1[i]));
  1783.     }
  1784.     MMI_current_menu_type = LIST_MENU;
  1785.     register_fixed_list_shortcut_handler();
  1786.     register_fixed_list_keys();
  1787.     shortcut_width = set_menu_item_count(number_of_items) + 7;
  1788.     resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  1789.     move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  1790.     register_hide_menu_shortcut(gui_redraw_menu_shortcut);
  1791.     move_fixed_list(0, (MMI_title_y + MMI_title_height));
  1792.     resize_fixed_list(MMI_content_width, MMI_content_height + 2);
  1793.     resize_fixed_list_to_content_height();
  1794.     register_fixed_list_highlight_handler(standard_list_highlight_handler);
  1795.     change_left_softkey(left_softkey, left_softkey_icon);
  1796.     change_right_softkey(right_softkey, right_softkey_icon);
  1797.     clear_left_softkey();
  1798.     clear_right_softkey();
  1799.     register_left_softkey_handler();
  1800.     register_right_softkey_handler();
  1801.     register_default_hide_softkeys();
  1802.     MMI_title_string = (UI_string_type) get_string(title);
  1803.     MMI_title_icon = (PU8) get_image(title_icon);
  1804.     h_flag = set_list_menu_category_history(MMI_CATEGORY24_ID, history_buffer);
  1805.     if (h_flag)
  1806.     {
  1807.         fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  1808.     }
  1809.     else
  1810.     {
  1811.         fixed_list_goto_item_no_redraw(highlighted_item);
  1812.     }
  1813.     resize_fixed_icontext_list_menuitems_to_list_width();
  1814.     gui_unlock_double_buffer();
  1815.     ExitCategoryFunction = ExitCategory24Screen;
  1816.     RedrawCategoryFunction = RedrawCategory24Screen;
  1817.     GetCategoryHistory = GetCategory24History;
  1818.     GetCategoryHistorySize = GetCategory24HistorySize;
  1819.     RedrawCategory24Screen();
  1820. }
  1821. /*****************************************************************************
  1822.  * FUNCTION
  1823.  *  ExitCategory24Screen
  1824.  * DESCRIPTION
  1825.  *  Exits the SMS outbox category screen
  1826.  * PARAMETERS
  1827.  *  void
  1828.  * RETURNS
  1829.  *  void
  1830.  *****************************************************************************/
  1831. void ExitCategory24Screen(void)
  1832. {
  1833.     /*----------------------------------------------------------------*/
  1834.     /* Local Variables                                                */
  1835.     /*----------------------------------------------------------------*/
  1836.     /*----------------------------------------------------------------*/
  1837.     /* Code Body                                                      */
  1838.     /*----------------------------------------------------------------*/
  1839.     ClearHighlightHandler();
  1840.     reset_softkeys();
  1841.     reset_menu_shortcut_handler();
  1842.     reset_fixed_list();
  1843.     ExitCategoryFunction = MMI_dummy_function;
  1844.     RedrawCategoryFunction = MMI_dummy_function;
  1845.     GetCategoryHistory = dummy_get_history;
  1846.     GetCategoryHistorySize = dummy_get_history_size;
  1847. }
  1848. /*****************************************************************************
  1849.  * FUNCTION
  1850.  *  GetCategory24HistorySize
  1851.  * DESCRIPTION
  1852.  *  Gets the size of the history buffer for the SMS outbox screen
  1853.  * PARAMETERS
  1854.  *  void
  1855.  * RETURNS
  1856.  *  size of history buffer in U8s
  1857.  *****************************************************************************/
  1858. S32 GetCategory24HistorySize(void)
  1859. {
  1860.     /*----------------------------------------------------------------*/
  1861.     /* Local Variables                                                */
  1862.     /*----------------------------------------------------------------*/
  1863.     /*----------------------------------------------------------------*/
  1864.     /* Code Body                                                      */
  1865.     /*----------------------------------------------------------------*/
  1866.     return (sizeof(list_menu_category_history));
  1867. }
  1868. /*****************************************************************************
  1869.  * FUNCTION
  1870.  *  GetCategory24History
  1871.  * DESCRIPTION
  1872.  *  Gets the history buffer for the SMS outbox screen
  1873.  * PARAMETERS
  1874.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  1875.  * RETURNS
  1876.  *  pointer to the history buffer
  1877.  *****************************************************************************/
  1878. U8 *GetCategory24History(U8 *history_buffer)
  1879. {
  1880.     /*----------------------------------------------------------------*/
  1881.     /* Local Variables                                                */
  1882.     /*----------------------------------------------------------------*/
  1883.     /*----------------------------------------------------------------*/
  1884.     /* Code Body                                                      */
  1885.     /*----------------------------------------------------------------*/
  1886.     get_list_menu_category_history(MMI_CATEGORY24_ID, history_buffer);
  1887.     return (history_buffer);
  1888. }
  1889. #define USE_NEW_DATE_TIME_IMPLEMENTATION  0
  1890. #if(USE_NEW_DATE_TIME_IMPLEMENTATION)
  1891. date_input wgui_date_input_object;
  1892. #endif 
  1893. /*****************************************************************************
  1894.  * FUNCTION
  1895.  *  RedrawCategory25Screen
  1896.  * DESCRIPTION
  1897.  *  Redraws the category25 screen
  1898.  * PARAMETERS
  1899.  *  void
  1900.  * RETURNS
  1901.  *  void
  1902.  *****************************************************************************/
  1903. void RedrawCategory25Screen(void)
  1904. {
  1905.     /*----------------------------------------------------------------*/
  1906.     /* Local Variables                                                */
  1907.     /*----------------------------------------------------------------*/
  1908.     color c = gui_color(0, 0, 0);
  1909. #if(!USE_NEW_DATE_TIME_IMPLEMENTATION)
  1910.     UI_string_type DD_string = get_string(WGUI_CATEGORY_DD_STRING_ID);
  1911.     UI_string_type MM_string = get_string(WGUI_CATEGORY_MM_STRING_ID);
  1912.     UI_string_type YYYY_string = get_string(WGUI_CATEGORY_YYYY_STRING_ID);
  1913.     UI_string_type THH_string = get_string(WGUI_CATEGORY_THH_STRING_ID);
  1914.     UI_string_type TMM_string = get_string(WGUI_CATEGORY_TMM_STRING_ID);
  1915.     S32 w;
  1916. #else /* (!USE_NEW_DATE_TIME_IMPLEMENTATION) */ 
  1917.     UI_string_type date_format_string = get_string(WGUI_CATEGORY_YYYY_MM_DD_STRING_ID);
  1918.     UI_string_type time_format_string = get_string(WGUI_CATEGORY_HH_MM_STRING_ID);
  1919.     S32 w, y;
  1920. #endif /* (!USE_NEW_DATE_TIME_IMPLEMENTATION) */ 
  1921.     /*----------------------------------------------------------------*/
  1922.     /* Code Body                                                      */
  1923.     /*----------------------------------------------------------------*/
  1924.     gui_lock_double_buffer();
  1925.     clear_screen();
  1926.     show_title_status_icon();
  1927.     draw_title();
  1928.     show_multiline_inputbox();
  1929.     show_softkey_background();
  1930.     show_left_softkey();
  1931.     show_right_softkey();
  1932. #if(!USE_NEW_DATE_TIME_IMPLEMENTATION)
  1933.     /* Needs to be enhanced */
  1934.     gui_reset_text_clip();
  1935.     gui_set_text_color(c);
  1936.     gui_set_font(wgui_date_input_day.text_font);
  1937.     w = (wgui_date_input_day.width >> 1) - (gui_get_string_width(DD_string) >> 1);
  1938.     gui_move_text_cursor(wgui_date_input_day.x + w, wgui_date_input_day.y - 14);
  1939.     gui_print_text(DD_string);
  1940.     w = (wgui_date_input_month.width >> 1) - (gui_get_string_width(MM_string) >> 1);
  1941.     gui_move_text_cursor(wgui_date_input_month.x + w, wgui_date_input_month.y - 14);
  1942.     gui_print_text(MM_string);
  1943.     w = (wgui_date_input_year.width >> 1) - (gui_get_string_width(YYYY_string) >> 1);
  1944.     gui_move_text_cursor(wgui_date_input_year.x + w, wgui_date_input_year.y - 14);
  1945.     gui_print_text(YYYY_string);
  1946.     gui_set_font(wgui_time_input_hours.text_font);
  1947.     w = (wgui_time_input_hours.width >> 1) - (gui_get_string_width(THH_string) >> 1);
  1948.     gui_move_text_cursor(wgui_time_input_hours.x + w, wgui_time_input_hours.y - 14);
  1949.     gui_print_text(THH_string);
  1950.     w = (wgui_time_input_minutes.width >> 1) - (gui_get_string_width(TMM_string) >> 1);
  1951.     gui_move_text_cursor(wgui_time_input_minutes.x + w, wgui_time_input_minutes.y - 14);
  1952.     gui_print_text(TMM_string);
  1953.     wgui_show_date_time_input();
  1954. #else /* (!USE_NEW_DATE_TIME_IMPLEMENTATION) */ 
  1955.     y = MMI_multiline_inputbox.y + MMI_multiline_inputbox.height;
  1956.     gui_reset_text_clip();
  1957.     gui_set_text_color(c);
  1958.     gui_set_font(&MMI_default_font);
  1959.     w = (UI_device_width >> 1) - (gui_get_string_width(date_format_string) >> 1);
  1960.     gui_move_text_cursor(w, y);
  1961.     gui_print_text(date_format_string);
  1962.     w = (UI_device_width >> 1) - (gui_get_string_width(time_format_string) >> 1);
  1963.     y = wgui_date_input_object.y + wgui_date_input_object.height + 2;
  1964.     gui_move_text_cursor(w, y);
  1965.     gui_print_text(time_format_string);
  1966.     date_input_show_background(&wgui_date_input_object);
  1967.     show_date_input(&wgui_date_input_object);
  1968. #endif /* (!USE_NEW_DATE_TIME_IMPLEMENTATION) */ 
  1969.     gui_unlock_double_buffer();
  1970.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1971. }
  1972. /*----------------------------------------------------------------------------
  1973. Function:         category25_RSK_function
  1974. Description:      a function pointer store the address of RSK key
  1975. Input Parameters: none
  1976. Output Parameters:   none
  1977. Returns:       void
  1978. ----------------------------------------------------------------------------*/
  1979. void (*category25_RSK_function) (void) = NULL;
  1980. U8 category25_RSK_label_clear = 0;
  1981. /* store the RSK string of category 25 */
  1982. UI_string_type category25_RSK_label_string;
  1983. /* store the RSK icon  of category 25 */
  1984. PU8 category25_RSK_label_icon;
  1985. /*****************************************************************************
  1986.  * FUNCTION
  1987.  *  SetCategory25RightSoftkeyFunction
  1988.  * DESCRIPTION
  1989.  *  set teh function pointer of RSK key handler of category25
  1990.  * PARAMETERS
  1991.  *  f           [IN]        
  1992.  *  k           [IN]        
  1993.  *  a(?)        [IN]        Function pointer
  1994.  * RETURNS
  1995.  *  void
  1996.  *****************************************************************************/
  1997. void SetCategory25RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
  1998. {
  1999.     /*----------------------------------------------------------------*/
  2000.     /* Local Variables                                                */
  2001.     /*----------------------------------------------------------------*/
  2002.     /*----------------------------------------------------------------*/
  2003.     /* Code Body                                                      */
  2004.     /*----------------------------------------------------------------*/
  2005.     UI_UNUSED_PARAMETER(k);
  2006.     category25_RSK_function = f;
  2007. }
  2008. /*****************************************************************************
  2009.  * FUNCTION
  2010.  *  handle_category25_right_softkey_down
  2011.  * DESCRIPTION
  2012.  *  handle category 25 RSK down key
  2013.  * PARAMETERS
  2014.  *  void
  2015.  * RETURNS
  2016.  *  void
  2017.  *****************************************************************************/
  2018. void handle_category25_right_softkey_down(void)
  2019. {
  2020.     /*----------------------------------------------------------------*/
  2021.     /* Local Variables                                                */
  2022.     /*----------------------------------------------------------------*/
  2023.     /*----------------------------------------------------------------*/
  2024.     /* Code Body                                                      */
  2025.     /*----------------------------------------------------------------*/
  2026.     wgui_date_time_delete_character();
  2027. }
  2028. /*****************************************************************************
  2029.  * FUNCTION
  2030.  *  handle_category25_right_softkey_up
  2031.  * DESCRIPTION
  2032.  *  handle category 25 RSK up  key
  2033.  * PARAMETERS
  2034.  *  void
  2035.  * RETURNS
  2036.  *  void
  2037.  *****************************************************************************/
  2038. void handle_category25_right_softkey_up(void)
  2039. {
  2040.     /*----------------------------------------------------------------*/
  2041.     /* Local Variables                                                */
  2042.     /*----------------------------------------------------------------*/
  2043.     S32 l1 = gui_single_line_input_box_get_text_length(&wgui_date_input_day);
  2044.     S32 l2 = gui_single_line_input_box_get_text_length(&wgui_date_input_month);
  2045.     S32 l3 = gui_single_line_input_box_get_text_length(&wgui_date_input_year);
  2046.     S32 l4 = gui_single_line_input_box_get_text_length(&wgui_time_input_hours);
  2047.     S32 l5 = gui_single_line_input_box_get_text_length(&wgui_time_input_minutes);
  2048.     /*----------------------------------------------------------------*/
  2049.     /* Code Body                                                      */
  2050.     /*----------------------------------------------------------------*/
  2051.     if ((l1 <= 0) && (l2 <= 0) && (l3 <= 0) && (l4 <= 0) && (l5 <= 0) && (!category25_RSK_label_clear))
  2052.     {
  2053.         if (category25_RSK_function != NULL)
  2054.         {
  2055.             category25_RSK_function();
  2056.         }
  2057.     }
  2058. }
  2059. /*****************************************************************************
  2060.  * FUNCTION
  2061.  *  register_category25_handle_right_softkey_up
  2062.  * DESCRIPTION
  2063.  *  register right soft key function handler of category 25
  2064.  * PARAMETERS
  2065.  *  void
  2066.  * RETURNS
  2067.  *  void
  2068.  *****************************************************************************/
  2069. void register_category25_handle_right_softkey_up(void)
  2070. {
  2071.     /*----------------------------------------------------------------*/
  2072.     /* Local Variables                                                */
  2073.     /*----------------------------------------------------------------*/
  2074.     /*----------------------------------------------------------------*/
  2075.     /* Code Body                                                      */
  2076.     /*----------------------------------------------------------------*/
  2077.     set_right_softkey_function(handle_category25_right_softkey_up, KEY_EVENT_UP);
  2078. }
  2079. /*****************************************************************************
  2080.  * FUNCTION
  2081.  *  handle_category25_right_softkey_long_press
  2082.  * DESCRIPTION
  2083.  *  
  2084.  * PARAMETERS
  2085.  *  void
  2086.  * RETURNS
  2087.  *  void
  2088.  *****************************************************************************/
  2089. void handle_category25_right_softkey_long_press(void)
  2090. {
  2091.     /*----------------------------------------------------------------*/
  2092.     /* Local Variables                                                */
  2093.     /*----------------------------------------------------------------*/
  2094.     /*----------------------------------------------------------------*/
  2095.     /* Code Body                                                      */
  2096.     /*----------------------------------------------------------------*/
  2097. }
  2098. /*****************************************************************************
  2099.  * FUNCTION
  2100.  *  handle_category25_input
  2101.  * DESCRIPTION
  2102.  *  handle category25 input
  2103.  * PARAMETERS
  2104.  *  void
  2105.  * RETURNS
  2106.  *  void
  2107.  *****************************************************************************/
  2108. void handle_category25_input(void)
  2109. {
  2110.     /*----------------------------------------------------------------*/
  2111.     /* Local Variables                                                */
  2112.     /*----------------------------------------------------------------*/
  2113.     S32 l1 = gui_single_line_input_box_get_text_length(&wgui_date_input_day);
  2114.     S32 l2 = gui_single_line_input_box_get_text_length(&wgui_date_input_month);
  2115.     S32 l3 = gui_single_line_input_box_get_text_length(&wgui_date_input_year);
  2116.     S32 l4 = gui_single_line_input_box_get_text_length(&wgui_time_input_hours);
  2117.     S32 l5 = gui_single_line_input_box_get_text_length(&wgui_time_input_minutes);
  2118.     /*----------------------------------------------------------------*/
  2119.     /* Code Body                                                      */
  2120.     /*----------------------------------------------------------------*/
  2121.     if ((l1 > 0) || (l2 > 0) || (l3 > 0) || (l4 > 0) || (l5 > 0))
  2122.     {
  2123.         if (category25_RSK_label_clear == 0)
  2124.         {
  2125.             /* Hardcoded. Needs to be modified to take IDs  */
  2126.             set_right_softkey_label((UI_string_type) get_string(WGUI_CATEGORY_CLEAR_STRING_ID));
  2127.             set_right_softkey_icon(NULL);
  2128.             redraw_right_softkey();
  2129.             category25_RSK_label_clear = 1;
  2130.             set_right_softkey_function(UI_dummy_function, KEY_EVENT_UP);
  2131.         }
  2132.     }
  2133.     else
  2134.     {
  2135.         if (category25_RSK_label_clear == 1)
  2136.         {
  2137.             set_right_softkey_label(category25_RSK_label_string);
  2138.             set_right_softkey_icon(category25_RSK_label_icon);
  2139.             redraw_right_softkey();
  2140.             category25_RSK_label_clear = 0;
  2141.             set_right_softkey_function(register_category25_handle_right_softkey_up, KEY_EVENT_UP);
  2142.         }
  2143.     }
  2144. }
  2145. /*****************************************************************************
  2146.  * FUNCTION
  2147.  *  ShowCategory25Screen
  2148.  * DESCRIPTION
  2149.  *  Displays the category25 screen
  2150.  * PARAMETERS
  2151.  *  title                   [IN]        Title for the screen
  2152.  *  title_icon              [IN]        Icon shown with the title
  2153.  *  left_softkey            [IN]        Left softkey label
  2154.  *  left_softkey_icon       [IN]        Icon for the Left softkey
  2155.  *  right_softkey           [IN]        Right softkey label
  2156.  *  right_softkey_icon      [IN]        Icon for the right softkey
  2157.  *  message                 [IN]        Message string
  2158.  *  day_buffer              [IN]        Buffer to input day
  2159.  *  month_buffer            [IN]        Buffer to input month
  2160.  *  year_buffer             [IN]        Buffer to input year
  2161.  *  hours_buffer            [IN]        Buffer to input hours
  2162.  *  minutes_buffer          [IN]        Buffer to input minutes
  2163.  *  history_buffer          [IN]        History buffer
  2164.  * RETURNS
  2165.  *  void
  2166.  *****************************************************************************/
  2167. void ShowCategory25Screen(
  2168.         U16 title,
  2169.         U16 title_icon,
  2170.         U16 left_softkey,
  2171.         U16 left_softkey_icon,
  2172.         U16 right_softkey,
  2173.         U16 right_softkey_icon,
  2174.         U16 message,
  2175.         U8 *day_buffer,
  2176.         U8 *month_buffer,
  2177.         U8 *year_buffer,
  2178.         U8 *hours_buffer,
  2179.         U8 *minutes_buffer,
  2180.         U8 *history_buffer)
  2181. {
  2182.     /*----------------------------------------------------------------*/
  2183.     /* Local Variables                                                */
  2184.     /*----------------------------------------------------------------*/
  2185.     S32 l, fh, n;
  2186. #if(!USE_NEW_DATE_TIME_IMPLEMENTATION)
  2187.     S32 s1, s2, s3, sg, x, y;
  2188. #endif 
  2189.     /*----------------------------------------------------------------*/
  2190.     /* Code Body                                                      */
  2191.     /*----------------------------------------------------------------*/
  2192.     ADD_SCREEN_STRINGS((4, title, left_softkey, right_softkey, message));
  2193.     ADD_SCREEN_IMAGES((3, title_icon, left_softkey_icon, right_softkey_icon));
  2194.     UI_UNUSED_PARAMETER(history_buffer);
  2195. #if(UI_DOUBLE_BUFFER_SUPPORT)
  2196.     gui_lock_double_buffer();
  2197. #endif 
  2198.     MMI_menu_shortcut_number = -1;
  2199.     clear_category_screen_key_handlers();
  2200.     clear_left_softkey();
  2201.     clear_right_softkey();
  2202.     change_left_softkey(left_softkey, left_softkey_icon);
  2203.     change_right_softkey(right_softkey, right_softkey_icon);
  2204.     register_left_softkey_handler();
  2205.     register_right_softkey_handler();
  2206.     register_default_hide_softkeys();
  2207.     MMI_title_string = (UI_string_type) get_string(title);
  2208.     MMI_title_icon = (PU8) get_image(title_icon);
  2209.     MMI_message_string = (UI_string_type) get_string(message);
  2210.     l = gui_strlen(MMI_message_string);
  2211.     create_multiline_inputbox_set_buffer(MMI_message_string, l, l, 0);
  2212.     resize_multiline_inputbox(MMI_multiline_inputbox.width, MMI_content_height);
  2213.     MMI_multiline_inputbox.flags |=
  2214.         (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY |
  2215.          UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND | UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR);
  2216.     show_multiline_inputbox_no_draw();
  2217.     gui_set_font(MMI_multiline_inputbox.text_font);
  2218.     fh = get_multiline_inputbox_line_height();
  2219.     n = MMI_multiline_inputbox.n_lines;
  2220.     if (n > 2)
  2221.     {
  2222.         n = 2;
  2223.     }
  2224.     resize_multiline_inputbox(
  2225.         MMI_multiline_inputbox.width,
  2226.         (n * fh) + MULTILINE_INPUTBOX_HEIGHT_PAD + MMI_multiline_inputbox.text_y);
  2227.     move_multiline_inputbox(0, (MMI_title_y + MMI_title_height));
  2228. #if(!USE_NEW_DATE_TIME_IMPLEMENTATION)
  2229.     wgui_initialize_date_input(day_buffer, 2, month_buffer, 2, year_buffer, 4);
  2230.     wgui_initialize_time_input(hours_buffer, 2, minutes_buffer, 2, NULL, 0);
  2231.     y = 16 + MMI_multiline_inputbox.y + MMI_multiline_inputbox.height +
  2232.         (((MMI_content_height - MMI_multiline_inputbox.height) >> 1) - (16 + 18));
  2233.     s1 = 24;
  2234.     s2 = 24;
  2235.     s3 = 40;
  2236.     sg = 4;
  2237.     wgui_resize_day_input(s1, 18);
  2238.     wgui_resize_month_input(s2, 18);
  2239.     wgui_resize_year_input(s3, 18);
  2240.     x = (UI_device_width >> 1) - ((s1 + s2 + s3 + sg + sg) >> 1);
  2241.     wgui_move_day_input(x, y);
  2242.     x += s1 + sg;
  2243.     wgui_move_month_input(x, y);
  2244.     x += s2 + sg;
  2245.     wgui_move_year_input(x, y);
  2246.     y += 18 + 16;
  2247.     s1 = 24;
  2248.     s2 = 24;
  2249.     sg = 4;
  2250.     wgui_resize_hours_input(s1, 18);
  2251.     wgui_resize_minutes_input(s2, 18);
  2252.     x = (UI_device_width >> 1) - ((s1 + s2 + sg) >> 1);
  2253.     wgui_move_hours_input(x, y);
  2254.     x += s1 + sg;
  2255.     wgui_move_minutes_input(x, y);
  2256.     wgui_set_day_input_navigation(WGUI_DATE_TIME_INPUT_FOCUS_NONE, WGUI_DATE_TIME_INPUT_FOCUS_MONTH);
  2257.     wgui_set_month_input_navigation(WGUI_DATE_TIME_INPUT_FOCUS_DAY, WGUI_DATE_TIME_INPUT_FOCUS_YEAR);
  2258.     wgui_set_year_input_navigation(WGUI_DATE_TIME_INPUT_FOCUS_MONTH, WGUI_DATE_TIME_INPUT_FOCUS_HOURS);
  2259.     wgui_set_hours_input_navigation(WGUI_DATE_TIME_INPUT_FOCUS_YEAR, WGUI_DATE_TIME_INPUT_FOCUS_MINUTES);
  2260.     wgui_set_minutes_input_navigation(WGUI_DATE_TIME_INPUT_FOCUS_HOURS, WGUI_DATE_TIME_INPUT_FOCUS_NONE);
  2261.     wgui_date_time_input_set_focus(WGUI_DATE_TIME_INPUT_FOCUS_DAY);
  2262.     wgui_date_time_input_register_keys();
  2263.     category25_RSK_label_clear = 0;
  2264.     set_right_softkey_function(handle_category25_right_softkey_down, KEY_EVENT_DOWN);
  2265.     set_right_softkey_function(handle_category25_right_softkey_long_press, KEY_LONG_PRESS);
  2266.     register_wgui_date_time_input_callback(handle_category25_input);
  2267.     category25_RSK_label_icon = get_image(right_softkey_icon);
  2268.     category25_RSK_label_string = get_string(right_softkey);
  2269.     handle_category25_input();
  2270.     {
  2271.         S32 l1 = gui_single_line_input_box_get_text_length(&wgui_date_input_day);
  2272.         S32 l2 = gui_single_line_input_box_get_text_length(&wgui_date_input_month);
  2273.         S32 l3 = gui_single_line_input_box_get_text_length(&wgui_date_input_year);
  2274.         S32 l4 = gui_single_line_input_box_get_text_length(&wgui_time_input_hours);
  2275.         S32 l5 = gui_single_line_input_box_get_text_length(&wgui_time_input_minutes);
  2276.         if ((l1 <= 0) && (l2 <= 0) && (l3 <= 0) && (l4 <= 0) && (l5 <= 0))
  2277.         {
  2278.             set_right_softkey_function(handle_category25_right_softkey_up, KEY_EVENT_UP);
  2279.         }
  2280.     }
  2281. #else /* (!USE_NEW_DATE_TIME_IMPLEMENTATION) */ 
  2282.     create_date_input(
  2283.         &wgui_date_input_object,
  2284.         8,
  2285.         MMI_multiline_inputbox.y + 22,
  2286.         UI_device_width - 16,
  2287.         18,
  2288.         DATE_INPUT_TYPE_YYYY_MM_DD,
  2289.         day_buffer,
  2290.         month_buffer,
  2291.         year_buffer);
  2292.     /* inline_date_edit_set_history(INLINE_DATE_HISTORY_ID,history_buffer); */
  2293.     date_input_set_seperator(&wgui_date_input_object, (UI_character_type) '/');
  2294.     set_current_date_input(&wgui_date_input_object);
  2295.     date_input_register_keys();
  2296. #endif /* (!USE_NEW_DATE_TIME_IMPLEMENTATION) */ 
  2297. #if(UI_DOUBLE_BUFFER_SUPPORT)
  2298.     gui_unlock_double_buffer();
  2299. #endif 
  2300.     ExitCategoryFunction = ExitCategory25Screen;
  2301.     RedrawCategoryFunction = RedrawCategory25Screen;
  2302.     GetCategoryHistory = GetCategory25History;
  2303.     GetCategoryHistorySize = GetCategory25HistorySize;
  2304.     RedrawCategory25Screen();
  2305. }
  2306. /*****************************************************************************
  2307.  * FUNCTION
  2308.  *  ExitCategory25Screen
  2309.  * DESCRIPTION
  2310.  *  Exits the category25 screen
  2311.  * PARAMETERS
  2312.  *  void
  2313.  * RETURNS
  2314.  *  void
  2315.  *****************************************************************************/
  2316. void ExitCategory25Screen(void)
  2317. {
  2318.     /*----------------------------------------------------------------*/
  2319.     /* Local Variables                                                */
  2320.     /*----------------------------------------------------------------*/
  2321.     /*----------------------------------------------------------------*/
  2322.     /* Code Body                                                      */
  2323.     /*----------------------------------------------------------------*/
  2324.     wgui_date_time_input_clear_keys();
  2325.     wgui_reset_date_input();
  2326.     wgui_reset_time_input();
  2327.     clear_wgui_date_time_input_callback();
  2328.     ExitCategoryFunction = MMI_dummy_function;
  2329.     RedrawCategoryFunction = MMI_dummy_function;
  2330.     GetCategoryHistory = dummy_get_history;
  2331.     GetCategoryHistorySize = dummy_get_history_size;
  2332. }
  2333. /*****************************************************************************
  2334.  * FUNCTION
  2335.  *  GetCategory25HistorySize
  2336.  * DESCRIPTION
  2337.  *  Gets the history buffer size for the category25 screen
  2338.  * PARAMETERS
  2339.  *  void
  2340.  * RETURNS
  2341.  *  size of history buffer in U8s
  2342.  *****************************************************************************/
  2343. S32 GetCategory25HistorySize(void)
  2344. {
  2345.     /*----------------------------------------------------------------*/
  2346.     /* Local Variables                                                */
  2347.     /*----------------------------------------------------------------*/
  2348.     /*----------------------------------------------------------------*/
  2349.     /* Code Body                                                      */
  2350.     /*----------------------------------------------------------------*/
  2351.     return (0);
  2352. }
  2353. /*****************************************************************************
  2354.  * FUNCTION
  2355.  *  GetCategory25History
  2356.  * DESCRIPTION
  2357.  *  Gets the history buffer for the category25 screen
  2358.  * PARAMETERS
  2359.  *  history_buffer      [IN]        Is the buffer to store the history data (pre-allocated)
  2360.  * RETURNS
  2361.  *  pointer to the history buffer
  2362.  *****************************************************************************/
  2363. U8 *GetCategory25History(U8 *history_buffer)
  2364. {
  2365.     /*----------------------------------------------------------------*/
  2366.     /* Local Variables                                                */
  2367.     /*----------------------------------------------------------------*/
  2368.     /*----------------------------------------------------------------*/
  2369.     /* Code Body                                                      */
  2370.     /*----------------------------------------------------------------*/
  2371.     return (history_buffer);
  2372. }
  2373. /*****************************************************************************
  2374.  * FUNCTION
  2375.  *  RedrawCategory26Screen
  2376.  * DESCRIPTION
  2377.  *  Redraws the category26 screen
  2378.  * PARAMETERS
  2379.  *  void
  2380.  * RETURNS
  2381.  *  void
  2382.  *****************************************************************************/
  2383. void RedrawCategory26Screen(void)
  2384. {
  2385.     /*----------------------------------------------------------------*/
  2386.     /* Local Variables                                                */
  2387.     /*----------------------------------------------------------------*/
  2388.     color c = gui_color(0, 0, 0);
  2389.     UI_string_type DD_string = get_string(WGUI_CATEGORY_DD_STRING_ID);
  2390.     UI_string_type MM_string = get_string(WGUI_CATEGORY_MM_STRING_ID);
  2391.     UI_string_type YYYY_string = get_string(WGUI_CATEGORY_YYYY_STRING_ID);
  2392.     S32 w;
  2393.     /*----------------------------------------------------------------*/
  2394.     /* Code Body                                                      */
  2395.     /*----------------------------------------------------------------*/
  2396.     gui_lock_double_buffer();
  2397.     clear_screen();
  2398.     show_title_status_icon();
  2399.     draw_title();
  2400.     show_multiline_inputbox();
  2401.     show_softkey_background();
  2402.     show_left_softkey();
  2403.     show_right_softkey();
  2404.     /* Needs to be enhanced */
  2405.     gui_reset_text_clip();
  2406.     gui_set_text_color(c);
  2407.     gui_set_font(wgui_date_input_day.text_font);
  2408.     w = (wgui_date_input_day.width >> 1) - (gui_get_string_width(DD_string) >> 1);
  2409.     gui_move_text_cursor(wgui_date_input_day.x + w, wgui_date_input_day.y - 14);
  2410.     gui_print_text(DD_string);
  2411.     w = (wgui_date_input_month.width >> 1) - (gui_get_string_width(MM_string) >> 1);
  2412.     gui_move_text_cursor(wgui_date_input_month.x + w, wgui_date_input_month.y - 14);
  2413.     gui_print_text(MM_string);
  2414.     w = (wgui_date_input_year.width >> 1) - (gui_get_string_width(YYYY_string) >> 1);
  2415.     gui_move_text_cursor(wgui_date_input_year.x + w, wgui_date_input_year.y - 14);
  2416.     gui_print_text(YYYY_string);
  2417.     wgui_show_date_time_input();
  2418.     gui_unlock_double_buffer();
  2419.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  2420. }
  2421. /*----------------------------------------------------------------------------
  2422. Function:         category26_RSK_function
  2423. Description:      a function pointer store teh address of function which handles
  2424.                category26 RSK
  2425. Input Parameters: none
  2426. Output Parameters:   none
  2427. Returns:       void
  2428. ----------------------------------------------------------------------------*/
  2429. void (*category26_RSK_function) (void) = NULL;
  2430. U8 category26_RSK_label_clear = 0;
  2431. /* store teh string of category26 RSK */
  2432. UI_string_type category26_RSK_label_string;
  2433. /* store the icon of category 26 RSK */
  2434. PU8 category26_RSK_label_icon;
  2435. /*****************************************************************************
  2436.  * FUNCTION
  2437.  *  SetCategory26RightSoftkeyFunction
  2438.  * DESCRIPTION
  2439.  *  set the function of RSK key of category26
  2440.  * PARAMETERS
  2441.  *  f           [IN]        
  2442.  *  k           [IN]        
  2443.  *  a(?)        [IN]        Function pointer
  2444.  * RETURNS
  2445.  *  void
  2446.  *****************************************************************************/
  2447. void SetCategory26RightSoftkeyFunction(void (*f) (void), MMI_key_event_type k)
  2448. {
  2449.     /*----------------------------------------------------------------*/
  2450.     /* Local Variables                                                */
  2451.     /*----------------------------------------------------------------*/
  2452.     /*----------------------------------------------------------------*/
  2453.     /* Code Body                                                      */
  2454.     /*----------------------------------------------------------------*/
  2455.     UI_UNUSED_PARAMETER(k);
  2456.     category26_RSK_function = f;
  2457. }
  2458. /*****************************************************************************
  2459.  * FUNCTION
  2460.  *  handle_category26_right_softkey_down
  2461.  * DESCRIPTION
  2462.  *  a function handle the RSK down key of category 26
  2463.  * PARAMETERS
  2464.  *  void
  2465.  * RETURNS
  2466.  *  void
  2467.  *****************************************************************************/
  2468. void handle_category26_right_softkey_down(void)
  2469. {
  2470.     /*----------------------------------------------------------------*/
  2471.     /* Local Variables                                                */
  2472.     /*----------------------------------------------------------------*/
  2473.     /*----------------------------------------------------------------*/
  2474.     /* Code Body                                                      */
  2475.     /*----------------------------------------------------------------*/
  2476.     wgui_date_time_delete_character();
  2477. }
  2478. /*****************************************************************************
  2479.  * FUNCTION
  2480.  *  handle_category26_right_softkey_up
  2481.  * DESCRIPTION
  2482.  *  a function handle the RSK up key of category 26
  2483.  * PARAMETERS
  2484.  *  void
  2485.  * RETURNS
  2486.  *  void
  2487.  *****************************************************************************/
  2488. void handle_category26_right_softkey_up(void)
  2489. {
  2490.     /*----------------------------------------------------------------*/
  2491.     /* Local Variables                                                */
  2492.     /*----------------------------------------------------------------*/
  2493.     S32 l1 = gui_single_line_input_box_get_text_length(&wgui_date_input_day);
  2494.     S32 l2 = gui_single_line_input_box_get_text_length(&wgui_date_input_month);
  2495.     S32 l3 = gui_single_line_input_box_get_text_length(&wgui_date_input_year);
  2496.     /*----------------------------------------------------------------*/
  2497.     /* Code Body                                                      */
  2498.     /*----------------------------------------------------------------*/
  2499.     if ((l1 <= 0) && (l2 <= 0) && (l3 <= 0) && (!category26_RSK_label_clear))
  2500.     {
  2501.         if (category26_RSK_function != NULL)
  2502.         {
  2503.             category26_RSK_function();
  2504.         }
  2505.     }
  2506. }
  2507. /*****************************************************************************
  2508.  * FUNCTION
  2509.  *  register_category26_handle_right_softkey_up
  2510.  * DESCRIPTION
  2511.  *  register a function whcih handle category26 RSK up key
  2512.  * PARAMETERS
  2513.  *  void
  2514.  * RETURNS
  2515.  *  void
  2516.  *****************************************************************************/
  2517. void register_category26_handle_right_softkey_up(void)
  2518. {
  2519.     /*----------------------------------------------------------------*/
  2520.     /* Local Variables                                                */
  2521.     /*----------------------------------------------------------------*/
  2522.     /*----------------------------------------------------------------*/
  2523.     /* Code Body                                                      */
  2524.     /*----------------------------------------------------------------*/
  2525.     set_right_softkey_function(handle_category26_right_softkey_up, KEY_EVENT_UP);
  2526. }
  2527. /*****************************************************************************
  2528.  * FUNCTION
  2529.  *  handle_category26_right_softkey_long_press
  2530.  * DESCRIPTION
  2531.  *  
  2532.  * PARAMETERS
  2533.  *  void
  2534.  * RETURNS
  2535.  *  void
  2536.  *****************************************************************************/
  2537. void handle_category26_right_softkey_long_press(void)
  2538. {
  2539.     /*----------------------------------------------------------------*/
  2540.     /* Local Variables                                                */
  2541.     /*----------------------------------------------------------------*/
  2542.     /*----------------------------------------------------------------*/
  2543.     /* Code Body                                                      */
  2544.     /*----------------------------------------------------------------*/
  2545. }
  2546. /*****************************************************************************
  2547.  * FUNCTION
  2548.  *  handle_category26_input
  2549.  * DESCRIPTION
  2550.  *  a function which handle category26 input
  2551.  * PARAMETERS
  2552.  *  void
  2553.  * RETURNS
  2554.  *  void
  2555.  *****************************************************************************/
  2556. void handle_category26_input(void)
  2557. {
  2558.     /*----------------------------------------------------------------*/
  2559.     /* Local Variables                                                */
  2560.     /*----------------------------------------------------------------*/
  2561.     S32 l1 = gui_single_line_input_box_get_text_length(&wgui_date_input_day);
  2562.     S32 l2 = gui_single_line_input_box_get_text_length(&wgui_date_input_month);
  2563.     S32 l3 = gui_single_line_input_box_get_text_length(&wgui_date_input_year);
  2564.     /*----------------------------------------------------------------*/
  2565.     /* Code Body                                                      */
  2566.     /*----------------------------------------------------------------*/
  2567.     if ((l1 > 0) || (l2 > 0) || (l3 > 0))
  2568.     {
  2569.         if (category26_RSK_label_clear == 0)
  2570.         {
  2571.             set_right_softkey_label((UI_string_type) get_string(WGUI_CATEGORY_CLEAR_STRING_ID));
  2572.             set_right_softkey_icon(NULL);
  2573.             redraw_right_softkey();
  2574.             category26_RSK_label_clear = 1;
  2575.             set_right_softkey_function(UI_dummy_function, KEY_EVENT_UP);
  2576.         }
  2577.     }
  2578.     else
  2579.     {
  2580.         if (category26_RSK_label_clear == 1)
  2581.         {
  2582.             set_right_softkey_label(category26_RSK_label_string);
  2583.             set_right_softkey_icon(category26_RSK_label_icon);
  2584.             redraw_right_softkey();
  2585.             category26_RSK_label_clear = 0;
  2586.             set_right_softkey_function(register_category26_handle_right_softkey_up, KEY_EVENT_UP);
  2587.         }
  2588.     }
  2589. }
  2590. /*****************************************************************************
  2591.  * FUNCTION
  2592.  *  ShowCategory26Screen
  2593.  * DESCRIPTION
  2594.  *  Displays the category26 screen
  2595.  * PARAMETERS
  2596.  *  title                   [IN]        Title for the screen
  2597.  *  title_icon              [IN]        Icon shown with the title
  2598.  *  left_softkey            [IN]        Left softkey label
  2599.  *  left_softkey_icon       [IN]        Icon for the Left softkey
  2600.  *  right_softkey           [IN]        Right softkey label
  2601.  *  right_softkey_icon      [IN]        Icon for the right softkey
  2602.  *  message                 [IN]        Message string
  2603.  *  day_buffer              [IN]        Buffer to input day
  2604.  *  month_buffer            [IN]        Buffer to input month
  2605.  *  year_buffer             [IN]        Buffer to input year
  2606.  *  history_buffer          [IN]        History buffer
  2607.  * RETURNS
  2608.  *  void
  2609.  *****************************************************************************/
  2610. void ShowCategory26Screen(
  2611.         U16 title,
  2612.         U16 title_icon,
  2613.         U16 left_softkey,
  2614.         U16 left_softkey_icon,
  2615.         U16 right_softkey,
  2616.         U16 right_softkey_icon,
  2617.         U16 message,
  2618.         U8 *day_buffer,
  2619.         U8 *month_buffer,
  2620.         U8 *year_buffer,
  2621.         U8 *history_buffer)
  2622. {
  2623.     /*----------------------------------------------------------------*/
  2624.     /* Local Variables                                                */
  2625.     /*----------------------------------------------------------------*/
  2626.     S32 l, s1, s2, s3, sg, x, y, fh;
  2627.     /*----------------------------------------------------------------*/
  2628.     /* Code Body                                                      */
  2629.     /*----------------------------------------------------------------*/
  2630.     ADD_SCREEN_STRINGS((4, title, left_softkey, right_softkey, message));
  2631.     ADD_SCREEN_IMAGES((3, title_icon, left_softkey_icon, right_softkey_icon));
  2632.     UI_UNUSED_PARAMETER(history_buffer);
  2633. #if(UI_DOUBLE_BUFFER_SUPPORT)
  2634.     gui_lock_double_buffer();
  2635. #endif 
  2636.     MMI_menu_shortcut_number = -1;
  2637.     clear_category_screen_key_handlers();
  2638.     clear_left_softkey();
  2639.     clear_right_softkey();
  2640.     change_left_softkey(left_softkey, left_softkey_icon);
  2641.     change_right_softkey(right_softkey, right_softkey_icon);
  2642.     register_left_softkey_handler();
  2643.     register_right_softkey_handler();
  2644.     register_default_hide_softkeys();
  2645.     MMI_title_string = (UI_string_type) get_string(title);
  2646.     MMI_title_icon = (PU8) get_image(title_icon);
  2647.     MMI_message_string = (UI_string_type) get_string(message);
  2648.     l = gui_strlen(MMI_message_string);
  2649.     create_multiline_inputbox_set_buffer(MMI_message_string, l, l, 0);
  2650.     resize_multiline_inputbox(MMI_multiline_inputbox.width, 40);
  2651.     MMI_multiline_inputbox.flags |=
  2652.         (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY |
  2653.          UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND | UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR);
  2654.     show_multiline_inputbox_no_draw();
  2655.     gui_set_font(MMI_multiline_inputbox.text_font);
  2656.     fh = get_multiline_inputbox_line_height();
  2657.     resize_multiline_inputbox(
  2658.         MMI_multiline_inputbox.width,
  2659.         (MMI_multiline_inputbox.n_lines * fh) + MULTILINE_INPUTBOX_HEIGHT_PAD + MMI_multiline_inputbox.text_y);
  2660.     /* MTK Leo added, to move inputbox to proper position */
  2661. #ifdef __BW_MMI__
  2662.     move_multiline_inputbox((MMI_content_width << 1) - (l << 1), (MMI_title_y + MMI_title_height) + 2);
  2663. #else 
  2664.     move_multiline_inputbox(0, (MMI_title_y + MMI_title_height));
  2665. #endif 
  2666.     /* MTK Leo end */
  2667.     wgui_reset_time_input();
  2668.     wgui_initialize_date_input(day_buffer, 2, month_buffer, 2, year_buffer, 4);
  2669.     y = 16 + MMI_multiline_inputbox.y + MMI_multiline_inputbox.height +
  2670.         (((MMI_content_height - MMI_multiline_inputbox.height) >> 1) - ((16 + 18) >> 1));
  2671.     s1 = 24;
  2672.     s2 = 24;
  2673.     s3 = 40;
  2674.     sg = 4;
  2675.     wgui_resize_day_input(s1, 18);
  2676.     wgui_resize_month_input(s2, 18);
  2677.     wgui_resize_year_input(s3, 18);
  2678.     x = (UI_device_width >> 1) - ((s1 + s2 + s3 + sg + sg) >> 1);
  2679.     wgui_move_day_input(x, y);
  2680.     x += s1 + sg;
  2681.     wgui_move_month_input(x, y);
  2682.     x += s2 + sg;
  2683.     wgui_move_year_input(x, y);
  2684.     wgui_set_day_input_navigation(WGUI_DATE_TIME_INPUT_FOCUS_NONE, WGUI_DATE_TIME_INPUT_FOCUS_MONTH);
  2685.     wgui_set_month_input_navigation(WGUI_DATE_TIME_INPUT_FOCUS_DAY, WGUI_DATE_TIME_INPUT_FOCUS_YEAR);
  2686.     wgui_set_year_input_navigation(WGUI_DATE_TIME_INPUT_FOCUS_MONTH, WGUI_DATE_TIME_INPUT_FOCUS_NONE);
  2687.     wgui_date_time_input_set_focus(WGUI_DATE_TIME_INPUT_FOCUS_DAY);
  2688.     wgui_date_time_input_register_keys();
  2689.     category26_RSK_label_clear = 0;
  2690.     set_right_softkey_function(handle_category26_right_softkey_down, KEY_EVENT_DOWN);
  2691.     set_right_softkey_function(handle_category26_right_softkey_long_press, KEY_LONG_PRESS);
  2692.     register_wgui_date_time_input_callback(handle_category26_input);
  2693.     category26_RSK_label_icon = get_image(right_softkey_icon);
  2694.     category26_RSK_label_string = get_string(right_softkey);
  2695.     handle_category26_input();
  2696.     {
  2697.         S32 l1 = gui_single_line_input_box_get_text_length(&wgui_date_input_day);
  2698.         S32 l2 = gui_single_line_input_box_get_text_length(&wgui_date_input_month);
  2699.         S32 l3 = gui_single_line_input_box_get_text_length(&wgui_date_input_year);
  2700.         if ((l1 <= 0) && (l2 <= 0) && (l3 <= 0))
  2701.         {
  2702.             set_right_softkey_function(handle_category26_right_softkey_up, KEY_EVENT_UP);
  2703.         }
  2704.     }
  2705. #if(UI_DOUBLE_BUFFER_SUPPORT)
  2706.     gui_unlock_double_buffer();
  2707. #endif 
  2708.     ExitCategoryFunction = ExitCategory26Screen;
  2709.     RedrawCategoryFunction = RedrawCategory26Screen;
  2710.     GetCategoryHistory = GetCategory26History;
  2711.     GetCategoryHistorySize = GetCategory26HistorySize;
  2712.     RedrawCategory26Screen();
  2713. }
  2714. /*****************************************************************************
  2715.  * FUNCTION
  2716.  *  ExitCategory26Screen
  2717.  * DESCRIPTION
  2718.  *  Exits the category26 screen
  2719.  * PARAMETERS
  2720.  *  void
  2721.  * RETURNS
  2722.  *  void
  2723.  *****************************************************************************/
  2724. void ExitCategory26Screen(void)
  2725. {
  2726.     /*----------------------------------------------------------------*/