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

MTK

开发平台:

C/C++

  1.     /* Code Body                                                      */
  2.     /*----------------------------------------------------------------*/
  3.     MMI_slide_control[0].change_callback = f1;
  4.     MMI_slide_control[1].change_callback = f2;
  5. }   /* end of RegisterCategory88ChangeCallbacks */
  6. /*****************************************************************************
  7.  * FUNCTION
  8.  *  category88_keyboard_key_handler
  9.  * DESCRIPTION
  10.  *  keyboard handler of category88(Only for Win32 environment)
  11.  * PARAMETERS
  12.  *  vkey_code       [IN]        Key code to identify the key
  13.  *  key_state       [IN]        The state of key
  14.  * RETURNS
  15.  *  void
  16.  *****************************************************************************/
  17. void category88_keyboard_key_handler(S32 vkey_code, S32 key_state)
  18. {
  19. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  20.     /*----------------------------------------------------------------*/
  21.     /* Local Variables                                                */
  22.     /*----------------------------------------------------------------*/
  23.     /*----------------------------------------------------------------*/
  24.     /* Code Body                                                      */
  25.     /*----------------------------------------------------------------*/
  26.     if (key_state)
  27.     {
  28.         switch (vkey_code)
  29.         {
  30.             case 37:
  31.                 wgui_slide_control_previous();
  32.                 break;
  33.             case 39:
  34.                 wgui_slide_control_next();
  35.                 break;
  36.             case 38:
  37.                 category88_handle_up_key();
  38.                 break;
  39.             case 40:
  40.                 category88_handle_down_key();
  41.                 break;
  42.         }
  43.     }
  44. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  45.     UI_UNUSED_PARAMETER(vkey_code);
  46.     UI_UNUSED_PARAMETER(key_state);
  47. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  48. }   /* end of category88_keyboard_key_handler */
  49. /*****************************************************************************
  50.  * FUNCTION
  51.  *  ShowCategory88Screen
  52.  * DESCRIPTION
  53.  *  
  54.  * PARAMETERS
  55.  *  title                   [IN]        
  56.  *  title_icon              [IN]        
  57.  *  left_softkey            [IN]        
  58.  *  left_softkey_icon       [IN]        
  59.  *  right_softkey           [IN]        
  60.  *  right_softkey_icon      [IN]        
  61.  *  bg_image_id             [IN]        
  62.  *  n_items                 [IN]        
  63.  *  string_list             [IN]        
  64.  *  lower_limit             [?]         
  65.  *  upper_limit             [?]         
  66.  *  current_value           [IN]        
  67.  *  cb_func                 [IN]        
  68.  *  history_buffer          [?]         
  69.  * RETURNS
  70.  *  void
  71.  *****************************************************************************/
  72. void ShowCategory88Screen(
  73.         U16 title,
  74.         U16 title_icon,
  75.         U16 left_softkey,
  76.         U16 left_softkey_icon,
  77.         U16 right_softkey,
  78.         U16 right_softkey_icon,
  79.         U16 bg_image_id,
  80.         U16 n_items,
  81.         U8 **string_list,
  82.         S32 *lower_limit,
  83.         S32 *upper_limit,
  84.         S32 **current_value,
  85.         void (**cb_func) (S32 value),
  86.         U8 *history_buffer)
  87. {
  88.     /*----------------------------------------------------------------*/
  89.     /* Local Variables                                                */
  90.     /*----------------------------------------------------------------*/
  91.     U8 idx = 0;
  92.     dm_data_struct dm_data;
  93.     U8 h_flag;
  94.     /* slide_control *current_focus=&MMI_slide_control[0];//010206 Calvin */
  95.     color c = *(current_MMI_theme->UI_black_color);
  96.     color wc = *(current_MMI_theme->UI_white_color);
  97.     /*----------------------------------------------------------------*/
  98.     /* Code Body                                                      */
  99.     /*----------------------------------------------------------------*/
  100.     MMI_ASSERT(n_items <= MMI_MAX_SLIDE_CONTROL);
  101.     dm_reset_context();
  102.     UI_UNUSED_PARAMETER(history_buffer);
  103.     MMI_ASSERT(lower_limit != NULL);
  104.     MMI_ASSERT(upper_limit != NULL);
  105.     MMI_ASSERT(current_value != NULL);
  106.     gdi_layer_lock_frame_buffer();
  107.     MMI_menu_shortcut_number = -1;
  108.     change_left_softkey(left_softkey, left_softkey_icon);
  109.     change_right_softkey(right_softkey, right_softkey_icon);
  110.     SetupCategoryKeyHandlers();
  111.     MMI_title_string = get_string(title);
  112.     MMI_title_icon = get_image(title_icon);
  113.     h_flag = set_slide_control_category_history((U16) (MMI_CATEGORY88_1ITEM_ID + n_items - 1), (U8*) history_buffer);
  114.     if (h_flag)
  115.     {
  116.         /* the number of slide controls should be the same as the number kept in history */
  117.         MMI_ASSERT(h_flag == n_items);
  118.         for (idx = 0; idx < n_items; idx++)
  119.         {
  120.             *current_value[idx] = *MMI_slide_control_value[idx];
  121.         }
  122.     }
  123.     else
  124.     {
  125.         for (idx = 0; idx < n_items; idx++)
  126.         {
  127.             MMI_slide_control_value[idx] = (current_value[idx]);
  128.         }
  129.         MMI_current_slide_control = &MMI_slide_control[0];
  130.         MMI_current_slide_control_value = (S32*) MMI_slide_control_value[0];            
  131.     }
  132.     /* Avoid NULL pointer in global context */
  133.     MMI_ASSERT(MMI_current_slide_control && MMI_current_slide_control_value);
  134.     for (idx = 0; idx < n_items; idx++)
  135.     {
  136.         if (string_list)
  137.         {
  138.             dm_add_string((UI_string_type) string_list[idx], &MMI_default_font, c, wc, NULL);
  139.             if (cb_func != NULL)
  140.             {
  141.                 dm_add_slide_control(
  142.                     lower_limit[idx],
  143.                     upper_limit[idx],
  144.                     *current_value[idx],
  145.                     cb_func[idx],
  146.                     string_list[idx]);
  147.             }
  148.             else
  149.             {
  150.                 dm_add_slide_control(lower_limit[idx], upper_limit[idx], *current_value[idx], NULL, string_list[idx]);
  151.             }
  152.         }
  153.         else
  154.         {
  155.             if (cb_func != NULL)
  156.             {
  157.                 dm_add_slide_control(lower_limit[idx], upper_limit[idx], *current_value[idx], cb_func[idx], NULL);
  158.             }
  159.             else
  160.             {
  161.                 dm_add_slide_control(lower_limit[idx], upper_limit[idx], *current_value[idx], NULL, NULL);
  162.             }
  163.         }
  164.     }
  165.     if (bg_image_id != 0)
  166.     {
  167.         dm_add_image(get_image(bg_image_id), NULL, NULL);
  168.     }
  169.     SetKeyHandler(wgui_slide_control_previous, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  170.     SetKeyHandler(wgui_slide_control_next, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  171.     SetKeyHandler(category88_handle_up_key, KEY_VOL_UP, KEY_EVENT_DOWN);
  172.     SetKeyHandler(category88_handle_down_key, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  173.     SetKeyHandler(category88_handle_up_key, KEY_UP_ARROW, KEY_EVENT_DOWN);
  174.     SetKeyHandler(category88_handle_down_key, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  175.     register_keyboard_key_handler(category88_keyboard_key_handler);
  176.     gdi_layer_unlock_frame_buffer();
  177.     ExitCategoryFunction = ExitCategory88Screen;
  178.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  179.     dm_data.s32CatId = MMI_CATEGORY88_1ITEM_ID + n_items - 1;
  180.     dm_data.s32ScrId = GetActiveScreenId();
  181.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  182.     dm_setup_data(&dm_data);
  183.     dm_redraw_category_screen();
  184. }
  185. /*****************************************************************************
  186.  * FUNCTION
  187.  *  ExitCategory88Screen
  188.  * DESCRIPTION
  189.  *  Exits the Double Slide control screen
  190.  * PARAMETERS
  191.  *  void
  192.  * RETURNS
  193.  *  void
  194.  *****************************************************************************/
  195. void ExitCategory88Screen(void)
  196. {
  197.     /*----------------------------------------------------------------*/
  198.     /* Local Variables                                                */
  199.     /*----------------------------------------------------------------*/
  200.     /*----------------------------------------------------------------*/
  201.     /* Code Body                                                      */
  202.     /*----------------------------------------------------------------*/
  203.     MMI_message_string = NULL;
  204.     MMI_message_string2 = NULL;
  205.     reset_softkeys();
  206. }
  207. /*****************************************************************************
  208.  * FUNCTION
  209.  *  ShowCategory87Screen
  210.  * DESCRIPTION
  211.  *  
  212.  * PARAMETERS
  213.  *  title                   [IN]        
  214.  *  title_icon              [IN]        
  215.  *  left_softkey            [IN]        
  216.  *  left_softkey_icon       [IN]        
  217.  *  right_softkey           [IN]        
  218.  *  right_softkey_icon      [IN]        
  219.  *  l_limit                 [IN]        
  220.  *  u_limit                 [IN]        
  221.  *  current_value           [?]         
  222.  *  history_buffer          [?]         
  223.  * RETURNS
  224.  *  void
  225.  *****************************************************************************/
  226. void ShowCategory87Screen(
  227.         U16 title,
  228.         U16 title_icon,
  229.         U16 left_softkey,
  230.         U16 left_softkey_icon,
  231.         U16 right_softkey,
  232.         U16 right_softkey_icon,
  233.         S32 l_limit,
  234.         S32 u_limit,
  235.         S32 *current_value,
  236.         U8 *history_buffer)
  237. {
  238.     /*----------------------------------------------------------------*/
  239.     /* Local Variables                                                */
  240.     /*----------------------------------------------------------------*/
  241.     S32 lower_limit[1], upper_limit[1];
  242.     S32 *curr_value[1];
  243.     /*----------------------------------------------------------------*/
  244.     /* Code Body                                                      */
  245.     /*----------------------------------------------------------------*/
  246.     lower_limit[0] = l_limit;
  247.     upper_limit[0] = u_limit;
  248.     curr_value[0] = current_value;
  249.     ShowCategory88Screen(
  250.         title,
  251.         title_icon,
  252.         left_softkey,
  253.         left_softkey_icon,
  254.         right_softkey,
  255.         right_softkey_icon,
  256.         0,
  257.         1,
  258.         NULL,
  259.         lower_limit,
  260.         upper_limit,
  261.         curr_value,
  262.         NULL,
  263.         history_buffer);
  264. }   /* end of ShowCategory87Screen */
  265. /*****************************************************************************
  266.  * FUNCTION
  267.  *  ShowCategory89Screen
  268.  * DESCRIPTION
  269.  *  Displays the Numbered Items screen(with description)
  270.  * PARAMETERS
  271.  *  title                       [IN]        Title for the screen
  272.  *  title_icon                  [IN]        Icon displayed with the title
  273.  *  left_softkey                [IN]        Left softkey label
  274.  *  left_softkey_icon           [IN]        Left softkey icon
  275.  *  right_softkey               [IN]        Right softkey label
  276.  *  right_softkey_icon          [IN]        Right softkey icon
  277.  *  number_of_items             [IN]        Number of items in the menu
  278.  *  list_of_items               [IN]        Array of items
  279.  *  list_of_descriptions        [IN]        Array of Pop up description strings
  280.  *  flags                       [IN]        Flags (see explanation below)
  281.  *  highlighted_item            [IN]        Default item to be highlighted (if there is no history)
  282.  *  history_buffer              [IN]        History buffer
  283.  * RETURNS
  284.  *  void
  285.  *****************************************************************************/
  286. void ShowCategory89Screen(
  287.         U16 title,
  288.         U16 title_icon,
  289.         U16 left_softkey,
  290.         U16 left_softkey_icon,
  291.         U16 right_softkey,
  292.         U16 right_softkey_icon,
  293.         S32 number_of_items,
  294.         U8 **list_of_items,
  295.         U8 **list_of_descriptions,
  296.         S32 flags,
  297.         S32 highlighted_item,
  298.         U8 *history_buffer)
  299. {
  300.     /*----------------------------------------------------------------*/
  301.     /* Local Variables                                                */
  302.     /*----------------------------------------------------------------*/
  303.     dm_data_struct dm_data;
  304.     S32 i;
  305.     U8 h_flag;
  306.     /*----------------------------------------------------------------*/
  307.     /* Code Body                                                      */
  308.     /*----------------------------------------------------------------*/
  309.     gdi_layer_lock_frame_buffer();
  310.     create_fixed_icontext_list_menuitems(2, 0);
  311.     GUI_current_fixed_icontext_list_menuitem_column = 1;
  312.     set_fixed_icontext_list_text_coordinates(0, 1, 0, 30, MMI_MENUITEM_HEIGHT);
  313.     /* Need to modify */
  314.     set_fixed_icontext_list_text_coordinates(
  315.         1,
  316.         30,
  317.         0,
  318.         UI_device_width - 30 - 4 - MMI_fixed_list_menu.vbar.width,
  319.         MMI_MENUITEM_HEIGHT);
  320.     associate_fixed_icontext_list_list();
  321.     ShowListCategoryScreen(
  322.         get_string(title),
  323.         get_image(title_icon),
  324.         get_string(left_softkey),
  325.         get_image(left_softkey_icon),
  326.         get_string(right_softkey),
  327.         get_image(right_softkey_icon),
  328.         number_of_items);
  329.     for (i = 0; i < number_of_items; i++)
  330.     {
  331.         fixed_icontext_list_item_insert(i);
  332.         gui_itoa(i + 1, (UI_string_type) category89_string_list[i], 10);
  333.         gui_strcat((UI_string_type) category89_string_list[i], (UI_string_type) ".");
  334.         add_fixed_icontext_list_item_text(i, 0, (UI_string_type) category89_string_list[i]);
  335.         add_fixed_icontext_list_item_text(i, 1, (UI_string_type) list_of_items[i]);
  336.         if (list_of_descriptions == NULL)
  337.         {
  338.             wgui_pop_up_description_strings[i].text_strings[0] = NULL;
  339.         }
  340.         else
  341.         {
  342.             wgui_pop_up_description_strings[i].text_strings[0] = (UI_string_type) list_of_descriptions[i];
  343.         }
  344.     }
  345.     h_flag = set_list_menu_category_history(MMI_CATEGORY89_ID, history_buffer);
  346.     if (h_flag)
  347.     {
  348.         fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  349.     }
  350.     else
  351.     {
  352.         fixed_list_goto_item_no_redraw(highlighted_item);
  353.     }
  354.     set_pop_up_descriptions(1, number_of_items, MMI_fixed_list_menu.highlighted_item);
  355.     gdi_layer_unlock_frame_buffer();
  356.     ExitCategoryFunction = ExitListCategoryScreen;
  357.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  358.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  359.     dm_data.s32CatId = MMI_CATEGORY89_ID;
  360.     dm_data.s32flags = 0;
  361.     dm_setup_data(&dm_data);
  362.     dm_redraw_category_screen();
  363. }
  364. /*****************************************************************************
  365.  * FUNCTION
  366.  *  ExitCategory89Screen
  367.  * DESCRIPTION
  368.  *  Exits the Numbered Items screen
  369.  * PARAMETERS
  370.  *  void
  371.  * RETURNS
  372.  *  void
  373.  *****************************************************************************/
  374. void ExitCategory89Screen(void)
  375. {
  376.     /*----------------------------------------------------------------*/
  377.     /* Local Variables                                                */
  378.     /*----------------------------------------------------------------*/
  379.     /*----------------------------------------------------------------*/
  380.     /* Code Body                                                      */
  381.     /*----------------------------------------------------------------*/
  382.     GUI_current_fixed_icontext_list_menuitem_column = 0;
  383.     ClearHighlightHandler();
  384.     reset_softkeys();
  385.     reset_menu_shortcut_handler();
  386.     reset_pop_up_descriptions();
  387.     reset_fixed_list();
  388. }
  389. #ifdef __MMI_CALORIE__
  390. /* under construction !*/
  391. /* under construction !*/
  392. /* under construction !*/
  393. /* under construction !*/
  394. /* under construction !*/
  395. /* under construction !*/
  396. /* under construction !*/
  397. /* under construction !*/
  398. /* under construction !*/
  399. /* under construction !*/
  400. /* under construction !*/
  401. /* under construction !*/
  402. /* under construction !*/
  403. /* under construction !*/
  404. /* under construction !*/
  405. /* under construction !*/
  406. /* under construction !*/
  407. /* under construction !*/
  408. /* under construction !*/
  409. /* under construction !*/
  410. /* under construction !*/
  411. /* under construction !*/
  412. /* under construction !*/
  413. /* under construction !*/
  414. /* under construction !*/
  415. /* under construction !*/
  416. /* under construction !*/
  417. /* under construction !*/
  418. /* under construction !*/
  419. /* under construction !*/
  420. /* under construction !*/
  421. /* under construction !*/
  422. /* under construction !*/
  423. /* under construction !*/
  424. /* under construction !*/
  425. /* under construction !*/
  426. /* under construction !*/
  427. /* under construction !*/
  428. /* under construction !*/
  429. /* under construction !*/
  430. /* under construction !*/
  431. /* under construction !*/
  432. /* under construction !*/
  433. /* under construction !*/
  434. /* under construction !*/
  435. /* under construction !*/
  436. /* under construction !*/
  437. /* under construction !*/
  438. /* under construction !*/
  439. /* under construction !*/
  440. /* under construction !*/
  441. /* under construction !*/
  442. /* under construction !*/
  443. /* under construction !*/
  444. /* under construction !*/
  445. /* under construction !*/
  446. /* under construction !*/
  447. /* under construction !*/
  448. /* under construction !*/
  449. /* under construction !*/
  450. /* under construction !*/
  451. /* under construction !*/
  452. /* under construction !*/
  453. /* under construction !*/
  454. /* under construction !*/
  455. /* under construction !*/
  456. /* under construction !*/
  457. /* under construction !*/
  458. /* under construction !*/
  459. /* under construction !*/
  460. /* under construction !*/
  461. /* under construction !*/
  462. /* under construction !*/
  463. /* under construction !*/
  464. /* under construction !*/
  465. /* under construction !*/
  466. /* under construction !*/
  467. /* under construction !*/
  468. /* under construction !*/
  469. /* under construction !*/
  470. /* under construction !*/
  471. /* under construction !*/
  472. /* under construction !*/
  473. /* under construction !*/
  474. /* under construction !*/
  475. /* under construction !*/
  476. /* under construction !*/
  477. /* under construction !*/
  478. /* under construction !*/
  479. /* under construction !*/
  480. /* under construction !*/
  481. /* under construction !*/
  482. /* under construction !*/
  483. /* under construction !*/
  484. /* under construction !*/
  485. /* under construction !*/
  486. /* under construction !*/
  487. /* under construction !*/
  488. /* under construction !*/
  489. /* under construction !*/
  490. /* under construction !*/
  491. /* under construction !*/
  492. /* under construction !*/
  493. /* under construction !*/
  494. /* under construction !*/
  495. /* under construction !*/
  496. /* under construction !*/
  497. /* under construction !*/
  498. /* under construction !*/
  499. /* under construction !*/
  500. /* under construction !*/
  501. /* under construction !*/
  502. /* under construction !*/
  503. /* under construction !*/
  504. /* under construction !*/
  505. /* under construction !*/
  506. /* under construction !*/
  507. /* under construction !*/
  508. /* under construction !*/
  509. /* under construction !*/
  510. /* under construction !*/
  511. /* under construction !*/
  512. /* under construction !*/
  513. /* under construction !*/
  514. /* under construction !*/
  515. /* under construction !*/
  516. /* under construction !*/
  517. /* under construction !*/
  518. /* under construction !*/
  519. /* under construction !*/
  520. /* under construction !*/
  521. /* under construction !*/
  522. /* under construction !*/
  523. /* under construction !*/
  524. /* under construction !*/
  525. /* under construction !*/
  526. /* under construction !*/
  527. /* under construction !*/
  528. /* under construction !*/
  529. /* under construction !*/
  530. /* under construction !*/
  531. /* under construction !*/
  532. /* under construction !*/
  533. /* under construction !*/
  534. /* under construction !*/
  535. /* under construction !*/
  536. /* under construction !*/
  537. /* under construction !*/
  538. /* under construction !*/
  539. /* under construction !*/
  540. /* under construction !*/
  541. /* under construction !*/
  542. /* under construction !*/
  543. /* under construction !*/
  544. /* under construction !*/
  545. /* under construction !*/
  546. /* under construction !*/
  547. /* under construction !*/
  548. /* under construction !*/
  549. /* under construction !*/
  550. /* under construction !*/
  551. /* under construction !*/
  552. /* under construction !*/
  553. /* under construction !*/
  554. /* under construction !*/
  555. /* under construction !*/
  556. /* under construction !*/
  557. /* under construction !*/
  558. /* under construction !*/
  559. /* under construction !*/
  560. /* under construction !*/
  561. /* under construction !*/
  562. /* under construction !*/
  563. /* under construction !*/
  564. /* under construction !*/
  565. /* under construction !*/
  566. /* under construction !*/
  567. /* under construction !*/
  568. /* under construction !*/
  569. /* under construction !*/
  570. /* under construction !*/
  571. /* under construction !*/
  572. /* under construction !*/
  573. /* under construction !*/
  574. /* under construction !*/
  575. /* under construction !*/
  576. /* under construction !*/
  577. /* under construction !*/
  578. /* under construction !*/
  579. /* under construction !*/
  580. /* under construction !*/
  581. /* under construction !*/
  582. /* under construction !*/
  583. /* under construction !*/
  584. /* under construction !*/
  585. /* under construction !*/
  586. /* under construction !*/
  587. /* under construction !*/
  588. /* under construction !*/
  589. /* under construction !*/
  590. /* under construction !*/
  591. /* under construction !*/
  592. /* under construction !*/
  593. /* under construction !*/
  594. /* under construction !*/
  595. /* under construction !*/
  596. /* under construction !*/
  597. /* under construction !*/
  598. /* under construction !*/
  599. /* under construction !*/
  600. /* under construction !*/
  601. /* under construction !*/
  602. /* under construction !*/
  603. /* under construction !*/
  604. /* under construction !*/
  605. /* under construction !*/
  606. /* under construction !*/
  607. /* under construction !*/
  608. /* under construction !*/
  609. /* under construction !*/
  610. /* under construction !*/
  611. /* under construction !*/
  612. /* under construction !*/
  613. /* under construction !*/
  614. /* under construction !*/
  615. /* under construction !*/
  616. /* under construction !*/
  617. /* under construction !*/
  618. /* under construction !*/
  619. /* under construction !*/
  620. /* under construction !*/
  621. /* under construction !*/
  622. /* under construction !*/
  623. /* under construction !*/
  624. /* under construction !*/
  625. /* under construction !*/
  626. /* under construction !*/
  627. /* under construction !*/
  628. /* under construction !*/
  629. /* under construction !*/
  630. /* under construction !*/
  631. /* under construction !*/
  632. /* under construction !*/
  633. /* under construction !*/
  634. /* under construction !*/
  635. /* under construction !*/
  636. /* under construction !*/
  637. /* under construction !*/
  638. /* under construction !*/
  639. /* under construction !*/
  640. /* under construction !*/
  641. /* under construction !*/
  642. /* under construction !*/
  643. /* under construction !*/
  644. /* under construction !*/
  645. /* under construction !*/
  646. /* under construction !*/
  647. /* under construction !*/
  648. /* under construction !*/
  649. #endif /* __MMI_CALORIE__ */ 
  650. /*****************************************************************************
  651.  * FUNCTION
  652.  *  ShowCategory119Screen
  653.  * DESCRIPTION
  654.  *  Displays the category119 screen
  655.  * PARAMETERS
  656.  *  left_softkey            [IN]        Left softkey label
  657.  *  left_softkey_icon       [IN]        Left softkey icon
  658.  *  right_softkey           [IN]        Right softkey label
  659.  *  right_softkey_icon      [IN]        Right softkey icon
  660.  *  message                 [?]         
  661.  *  message_icon            [IN]        
  662.  *  history_buffer          [IN]        History buffer
  663.  *  icon(?)                 [IN]        Message Icon
  664.  * RETURNS
  665.  *  void
  666.  *****************************************************************************/
  667. void ShowCategory119Screen(
  668.         U16 left_softkey,
  669.         U16 left_softkey_icon,
  670.         U16 right_softkey,
  671.         U16 right_softkey_icon,
  672.         U8 *message,
  673.         U16 message_icon,
  674.         U8 *history_buffer)
  675. {
  676.     /*----------------------------------------------------------------*/
  677.     /* Local Variables                                                */
  678.     /*----------------------------------------------------------------*/
  679.     dm_data_struct dm_data;
  680.     S32 l;
  681.     /*----------------------------------------------------------------*/
  682.     /* Code Body                                                      */
  683.     /*----------------------------------------------------------------*/
  684.     UI_UNUSED_PARAMETER(history_buffer);
  685.     gdi_layer_lock_frame_buffer();
  686.     MMI_menu_shortcut_number = -1;
  687.     change_left_softkey(left_softkey, left_softkey_icon);
  688.     change_right_softkey(right_softkey, right_softkey_icon);
  689.     SetupCategoryKeyHandlers();
  690.     MMI_message_string = (UI_string_type) message;
  691.     l = gui_strlen(MMI_message_string);
  692.     create_multiline_inputbox_set_buffer(MMI_message_string, l, l, 0);
  693.     MMI_multiline_inputbox.flags |=
  694.         (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY |
  695.          UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND | UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR);
  696.     dm_add_image(get_image(message_icon), NULL, NULL);
  697.     gdi_layer_unlock_frame_buffer();
  698.     ExitCategoryFunction = ExitCategory119Screen;
  699.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  700.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  701.     dm_data.s32CatId = MMI_CATEGORY119_ID;
  702.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  703.     dm_setup_data(&dm_data);
  704.     dm_redraw_category_screen();
  705. }   /* end of ShowCategory119Screen */
  706. /*****************************************************************************
  707.  * FUNCTION
  708.  *  ExitCategory119Screen
  709.  * DESCRIPTION
  710.  *  Exits the category119 screen
  711.  * PARAMETERS
  712.  *  void
  713.  * RETURNS
  714.  *  void
  715.  *****************************************************************************/
  716. void ExitCategory119Screen(void)
  717. {
  718.     /*----------------------------------------------------------------*/
  719.     /* Local Variables                                                */
  720.     /*----------------------------------------------------------------*/
  721.     /*----------------------------------------------------------------*/
  722.     /* Code Body                                                      */
  723.     /*----------------------------------------------------------------*/
  724.     gui_hide_animations();
  725. }   /* end of ExitCategory119Screen */
  726. /*****************************************************************************
  727.  * FUNCTION
  728.  *  cat129_clear_icon_bg
  729.  * DESCRIPTION
  730.  *  Clear button background function
  731.  * PARAMETERS
  732.  *  button      [IN]        Button pointer
  733.  * RETURNS
  734.  *  void
  735.  *****************************************************************************/
  736. void cat129_clear_icon_bg(void *button)
  737. {
  738.     /*----------------------------------------------------------------*/
  739.     /* Local Variables                                                */
  740.     /*----------------------------------------------------------------*/
  741.     icontext_button *b = (icontext_button*) button;
  742.     S32 x1 = b->x;
  743.     S32 y1 = b->y;
  744.     S32 x2 = b->x + b->width - 1;
  745.     S32 y2 = b->y + b->height - 1;
  746.     /*----------------------------------------------------------------*/
  747.     /* Code Body                                                      */
  748.     /*----------------------------------------------------------------*/
  749.     gdi_layer_push_clip();
  750.     //gdi_layer_set_clip(x1, y1, x2, y2);
  751.     //gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);
  752.     //gdi_layer_pop_clip();
  753.     gdi_layer_set_clip(x1, y1, x2 + 1, y2 + 1);
  754.     gdi_draw_solid_rect(MMI_title_x, MMI_title_y, MMI_title_x + MMI_title_width - 1, MMI_title_y + MMI_title_height - 1, GDI_COLOR_TRANSPARENT);    /* 061705 Calvin added */
  755.     if (title_bg_id != 0)
  756.     {
  757.         gdi_image_draw_id(MMI_title_x, MMI_title_y, title_bg_id);
  758.     }
  759.     else
  760.     {
  761.         gui_draw_filled_area(
  762.             MMI_title_x,
  763.             MMI_title_y,
  764.             MMI_title_x + MMI_title_width - 1,
  765.             MMI_title_y + MMI_title_height - 1,
  766.             current_UI_theme->window_title_theme->active_filler);
  767.     }
  768.     gdi_layer_pop_clip();
  769. }
  770. /*****************************************************************************
  771.  * FUNCTION
  772.  *  cat129_get_image_handle
  773.  * DESCRIPTION
  774.  *  get the animation handle for cat 129
  775.  * PARAMETERS
  776.  *  void
  777.  * RETURNS
  778.  *  gdi_handle
  779.  *****************************************************************************/
  780. gdi_handle cat129_get_image_handle(void)//070706
  781. {
  782.     return dm_get_image_handle(0);
  783. }
  784. /*****************************************************************************
  785.  * FUNCTION
  786.  *  ShowCategory129Screen
  787.  * DESCRIPTION
  788.  *  Displays the category129 screen
  789.  * PARAMETERS
  790.  *  title                   [IN]        Title for the screen
  791.  *  title_icon              [IN]        Icon displayed with the title
  792.  *  left_softkey            [IN]        Left softkey label
  793.  *  left_softkey_icon       [IN]        Left softkey icon
  794.  *  right_softkey           [IN]        Right softkey label
  795.  *  right_softkey_icon      [IN]        Right softkey icon
  796.  *  message_icon            [IN]        
  797.  *  history_buffer          [IN]        History buffer
  798.  *  image(?)                [IN]        Animation image
  799.  * RETURNS
  800.  *  void
  801.  *****************************************************************************/
  802. void ShowCategory129Screen(
  803.         U8 *title,
  804.         U16 title_icon,
  805.         U16 left_softkey,
  806.         U16 left_softkey_icon,
  807.         U16 right_softkey,
  808.         U16 right_softkey_icon,
  809.         U16 message_icon,
  810.         U8 *history_buffer)
  811. {
  812.     /*----------------------------------------------------------------*/
  813.     /* Local Variables                                                */
  814.     /*----------------------------------------------------------------*/
  815.     dm_data_struct dm_data;
  816.     U16 btn_prev_item_id = 0, btn_next_item_id = 0;
  817.     /*----------------------------------------------------------------*/
  818.     /* Code Body                                                      */
  819.     /*----------------------------------------------------------------*/
  820.     UI_UNUSED_PARAMETER(history_buffer);
  821.     gdi_layer_lock_frame_buffer();
  822.     MMI_menu_shortcut_number = -1;
  823.     change_left_softkey(left_softkey, left_softkey_icon);
  824.     change_right_softkey(right_softkey, right_softkey_icon);
  825.     SetupCategoryKeyHandlers();
  826.     MMI_title_string = (UI_string_type) title;
  827.     MMI_title_icon = (PU8) get_image(title_icon);
  828.     MMI_message_string = (UI_string_type) NULL;
  829.     /* MTK Leo start, use new layer instead of scr_bg layer to draw wallpaper */
  830.     /*
  831.      * #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  832.      * dm_get_scr_bg_image(&idle_scr_bg_ID, &idle_scr_bg_filename, &idle_scr_bg_x, &idle_scr_bg_y, &idle_scr_bg_opacity);
  833.      * dm_set_scr_bg_image(message_icon, NULL, -1, -1, 255);
  834.      * #else
  835.      */
  836.     dm_add_image(get_image(message_icon), NULL, NULL);
  837.     wgui_set_wallpaper_on_bottom(MMI_TRUE);
  838.     //      #endif
  839.     // MTK Leo end
  840.     //PMT HIMANSHU START 20050815
  841.     //check if the title bar buttons are enabled for the particular screen.
  842.     if (wgui_is_touch_title_bar_buttons())
  843.     {
  844.         btn_prev_item_id = dm_add_button(
  845.                             NULL,
  846.                             get_image(LEFT_RED_ARROW),
  847.                             get_image(LEFT_RED_ARROW),
  848.                             cat129_clear_icon_bg);
  849.         btn_next_item_id = dm_add_button(
  850.                             NULL,
  851.                             get_image(RIGHT_RED_ARROW),
  852.                             get_image(RIGHT_RED_ARROW),
  853.                             cat129_clear_icon_bg);
  854.         title_bg_id = IMAGE_VIEW_TITLEBAR_BG;   /* for showing different title bar. */
  855.     }
  856.     /* PMT HIMANSHU END 20050815 */
  857.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  858.     gdi_layer_unlock_frame_buffer();
  859.     ExitCategoryFunction = ExitCategory129Screen;
  860. #if defined(__MMI_TOUCH_SCREEN__)
  861.     if (wgui_is_touch_title_bar_buttons())
  862.     {
  863.         /* register the handler for pen event down istead of pen event up */
  864.         dm_register_button_functions(btn_prev_item_id, KEY_EVENT_UP, gMMI_touch_title_button1_down_handler);
  865.         dm_register_button_functions(btn_next_item_id, KEY_EVENT_UP, gMMI_touch_title_button2_down_handler);
  866.     }
  867. #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  868.     dm_setup_category_functions(dm_redraw_category_screen, dummy_get_history, dummy_get_history_size);
  869.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  870.     dm_data.s32CatId = MMI_CATEGORY129_ID;
  871.     dm_setup_data(&dm_data);
  872.     dm_redraw_category_screen();
  873. }   /* end of ShowCategory129Screen */
  874. /*****************************************************************************
  875.  * FUNCTION
  876.  *  ExitCategory129Screen
  877.  * DESCRIPTION
  878.  *  Exits the category129 screen
  879.  * PARAMETERS
  880.  *  void
  881.  * RETURNS
  882.  *  void
  883.  *****************************************************************************/
  884. void ExitCategory129Screen(void)
  885. {
  886.     /*----------------------------------------------------------------*/
  887.     /* Local Variables                                                */
  888.     /*----------------------------------------------------------------*/
  889.     /*----------------------------------------------------------------*/
  890.     /* Code Body                                                      */
  891.     /*----------------------------------------------------------------*/
  892.     gui_hide_animations();
  893.     title_bg_id = 0;
  894.     wgui_reset_touch_title_bar_buttons();
  895.     /* MTK Leo start, use new layer instead of scr_bg layer to draw wallpaper */
  896.     /*
  897.      * #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  898.      * if (wgui_is_wallpaper_change())
  899.      * {
  900.      * U8 dummy_opacity;
  901.      * dm_get_scr_bg_image(&idle_scr_bg_ID, &idle_scr_bg_filename, &idle_scr_bg_x, &idle_scr_bg_y, &dummy_opacity);
  902.      * dm_set_scr_bg_image(idle_scr_bg_ID, idle_scr_bg_filename, idle_scr_bg_x, idle_scr_bg_y, idle_scr_bg_opacity);
  903.      * wgui_reset_wallpaper_change();
  904.      * }
  905.      * else
  906.      * {
  907.      * dm_set_scr_bg_image_no_draw(idle_scr_bg_ID, idle_scr_bg_filename, idle_scr_bg_x, idle_scr_bg_y, idle_scr_bg_opacity);
  908.      * }
  909.      * #endif
  910.      */
  911. }   /* end of ExitCategory129Screen */
  912. /*****************************************************************************
  913.  * FUNCTION
  914.  *  set_list_menu_category140_history
  915.  * DESCRIPTION
  916.  *  Sets the history data for the list menu of category140 (check box list)
  917.  *  from the given history buffer
  918.  * PARAMETERS
  919.  *  history_ID          [IN]        The ID used by category screens
  920.  *  history_buffer      [IN]        Buffer from which history data is taken
  921.  * RETURNS
  922.  *  byte              Returns true if the history ID is valid
  923.  *****************************************************************************/
  924. U8 set_list_menu_category140_history(U16 history_ID, U8 *history_buffer)
  925. {
  926.     /*----------------------------------------------------------------*/
  927.     /* Local Variables                                                */
  928.     /*----------------------------------------------------------------*/
  929.     S32 i = 0;
  930.     /*----------------------------------------------------------------*/
  931.     /* Code Body                                                      */
  932.     /*----------------------------------------------------------------*/
  933.     if (history_buffer != NULL)
  934.     {
  935.         list_menu_category_history_cat140 *h = (list_menu_category_history_cat140*) history_buffer;
  936.         if (history_valid(h->history_ID, history_ID))
  937.         {
  938.             MMI_fixed_list_menu.highlighted_item = h->highlighted_item;
  939.             MMI_fixed_list_menu.first_displayed_item = h->first_displayed_item;
  940.             MMI_fixed_list_menu.last_displayed_item = h->last_displayed_item;
  941.             MMI_fixed_list_menu.displayed_items = h->displayed_items;
  942.             MMI_fixed_list_menu.flags = h->flags;
  943.             item_checked = h->state;
  944.             for (i = 0; i < h->no_of_items; i++)
  945.             {
  946.                 if (h->list_of_states[i] == 1)
  947.                 {
  948.                     MMI_fixed_twostate_menuitems[i].flags |= UI_MENUITEM_STATE_SELECTED;
  949.                 }
  950.                 else
  951.                 {
  952.                     MMI_fixed_twostate_menuitems[i].flags &= ~UI_MENUITEM_STATE_SELECTED;
  953.                 }
  954.             }
  955.             return (1);
  956.         }
  957.     }
  958.     return (0);
  959. }   /* end of set_list_menu_category140_history */
  960. /*****************************************************************************
  961.  * FUNCTION
  962.  *  get_list_menu_category_history140
  963.  * DESCRIPTION
  964.  *  Gets the history data for the list menu of category140 (check box list)
  965.  *  from the given history buffer
  966.  * PARAMETERS
  967.  *  history_ID          [IN]        The ID used by category screens
  968.  *  history_buffer      [IN]        Buffer from which history data is taken
  969.  * RETURNS
  970.  *  void
  971.  *****************************************************************************/
  972. void get_list_menu_category_history140(U16 history_ID, U8 *history_buffer)
  973. {
  974.     /*----------------------------------------------------------------*/
  975.     /* Local Variables                                                */
  976.     /*----------------------------------------------------------------*/
  977.     /*----------------------------------------------------------------*/
  978.     /* Code Body                                                      */
  979.     /*----------------------------------------------------------------*/
  980.     if (history_buffer != NULL)
  981.     {
  982.         U16 hID = (U16) (history_ID | 0x8000);
  983.         S32 i = 0;
  984.         list_menu_category_history_cat140 *h = (list_menu_category_history_cat140*) history_buffer;
  985.         h->history_ID = hID;
  986.         h->highlighted_item = (S16) MMI_fixed_list_menu.highlighted_item;
  987.         h->first_displayed_item = (S16) MMI_fixed_list_menu.first_displayed_item;
  988.         h->last_displayed_item = (S16) MMI_fixed_list_menu.last_displayed_item;
  989.         h->displayed_items = (S16) MMI_fixed_list_menu.displayed_items;
  990.         h->flags = MMI_fixed_list_menu.flags;
  991.         h->no_of_items = MMI_fixed_list_menu.n_items;
  992.         h->state = (S8) item_checked;
  993.         for (i = 0; i < MMI_fixed_list_menu.n_items; i++)
  994.         {
  995.             if (MMI_fixed_twostate_menuitems[i].flags & UI_MENUITEM_STATE_SELECTED)
  996.             {
  997.                 h->list_of_states[i] = 1;
  998.             }
  999.             else
  1000.             {
  1001.                 h->list_of_states[i] = 0;
  1002.             }
  1003.         }
  1004.     }
  1005. }   /* end of get_list_menu_category_history140 */
  1006. /*****************************************************************************
  1007.  * FUNCTION
  1008.  *  GetCategory140HistorySize
  1009.  * DESCRIPTION
  1010.  *  Gets the history buffer size for Category140 screen
  1011.  * PARAMETERS
  1012.  *  void
  1013.  * RETURNS
  1014.  *  void
  1015.  *****************************************************************************/
  1016. S32 GetCategory140HistorySize(void)
  1017. {
  1018.     /*----------------------------------------------------------------*/
  1019.     /* Local Variables                                                */
  1020.     /*----------------------------------------------------------------*/
  1021.     /*----------------------------------------------------------------*/
  1022.     /* Code Body                                                      */
  1023.     /*----------------------------------------------------------------*/
  1024.     return (sizeof(list_menu_category_history_cat140));
  1025. }   /* end of GetCategory140HistorySize */
  1026. /*****************************************************************************
  1027.  * FUNCTION
  1028.  *  GetCategory140History
  1029.  * DESCRIPTION
  1030.  *  Gets the history buffer for Category140 screen
  1031.  * PARAMETERS
  1032.  *  history_buffer      [IN]        History_buffer is a pointer to the buffer where the history data is to be stored      (pre-allocated)
  1033.  * RETURNS
  1034.  *  void
  1035.  *****************************************************************************/
  1036. U8 *GetCategory140History(U8 *history_buffer)
  1037. {
  1038.     /*----------------------------------------------------------------*/
  1039.     /* Local Variables                                                */
  1040.     /*----------------------------------------------------------------*/
  1041.     /*----------------------------------------------------------------*/
  1042.     /* Code Body                                                      */
  1043.     /*----------------------------------------------------------------*/
  1044.     get_list_menu_category_history140(MMI_CATEGORY140_ID, history_buffer);
  1045.     return (history_buffer);
  1046. }   /* end of GetCategory140History */
  1047. /*****************************************************************************
  1048.  * FUNCTION
  1049.  *  ShowCategory140Screen
  1050.  * DESCRIPTION
  1051.  *  Displays the Category140 screen
  1052.  * PARAMETERS
  1053.  *  title                       [IN]        Title for the screen
  1054.  *  title_icon                  [IN]        Icon displayed with the title
  1055.  *  number_of_items             [IN]        Number of items in the menu
  1056.  *  list_of_items               [IN]        Array of items
  1057.  *  list_of_states              [?]         
  1058.  *  highlighted_item            [IN]        Default item to be highlighted (if there is no history)
  1059.  *  history_buffer              [IN]        History buffer
  1060.  *  left_softkey_icon(?)        [IN]        Left softkey icon
  1061.  *  left_softkey(?)             [IN]        Left softkey label
  1062.  *  right_softkey_icon(?)       [IN]        Right softkey icon
  1063.  *  right_softkey(?)            [IN]        Right softkey label
  1064.  * RETURNS
  1065.  *  void
  1066.  *****************************************************************************/
  1067. void ShowCategory140Screen(
  1068.         U16 title,
  1069.         U16 title_icon,
  1070.         S32 number_of_items,
  1071.         U8 **list_of_items,
  1072.         U8 *list_of_states,
  1073.         S32 highlighted_item,
  1074.         U8 *history_buffer)
  1075. {
  1076.     /*----------------------------------------------------------------*/
  1077.     /* Local Variables                                                */
  1078.     /*----------------------------------------------------------------*/
  1079.     dm_data_struct dm_data;
  1080.     S32 i;
  1081.     U8 h_flag;
  1082.     /*----------------------------------------------------------------*/
  1083.     /* Code Body                                                      */
  1084.     /*----------------------------------------------------------------*/
  1085.     gdi_layer_lock_frame_buffer();
  1086.     create_fixed_twostate_menuitems(get_image(CHECKBOX_ON_IMAGE_ID), get_image(CHECKBOX_OFF_IMAGE_ID));
  1087.     associate_fixed_twostate_list();
  1088.     ShowListCategoryScreen(
  1089.         get_string(title),
  1090.         get_image(title_icon),
  1091.         get_string(STR_GLOBAL_OK),
  1092.         get_image(0),
  1093.         get_string(STR_GLOBAL_DONE),
  1094.         get_image(0),
  1095.         number_of_items);
  1096.     resize_fixed_twostate_menuitems(0, MMI_MENUITEM_HEIGHT);
  1097.     set_fixed_twostate_positions(MMI_MENUITEM_HEIGHT, 0, 1, 0);
  1098.     set_left_softkey_function(toggle_check_list_handle_left_softkey_up, KEY_EVENT_UP);
  1099.     checklist_category_menu_item_states = list_of_states;
  1100.     h_flag = set_list_menu_category140_history(MMI_CATEGORY140_ID, history_buffer);
  1101.     if (h_flag)
  1102.     {
  1103.         for (i = 0; i < number_of_items; i++)
  1104.         {
  1105.             if (MMI_fixed_twostate_menuitems[i].flags & UI_MENUITEM_STATE_SELECTED)
  1106.             {
  1107.                 list_of_states[i] = 1;
  1108.             }
  1109.             else
  1110.             {
  1111.                 list_of_states[i] = 0;
  1112.             }
  1113.         }
  1114.     }
  1115.     for (i = 0; i < number_of_items; i++)
  1116.     {
  1117.         add_fixed_twostate_item((UI_string_type) list_of_items[i]);
  1118.         if (list_of_states[i])
  1119.         {
  1120.             select_fixed_twostate_item(i);
  1121.         }
  1122.     }
  1123.     register_fixed_list_highlight_handler(toggle_check_list_highlight_handler);
  1124.     if (h_flag && item_checked)
  1125.     {   /* 2004-02-18, Check status in history if history is not null */
  1126.         change_right_softkey(STR_GLOBAL_DONE, 0);
  1127.         set_right_softkey_function(checkbox_toggle_DONE_RSK_function, KEY_EVENT_UP);
  1128.     }
  1129.     else
  1130.     {
  1131.         change_right_softkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  1132.         set_right_softkey_function(checkbox_toggle_BACK_RSK_function, KEY_EVENT_UP);
  1133.         item_checked = 0;
  1134.     }
  1135.     if (h_flag)
  1136.     {
  1137.         fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  1138.     }
  1139.     else
  1140.     {
  1141.         fixed_list_goto_item_no_redraw(highlighted_item);
  1142.     }
  1143.     resize_fixed_twostate_menuitems_to_list_width();
  1144.     gdi_layer_unlock_frame_buffer();
  1145.     ExitCategoryFunction = ExitListCategoryScreen;
  1146.     dm_setup_category_functions(dm_redraw_category_screen, GetCategory140History, GetCategory140HistorySize);
  1147.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1148.     dm_data.s32CatId = MMI_CATEGORY140_ID;
  1149.     dm_data.s32flags = 0;
  1150.     dm_setup_data(&dm_data);
  1151.     dm_redraw_category_screen();
  1152. }   /* end of ShowCategory140Screen */
  1153. /*****************************************************************************
  1154.  * FUNCTION
  1155.  *  ExitCategory140Screen
  1156.  * DESCRIPTION
  1157.  *  Exits the category140 screen
  1158.  * PARAMETERS
  1159.  *  void
  1160.  * RETURNS
  1161.  *  void
  1162.  *****************************************************************************/
  1163. void ExitCategory140Screen(void)
  1164. {
  1165.     /*----------------------------------------------------------------*/
  1166.     /* Local Variables                                                */
  1167.     /*----------------------------------------------------------------*/
  1168.     /*----------------------------------------------------------------*/
  1169.     /* Code Body                                                      */
  1170.     /*----------------------------------------------------------------*/
  1171.     ClearHighlightHandler();
  1172.     reset_softkeys();
  1173.     reset_menu_shortcut_handler();
  1174.     reset_fixed_list();
  1175. }   /* end of ExitCategory140Screen */
  1176. /* structure usedto store one big line in to two lines */
  1177. typedef struct _split_lines
  1178. {
  1179.     U8 str_line1[126];
  1180.     U8 str_line2[126];
  1181.     U8 no_of_lines;
  1182. } SPILTLINES;
  1183. SPILTLINES *split_buffer = NULL;
  1184. /*****************************************************************************
  1185.  * FUNCTION
  1186.  *  ShowCategory141Screen
  1187.  * DESCRIPTION
  1188.  *  Displays the Category141 screen
  1189.  * PARAMETERS
  1190.  *  title                   [IN]        Title for the screen
  1191.  *  title_icon              [IN]        Icon displayed with the title
  1192.  *  left_softkey            [IN]        Left softkey label
  1193.  *  left_softkey_icon       [IN]        Left softkey icon
  1194.  *  right_softkey           [IN]        Right softkey label
  1195.  *  right_softkey_icon      [IN]        Right softkey icon
  1196.  *  message                 [IN]        Notification message
  1197.  *  message_icon            [IN]        
  1198.  *  history_buffer          [IN]        History buffer
  1199.  *  image(?)                [IN]        Notification image
  1200.  * RETURNS
  1201.  *  void
  1202.  *****************************************************************************/
  1203. void ShowCategory141Screen(
  1204.         U16 title,
  1205.         U16 title_icon,
  1206.         U16 left_softkey,
  1207.         U16 left_softkey_icon,
  1208.         U16 right_softkey,
  1209.         U16 right_softkey_icon,
  1210.         U8 *message,
  1211.         U16 message_icon,
  1212.         U8 *history_buffer)
  1213. {
  1214.     /*----------------------------------------------------------------*/
  1215.     /* Local Variables                                                */
  1216.     /*----------------------------------------------------------------*/
  1217.     dm_data_struct dm_data;
  1218.     S32 l;
  1219.     /*----------------------------------------------------------------*/
  1220.     /* Code Body                                                      */
  1221.     /*----------------------------------------------------------------*/
  1222.     UI_UNUSED_PARAMETER(history_buffer);
  1223.     gdi_layer_lock_frame_buffer();
  1224.     MMI_menu_shortcut_number = -1;
  1225.     change_left_softkey(left_softkey, left_softkey_icon);
  1226.     change_right_softkey(right_softkey, right_softkey_icon);
  1227.     SetupCategoryKeyHandlers();
  1228.     gui_set_font(&MMI_medium_font);
  1229.     if (title == 0)
  1230.     {
  1231.         wgui_switch_title_with_status_bar = 1;
  1232.         ShowStatusIconsTitle();
  1233.     }
  1234.     else
  1235.     {
  1236.         MMI_title_string = get_string(title);
  1237.         MMI_title_icon = get_image(title_icon);
  1238.         wgui_switch_title_with_status_bar = 0;
  1239.     }
  1240.     l = gui_strlen((UI_string_type) message);
  1241.     create_multiline_inputbox_set_buffer((UI_string_type) message, l, l, 0);
  1242.     MMI_multiline_inputbox.flags |=
  1243.         UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND | UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY |
  1244.         UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE |
  1245.         UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_USE_ENCODING_BASED_LENGTH;
  1246.     dm_add_image(get_image(message_icon), NULL, NULL);
  1247.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  1248.     gdi_layer_unlock_frame_buffer();
  1249.     ExitCategoryFunction = ExitCategory141Screen;
  1250.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  1251.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1252.     if (wgui_switch_title_with_status_bar == 1)
  1253.     {
  1254.         dm_data.s32CatId = MMI_CATEGORY141_STATUS_ICON_ID;
  1255.     }
  1256.     else
  1257.     {
  1258.         dm_data.s32CatId = MMI_CATEGORY141_ID;
  1259.     }
  1260.     dm_setup_data(&dm_data);
  1261.     dm_redraw_category_screen();
  1262. }
  1263. /*****************************************************************************
  1264.  * FUNCTION
  1265.  *  ExitCategory141Screen
  1266.  * DESCRIPTION
  1267.  *  Exits the Message Received screen
  1268.  * PARAMETERS
  1269.  *  void
  1270.  * RETURNS
  1271.  *  void
  1272.  *****************************************************************************/
  1273. void ExitCategory141Screen(void)
  1274. {
  1275.     /*----------------------------------------------------------------*/
  1276.     /* Local Variables                                                */
  1277.     /*----------------------------------------------------------------*/
  1278.     /*----------------------------------------------------------------*/
  1279.     /* Code Body                                                      */
  1280.     /*----------------------------------------------------------------*/
  1281.     if (wgui_switch_title_with_status_bar)
  1282.     {
  1283.         close_status_icons();
  1284.         wgui_switch_title_with_status_bar = 0;
  1285.     }
  1286.     gui_hide_animations();
  1287. }   /* end of ExitCategory141Screen */
  1288. /*****************************************************************************
  1289.  * FUNCTION
  1290.  *  category_142_redraw_highlighted_item
  1291.  * DESCRIPTION
  1292.  *  Redraw the highlighted item(selected image) of category 142.
  1293.  * PARAMETERS
  1294.  *  void
  1295.  * RETURNS
  1296.  *  void
  1297.  *****************************************************************************/
  1298. void category_142_redraw_highlighted_item(void)
  1299. {
  1300.     /*----------------------------------------------------------------*/
  1301.     /* Local Variables                                                */
  1302.     /*----------------------------------------------------------------*/
  1303.     S32 index, img_width, img_height, vbar_x = 0, vbar_button_x = 0;
  1304.     PU8 img;
  1305.     color c;
  1306.     /*----------------------------------------------------------------*/
  1307.     /* Code Body                                                      */
  1308.     /*----------------------------------------------------------------*/
  1309.     if (animation_handle != GDI_ERROR_HANDLE)
  1310.     {
  1311.         gdi_image_stop_animation(animation_handle);
  1312.     }
  1313.     if (category_142_image_list != NULL)
  1314.     {
  1315.         if (category_142_image_list_index != NULL)
  1316.         {
  1317.             index = *category_142_image_list_index;
  1318.         }
  1319.         else
  1320.         {
  1321.             index = 0;
  1322.         }
  1323.         if (!wgui_switch_title_with_status_bar && (category_142_list_of_titles != NULL))
  1324.         {
  1325.             MMI_title_string = (UI_string_type) category_142_list_of_titles[index];
  1326.             draw_title();
  1327.         }
  1328.         c = gui_color(255, 255, 255);
  1329.         gdi_layer_push_clip();
  1330.         if (r2lMMIFlag)
  1331.         {
  1332.             gdi_layer_set_clip(
  1333.                 current_MMI_theme->scrollbar_size,
  1334.                 (MMI_title_y + MMI_title_height),
  1335.                 UI_device_width - 1,
  1336.                 UI_device_height - MMI_button_bar_height - 1);
  1337.         }
  1338.         else
  1339.         {
  1340.             gdi_layer_set_clip(
  1341.                 0,
  1342.                 (MMI_title_y + MMI_title_height),
  1343.                 UI_device_width - current_MMI_theme->scrollbar_size - 1,
  1344.                 UI_device_height - MMI_button_bar_height - 1);
  1345.         }
  1346.         gui_fill_rectangle(
  1347.             0,
  1348.             (MMI_title_y + MMI_title_height),
  1349.             UI_device_width - 1,
  1350.             UI_device_height - MMI_button_bar_height - 1,
  1351.             c);
  1352.         if (category_142_image_list[index])
  1353.         {
  1354.             img = get_image(category_142_image_list[index]);
  1355.         }
  1356.         else
  1357.         {
  1358.             img = category_142_image_file_name_list[index];
  1359.         }
  1360.         gui_measure_image(img, &img_width, &img_height);
  1361.         if (r2lMMIFlag)
  1362.         {
  1363.             if (gdi_image_draw_animation((UI_device_width - img_width + current_MMI_theme->scrollbar_size) >> 1, (UI_device_height - img_height) >> 1, (U8*) img, &animation_handle) < 0)      /* 033105 Calvin modified */
  1364.             {
  1365.                 animation_handle = GDI_ERROR_HANDLE;
  1366.             }
  1367.         }
  1368.         else
  1369.         {
  1370.             if (gdi_image_draw_animation((UI_device_width - img_width) >> 1, (UI_device_height - img_height) >> 1, (U8*) img, &animation_handle) < 0)  /* 033105 Calvin modified */
  1371.             {
  1372.                 animation_handle = GDI_ERROR_HANDLE;
  1373.             }
  1374.         }
  1375.         gdi_layer_pop_clip();
  1376.         /* Uncomment below line for auto-disable scrollbar    */
  1377.         /*    if(category_142_image_list_n_items>1)        */
  1378.         {
  1379.             gui_set_vertical_scrollbar_range(&category142_vbar, category_142_image_list_n_items);
  1380.             gui_set_vertical_scrollbar_scale(&category142_vbar, 1);
  1381.             gui_set_vertical_scrollbar_value(&category142_vbar, index);
  1382.             if (r2lMMIFlag)
  1383.             {
  1384.                 vbar_x = category142_vbar.x;
  1385.                 vbar_button_x = category142_vbar.scroll_button.x;
  1386.                 category142_vbar.x = category142_vbar.x + category142_vbar.width - (UI_device_width - 1);
  1387.                 category142_vbar.scroll_button.x =
  1388.                     category142_vbar.scroll_button.x + category142_vbar.scroll_button.width - (UI_device_width - 1);
  1389.                 gui_show_vertical_scrollbar(&category142_vbar);
  1390.             }
  1391.             else
  1392.             {
  1393.                 gui_show_vertical_scrollbar(&category142_vbar);
  1394.             }
  1395.             if (r2lMMIFlag)
  1396.             {
  1397.                 category142_vbar.x = vbar_x;
  1398.                 category142_vbar.scroll_button.x = vbar_button_x;
  1399.             }
  1400.         }
  1401.     }
  1402.     gdi_layer_blt_previous(
  1403.         0,
  1404.         (MMI_title_y + MMI_title_height),
  1405.         UI_device_width - 1,
  1406.         UI_device_height - MMI_button_bar_height);
  1407. }   /* end of category_142_redraw_highlighted_item */
  1408. /*****************************************************************************
  1409.  * FUNCTION
  1410.  *  category_142_highlight_handler
  1411.  * DESCRIPTION
  1412.  *  hightlight handler of category 142
  1413.  * PARAMETERS
  1414.  *  index       [IN]        The index of highlighted item
  1415.  * RETURNS
  1416.  *  void
  1417.  *****************************************************************************/
  1418. void category_142_highlight_handler(S32 index)
  1419. {
  1420.     /*----------------------------------------------------------------*/
  1421.     /* Local Variables                                                */
  1422.     /*----------------------------------------------------------------*/
  1423.     /*----------------------------------------------------------------*/
  1424.     /* Code Body                                                      */
  1425.     /*----------------------------------------------------------------*/
  1426.     MMI_menu_shortcut_number = index + 1;
  1427.     if (!menu_shortcut_handler_display)
  1428.     {
  1429.         gui_redraw_menu_shortcut();
  1430.     }
  1431.     MMI_list_highlight_handler(index);
  1432. }   /* end of category_142_highlight_handler */
  1433. /*****************************************************************************
  1434.  * FUNCTION
  1435.  *  category_142_goto_item
  1436.  * DESCRIPTION
  1437.  *  go to specific item of category 142
  1438.  * PARAMETERS
  1439.  *  index       [IN]        The index of item to go
  1440.  * RETURNS
  1441.  *  void
  1442.  *****************************************************************************/
  1443. void category_142_goto_item(S32 index)
  1444. {
  1445.     /*----------------------------------------------------------------*/
  1446.     /* Local Variables                                                */
  1447.     /*----------------------------------------------------------------*/
  1448.     /*----------------------------------------------------------------*/
  1449.     /* Code Body                                                      */
  1450.     /*----------------------------------------------------------------*/
  1451.     if (category_142_image_list_index != NULL)
  1452.     {
  1453.         if (index < 0)
  1454.         {
  1455.             return; /* index=0; */
  1456.         }
  1457.         if (index > (category_142_image_list_n_items - 1))
  1458.         {
  1459.             return; /* index=category_142_image_list_n_items-1;  */
  1460.         }
  1461.         *category_142_image_list_index = index;
  1462.     }
  1463.     category_142_highlight_handler(index);
  1464.     category_142_redraw_highlighted_item();
  1465. }   /* end of category_142_goto_item */
  1466. /*****************************************************************************
  1467.  * FUNCTION
  1468.  *  category_142_goto_previous_item
  1469.  * DESCRIPTION
  1470.  *  go to previous item of category142
  1471.  * PARAMETERS
  1472.  *  void
  1473.  * RETURNS
  1474.  *  void
  1475.  *****************************************************************************/
  1476. void category_142_goto_previous_item(void)
  1477. {
  1478.     /*----------------------------------------------------------------*/
  1479.     /* Local Variables                                                */
  1480.     /*----------------------------------------------------------------*/
  1481.     S32 index = *category_142_image_list_index;
  1482.     /*----------------------------------------------------------------*/
  1483.     /* Code Body                                                      */
  1484.     /*----------------------------------------------------------------*/
  1485.     index--;
  1486.     if (index < 0)
  1487.     {
  1488.         index = category_142_image_list_n_items - 1;
  1489.     }
  1490.     *category_142_image_list_index = index;
  1491.     category_142_redraw_highlighted_item();
  1492.     category_142_highlight_handler(index);
  1493. }   /* end of category_142_goto_previous_item */
  1494. /*****************************************************************************
  1495.  * FUNCTION
  1496.  *  category_142_goto_next_item
  1497.  * DESCRIPTION
  1498.  *  go to next item of category142
  1499.  * PARAMETERS
  1500.  *  void
  1501.  * RETURNS
  1502.  *  void
  1503.  *****************************************************************************/
  1504. void category_142_goto_next_item(void)
  1505. {
  1506.     /*----------------------------------------------------------------*/
  1507.     /* Local Variables                                                */
  1508.     /*----------------------------------------------------------------*/
  1509.     S32 index = *category_142_image_list_index;
  1510.     /*----------------------------------------------------------------*/
  1511.     /* Code Body                                                      */
  1512.     /*----------------------------------------------------------------*/
  1513.     index++;
  1514.     if (index > (category_142_image_list_n_items - 1))
  1515.     {
  1516.         index = 0;
  1517.     }
  1518.     *category_142_image_list_index = index;
  1519.     category_142_redraw_highlighted_item();
  1520.     category_142_highlight_handler(index);
  1521. }   /* end of category_142_goto_next_item */
  1522. /*****************************************************************************
  1523.  * FUNCTION
  1524.  *  category_142_key_handler
  1525.  * DESCRIPTION
  1526.  *  handle key handlers of catefory 142
  1527.  * PARAMETERS
  1528.  *  vkey_code       [IN]        To identify the key
  1529.  *  key_state       [IN]        The state of the key
  1530.  * RETURNS
  1531.  *  void
  1532.  *****************************************************************************/
  1533. void category_142_key_handler(S32 vkey_code, S32 key_state)
  1534. {
  1535. #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
  1536.     /*----------------------------------------------------------------*/
  1537.     /* Local Variables                                                */
  1538.     /*----------------------------------------------------------------*/
  1539.     /*----------------------------------------------------------------*/
  1540.     /* Code Body                                                      */
  1541.     /*----------------------------------------------------------------*/
  1542.     if (key_state)
  1543.     {
  1544.         switch (vkey_code)
  1545.         {
  1546.             case 37:    /* left */
  1547.                 break;
  1548.             case 39:    /* right */
  1549.                 break;
  1550.             case 38:
  1551.                 category_142_goto_previous_item();
  1552.                 break;
  1553.             case 40:
  1554.                 category_142_goto_next_item();
  1555.                 break;
  1556.         }
  1557.     }
  1558. #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1559.     UI_UNUSED_PARAMETER(vkey_code);
  1560.     UI_UNUSED_PARAMETER(key_state);
  1561. #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */ 
  1562. }   /* end of category_142_key_handler */
  1563. #ifdef __MMI_TOUCH_SCREEN__
  1564. /*****************************************************************************
  1565.  * FUNCTION
  1566.  *  category_142_pen_down_hdlr
  1567.  * DESCRIPTION
  1568.  *  
  1569.  * PARAMETERS
  1570.  *  pos     [IN]        
  1571.  * RETURNS
  1572.  *  
  1573.  *****************************************************************************/
  1574. MMI_BOOL category_142_pen_down_hdlr(mmi_pen_point_struct pos)
  1575. {
  1576.     /*----------------------------------------------------------------*/
  1577.     /* Local Variables                                                */
  1578.     /*----------------------------------------------------------------*/
  1579.     gui_scrollbar_pen_enum scrollbar_event;
  1580.     gui_pen_event_param_struct scrollbar_param;
  1581.     /*----------------------------------------------------------------*/
  1582.     /* Code Body                                                      */
  1583.     /*----------------------------------------------------------------*/
  1584.     if (PEN_CHECK_BOUND
  1585.         (pos.x, pos.y, category142_vbar.x, category142_vbar.y, category142_vbar.width, category142_vbar.height))
  1586.     {
  1587.         gui_vertical_scrollbar_translate_pen_event(
  1588.             &category142_vbar,
  1589.             MMI_PEN_EVENT_DOWN,
  1590.             pos.x,
  1591.             pos.y,
  1592.             &scrollbar_event,
  1593.             &scrollbar_param);
  1594.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  1595.         {
  1596.             category_142_goto_item((S32) scrollbar_param._u.i);
  1597.         }
  1598.         return MMI_TRUE;
  1599.     }
  1600.     return MMI_FALSE;
  1601. }
  1602. /*****************************************************************************
  1603.  * FUNCTION
  1604.  *  category_142_pen_move_hdlr
  1605.  * DESCRIPTION
  1606.  *  
  1607.  * PARAMETERS
  1608.  *  pos     [IN]        
  1609.  * RETURNS
  1610.  *  
  1611.  *****************************************************************************/
  1612. MMI_BOOL category_142_pen_move_hdlr(mmi_pen_point_struct pos)
  1613. {
  1614.     /*----------------------------------------------------------------*/
  1615.     /* Local Variables                                                */
  1616.     /*----------------------------------------------------------------*/
  1617.     gui_scrollbar_pen_enum scrollbar_event;
  1618.     gui_pen_event_param_struct scrollbar_param;
  1619.     /*----------------------------------------------------------------*/
  1620.     /* Code Body                                                      */
  1621.     /*----------------------------------------------------------------*/
  1622.     if (PEN_CHECK_BOUND
  1623.         (pos.x, pos.y, category142_vbar.x, category142_vbar.y, category142_vbar.width, category142_vbar.height))
  1624.     {
  1625.         gui_vertical_scrollbar_translate_pen_event(
  1626.             &category142_vbar,
  1627.             MMI_PEN_EVENT_MOVE,
  1628.             pos.x,
  1629.             pos.y,
  1630.             &scrollbar_event,
  1631.             &scrollbar_param);
  1632.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  1633.         {
  1634.             category_142_goto_item((S32) scrollbar_param._u.i);
  1635.         }
  1636.         return MMI_TRUE;
  1637.     }
  1638.     return MMI_FALSE;
  1639. }
  1640. /*****************************************************************************
  1641.  * FUNCTION
  1642.  *  category_142_pen_repeat_hdlr
  1643.  * DESCRIPTION
  1644.  *  
  1645.  * PARAMETERS
  1646.  *  pos     [IN]        
  1647.  * RETURNS
  1648.  *  
  1649.  *****************************************************************************/
  1650. MMI_BOOL category_142_pen_repeat_hdlr(mmi_pen_point_struct pos)
  1651. {
  1652.     /*----------------------------------------------------------------*/
  1653.     /* Local Variables                                                */
  1654.     /*----------------------------------------------------------------*/
  1655.     gui_scrollbar_pen_enum scrollbar_event;
  1656.     gui_pen_event_param_struct scrollbar_param;
  1657.     /*----------------------------------------------------------------*/
  1658.     /* Code Body                                                      */
  1659.     /*----------------------------------------------------------------*/
  1660.     if (PEN_CHECK_BOUND
  1661.         (pos.x, pos.y, category142_vbar.x, category142_vbar.y, category142_vbar.width, category142_vbar.height))
  1662.     {
  1663.         gui_vertical_scrollbar_translate_pen_event(
  1664.             &category142_vbar,
  1665.             MMI_PEN_EVENT_REPEAT,
  1666.             pos.x,
  1667.             pos.y,
  1668.             &scrollbar_event,
  1669.             &scrollbar_param);
  1670.         if (scrollbar_event == GUI_SCROLLBAR_PEN_JUMP_TO_I)
  1671.         {
  1672.             category_142_goto_item((S32) scrollbar_param._u.i);
  1673.         }
  1674.         return MMI_TRUE;
  1675.     }
  1676.     return MMI_FALSE;
  1677. }
  1678. /*****************************************************************************
  1679.  * FUNCTION
  1680.  *  category_142_pen_up_hdlr
  1681.  * DESCRIPTION
  1682.  *  
  1683.  * PARAMETERS
  1684.  *  pos     [IN]        
  1685.  * RETURNS
  1686.  *  
  1687.  *****************************************************************************/
  1688. MMI_BOOL category_142_pen_up_hdlr(mmi_pen_point_struct pos)
  1689. {
  1690.     /*----------------------------------------------------------------*/
  1691.     /* Local Variables                                                */
  1692.     /*----------------------------------------------------------------*/
  1693.     gui_scrollbar_pen_enum scrollbar_event;
  1694.     gui_pen_event_param_struct scrollbar_param;
  1695.     /*----------------------------------------------------------------*/
  1696.     /* Code Body                                                      */
  1697.     /*----------------------------------------------------------------*/
  1698.     if (PEN_CHECK_BOUND
  1699.         (pos.x, pos.y, category142_vbar.x, category142_vbar.y, category142_vbar.width, category142_vbar.height))
  1700.     {
  1701.         gui_vertical_scrollbar_translate_pen_event(
  1702.             &category142_vbar,
  1703.             MMI_PEN_EVENT_UP,
  1704.             pos.x,
  1705.             pos.y,
  1706.             &scrollbar_event,
  1707.             &scrollbar_param);
  1708.         return MMI_TRUE;
  1709.     }
  1710.     return MMI_FALSE;
  1711. }
  1712. /*****************************************************************************
  1713.  * FUNCTION
  1714.  *  category_142_pen_abort_hdlr
  1715.  * DESCRIPTION
  1716.  *  
  1717.  * PARAMETERS
  1718.  *  pos     [IN]        
  1719.  * RETURNS
  1720.  *  
  1721.  *****************************************************************************/
  1722. MMI_BOOL category_142_pen_abort_hdlr(mmi_pen_point_struct pos)
  1723. {
  1724.     /*----------------------------------------------------------------*/
  1725.     /* Local Variables                                                */
  1726.     /*----------------------------------------------------------------*/
  1727.     gui_scrollbar_pen_enum scrollbar_event;
  1728.     gui_pen_event_param_struct scrollbar_param;
  1729.     /*----------------------------------------------------------------*/
  1730.     /* Code Body                                                      */
  1731.     /*----------------------------------------------------------------*/
  1732.     if (PEN_CHECK_BOUND
  1733.         (pos.x, pos.y, category142_vbar.x, category142_vbar.y, category142_vbar.width, category142_vbar.height))
  1734.     {
  1735.         gui_vertical_scrollbar_translate_pen_event(
  1736.             &category142_vbar,
  1737.             MMI_PEN_EVENT_ABORT,
  1738.             pos.x,
  1739.             pos.y,
  1740.             &scrollbar_event,
  1741.             &scrollbar_param);
  1742.         return MMI_TRUE;
  1743.     }
  1744.     return MMI_FALSE;
  1745. }
  1746. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1747. /*****************************************************************************
  1748.  * FUNCTION
  1749.  *  DrawCate142CategoryControlArea
  1750.  * DESCRIPTION
  1751.  *  
  1752.  * PARAMETERS
  1753.  *  coordinate      [?]     
  1754.  * RETURNS
  1755.  *  void
  1756.  *****************************************************************************/
  1757. void DrawCate142CategoryControlArea(dm_coordinates *coordinate)
  1758. {
  1759.     /*----------------------------------------------------------------*/
  1760.     /* Local Variables                                                */
  1761.     /*----------------------------------------------------------------*/
  1762.     /*----------------------------------------------------------------*/
  1763.     /* Code Body                                                      */
  1764.     /*----------------------------------------------------------------*/
  1765.     category_142_redraw_highlighted_item();
  1766. }
  1767. /*****************************************************************************
  1768.  * FUNCTION
  1769.  *  ShowCategory142Screen
  1770.  * DESCRIPTION
  1771.  *  Displays the picture list screen
  1772.  * PARAMETERS
  1773.  *  title                   [IN]        Title for the screen
  1774.  *  title_icon              [IN]        Icon displayed with the title
  1775.  *  left_softkey            [IN]        Left softkey label
  1776.  *  left_softkey_icon       [IN]        Left softkey icon
  1777.  *  right_softkey           [IN]        Right softkey label
  1778.  *  right_softkey_icon      [IN]        Right softkey icon
  1779.  *  list_of_titles          [IN]        List of string to displayed as image title
  1780.  *  list_of_images          [IN]        List of image IDs
  1781.  *  file_list_of_images     [IN]        List of image file name
  1782.  *  n_items                 [IN]        Number of images
  1783.  *  index                   [IN]        Currently displayed image index
  1784.  *  history_buffer          [IN]        History buffer
  1785.  * RETURNS
  1786.  *  void
  1787.  *****************************************************************************/
  1788. void ShowCategory142Screen(
  1789.         U8 *title,
  1790.         U16 title_icon,
  1791.         U16 left_softkey,
  1792.         U16 left_softkey_icon,
  1793.         U16 right_softkey,
  1794.         U16 right_softkey_icon,
  1795.         U8 **list_of_titles,
  1796.         U16 *list_of_images,
  1797.         U8 **file_list_of_images,
  1798.         S32 n_items,
  1799.         S32 *index,
  1800.         U8 *history_buffer)
  1801. {
  1802.     /*----------------------------------------------------------------*/
  1803.     /* Local Variables                                                */
  1804.     /*----------------------------------------------------------------*/
  1805.     dm_data_struct dm_data;
  1806.     U8 h_flag;
  1807.     /*----------------------------------------------------------------*/
  1808.     /* Code Body                                                      */
  1809.     /*----------------------------------------------------------------*/
  1810.     UI_UNUSED_PARAMETER(history_buffer);
  1811.     gdi_layer_lock_frame_buffer();
  1812.     MMI_menu_shortcut_number = -1;
  1813.     change_left_softkey(left_softkey, left_softkey_icon);
  1814.     change_right_softkey(right_softkey, right_softkey_icon);
  1815.     SetupCategoryKeyHandlers();
  1816.     if (title == NULL)
  1817.     {
  1818.         wgui_switch_title_with_status_bar = 1;
  1819.         ShowStatusIconsTitle();
  1820.     }
  1821.     else
  1822.     {
  1823.         MMI_title_icon = get_image(title_icon);
  1824.         wgui_switch_title_with_status_bar = 0;
  1825.     }
  1826.     MMI_menu_shortcut_number = *index + 1;
  1827.     category_142_image_list_index = index;
  1828.     h_flag = set_object_list_category_history(MMI_CATEGORY142_ID, history_buffer, category_142_image_list_index);
  1829.     if (h_flag)
  1830.     {
  1831.         *index = *category_142_image_list_index;
  1832.     }
  1833.     category_142_list_of_titles = list_of_titles;
  1834.     MMI_title_string = (UI_string_type) title;
  1835.     category_142_image_list = list_of_images;
  1836.     category_142_image_file_name_list = file_list_of_images;
  1837.     category_142_image_list_n_items = n_items;
  1838.     gui_create_vertical_scrollbar(
  1839.         &category142_vbar,
  1840.         UI_device_width - current_MMI_theme->scrollbar_size,
  1841.         (MMI_title_y + MMI_title_height),
  1842.         current_MMI_theme->scrollbar_size,
  1843.         MMI_content_height);
  1844.   
  1845.     /* register shortcut handler */
  1846.     if (n_items > 1)
  1847.     {
  1848.         S32 shortcut_width;
  1849.         MMI_disable_title_shortcut_display = 0;
  1850.         register_fixed_list_shortcut_handler();
  1851.         shortcut_width = set_menu_item_count(n_items) + 7;
  1852.         resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  1853.         move_menu_shortcut_handler(UI_device_width - MMI_menu_shortcut_box.width, MMI_title_y);
  1854.         register_hide_menu_shortcut(gui_redraw_menu_shortcut);
  1855.         register_keyboard_key_handler(category_142_key_handler);
  1856.         register_menu_shortcut_keys();
  1857.         register_menu_shortcut_handler(category_142_goto_item);
  1858.         SetKeyHandler(category_142_goto_previous_item, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1859.         SetKeyHandler(category_142_goto_next_item, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1860.         SetKeyHandler(category_142_goto_previous_item, KEY_VOL_UP, KEY_EVENT_DOWN);
  1861.         SetKeyHandler(category_142_goto_next_item, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  1862. #ifdef __MMI_TOUCH_SCREEN__
  1863.         wgui_register_category_screen_control_area_pen_handlers(category_142_pen_down_hdlr, MMI_PEN_EVENT_DOWN);
  1864.         wgui_register_category_screen_control_area_pen_handlers(category_142_pen_move_hdlr, MMI_PEN_EVENT_MOVE);
  1865.         wgui_register_category_screen_control_area_pen_handlers(category_142_pen_repeat_hdlr, MMI_PEN_EVENT_REPEAT);
  1866.         wgui_register_category_screen_control_area_pen_handlers(category_142_pen_up_hdlr, MMI_PEN_EVENT_UP);
  1867.         wgui_register_category_screen_control_area_pen_handlers(category_142_pen_abort_hdlr, MMI_PEN_EVENT_ABORT);
  1868. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1869.     }
  1870.     else
  1871.     {
  1872.         MMI_disable_title_shortcut_display = 1;
  1873.     }
  1874.     gdi_layer_unlock_frame_buffer();
  1875.     ExitCategoryFunction = ExitCategory142Screen;
  1876.     dm_setup_category_functions(dm_redraw_category_screen, GetCategory142History, dm_get_category_history_size);
  1877.     dm_register_category_controlled_callback(DrawCate142CategoryControlArea);
  1878.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1879.     if (wgui_switch_title_with_status_bar == 1)
  1880.     {
  1881.         dm_data.s32CatId = MMI_CATEGORY142_STATUS_ICON_ID;
  1882.     }
  1883.     else
  1884.     {
  1885.         dm_data.s32CatId = MMI_CATEGORY142_ID;
  1886.     }
  1887.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  1888.     dm_setup_data(&dm_data);
  1889.     dm_redraw_category_screen();
  1890. }   /* end of ShowCategory142Screen */
  1891. /*****************************************************************************
  1892.  * FUNCTION
  1893.  *  ExitCategory142Screen
  1894.  * DESCRIPTION
  1895.  *  Exits the picture list screen
  1896.  * PARAMETERS
  1897.  *  void
  1898.  * RETURNS
  1899.  *  void
  1900.  *****************************************************************************/
  1901. void ExitCategory142Screen(void)
  1902. {
  1903.     /*----------------------------------------------------------------*/
  1904.     /* Local Variables                                                */
  1905.     /*----------------------------------------------------------------*/
  1906.     /*----------------------------------------------------------------*/
  1907.     /* Code Body                                                      */
  1908.     /*----------------------------------------------------------------*/
  1909.     if (wgui_switch_title_with_status_bar)
  1910.     {
  1911.         close_status_icons();
  1912.         wgui_switch_title_with_status_bar = 0;
  1913.     }
  1914.     category_142_image_list = NULL;
  1915.     category_142_image_file_name_list = NULL;
  1916.     category_142_image_list_index = NULL;
  1917.     category_142_image_list_n_items = 0;
  1918.     category_142_list_of_titles = NULL;
  1919.     animation_handle = GDI_ERROR_HANDLE;
  1920.     gui_hide_animations();
  1921. }   /* end of ExitCategory142Screen */
  1922. /*****************************************************************************
  1923.  * FUNCTION
  1924.  *  GetCategory142History
  1925.  * DESCRIPTION
  1926.  *  Gets the history buffer for the picture list screen
  1927.  * PARAMETERS
  1928.  *  history_buffer      [IN]        Buffer to store history
  1929.  * RETURNS
  1930.  *  U8*                  pointer to the history buffer
  1931.  *****************************************************************************/
  1932. U8 *GetCategory142History(U8 *history_buffer)
  1933. {
  1934.     /*----------------------------------------------------------------*/
  1935.     /* Local Variables                                                */
  1936.     /*----------------------------------------------------------------*/
  1937.     /*----------------------------------------------------------------*/
  1938.     /* Code Body                                                      */
  1939.     /*----------------------------------------------------------------*/
  1940.     get_object_list_category_history(MMI_CATEGORY142_ID, history_buffer, category_142_image_list_index);
  1941.     return (history_buffer);
  1942. }
  1943. extern void gui_fixed_icontext_list_menuitem_scroll_handler(void);
  1944. /*****************************************************************************
  1945.  * FUNCTION
  1946.  *  DrawCate150CategoryControlArea
  1947.  * DESCRIPTION
  1948.  *  
  1949.  * PARAMETERS
  1950.  *  coordinate      [?]     
  1951.  * RETURNS
  1952.  *  void
  1953.  *****************************************************************************/
  1954. void DrawCate150CategoryControlArea(dm_coordinates *coordinate)
  1955. {
  1956.     /*----------------------------------------------------------------*/
  1957.     /* Local Variables                                                */
  1958.     /*----------------------------------------------------------------*/
  1959.     S32 i = 0;
  1960.     /*----------------------------------------------------------------*/
  1961.     /* Code Body                                                      */
  1962.     /*----------------------------------------------------------------*/
  1963.     for (i = 0; i < MMI_fixed_list_menu.n_items; i++)
  1964.     {
  1965.         MMI_fixed_list_menu.item_remove_highlight_function(
  1966.                                 MMI_fixed_list_menu.items[i],
  1967.                                 MMI_fixed_list_menu.common_item_data);
  1968.     }
  1969.     move_fixed_list(coordinate->s16X, coordinate->s16Y);
  1970.     show_fixed_list();
  1971.     gui_cancel_timer(gui_fixed_icontext_list_menuitem_scroll_handler);
  1972. }
  1973. /*****************************************************************************
  1974.  * FUNCTION
  1975.  *  ShowCategory150Screen
  1976.  * DESCRIPTION
  1977.  *  Displays the category screen 153
  1978.  * PARAMETERS
  1979.  *  title                   [IN]        Title for the screen
  1980.  *  title_icon              [IN]        Icon displayed with the title
  1981.  *  left_softkey            [IN]        Left softkey label
  1982.  *  left_softkey_icon       [IN]        Left softkey icon
  1983.  *  right_softkey           [IN]        Right softkey label
  1984.  *  right_softkey_icon      [IN]        Right softkey icon
  1985.  *  number_of_items         [IN]        Number of items
  1986.  *  list_of_items1          [IN]        Strings of item1
  1987.  *  list_of_items2          [IN]        Strings if item2
  1988.  *  highlighted_item        [IN]        Highlighted index
  1989.  *  history_buffer          [IN]        History buffer
  1990.  * RETURNS
  1991.  *  void
  1992.  *****************************************************************************/
  1993. void ShowCategory150Screen(
  1994.         U16 title,
  1995.         U16 title_icon,
  1996.         U16 left_softkey,
  1997.         U16 left_softkey_icon,
  1998.         U16 right_softkey,
  1999.         U16 right_softkey_icon,
  2000.         S32 number_of_items,
  2001.         U8 **list_of_items1,
  2002.         U8 **list_of_items2,
  2003.         S32 highlighted_item,
  2004.         U8 *history_buffer)
  2005. {
  2006.     /*----------------------------------------------------------------*/
  2007.     /* Local Variables                                                */
  2008.     /*----------------------------------------------------------------*/
  2009.     dm_data_struct dm_data;
  2010.     S32 i, w;
  2011.     U8 h_flag;
  2012.     /*----------------------------------------------------------------*/
  2013.     /* Code Body                                                      */
  2014.     /*----------------------------------------------------------------*/
  2015.     gdi_layer_lock_frame_buffer();
  2016.     create_fixed_icontext_list_menuitems(2, 0);
  2017.     /* This might be a problem for draw manager. */
  2018.     w = UI_device_width - MMI_fixed_list_menu.vbar.width - 4;
  2019.     //PMT HIMANSHU START 20051028
  2020.     //      set_fixed_icontext_list_text_coordinates(0,2,0,w>>1,18);
  2021.     //---
  2022.     set_fixed_icontext_list_text_coordinates(0, 2, 0, (w >> 1), MMI_MENUITEM_HEIGHT);
  2023.     set_fixed_icontext_list_text_coordinates(1, (w >> 1), 0, (w >> 1), MMI_MENUITEM_HEIGHT);
  2024.     associate_fixed_icontext_list_list();
  2025.     ShowListCategoryScreen(
  2026.         get_string(title),
  2027.         get_image(title_icon),
  2028.         get_string(left_softkey),
  2029.         get_image(left_softkey_icon),
  2030.         get_string(right_softkey),
  2031.         get_image(right_softkey_icon),
  2032.         number_of_items);
  2033.     if (wgui_is_disable_shortcut_display() == MMI_TRUE)
  2034.     {
  2035.         MMI_disable_title_shortcut_display = 1;
  2036.         disable_menu_shortcut_box_display = 1;
  2037.     }
  2038.     MMI_fixed_icontext_list_menuitem.flags |= (UI_MENUITEM_RIGHT_JUSTIFY_COL2 | UI_MENUITEM_DISABLE_TEXT_CLIP);
  2039.     for (i = 0; i < number_of_items; i++)
  2040.     {
  2041.         fixed_icontext_list_item_insert(i);
  2042.         add_fixed_icontext_list_item_text(i, 0, (UI_string_type) list_of_items1[i]);
  2043.         add_fixed_icontext_list_item_text(i, 1, (UI_string_type) list_of_items2[i]);
  2044.     }
  2045.     h_flag = set_list_menu_category_history(MMI_CATEGORY150_ID, history_buffer);
  2046.     if (h_flag)
  2047.     {
  2048.         fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);
  2049.     }
  2050.     else
  2051.     {
  2052.         fixed_list_goto_item_no_redraw(highlighted_item);
  2053.     }
  2054.     resize_fixed_icontext_list_menuitems_to_list_width();
  2055.     for (i = 0; i < MMI_fixed_list_menu.n_items; i++)
  2056.     {
  2057.         MMI_fixed_list_menu.item_remove_highlight_function(
  2058.                                 MMI_fixed_list_menu.items[i],
  2059.                                 MMI_fixed_list_menu.common_item_data);
  2060.     }
  2061.     gui_cancel_timer(gui_fixed_icontext_list_menuitem_scroll_handler);
  2062.     gdi_layer_unlock_frame_buffer();
  2063.     ExitCategoryFunction = ExitListCategoryScreen;
  2064.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  2065.     dm_register_category_controlled_callback(DrawCate150CategoryControlArea);
  2066.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2067.     dm_data.s32CatId = MMI_CATEGORY150_ID;
  2068.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  2069.     dm_setup_data(&dm_data);
  2070.     dm_redraw_category_screen();
  2071. }   /* end of ShowCategory150Screen */
  2072. /*****************************************************************************
  2073.  * FUNCTION
  2074.  *  ExitCategory150Screen
  2075.  * DESCRIPTION
  2076.  *  Exits the Games high scores category screen
  2077.  * PARAMETERS
  2078.  *  void
  2079.  * RETURNS
  2080.  *  void
  2081.  *****************************************************************************/
  2082. void ExitCategory150Screen(void)
  2083. {
  2084.     /*----------------------------------------------------------------*/
  2085.     /* Local Variables                                                */
  2086.     /*----------------------------------------------------------------*/
  2087.     /*----------------------------------------------------------------*/
  2088.     /* Code Body                                                      */
  2089.     /*----------------------------------------------------------------*/
  2090.     MMI_fixed_icontext_list_menuitem_theme.flags &= ~(UI_MENUITEM_RIGHT_JUSTIFY_COL2 | UI_MENUITEM_DISABLE_TEXT_CLIP);
  2091.     ClearHighlightHandler();
  2092.     reset_softkeys();
  2093.     reset_menu_shortcut_handler();
  2094.     reset_fixed_list();
  2095.     if (wgui_is_disable_shortcut_display() == MMI_TRUE)
  2096.     {
  2097.         wgui_reset_disable_shortcut_display();
  2098.         MMI_disable_title_shortcut_display = 0;
  2099.         disable_menu_shortcut_box_display = 0;
  2100.     }
  2101. }   /* end of ExitCategory150Screen */
  2102. /*****************************************************************************
  2103.  * FUNCTION
  2104.  *  ExitCategory152Screen
  2105.  * DESCRIPTION
  2106.  *  Exit category152 screen
  2107.  * PARAMETERS
  2108.  *  void
  2109.  * RETURNS
  2110.  *  void
  2111.  *****************************************************************************/
  2112. void ExitCategory152Screen(void)
  2113. {
  2114.     /*----------------------------------------------------------------*/
  2115.     /* Local Variables                                                */
  2116.     /*----------------------------------------------------------------*/
  2117.     /*----------------------------------------------------------------*/
  2118.     /* Code Body                                                      */
  2119.     /*----------------------------------------------------------------*/
  2120.     reset_softkeys();
  2121. }   /* end of ExitCategory152Screen */
  2122. /*****************************************************************************
  2123.  * FUNCTION
  2124.  *  ShowCategory152Screen
  2125.  * DESCRIPTION
  2126.  *  Displays the category screen 152
  2127.  * PARAMETERS
  2128.  *  title                   [IN]        Title for the screen
  2129.  *  title_icon              [IN]        Icon displayed with the title
  2130.  *  left_softkey            [IN]        Left softkey label
  2131.  *  left_softkey_icon       [IN]        Left softkey icon
  2132.  *  right_softkey           [IN]        Right softkey label
  2133.  *  right_softkey_icon      [IN]        Right softkey icon
  2134.  *  message                 [IN]        Message
  2135.  *  history_buffer          [IN]        History buffer
  2136.  * RETURNS
  2137.  *  void
  2138.  *****************************************************************************/
  2139. void ShowCategory152Screen(
  2140.         U16 title,
  2141.         U16 title_icon,
  2142.         U16 left_softkey,
  2143.         U16 left_softkey_icon,
  2144.         U16 right_softkey,
  2145.         U16 right_softkey_icon,
  2146.         U8 *message,
  2147.         U8 *history_buffer)
  2148. {
  2149.     /*----------------------------------------------------------------*/
  2150.     /* Local Variables                                                */
  2151.     /*----------------------------------------------------------------*/
  2152.     dm_data_struct dm_data;
  2153.     S32 l;
  2154.     /*----------------------------------------------------------------*/
  2155.     /* Code Body                                                      */
  2156.     /*----------------------------------------------------------------*/
  2157.     UI_UNUSED_PARAMETER(history_buffer);
  2158.     gdi_layer_lock_frame_buffer();
  2159.     MMI_menu_shortcut_number = -1;
  2160.     change_left_softkey(left_softkey, left_softkey_icon);
  2161.     change_right_softkey(right_softkey, right_softkey_icon);
  2162.     SetupCategoryKeyHandlers();
  2163.     MMI_title_string = (UI_string_type) get_string(title);
  2164.     MMI_title_icon = (PU8) get_image(title_icon);
  2165.     MMI_message_string = (UI_string_type) (message);
  2166.     l = gui_strlen(MMI_message_string);
  2167.     create_multiline_inputbox_set_buffer(MMI_message_string, l, l, 0);
  2168.     MMI_multiline_inputbox.flags |=
  2169.         (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND |
  2170.          UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR);
  2171. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  2172.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
  2173. #endif 
  2174.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND | DM_LEFT_ALIGN_TITLE;
  2175.     gdi_layer_unlock_frame_buffer();
  2176.     ExitCategoryFunction = ExitCategory152Screen;
  2177.     dm_setup_category_functions(dm_redraw_category_screen, dummy_get_history, dummy_get_history_size);
  2178.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2179.     dm_data.s32CatId = MMI_CATEGORY152_ID;
  2180.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  2181.     dm_setup_data(&dm_data);
  2182.     dm_redraw_category_screen();
  2183. }   /* end of ShowCategory152Screen */
  2184. /*****************************************************************************
  2185.  * FUNCTION
  2186.  *  ShowCategory153Screen
  2187.  * DESCRIPTION
  2188.  *  Displays the category screen 153
  2189.  * PARAMETERS
  2190.  *  title                   [IN]        Title for the screen
  2191.  *  title_icon              [IN]        Icon displayed with the title
  2192.  *  left_softkey            [IN]        Left softkey label
  2193.  *  left_softkey_icon       [IN]        Left softkey icon
  2194.  *  right_softkey           [IN]        Right softkey label
  2195.  *  right_softkey_icon      [IN]        Right softkey icon
  2196.  *  number_of_items         [IN]        Number of items
  2197.  *  list_of_items1          [IN]        Strings of item1
  2198.  *  list_of_items2          [IN]        Strings if item2
  2199.  *  highlighted_item        [IN]        Highlighted index
  2200.  *  history_buffer          [IN]        History buffer
  2201.  * RETURNS
  2202.  *  void
  2203.  *****************************************************************************/
  2204. void ShowCategory153Screen(
  2205.         U16 title,
  2206.         U16 title_icon,
  2207.         U16 left_softkey,
  2208.         U16 left_softkey_icon,
  2209.         U16 right_softkey,
  2210.         U16 right_softkey_icon,
  2211.         S32 number_of_items,
  2212.         U8 **list_of_items1,
  2213.         U8 **list_of_items2,
  2214.         S32 highlighted_item,
  2215.         U8 *history_buffer)
  2216. {
  2217.     /*----------------------------------------------------------------*/
  2218.     /* Local Variables                                                */
  2219.     /*----------------------------------------------------------------*/
  2220.     /*----------------------------------------------------------------*/
  2221.     /* Code Body                                                      */
  2222.     /*----------------------------------------------------------------*/
  2223.     highlighted_item = -1;
  2224.     /* 071205 Calvin Start */
  2225.     /* gdi_layer_lock_frame_buffer(); */
  2226.     wgui_set_disable_shortcut_display();
  2227.     ShowCategory150Screen(
  2228.         title,
  2229.         title_icon,
  2230.         left_softkey,
  2231.         left_softkey_icon,
  2232.         right_softkey,
  2233.         right_softkey_icon,
  2234.         number_of_items,
  2235.         list_of_items1,
  2236.         list_of_items2,
  2237.         highlighted_item,
  2238.         history_buffer);
  2239.     /* Disable pen on list menu */
  2240.     MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_PEN;
  2241.     /* gdi_layer_unlock_frame_buffer(); */
  2242.     /* 071205 Calvin End */
  2243.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  2244.     clear_key_handlers();
  2245. }   /* end of ShowCategory153Screen */
  2246. /*****************************************************************************
  2247.  * FUNCTION
  2248.  *  DrawCate154CategoryControlArea
  2249.  * DESCRIPTION
  2250.  *  
  2251.  * PARAMETERS
  2252.  *  coordinate      [?]     
  2253.  * RETURNS
  2254.  *  void
  2255.  *****************************************************************************/
  2256. void DrawCate154CategoryControlArea(dm_coordinates *coordinate)
  2257. {
  2258.     /*----------------------------------------------------------------*/
  2259.     /* Local Variables                                                */
  2260.     /*----------------------------------------------------------------*/
  2261.     S32 w1, h1, w2, h2, x;
  2262.     /*----------------------------------------------------------------*/
  2263.     /* Code Body                                                      */
  2264.     /*----------------------------------------------------------------*/
  2265.     gdi_layer_reset_clip();
  2266.     gui_set_font(current_UI_theme->multi_line_input_box_theme->text_font);
  2267.     gui_measure_string(MMI_message_string, &w1, &h1);
  2268.     gui_measure_string(MMI_message_string2, &w2, &h2);
  2269.     gui_set_text_color(*(current_MMI_theme->UI_black_color));
  2270.     if (Category154Align)
  2271.     {
  2272.         x = 2;
  2273.     }
  2274.     else
  2275.     {
  2276.         x = (UI_device_width >> 1) - (w1 >> 1);
  2277.         if (x < 2)
  2278.         {
  2279.             x = 2;
  2280.         }
  2281.     }
  2282.     if (r2lMMIFlag)
  2283.     {
  2284.         gui_move_text_cursor(x + gui_get_string_width((UI_string_type) MMI_message_string), category_154_message1_y);
  2285.     }
  2286.     else
  2287.     {
  2288.         gui_move_text_cursor(x, category_154_message1_y);
  2289.     }
  2290.     gui_set_line_height(h1);
  2291.     gui_print_text(MMI_message_string);
  2292.     if (Category154Align)
  2293.     {
  2294.         x = 2;
  2295.     }
  2296.     else
  2297.     {
  2298.         x = (UI_device_width >> 1) - (w2 >> 1);
  2299.         if (x < 2)
  2300.         {
  2301.             x = 2;
  2302.         }
  2303.     }
  2304.     if (r2lMMIFlag)
  2305.     {
  2306.         if (gui_get_string_width((UI_string_type) MMI_message_string2) >= UI_device_width)
  2307.         {
  2308.             x = UI_device_width - 1;
  2309.         }
  2310.         else
  2311.         {
  2312.             x += gui_get_string_width((UI_string_type) MMI_message_string2);
  2313.         }
  2314.     }
  2315.     gui_print_truncated_text(x, category_154_message2_y, UI_device_width - 2, MMI_message_string2);
  2316.     gdi_layer_set_clip(
  2317.         0,
  2318.         (MMI_title_y + MMI_title_height) + 1,
  2319.         UI_device_width - 1,
  2320.         UI_device_height - MMI_button_bar_height - 1);
  2321.     wgui_show_transparent_animation();
  2322. }
  2323. /*****************************************************************************
  2324.  * FUNCTION
  2325.  *  Setcategory154LeftAlign
  2326.  * DESCRIPTION
  2327.  *  Set content of category154 left alignment
  2328.  * PARAMETERS
  2329.  *  void
  2330.  * RETURNS
  2331.  *  void
  2332.  *****************************************************************************/
  2333. void Setcategory154LeftAlign(void)
  2334. {
  2335.     /*----------------------------------------------------------------*/
  2336.     /* Local Variables                                                */
  2337.     /*----------------------------------------------------------------*/
  2338.     /*----------------------------------------------------------------*/
  2339.     /* Code Body                                                      */
  2340.     /*----------------------------------------------------------------*/
  2341.     Category154Align = 1;
  2342. }
  2343. /*****************************************************************************
  2344.  * FUNCTION
  2345.  *  ChangeCategory154Data
  2346.  * DESCRIPTION
  2347.  *  Change data of category154
  2348.  * PARAMETERS
  2349.  *  message1            [IN]        Data pointer of message1
  2350.  *  message2            [IN]        Data pointer of message2
  2351.  *  message_icon        [IN]        Id of message icon
  2352.  * RETURNS
  2353.  *  void
  2354.  *****************************************************************************/
  2355. void ChangeCategory154Data(U8 *message1, U8 *message2, U16 message_icon)
  2356. {
  2357.     /*----------------------------------------------------------------*/
  2358.     /* Local Variables                                                */
  2359.     /*----------------------------------------------------------------*/
  2360.     S32 w1, h1, w2, h2, w3, h3, y, th, rh;
  2361.     PU8 image;
  2362.     /*----------------------------------------------------------------*/
  2363.     /* Code Body                                                      */
  2364.     /*----------------------------------------------------------------*/
  2365.     MMI_message_string = (UI_string_type) message1;
  2366.     MMI_message_string2 = (UI_string_type) message2;
  2367.     gui_set_font(current_UI_theme->multi_line_input_box_theme->text_font);
  2368.     gui_measure_string(MMI_message_string, &w1, &h1);
  2369.     gui_measure_string(MMI_message_string2, &w2, &h2);
  2370.     image = get_image(message_icon);
  2371.     gui_measure_image(image, &w3, &h3);
  2372.     th = h1 + h2 + h3 + 2;
  2373.     y = (MMI_title_y + MMI_title_height) + 1 + ((MMI_content_height - 1) >> 1) - (th >> 1);
  2374.     if (th < MMI_content_height)
  2375.     {
  2376.         rh = (MMI_content_height - th) >> 2;
  2377.     }
  2378.     else
  2379.     {
  2380.         rh = 0;
  2381.     }
  2382.     y -= rh;
  2383.     if (y < ((MMI_title_y + MMI_title_height) + 1))
  2384.     {
  2385.         y = (MMI_title_y + MMI_title_height) + 1;
  2386.     }
  2387.     category_154_message1_y = y;
  2388.     category_154_message2_y = y + h1;
  2389.     y += h1 + h2 + rh + 2;
  2390.     wgui_set_animation_image_y((UI_device_width >> 1), y, image);
  2391. }
  2392. /*****************************************************************************
  2393.  * FUNCTION
  2394.  *  ShowCategory154Screen
  2395.  * DESCRIPTION
  2396.  *  Displays the Message Received screen
  2397.  * PARAMETERS
  2398.  *  title                   [IN]        Title for the screen
  2399.  *  title_icon              [IN]        Icon shown with the title
  2400.  *  left_softkey            [IN]        Left softkey label
  2401.  *  left_softkey_icon       [IN]        Icon for the left softkey
  2402.  *  right_softkey           [IN]        Right softkey label
  2403.  *  right_softkey_icon      [IN]        Icon for the right softkey
  2404.  *  message1                [IN]        Notification message 1
  2405.  *  message2                [IN]        Notification message 2
  2406.  *  message_icon            [IN]        
  2407.  *  history_buffer          [IN]        History buffer
  2408.  *  MMI_ID_TYPE(?)          [IN]        Image          Notification image
  2409.  * RETURNS
  2410.  *  void
  2411.  *****************************************************************************/
  2412. void ShowCategory154Screen(
  2413.         U16 title,
  2414.         U16 title_icon,
  2415.         U16 left_softkey,
  2416.         U16 left_softkey_icon,
  2417.         U16 right_softkey,
  2418.         U16 right_softkey_icon,
  2419.         U8 *message1,
  2420.         U8 *message2,
  2421.         U16 message_icon,
  2422.         U8 *history_buffer)
  2423. {
  2424.     /*----------------------------------------------------------------*/
  2425.     /* Local Variables                                                */
  2426.     /*----------------------------------------------------------------*/
  2427.     dm_data_struct dm_data;
  2428.     S32 w1, h1, w2, h2, w3, h3, y, th, rh;
  2429.     PU8 image;
  2430.     /*----------------------------------------------------------------*/
  2431.     /* Code Body                                                      */
  2432.     /*----------------------------------------------------------------*/
  2433.     UI_UNUSED_PARAMETER(history_buffer);
  2434.     gdi_layer_lock_frame_buffer();
  2435.     MMI_menu_shortcut_number = -1;
  2436.     change_left_softkey(left_softkey, left_softkey_icon);
  2437.     change_right_softkey(right_softkey, right_softkey_icon);
  2438.     SetupCategoryKeyHandlers();
  2439.     if (title == 0)
  2440.     {
  2441.         wgui_switch_title_with_status_bar = 1;
  2442.         ShowStatusIconsTitle();
  2443.     }
  2444.     else
  2445.     {
  2446.         MMI_title_string = get_string(title);
  2447.         MMI_title_icon = get_image(title_icon);
  2448.         wgui_switch_title_with_status_bar = 0;
  2449.     }
  2450.     MMI_message_string = (UI_string_type) message1;
  2451.     MMI_message_string2 = (UI_string_type) message2;
  2452.     gui_set_font(current_UI_theme->multi_line_input_box_theme->text_font);
  2453.     gui_measure_string(MMI_message_string, &w1, &h1);
  2454.     gui_measure_string(MMI_message_string2, &w2, &h2);
  2455.     image = get_image(message_icon);
  2456.     gui_measure_image(image, &w3, &h3);
  2457.     th = h1 + 1 + h2 + 2 + h3;
  2458.     y = (MMI_title_y + MMI_title_height) + 1 + ((MMI_content_height - 1) >> 1) - (th >> 1);
  2459.     if (th < MMI_content_height)
  2460.     {
  2461.         rh = (MMI_content_height - th) >> 2;
  2462.     }
  2463.     else
  2464.     {
  2465.         rh = 0;
  2466.     }
  2467.     y -= rh;
  2468.     if (y < ((MMI_title_y + MMI_title_height) + 1))
  2469.     {
  2470.         y = (MMI_title_y + MMI_title_height) + 1;
  2471.     }
  2472.     category_154_message1_y = y;
  2473.     category_154_message2_y = y + h1 + 1;
  2474.     y += h1 + 1 + h2 + rh + 2;
  2475.     wgui_set_animation_image_y((UI_device_width >> 1), y, image);
  2476.     gdi_layer_unlock_frame_buffer();
  2477.     ExitCategoryFunction = ExitCategory154Screen;
  2478.     dm_setup_category_functions(dm_redraw_category_screen, dummy_get_history, dummy_get_history_size);
  2479.     dm_register_category_controlled_callback(DrawCate154CategoryControlArea);
  2480.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2481.     if (wgui_switch_title_with_status_bar == 1)
  2482.     {
  2483.         dm_data.s32CatId = MMI_CATEGORY154_STATUS_ICON_ID;
  2484.     }
  2485.     else
  2486.     {
  2487.         dm_data.s32CatId = MMI_CATEGORY154_ID;
  2488.     }
  2489.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  2490.     dm_setup_data(&dm_data);
  2491.     dm_redraw_category_screen();
  2492. }
  2493. /*****************************************************************************
  2494.  * FUNCTION
  2495.  *  ExitCategory154Screen
  2496.  * DESCRIPTION
  2497.  *  Exits the Message Received screen
  2498.  * PARAMETERS
  2499.  *  void
  2500.  * RETURNS
  2501.  *  void
  2502.  *****************************************************************************/
  2503. void ExitCategory154Screen(void)
  2504. {
  2505.     /*----------------------------------------------------------------*/
  2506.     /* Local Variables                                                */
  2507.     /*----------------------------------------------------------------*/
  2508.     /*----------------------------------------------------------------*/
  2509.     /* Code Body                                                      */
  2510.     /*----------------------------------------------------------------*/
  2511.     if (wgui_switch_title_with_status_bar)
  2512.     {
  2513.         close_status_icons();
  2514.         wgui_switch_title_with_status_bar = 0;
  2515.     }
  2516.     Category154Align = 0;
  2517.     MMI_message_string = NULL;
  2518.     MMI_message_string2 = NULL;
  2519.     gui_hide_animations();
  2520. }
  2521. #if defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
  2522. /* category 154 message 1 */
  2523. UI_string_type category_620_message1 = NULL;
  2524. /* category 154 message 2 */
  2525. UI_string_type category_620_message2 = NULL;
  2526. /* category 154 message 1 y postition */
  2527. S32 category_620_message1_y = 0;
  2528. /* category 154 message 2 y position  */
  2529. S32 category_620_message2_y = 0;
  2530. U8 Category620Align = 0;
  2531. /*****************************************************************************
  2532.  * FUNCTION
  2533.  *  RedrawCategory620Screen
  2534.  * DESCRIPTION
  2535.  *  Redraws the Message Received screen
  2536.  * PARAMETERS
  2537.  *  void
  2538.  * RETURNS
  2539.  *  void
  2540.  *****************************************************************************/
  2541. void RedrawCategory620Screen(void)
  2542. {
  2543.     /*----------------------------------------------------------------*/
  2544.     /* Local Variables                                                */
  2545.     /*----------------------------------------------------------------*/
  2546.     S32 w1, h1, w2, h2, x;
  2547.     /*----------------------------------------------------------------*/
  2548.     /* Code Body                                                      */
  2549.     /*----------------------------------------------------------------*/
  2550.     gdi_layer_lock_frame_buffer();
  2551.     gui_hide_animations();
  2552.     clear_screen();
  2553.     if (wgui_switch_title_with_status_bar)
  2554.     {
  2555.         show_status_icons();
  2556.     }
  2557.     else
  2558.     {
  2559.         draw_title();
  2560.     }
  2561.     gdi_layer_reset_clip();
  2562.     gui_set_font(current_UI_theme->multi_line_input_box_theme->text_font);
  2563.     gui_measure_string(category_620_message1, &w1, &h1);
  2564.     gui_measure_string(category_620_message2, &w2, &h2);
  2565.     gui_set_text_color(*(current_MMI_theme->UI_black_color));
  2566.     if (Category620Align)
  2567.     {
  2568.         x = 2;
  2569.     }
  2570.     else
  2571.     {
  2572.         x = (UI_device_width >> 1) - (w1 >> 1);
  2573.         if (x < 2)
  2574.         {
  2575.             x = 2;
  2576.         }
  2577.     }
  2578.     gui_move_text_cursor(x, category_620_message1_y);
  2579.     gui_set_line_height(h1);
  2580.     gui_print_text(category_620_message1);
  2581.     if (Category620Align)
  2582.     {
  2583.         x = 2;
  2584.     }
  2585.     else
  2586.     {
  2587.         x = (UI_device_width >> 1) - (w2 >> 1);
  2588.         if (x < 2)
  2589.         {
  2590.             x = 2;
  2591.         }
  2592.     }
  2593.     gui_print_truncated_text(x, category_620_message2_y, UI_device_width - 2, category_620_message2);
  2594.     gdi_layer_set_clip(
  2595.         0,
  2596.         (MMI_title_y + MMI_title_height) + 1,
  2597.         UI_device_width - 1,
  2598.         UI_device_height - MMI_button_bar_height - 1);
  2599.     wgui_show_transparent_animation();
  2600.     show_softkey_background();
  2601.     show_left_softkey();
  2602.     show_right_softkey();
  2603.     gdi_layer_unlock_frame_buffer();
  2604.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  2605. }
  2606. /*****************************************************************************
  2607.  * FUNCTION
  2608.  *  Setcategory620LeftAlign
  2609.  * DESCRIPTION
  2610.  *  
  2611.  * PARAMETERS
  2612.  *  void
  2613.  * RETURNS
  2614.  *  void
  2615.  *****************************************************************************/
  2616. void Setcategory620LeftAlign(void)
  2617. {
  2618.     /*----------------------------------------------------------------*/
  2619.     /* Local Variables                                                */
  2620.     /*----------------------------------------------------------------*/
  2621.     /*----------------------------------------------------------------*/
  2622.     /* Code Body                                                      */
  2623.     /*----------------------------------------------------------------*/
  2624.     Category620Align = 1;
  2625. }
  2626. /*****************************************************************************
  2627.  * FUNCTION
  2628.  *  ChangeCategory620Data
  2629.  * DESCRIPTION
  2630.  *  
  2631.  * PARAMETERS
  2632.  *  message1                [?]     
  2633.  *  message2                [?]     
  2634.  *  message_icon_buffer     [?]     
  2635.  * RETURNS
  2636.  *  void
  2637.  *****************************************************************************/
  2638. void ChangeCategory620Data(U8 *message1, U8 *message2, U8 *message_icon_buffer)
  2639. {
  2640.     /*----------------------------------------------------------------*/
  2641.     /* Local Variables                                                */
  2642.     /*----------------------------------------------------------------*/
  2643.     S32 w1, h1, w2, h2, w3, h3, y, th, rh;
  2644.     /*----------------------------------------------------------------*/
  2645.     /* Code Body                                                      */
  2646.     /*----------------------------------------------------------------*/
  2647.     category_620_message1 = (UI_string_type) message1;
  2648.     category_620_message2 = (UI_string_type) message2;
  2649.     gui_set_font(current_UI_theme->multi_line_input_box_theme->text_font);
  2650.     gui_measure_string(category_620_message1, &w1, &h1);
  2651.     gui_measure_string(category_620_message2, &w2, &h2);
  2652.     gui_measure_image((PU8) message_icon_buffer, &w3, &h3);
  2653.     th = h1 + h2 + h3 + 2;
  2654.     y = (MMI_title_y + MMI_title_height) + 1 + ((MMI_content_height - 1) >> 1) - (th >> 1);
  2655.     if (th < MMI_content_height)
  2656.     {
  2657.         rh = (MMI_content_height - th) >> 2;
  2658.     }
  2659.     else
  2660.     {
  2661.         rh = 0;
  2662.     }
  2663.     y -= rh;
  2664.     if (y < ((MMI_title_y + MMI_title_height) + 1))
  2665.     {
  2666.         y = (MMI_title_y + MMI_title_height) + 1;
  2667.     }
  2668.     category_620_message1_y = y;
  2669.     category_620_message2_y = y + h1;
  2670.     y += h1 + h2 + rh + 2;
  2671.     wgui_set_animation_image_y((UI_device_width >> 1), y, (PU8) message_icon_buffer);
  2672. }
  2673. /*****************************************************************************
  2674.  * FUNCTION
  2675.  *  ShowCategory620Screen
  2676.  * DESCRIPTION
  2677.  *  Displays the Message Received screen
  2678.  * PARAMETERS
  2679.  *  title                       [IN]        Title for the screen
  2680.  *  title_icon                  [IN]        Icon shown with the title
  2681.  *  left_softkey                [IN]        Left softkey label
  2682.  *  left_softkey_icon           [IN]        Icon for the left softkey
  2683.  *  right_softkey               [IN]        Right softkey label
  2684.  *  right_softkey_icon          [IN]        Icon for the right softkey
  2685.  *  message1                    [IN]        Notification message 1
  2686.  *  message2                    [IN]        Notification message 2
  2687.  *  message_icon_buffer         [?]         
  2688.  *  history_buffer              [IN]        History buffer
  2689.  *  IMAGE_Bufferimage(?)        [IN]        Notification image
  2690.  * RETURNS
  2691.  *  void
  2692.  *****************************************************************************/
  2693. void ShowCategory620Screen(
  2694.         U16 title,
  2695.         U16 title_icon,
  2696.         U16 left_softkey,
  2697.         U16 left_softkey_icon,
  2698.         U16 right_softkey,
  2699.         U16 right_softkey_icon,
  2700.         U8 *message1,
  2701.         U8 *message2,
  2702.         U8 *message_icon_buffer,
  2703.         U8 *history_buffer)
  2704. {
  2705.     /*----------------------------------------------------------------*/
  2706.     /* Local Variables                                                */
  2707.     /*----------------------------------------------------------------*/
  2708.     dm_data_struct dm_data;
  2709.     UI_UNUSED_PARAMETER(history_buffer);
  2710.     /*----------------------------------------------------------------*/
  2711.     /* Code Body                                                      */
  2712.     /*----------------------------------------------------------------*/
  2713.     dm_reset_context();
  2714.     gdi_layer_lock_frame_buffer();
  2715.     MMI_menu_shortcut_number = -1;
  2716.     change_left_softkey(left_softkey, left_softkey_icon);
  2717.     change_right_softkey(right_softkey, right_softkey_icon);
  2718.     SetupCategoryKeyHandlers();
  2719.     if (title == 0)
  2720.     {
  2721.         wgui_switch_title_with_status_bar = 1;
  2722.         ShowStatusIconsTitle();
  2723.     }
  2724.     else
  2725.     {
  2726.         MMI_title_string = get_string(title);
  2727.         MMI_title_icon = get_image(title_icon);
  2728.         wgui_switch_title_with_status_bar = 0;
  2729.     }
  2730.     dm_add_image((PU8) message_icon_buffer, NULL, NULL);
  2731.     dm_add_string((UI_string_type) message1, &MMI_medium_font, UI_COLOR_BLACK, UI_COLOR_BLACK, NULL);
  2732.     dm_add_string((UI_string_type) message2, &MMI_medium_font, UI_COLOR_BLACK, UI_COLOR_BLACK, NULL);
  2733.     gdi_layer_unlock_frame_buffer();
  2734.     ExitCategoryFunction = ExitCategory620Screen;
  2735.     dm_setup_category_functions(dm_redraw_category_screen, dummy_get_history, dummy_get_history_size);
  2736.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2737.     dm_data.s32CatId = MMI_CATEGORY620_ID;
  2738.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  2739.     dm_setup_data(&dm_data);
  2740.     dm_redraw_category_screen();
  2741. }
  2742. /*****************************************************************************
  2743.  * FUNCTION
  2744.  *  ExitCategory620Screen
  2745.  * DESCRIPTION
  2746.  *  Exits the Message Received screen
  2747.  * PARAMETERS
  2748.  *  void
  2749.  * RETURNS
  2750.  *  void
  2751.  *****************************************************************************/
  2752. void ExitCategory620Screen(void)
  2753. {
  2754.     /*----------------------------------------------------------------*/
  2755.     /* Local Variables                                                */
  2756.     /*----------------------------------------------------------------*/
  2757.     /*----------------------------------------------------------------*/
  2758.     /* Code Body                                                      */
  2759.     /*----------------------------------------------------------------*/
  2760.     if (wgui_switch_title_with_status_bar)
  2761.     {
  2762.         close_status_icons();
  2763.         wgui_switch_title_with_status_bar = 0;
  2764.     }
  2765.     Category620Align = 0;
  2766.     category_620_message1 = NULL;
  2767.     category_620_message2 = NULL;
  2768.     gui_hide_animations();
  2769.     ExitCategoryFunction = MMI_dummy_function;
  2770.     RedrawCategoryFunction = MMI_dummy_function;
  2771.     GetCategoryHistory = dummy_get_history;
  2772.     GetCategoryHistorySize = dummy_get_history_size;
  2773. }
  2774. /*****************************************************************************
  2775.  * FUNCTION
  2776.  *  GetCategory620HistorySize
  2777.  * DESCRIPTION
  2778.  *  Gets the history buffer size for the Message Received screen
  2779.  * PARAMETERS
  2780.  *  void
  2781.  * RETURNS
  2782.  *  size in U8s of the history buffer
  2783.  *****************************************************************************/
  2784. S32 GetCategory620HistorySize(void)