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

MTK

开发平台:

C/C++

  1.     #if defined(__MMI_T9_POLISH__)
  2.         case INPUT_TYPE_SMART_UPPERCASE_POLISH:
  3.         case INPUT_TYPE_SMART_LOWERCASE_POLISH:
  4.     #endif /* defined(__MMI_T9_POLISH__) */ 
  5.             /* PMT CZ_PO_TU END 20050812 */
  6.     #if defined(__MMI_T9_FRENCH__)
  7.         case INPUT_TYPE_SMART_UPPERCASE_FRENCH:
  8.         case INPUT_TYPE_SMART_LOWERCASE_FRENCH:
  9.     #endif /* defined(__MMI_T9_FRENCH__) */ 
  10.     #if defined(__MMI_T9_GERMAN__)
  11.         case INPUT_TYPE_SMART_UPPERCASE_GERMAN:
  12.         case INPUT_TYPE_SMART_LOWERCASE_GERMAN:
  13.     #endif /* defined(__MMI_T9_GERMAN__) */ 
  14.     #if defined(__MMI_T9_ITALIAN__)
  15.         case INPUT_TYPE_SMART_UPPERCASE_ITALIAN:
  16.         case INPUT_TYPE_SMART_LOWERCASE_ITALIAN:
  17.     #endif /* defined(__MMI_T9_ITALIAN__) */ 
  18.             /* PMT Gurdev Start 20050729 */
  19.     #if defined(__MMI_T9_INDONESIAN__)
  20.         case INPUT_TYPE_SMART_UPPERCASE_INDONESIAN:
  21.         case INPUT_TYPE_SMART_LOWERCASE_INDONESIAN:
  22.     #endif /* defined(__MMI_T9_INDONESIAN__) */ 
  23.             //PMT Gurdev End 20050729
  24.             //PMT SHARIQ START 20050729
  25.     #if defined(__MMI_T9_PORTUGUESE__)
  26.         case INPUT_TYPE_SMART_UPPERCASE_PORTUGUESE:
  27.         case INPUT_TYPE_SMART_LOWERCASE_PORTUGUESE:
  28.     #endif /* defined(__MMI_T9_PORTUGUESE__) */ 
  29.             //PMT SHARIQ END 20050729
  30.             // PMT BHASKAR START 20052907
  31.     #if defined(__MMI_T9_VIETNAMESE__)
  32.         case INPUT_TYPE_SMART_UPPERCASE_VIETNAMESE:
  33.         case INPUT_TYPE_SMART_LOWERCASE_VIETNAMESE:
  34.     #endif /* defined(__MMI_T9_VIETNAMESE__) */ 
  35.             // PMT BHASKAR END 20052907
  36.             //PMT CZ_PO_TU START 20050812
  37.     #if defined(__MMI_T9_CZECH__)
  38.         case INPUT_TYPE_SMART_UPPERCASE_CZECH:
  39.         case INPUT_TYPE_SMART_LOWERCASE_CZECH:
  40.     #endif /* defined(__MMI_T9_CZECH__) */ 
  41.             //PMT CZ_PO_TU END 20050812  
  42.             //PMT CZ_PO_TU START 20050812
  43.     #if defined(__MMI_T9_TURKISH__)
  44.         case INPUT_TYPE_SMART_UPPERCASE_TURKISH:
  45.         case INPUT_TYPE_SMART_LOWERCASE_TURKISH:
  46.     #endif /* defined(__MMI_T9_TURKISH__) */ 
  47.             //PMT CZ_PO_TU END 20050812  
  48.             //PMT START HU_FI 20050825
  49.     #if defined(__MMI_T9_FINNISH__)
  50.         case INPUT_TYPE_SMART_UPPERCASE_FINNISH:
  51.         case INPUT_TYPE_SMART_LOWERCASE_FINNISH:
  52.     #endif /* defined(__MMI_T9_FINNISH__) */ 
  53.     #if defined(__MMI_T9_HUNGARIAN__)
  54.         case INPUT_TYPE_SMART_UPPERCASE_HUNGARIAN:
  55.         case INPUT_TYPE_SMART_LOWERCASE_HUNGARIAN:
  56.     #endif /* defined(__MMI_T9_HUNGARIAN__) */ 
  57.             //PMT END HU_FI 20050825
  58.             //PMT NO_AR_SL_DU START 20050909
  59.     #if defined(__MMI_T9_ARABIC__)
  60.         case INPUT_TYPE_SMART_ARABIC:
  61.     #endif 
  62.             /* PMT LANGUAGE START 20051221 */
  63.     #if defined(__MMI_T9_GREEK__)
  64.         case INPUT_TYPE_SMART_UPPERCASE_GREEK:
  65.         case INPUT_TYPE_SMART_LOWERCASE_GREEK:
  66.     #endif /* defined(__MMI_T9_GREEK__) */ 
  67.     #if defined(__MMI_T9_HEBREW__)
  68.         case INPUT_TYPE_SMART_HEBREW:
  69.     #endif 
  70.             //PMT LANGUAGE END 20051221
  71.             //PMT VIKAS GUPTA START 20051129
  72.     #if defined(__MMI_T9_HINDI__)
  73.         case INPUT_TYPE_SMART_HINDI:
  74.     #endif 
  75.             //PMT VIKAS GUPTA END 20051129
  76.             //Norwegian start
  77.     #if defined(__MMI_T9_NORWEGIAN__)
  78.         case INPUT_TYPE_SMART_UPPERCASE_NORWEGIAN:
  79.         case INPUT_TYPE_SMART_LOWERCASE_NORWEGIAN:
  80.     #endif /* defined(__MMI_T9_NORWEGIAN__) */ 
  81.             //Norwegian end
  82.             //START DUTCH_T9 20051021
  83.     #if defined(__MMI_T9_DUTCH__)
  84.         case INPUT_TYPE_SMART_UPPERCASE_DUTCH:
  85.         case INPUT_TYPE_SMART_LOWERCASE_DUTCH:
  86.     #endif /* defined(__MMI_T9_DUTCH__) */ 
  87.             //END DUTCH_T9 20051021
  88.             //PMT NO_AR_SL_DU END 20050909
  89.             //PMT LANGUAGE START 20051221
  90.     #if defined(__MMI_T9_SLOVENIAN__)
  91.         case INPUT_TYPE_SMART_UPPERCASE_SLOVENIAN:
  92.         case INPUT_TYPE_SMART_LOWERCASE_SLOVENIAN:
  93.     #endif /* defined(__MMI_T9_SLOVENIAN__) */ 
  94.     #if defined(__MMI_T9_SWEDISH__)
  95.         case INPUT_TYPE_SMART_UPPERCASE_SWEDISH:
  96.         case INPUT_TYPE_SMART_LOWERCASE_SWEDISH:
  97.     #endif /* defined(__MMI_T9_SWEDISH__) */ 
  98.             //PMT LANGUAGE END 20051221
  99.             //PMT START LANGUAGE 20060104
  100.     #if defined(__MMI_T9_MALAY__)
  101.         case INPUT_TYPE_SMART_UPPERCASE_MALAY:
  102.         case INPUT_TYPE_SMART_LOWERCASE_MALAY:
  103.     #endif /* defined(__MMI_T9_MALAY__) */ 
  104.     #if defined(__MMI_T9_CROATIAN__)
  105.         case INPUT_TYPE_SMART_UPPERCASE_CROATIAN:
  106.         case INPUT_TYPE_SMART_LOWERCASE_CROATIAN:
  107.     #endif /* defined(__MMI_T9_CROATIAN__) */ 
  108.     #if defined(__MMI_T9_SLOVAK__)
  109.         case INPUT_TYPE_SMART_UPPERCASE_SLOVAK:
  110.         case INPUT_TYPE_SMART_LOWERCASE_SLOVAK:
  111.     #endif /* defined(__MMI_T9_SLOVAK__) */ 
  112.     #if defined(__MMI_T9_ROMANIAN__)
  113.         case INPUT_TYPE_SMART_UPPERCASE_ROMANIAN:
  114.         case INPUT_TYPE_SMART_LOWERCASE_ROMANIAN:
  115.     #endif /* defined(__MMI_T9_ROMANIAN__) */ 
  116.             /* PMT END LANGUAGE 20060104 */
  117.             T9SynT9WithInputBox();
  118.             break;
  119.     }
  120. #endif /* __MMI_T9__ */ 
  121. }
  122. /*****************************************************************************
  123.  * FUNCTION
  124.  *  category435_draw_popup_background
  125.  * DESCRIPTION
  126.  *  
  127.  * PARAMETERS
  128.  *  void
  129.  * RETURNS
  130.  *  void
  131.  *****************************************************************************/
  132. static void category435_draw_popup_background(void)
  133. {
  134.     /*----------------------------------------------------------------*/
  135.     /* Local Variables                                                */
  136.     /*----------------------------------------------------------------*/
  137.     extern UI_filled_area wgui_pop_up_dialog_background;
  138.     S32 sw, sh; /* string width/height */
  139.     S32 sx, sy;
  140.     UI_filled_area f;
  141.     /*----------------------------------------------------------------*/
  142.     /* Code Body                                                      */
  143.     /*----------------------------------------------------------------*/
  144.     gui_push_clip();
  145.     gui_reset_clip();
  146.     gui_greyscale_rectangle(
  147.         0,
  148.         MMI_HORIZONTAL_TAB_BAR_Y + MMI_HORIZONTAL_TAB_BAR_TAB_AREA_HEIGHT,
  149.         MMI_content_width - 1,
  150.         CAT435_POPUP_Y + 15,    /* the dialog background has round corner */
  151.         CAT435_BACKGROUND_WHITE_VALUE,
  152.         MMI_BG_GREYSCALE_BLACK_VALUE);
  153.     f = wgui_pop_up_dialog_background;
  154.     f.c = g_mmi_gui_cat435_popup_color;
  155.     f.border_color = current_multitap_input_theme->normal_text_color;   /* Tricky. use multitap text color as border color */
  156.     wgui_draw_pop_up_screen_background_style2(
  157.         CAT435_POPUP_X,
  158.         CAT435_POPUP_Y,
  159.         CAT435_POPUP_X + CAT435_POPUP_WIDTH - 1,
  160.         CAT435_POPUP_Y + CAT435_POPUP_HEIGHT - 1,
  161.         (UI_filled_area*)&f,
  162.         MMI_TRUE,
  163.         MMI_FALSE,
  164.         MMI_FALSE,
  165.         MMI_FALSE);
  166.     gui_set_font(current_MMI_theme->window_title_font);
  167.     gui_set_text_color(*current_MMI_theme->title_text_color);
  168. #ifdef CAT435_POPUP_WITH_BORDER_TITLE
  169.     gui_set_text_border_color(*current_MMI_theme->title_text_border_color);
  170. #endif 
  171.     Get_StringWidthHeight((U8*) CAT435_CTX->popup_title, &sw, &sh);
  172.     if (sw > CAT435_POPUP_WIDTH)
  173.     {
  174.         sx = 0;
  175.     }
  176.     else
  177.     {
  178.         sx = (CAT435_POPUP_WIDTH - sw) >> 1;
  179.     }
  180.     if (sh > CAT435_POPUP_TITLE_HEIGHT)
  181.     {
  182.         sy = 0;
  183.     }
  184.     else
  185.     {
  186.         sy = (CAT435_POPUP_TITLE_HEIGHT - sh) >> 1;
  187.     }
  188. #ifdef CAT435_POPUP_WITH_BORDER_TITLE
  189.     if (r2lMMIFlag)
  190.     {
  191.         gui_print_truncated_borderd_text(
  192.             sx + CAT435_POPUP_X + sw - 1,
  193.             sy + CAT435_POPUP_Y,
  194.             CAT435_POPUP_WIDTH - sx,
  195.             CAT435_CTX->popup_title);
  196.     }
  197.     else
  198.     {
  199.         gui_print_truncated_borderd_text(
  200.             sx + CAT435_POPUP_X,
  201.             sy + CAT435_POPUP_Y,
  202.             CAT435_POPUP_WIDTH - sx,
  203.             CAT435_CTX->popup_title);
  204.     }
  205. #else /* CAT435_POPUP_WITH_BORDER_TITLE */ 
  206.     if (r2lMMIFlag)
  207.     {
  208.         gui_print_truncated_text(
  209.             sx + CAT435_POPUP_X + sw - 1,
  210.             sy + CAT435_POPUP_Y,
  211.             CAT435_POPUP_WIDTH - sx,
  212.             CAT435_CTX->popup_title);
  213.     }
  214.     else
  215.     {
  216.         gui_print_truncated_text(
  217.             sx + CAT435_POPUP_X,
  218.             sy + CAT435_POPUP_Y,
  219.             CAT435_POPUP_WIDTH - sx,
  220.             CAT435_CTX->popup_title);
  221.     }
  222. #endif /* CAT435_POPUP_WITH_BORDER_TITLE */ 
  223.     gui_pop_clip();
  224. }
  225. /* Content area between title and softkey */
  226. /*****************************************************************************
  227.  * FUNCTION
  228.  *  category435_draw_content_area
  229.  * DESCRIPTION
  230.  *  
  231.  * PARAMETERS
  232.  *  void
  233.  * RETURNS
  234.  *  void
  235.  *****************************************************************************/
  236. static void category435_draw_content_area(void)
  237. {
  238.     /*----------------------------------------------------------------*/
  239.     /* Local Variables                                                */
  240.     /*----------------------------------------------------------------*/
  241.     /*----------------------------------------------------------------*/
  242.     /* Code Body                                                      */
  243.     /*----------------------------------------------------------------*/
  244.     /* Show background log area */
  245. #ifdef CAT435_SHOW_LOG_BOX_WITH_POPUP
  246.     gui_show_multi_line_input_box(&CAT435_CTX->log_box);
  247. #else /* CAT435_SHOW_LOG_BOX_WITH_POPUP */ 
  248.     if (!CAT435_CTX->show_popup)
  249.     {
  250.         gui_show_multi_line_input_box(&CAT435_CTX->log_box);
  251.     }
  252. #endif /* CAT435_SHOW_LOG_BOX_WITH_POPUP */ 
  253.     /* Show editor in popup area */
  254.     if (CAT435_CTX->show_popup)
  255.     {
  256.         category435_draw_popup_background();
  257.         wgui_show_inputbox();
  258.     }
  259.     if (RedrawSpellingOrCandidateBoxesFunction)
  260.     {
  261.         RedrawSpellingOrCandidateBoxesFunction();
  262.     }
  263. }
  264. #if defined(__MMI_TOUCH_SCREEN__)
  265. /*****************************************************************************
  266.  * FUNCTION
  267.  *  category435_control_area_pen_handler
  268.  * DESCRIPTION
  269.  *  
  270.  * PARAMETERS
  271.  *  point           [IN]        
  272.  *  pen_event       [IN]        
  273.  * RETURNS
  274.  *  
  275.  *****************************************************************************/
  276. static MMI_BOOL category435_control_area_pen_handler(mmi_pen_point_struct point, mmi_pen_event_type_enum pen_event)
  277. {
  278.     /*----------------------------------------------------------------*/
  279.     /* Local Variables                                                */
  280.     /*----------------------------------------------------------------*/
  281.     BOOL ret;
  282.     gui_multi_line_input_box_pen_enum logbox_event;
  283.     /*----------------------------------------------------------------*/
  284.     /* Code Body                                                      */
  285.     /*----------------------------------------------------------------*/
  286.     if (!CAT435_CTX)
  287.     {
  288.         MMI_DBG_ASSERT(0);
  289.         return MMI_FALSE;
  290.     }
  291.     if (!CAT435_CTX->show_popup)
  292.     {
  293.         ret = gui_multi_line_input_box_translate_pen_event(
  294.                 &CAT435_CTX->log_box,
  295.                 pen_event,
  296.                 point.x,
  297.                 point.y,
  298.                 &logbox_event);
  299.     }
  300.     else
  301.     {
  302.         ret = MMI_FALSE;
  303.     }
  304.     return ret;
  305. }
  306. /*****************************************************************************
  307.  * FUNCTION
  308.  *  category435_control_area_pen_down_handler
  309.  * DESCRIPTION
  310.  *  
  311.  * PARAMETERS
  312.  *  point       [IN]        
  313.  * RETURNS
  314.  *  
  315.  *****************************************************************************/
  316. static MMI_BOOL category435_control_area_pen_down_handler(mmi_pen_point_struct point)
  317. {
  318.     /*----------------------------------------------------------------*/
  319.     /* Local Variables                                                */
  320.     /*----------------------------------------------------------------*/
  321.     /*----------------------------------------------------------------*/
  322.     /* Code Body                                                      */
  323.     /*----------------------------------------------------------------*/
  324.     return category435_control_area_pen_handler(point, MMI_PEN_EVENT_DOWN);
  325. }
  326. /*****************************************************************************
  327.  * FUNCTION
  328.  *  category435_control_area_pen_move_handler
  329.  * DESCRIPTION
  330.  *  
  331.  * PARAMETERS
  332.  *  point       [IN]        
  333.  * RETURNS
  334.  *  
  335.  *****************************************************************************/
  336. static MMI_BOOL category435_control_area_pen_move_handler(mmi_pen_point_struct point)
  337. {
  338.     /*----------------------------------------------------------------*/
  339.     /* Local Variables                                                */
  340.     /*----------------------------------------------------------------*/
  341.     /*----------------------------------------------------------------*/
  342.     /* Code Body                                                      */
  343.     /*----------------------------------------------------------------*/
  344.     return category435_control_area_pen_handler(point, MMI_PEN_EVENT_MOVE);
  345. }
  346. /*****************************************************************************
  347.  * FUNCTION
  348.  *  category435_control_area_pen_longtap_handler
  349.  * DESCRIPTION
  350.  *  
  351.  * PARAMETERS
  352.  *  point       [IN]        
  353.  * RETURNS
  354.  *  
  355.  *****************************************************************************/
  356. static MMI_BOOL category435_control_area_pen_longtap_handler(mmi_pen_point_struct point)
  357. {
  358.     /*----------------------------------------------------------------*/
  359.     /* Local Variables                                                */
  360.     /*----------------------------------------------------------------*/
  361.     /*----------------------------------------------------------------*/
  362.     /* Code Body                                                      */
  363.     /*----------------------------------------------------------------*/
  364.     return category435_control_area_pen_handler(point, MMI_PEN_EVENT_LONG_TAP);
  365. }
  366. /*****************************************************************************
  367.  * FUNCTION
  368.  *  category435_control_area_pen_repeat_handler
  369.  * DESCRIPTION
  370.  *  
  371.  * PARAMETERS
  372.  *  point       [IN]        
  373.  * RETURNS
  374.  *  
  375.  *****************************************************************************/
  376. static MMI_BOOL category435_control_area_pen_repeat_handler(mmi_pen_point_struct point)
  377. {
  378.     /*----------------------------------------------------------------*/
  379.     /* Local Variables                                                */
  380.     /*----------------------------------------------------------------*/
  381.     /*----------------------------------------------------------------*/
  382.     /* Code Body                                                      */
  383.     /*----------------------------------------------------------------*/
  384.     return category435_control_area_pen_handler(point, MMI_PEN_EVENT_REPEAT);
  385. }
  386. /*****************************************************************************
  387.  * FUNCTION
  388.  *  category435_control_area_pen_up_handler
  389.  * DESCRIPTION
  390.  *  
  391.  * PARAMETERS
  392.  *  point       [IN]        
  393.  * RETURNS
  394.  *  
  395.  *****************************************************************************/
  396. static MMI_BOOL category435_control_area_pen_up_handler(mmi_pen_point_struct point)
  397. {
  398.     /*----------------------------------------------------------------*/
  399.     /* Local Variables                                                */
  400.     /*----------------------------------------------------------------*/
  401.     /*----------------------------------------------------------------*/
  402.     /* Code Body                                                      */
  403.     /*----------------------------------------------------------------*/
  404.     return category435_control_area_pen_handler(point, MMI_PEN_EVENT_UP);
  405. }
  406. /*****************************************************************************
  407.  * FUNCTION
  408.  *  category435_control_area_pen_abort_handler
  409.  * DESCRIPTION
  410.  *  
  411.  * PARAMETERS
  412.  *  point       [IN]        
  413.  * RETURNS
  414.  *  
  415.  *****************************************************************************/
  416. static MMI_BOOL category435_control_area_pen_abort_handler(mmi_pen_point_struct point)
  417. {
  418.     /*----------------------------------------------------------------*/
  419.     /* Local Variables                                                */
  420.     /*----------------------------------------------------------------*/
  421.     /*----------------------------------------------------------------*/
  422.     /* Code Body                                                      */
  423.     /*----------------------------------------------------------------*/
  424.     return category435_control_area_pen_handler(point, MMI_PEN_EVENT_ABORT);
  425. }
  426. #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  427. /***************************************************************************** 
  428. * Global Variable
  429. *****************************************************************************/
  430. /***************************************************************************** 
  431. * Global Function
  432. *****************************************************************************/
  433. /*****************************************************************************
  434.  * FUNCTION
  435.  *  ExitCategory420Screen
  436.  * DESCRIPTION
  437.  *  Exit the category420 screen
  438.  * PARAMETERS
  439.  *  void
  440.  * RETURNS
  441.  *  void
  442.  *****************************************************************************/
  443. void ExitCategory420Screen(void)
  444. {
  445.     /*----------------------------------------------------------------*/
  446.     /* Local Variables                                                */
  447.     /*----------------------------------------------------------------*/
  448.     /*----------------------------------------------------------------*/
  449.     /* Code Body                                                      */
  450.     /*----------------------------------------------------------------*/
  451.     category420_free_image_cache();
  452.     reset_softkeys();
  453.     reset_multitaps();
  454.     reset_multiline_inputbox();
  455.     ExitCategoryFunction = MMI_dummy_function;
  456.     RedrawCategoryFunction = MMI_dummy_function;
  457.     GetCategoryHistory = dummy_get_history;
  458.     GetCategoryHistorySize = dummy_get_history_size;
  459.     OslMfree(g_mmi_gui_cat420_context_p);
  460.     g_mmi_gui_cat420_context_p = NULL;
  461. }
  462. /*****************************************************************************
  463.  * FUNCTION
  464.  *  ShowCategory420Screen
  465.  * DESCRIPTION
  466.  *  Displays the category420 screen
  467.  *  
  468.  *  The pointer of name, mood_string, status_string are used directly  in category 420.
  469.  *  They should not be released before category 420 exits.
  470.  *  photo_filename can be released immediately after ShowCategory420Screen() returns.
  471.  * PARAMETERS
  472.  *  title                   [IN]        Title for the screen
  473.  *  title_icon              [IN]        Icon shown with the title
  474.  *  left_softkey            [IN]        Left softkey label
  475.  *  left_softkey_icon       [IN]        Icon for the left softkey
  476.  *  right_softkey           [IN]        Right softkey label
  477.  *  right_softkey_icon      [IN]        Icon for the right softkey
  478.  *  name                    [IN]        User Name
  479.  *  photo_filename          [IN]        File name of photo
  480.  *  alternative_photo       [IN]        Default photo if 'photo_filename' is NULL
  481.  *  mood_caption            [IN]        String ID to "Mood" literally
  482.  *  mood_string             [IN]        Text indicating mood
  483.  *  mood_icon               [IN]        Image indicating mood
  484.  *  status_caption          [IN]        String ID to "Status" literally
  485.  *  status_string           [IN]        Text indicating mood
  486.  *  status_icon             [IN]        Image indicating mood
  487.  *  buffer                  [IN]        Buffer the input box should use.
  488.  *  buffer_size             [IN]        Size of the buffer.
  489.  *  history_buffer          [IN]        History buffer
  490.  * RETURNS
  491.  *  void
  492.  *****************************************************************************/
  493. void ShowCategory420Screen(
  494.         U16 title,
  495.         U16 title_icon,
  496.         U16 left_softkey,
  497.         U16 left_softkey_icon,
  498.         U16 right_softkey,
  499.         U16 right_softkey_icon,
  500.         UI_string_type name,
  501.         S8 *photo_filename,
  502.         U16 alternative_photo,
  503.         U16 mood_caption,
  504.         UI_string_type mood_string,
  505.         PU8 mood_icon,
  506.         U16 status_caption,
  507.         UI_string_type status_string,
  508.         PU8 status_icon,
  509.         U8 *buffer,
  510.         S32 buffer_size,
  511.         U8 *history_buffer)
  512. {
  513.     /*----------------------------------------------------------------*/
  514.     /* Local Variables                                                */
  515.     /*----------------------------------------------------------------*/
  516.     /* Category 420 is a read-only multi-line inputbox with decoration */
  517.     S32 l;
  518.     S16 input_type = 0;
  519.     S32 img_width, img_height;
  520.     S32 use_alternative_image = 0;
  521.     color tc;
  522.     dm_data_struct dm_data;
  523.     /*----------------------------------------------------------------*/
  524.     /* Code Body                                                      */
  525.     /*----------------------------------------------------------------*/
  526.     g_mmi_gui_cat420_context_p = OslMalloc(sizeof(gui_cat420_context_struct));
  527.     CAT420_CTX->name = name;
  528.     CAT420_CTX->mood_caption = mood_caption;
  529.     CAT420_CTX->mood_string = mood_string;
  530.     CAT420_CTX->mood_icon = mood_icon;
  531.     CAT420_CTX->status_caption = status_caption;
  532.     CAT420_CTX->status_string = status_string;
  533.     CAT420_CTX->status_icon = status_icon;
  534.     /* Compute image dimension for rendering layout */
  535.     if (!photo_filename || gdi_image_get_dimension_file(photo_filename, &img_width, &img_height) != GDI_IMAGE_SUCCEED)
  536.     {
  537.         if (!alternative_photo ||
  538.             gdi_image_get_dimension((U8*) GetImage(alternative_photo), &img_width, &img_height) != GDI_IMAGE_SUCCEED)
  539.         {
  540.             CAT420_CTX->image_ori_width = 0;
  541.             CAT420_CTX->image_ori_height = 0;
  542.             CAT420_CTX->display_image = MMI_FALSE;
  543.         }
  544.         else
  545.         {
  546.             CAT420_CTX->image_ori_width = (S16) img_width;
  547.             CAT420_CTX->image_ori_height = (S16) img_height;
  548.             CAT420_CTX->display_image = MMI_TRUE;
  549.             use_alternative_image = 1;
  550.         }
  551.     }
  552.     else
  553.     {
  554.         CAT420_CTX->image_ori_width = (S16) img_width;
  555.         CAT420_CTX->image_ori_height = (S16) img_height;
  556.         CAT420_CTX->display_image = MMI_TRUE;
  557.         use_alternative_image = 0;
  558.     }
  559.     category420_compute_layout();
  560.     category420_cache_image(photo_filename, (U8*) GetImage(alternative_photo), use_alternative_image);
  561.     gui_lock_double_buffer();
  562.     MMI_menu_shortcut_number = -1;
  563.     MMI_disable_title_shortcut_display = 1;
  564.     clear_category_screen_key_handlers();
  565.     change_left_softkey(left_softkey, left_softkey_icon);
  566.     change_right_softkey(right_softkey, right_softkey_icon);
  567.     clear_left_softkey();
  568.     clear_right_softkey();
  569.     register_left_softkey_handler();
  570.     register_right_softkey_handler();
  571.     register_default_hide_softkeys();
  572.     l = gui_strlen((UI_string_type) buffer);
  573.     create_multiline_inputbox_set_buffer((UI_string_type) buffer, buffer_size, l, 0);
  574.     register_multiline_inputbox_viewer_keys();
  575.     move_multiline_inputbox(MMI_content_x, MMI_content_y);
  576.     resize_multiline_inputbox(MMI_multiline_inputbox.width, MMI_content_height);
  577.     MMI_multiline_inputbox.flags |= (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW |
  578.                                      UI_MULTI_LINE_INPUT_BOX_VIEW_MODE |
  579.                                      UI_MULTI_LINE_INPUT_BOX_AUTO_DISABLE_SCROLLBAR);
  580.     MMI_multiline_inputbox.header_callback = category420_header_callback;
  581.     MMI_multiline_inputbox.header_height = CAT420_CTX->editor_header_height;
  582.     MMI_multiline_inputbox.footer_height = CAT420_EDITOR_BOTTOM_PADDING;
  583.     /* Better visual effect */
  584.     MMI_multiline_inputbox.min_text_height = MMI_content_height - CAT420_EDITOR_BOTTOM_PADDING;
  585.     MMI_multiline_inputbox.text_filler = &g_mmi_gui_cat420_text_filler;
  586.     tc.r = CAT420_TEXT_COLOR_R;
  587.     tc.g = CAT420_TEXT_COLOR_G;
  588.     tc.b = CAT420_TEXT_COLOR_B;
  589.     tc.alpha = 100;
  590.     MMI_multiline_inputbox.normal_text_color = tc;
  591.     MMI_multiline_inputbox.text_x = CAT420_EDITOR_LEFT_BORDER_PADDING;
  592.     MMI_multiline_inputbox.text_x2_gap_width = CAT420_EDITOR_RIGHT_BORDER_PADDING;
  593.     /* resize_multiline_inputbox() recomputes MMI_multiline_inputbox.edit_width by 'text_x' and 'text_x2_gap' */
  594.     resize_multiline_inputbox(MMI_multiline_inputbox.width, MMI_multiline_inputbox.height);
  595.     show_multiline_inputbox_no_draw();
  596.     set_multiline_inputbox_category_history(MMI_CATEGORY420_ID, history_buffer, &input_type);
  597.     MMI_title_string = (UI_string_type) get_string(title);
  598.     MMI_title_icon = (PU8) get_image(title_icon);
  599.     gui_unlock_double_buffer();
  600.     ExitCategoryFunction = ExitCategory420Screen;
  601.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  602.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  603.     dm_data.s32CatId = MMI_CATEGORY420_ID;
  604.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  605.     dm_setup_data(&dm_data);
  606.     dm_redraw_category_screen();
  607. }
  608. /*****************************************************************************
  609.  * FUNCTION
  610.  *  RedrawCategory425Screen
  611.  * DESCRIPTION
  612.  *  Redraw the category425 screen
  613.  * PARAMETERS
  614.  *  void
  615.  * RETURNS
  616.  *  void
  617.  *****************************************************************************/
  618. void RedrawCategory425Screen(void)
  619. {
  620.     /*----------------------------------------------------------------*/
  621.     /* Local Variables                                                */
  622.     /*----------------------------------------------------------------*/
  623.     /*----------------------------------------------------------------*/
  624.     /* Code Body                                                      */
  625.     /*----------------------------------------------------------------*/
  626.     gui_lock_double_buffer();
  627.     show_title_status_icon();
  628.     show_asyncdynamic_list();
  629.     if (CAT425_CTX->num_tab)
  630.     {
  631.         wgui_show_horizontal_tab_bar();
  632.     }
  633.     show_softkey_background();
  634.     show_left_softkey();
  635.     show_right_softkey();
  636.     gui_unlock_double_buffer();
  637.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  638. }
  639. /*****************************************************************************
  640.  * FUNCTION
  641.  *  ExitCategory425Screen
  642.  * DESCRIPTION
  643.  *  Exit the category425 screen
  644.  * PARAMETERS
  645.  *  void
  646.  * RETURNS
  647.  *  void
  648.  *****************************************************************************/
  649. void ExitCategory425Screen(void)
  650. {
  651.     /*----------------------------------------------------------------*/
  652.     /* Local Variables                                                */
  653.     /*----------------------------------------------------------------*/
  654.     /*----------------------------------------------------------------*/
  655.     /* Code Body                                                      */
  656.     /*----------------------------------------------------------------*/
  657.     ClearHighlightHandler();
  658.     reset_softkeys();
  659.     reset_menu_shortcut_handler();
  660.     if (CAT425_CTX->num_tab)
  661.     {
  662.         wgui_close_horizontal_tab_bar();
  663.     }
  664.     reset_asyncdynamic_list();
  665.     reset_pop_up_descriptions();
  666.     category425_reset_context();
  667.     ExitCategoryFunction = MMI_dummy_function;
  668.     RedrawCategoryFunction = MMI_dummy_function;
  669.     GetCategoryHistory = dummy_get_history;
  670.     GetCategoryHistorySize = dummy_get_history_size;
  671. }
  672. /*****************************************************************************
  673.  * FUNCTION
  674.  *  GetCategory425HistorySize
  675.  * DESCRIPTION
  676.  *  Gets the size of the history buffer for category425 screen
  677.  * PARAMETERS
  678.  *  void
  679.  * RETURNS
  680.  *  void
  681.  *  Returns
  682.  *****************************************************************************/
  683. S32 GetCategory425HistorySize(void)
  684. {
  685.     /*----------------------------------------------------------------*/
  686.     /* Local Variables                                                */
  687.     /*----------------------------------------------------------------*/
  688.     /*----------------------------------------------------------------*/
  689.     /* Code Body                                                      */
  690.     /*----------------------------------------------------------------*/
  691.     return (sizeof(list_menu_category_history));
  692. }
  693. /*****************************************************************************
  694.  * FUNCTION
  695.  *  GetCategory425History
  696.  * DESCRIPTION
  697.  *  Get history for category425 screen
  698.  * PARAMETERS
  699.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  700.  * RETURNS
  701.  *  Pointer to the history buffer
  702.  *****************************************************************************/
  703. U8 *GetCategory425History(U8 *history_buffer)
  704. {
  705.     /*----------------------------------------------------------------*/
  706.     /* Local Variables                                                */
  707.     /*----------------------------------------------------------------*/
  708.     /*----------------------------------------------------------------*/
  709.     /* Code Body                                                      */
  710.     /*----------------------------------------------------------------*/
  711.     get_list_menu_category_history(MMI_CATEGORY425_ID, history_buffer);
  712.     return history_buffer;
  713. }
  714. /*****************************************************************************
  715.  * FUNCTION
  716.  *  ShowCategory425Screen
  717.  * DESCRIPTION
  718.  *  Displays the category425 screen
  719.  *  
  720.  *  1. Each menu item has two text strings: name and category.
  721.  *  2. Each menu item has three image icons: buddy icon, message icon, and block icon.
  722.  *  An empty icon can be set as NULL in 'get_item_func'
  723.  *  3. Hint display id not visual appealing in this category screen, and should be avoided.
  724.  * PARAMETERS
  725.  *  title                   [IN]        Title for the screen
  726.  *  left_softkey            [IN]        Left softkey label
  727.  *  left_softkey_icon       [IN]        Icon for the left softkey
  728.  *  right_softkey           [IN]        Right softkey label
  729.  *  right_softkey_icon      [IN]        Icon for the right softkey
  730.  *  n_tabs                  [IN]        Number of tabs
  731.  *  highlighted_tab         [IN]        Highlighted tab
  732.  *  tab_items               [IN]        Tab list
  733.  *  number_of_items         [IN]        Number of menu items
  734.  *  get_item_func           [IN]        Callback function to get menu text.
  735.  *  get_hint_func           [IN]        (Deprecated) Callback function to get menu hint.
  736.  *  sample_icon             [IN]        Sample icon to get image dimension of buddy icon
  737.  *  sample_icon2            [IN]        Sample icon to get image dimension of message icon
  738.  *  highlighted_item        [IN]        Default highlighted menu item
  739.  *  history_buffer          [IN]        History buffer
  740.  *  list_is_ready_p         [OUT]       Whether the dynamic list menu is successfully loaded.
  741.  *  in(?)                   [IN]        The bottom-leftmost corner
  742.  * RETURNS
  743.  *  void
  744.  *****************************************************************************/
  745. void ShowCategory425Screen(
  746.         UI_string_type title,
  747.         U16 left_softkey,
  748.         U16 left_softkey_icon,
  749.         U16 right_softkey,
  750.         U16 right_softkey_icon,
  751.         S8 n_tabs,
  752.         S8 highlighted_tab,
  753.         tab_bar_item_type *tab_items,
  754.         S32 number_of_items,
  755.         GetAsyncItemFuncPtr get_item_func,
  756.         GetAsyncHintFuncPtr get_hint_func,
  757.         PU8 sample_icon,
  758.         PU8 sample_icon2,
  759.         S32 highlighted_item,
  760.         U8 *history_buffer,
  761.         BOOL *list_is_ready_p)
  762. {
  763.     /*----------------------------------------------------------------*/
  764.     /* Local Variables                                                */
  765.     /*----------------------------------------------------------------*/
  766.     dm_data_struct dm_data;
  767.     U8 h_flag;
  768.     S32 icon_height, icon_width, icon2_height, icon2_width, text_width;
  769.     S32 tmp_string_width;
  770.     int i;
  771.     S32 shortcut_width;
  772.     /*----------------------------------------------------------------*/
  773.     /* Code Body                                                      */
  774.     /*----------------------------------------------------------------*/
  775.     gui_asyncdynamic_list_error = 0;
  776.     *list_is_ready_p = MMI_FALSE;
  777.     g_mmi_gui_cat425_context_p = OslMalloc(sizeof(gui_cat425_context_struct));
  778.     CAT425_CTX->get_item_func = get_item_func;
  779.     CAT425_CTX->get_hint_func = get_hint_func;
  780.     MMI_title_string = NULL;
  781.     MMI_title_icon = NULL;
  782.     gui_lock_double_buffer();
  783.     clear_category_screen_key_handlers();
  784.     change_left_softkey(left_softkey, left_softkey_icon);
  785.     change_right_softkey(right_softkey, right_softkey_icon);
  786.     clear_left_softkey();
  787.     clear_right_softkey();
  788.     register_left_softkey_handler();
  789.     register_right_softkey_handler();
  790.     register_default_hide_softkeys();
  791.     /* Setup tab bar */
  792.     CAT425_CTX->num_tab = n_tabs;
  793.     if (n_tabs)
  794.     {
  795.         for (i = 0; i < n_tabs; i++)
  796.         {
  797.             MMI_tab_bar_items[i] = tab_items[i];
  798.         }
  799.         wgui_create_horizontal_tab_bar(TRUE, title, n_tabs, highlighted_tab, MMI_FALSE);
  800.         CAT425_CTX->content_x = MMI_CONTENT_X_WITH_H_TAB;
  801.         CAT425_CTX->content_y = MMI_CONTENT_Y_WITH_H_TAB;
  802.         CAT425_CTX->content_width = MMI_CONTENT_WIDTH_WITH_H_TAB;
  803.         CAT425_CTX->content_height = MMI_CONTENT_HEIGHT_WITH_H_TAB;
  804.     }
  805.     else
  806.     {
  807.         MMI_title_string = title;
  808.         CAT425_CTX->content_x = MMI_content_x;
  809.         CAT425_CTX->content_y = MMI_content_y;
  810.         CAT425_CTX->content_width = MMI_content_width;
  811.         CAT425_CTX->content_height = MMI_content_height;
  812.     }
  813.     /* Setup layout of menu */
  814.     create_fixed_icontext_list_menuitems(2, 3);
  815.     gui_measure_image(sample_icon, &icon_width, &icon_height);
  816.     gui_measure_image(sample_icon2, &icon2_width, &icon2_height);
  817.     if (icon_width == 0 || icon_height == 0)
  818.     {
  819.         icon_width = CAT425_DEFAULT_ICON_WIDTH;
  820.         icon_height = CAT425_DEFAULT_ICON_HEIGHT;
  821.     }
  822.     if (icon_width == 0 || icon_height == 0)
  823.     {
  824.         icon2_width = CAT425_DEFAULT_ICON2_WIDTH;
  825.         icon2_height = CAT425_DEFAULT_ICON2_HEIGHT;
  826.     }
  827.     tmp_string_width = gui_get_string_width((UI_string_type) L"[");
  828.     text_width = UI_device_width - MMI_fixed_list_menu.vbar.width - CAT425_ICON_X -
  829.         icon_width - CAT425_ICON_TEXT_GAP - CAT425_TEXT_SCROLLBAR_GAP;
  830.     set_fixed_icontext_list_icon_coordinates(0, CAT425_ICON_X, CAT425_ICON_Y, icon_width, icon_height);
  831.     if (r2lMMIFlag)
  832.     {
  833.         set_fixed_icontext_list_icon_coordinates(
  834.             1,
  835.             CAT425_ICON_X + icon_width - icon2_width,
  836.             CAT425_ICON_Y + icon_height - icon2_height,
  837.             icon2_width,
  838.             icon2_height);
  839.     }
  840.     else
  841.     {
  842.         set_fixed_icontext_list_icon_coordinates(
  843.             1,
  844.             CAT425_ICON_X,
  845.             CAT425_ICON_Y + icon_height - icon2_height,
  846.             icon2_width,
  847.             icon2_height);
  848.     }
  849.     set_fixed_icontext_list_icon_coordinates(2, CAT425_ICON_X, CAT425_ICON_Y, icon_width, icon_height);
  850.     set_fixed_icontext_list_text_coordinates(
  851.         0,
  852.         CAT425_ICON_X + icon_width + CAT425_ICON_TEXT_GAP,
  853.         CAT425_TEXT1_Y,
  854.         text_width,
  855.         CAT425_TEXT_HEIGHT);
  856.     set_fixed_icontext_list_text_coordinates(
  857.         1,
  858.         CAT425_ICON_X + icon_width + CAT425_ICON_TEXT_GAP + tmp_string_width + CAT425_TEXT2_BRACKET_GAP,
  859.         CAT425_TEXT2_Y,
  860.         text_width - (tmp_string_width + CAT425_TEXT2_BRACKET_GAP) * 2,
  861.         CAT425_TEXT_HEIGHT);
  862.     CAT425_CTX->icon_border_x1 = CAT425_ICON_X;
  863.     CAT425_CTX->icon_border_y1 = CAT425_ICON_Y;
  864.     CAT425_CTX->icon_border_x2 = CAT425_ICON_X + icon_width - 1;
  865.     CAT425_CTX->icon_border_y2 = CAT425_ICON_Y + icon_height - 1;
  866.     CAT425_CTX->bracket_x = CAT425_ICON_X + icon_width + CAT425_ICON_TEXT_GAP;
  867.     CAT425_CTX->bracket_y = CAT425_TEXT2_Y;
  868.     /* Setup data of menu */
  869.     associate_fixed_icontext_list_list();
  870.     set_fixed_icontext_list_menuitems_post_display(category425_post_display_menuitem);
  871.     MMI_fixed_icontext_list_menuitem.flags |= UI_MENUITEM_AUTO_CHOOSE_MARQUEE;
  872.     resize_fixed_icontext_list_menuitems(0, n_tabs ? CAT425_MENUITEM_HEIGHT : CAT425_MENUITEM_HEIGHT_NO_TAB);   /* Tricky! do this after associate_fixed_icontext_list_list() */
  873.     CAT425_CTX->backup_menu_flags = MMI_fixed_list_menu.flags;
  874.     CAT425_CTX->backup_menu_filler = MMI_fixed_list_menu.normal_filler;
  875.     /* Override style */
  876.     // Disable background image 
  877.     // MMI_fixed_list_menu.normal_filler = &g_mmi_gui_cat425_list_filler;
  878.     category425_setup_text_color();
  879.     MMI_fixed_icontext_list_menuitem.flags &=
  880.         ~(UI_MENUITEM_CENTER_TEXT_X | UI_MENUITEM_CENTER_TEXT_Y | UI_MENUITEM_CENTER_ICON_X |
  881.           UI_MENUITEM_CENTER_ICON_Y);
  882.     MMI_current_menu_type = LIST_MENU;
  883.     MMI_fixed_list_menu.n_items = number_of_items;
  884.     if (!init_asyncdynamic_item_buffer(number_of_items, get_item_func, get_hint_func))
  885.     {
  886.         MMI_DBG_ASSERT(0);  /* not recoverable */
  887.         category425_reset_context();
  888.         gui_unlock_double_buffer();
  889.         return;
  890.     }
  891.     register_asyncdynamic_list_keys();
  892.     resize_fixed_list(CAT425_CTX->content_width, CAT425_CTX->content_height);
  893.     move_fixed_list(CAT425_CTX->content_x, CAT425_CTX->content_y);
  894.     register_fixed_list_highlight_handler(asyncdynamic_list_highlight_handler);
  895.     h_flag = set_list_menu_category_history(MMI_CATEGORY425_ID, history_buffer);
  896.     if (h_flag)
  897.     {
  898.         highlighted_item = MMI_fixed_list_menu.highlighted_item;
  899.     }
  900.     asyncdynamic_list_goto_item_no_redraw(highlighted_item);
  901.     if (gui_asyncdynamic_list_error)
  902.     {
  903.         MMI_DBG_ASSERT(0);  /* not recoverable */
  904.         category425_reset_context();
  905.         gui_unlock_double_buffer();
  906.         return;
  907.     }
  908.     set_asyncdynamic_pop_up_descriptions(highlighted_item);
  909.     /* Setup (hidden) menu shortcut. */
  910.     MMI_menu_shortcut_number = highlighted_item + 1;
  911.     register_asyncdynamic_list_shortcut_handler();
  912.     shortcut_width = set_menu_item_count(number_of_items) + 7;
  913.     if (n_tabs)
  914.     {
  915.         resize_menu_shortcut_handler(shortcut_width, MMI_HORIZONTAL_TAB_BAR_HINT_AREA_HEIGHT);
  916.         move_menu_shortcut_handler(
  917.             MMI_HORIZONTAL_TAB_BAR_X + MMI_HORIZONTAL_TAB_BAR_WIDTH - MMI_menu_shortcut_box.width,
  918.             MMI_HORIZONTAL_TAB_BAR_Y + MMI_HORIZONTAL_TAB_BAR_TAB_AREA_HEIGHT);
  919.         register_hide_menu_shortcut(wgui_show_horizontal_tab_bar_hint_area);
  920.     }
  921.     else
  922.     {
  923.         resize_menu_shortcut_handler(shortcut_width, MMI_title_height);
  924.         move_menu_shortcut_handler(MMI_title_x + MMI_title_width - MMI_menu_shortcut_box.width, MMI_title_y);
  925.         register_hide_menu_shortcut(gui_redraw_menu_shortcut);
  926.     }
  927.     gui_unlock_double_buffer();
  928.     ExitCategoryFunction = ExitCategory425Screen;
  929.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  930.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  931.     if (n_tabs)
  932.     {
  933.         dm_data.s32CatId = MMI_CATEGORY425_ID;
  934.     }
  935.     else
  936.     {
  937.         dm_data.s32CatId = MMI_CATEGORY425_NO_TAB_ID;
  938.     }
  939.     dm_data.s32flags = 0;
  940.     dm_setup_data(&dm_data);
  941.     dm_redraw_category_screen();
  942.     *list_is_ready_p = MMI_TRUE;
  943. }
  944. /*****************************************************************************
  945.  * FUNCTION
  946.  *  RefreshCategory425Screen
  947.  * DESCRIPTION
  948.  *  Refresh the category425 screen
  949.  *  (it will reload menu item data with 'get_item_func' passed in ShowCategory425Screen)
  950.  *  
  951.  *  Category 425 screen should be currently displayed.
  952.  * PARAMETERS
  953.  *  number_of_items         [IN]        The number of menu items.
  954.  *  highlighted_item        [IN]        The highlighted item
  955.  * RETURNS
  956.  *  void
  957.  *****************************************************************************/
  958. void RefreshCategory425Screen(S32 number_of_items, S32 highlighted_item)
  959. {
  960.     /*----------------------------------------------------------------*/
  961.     /* Local Variables                                                */
  962.     /*----------------------------------------------------------------*/
  963.     /*----------------------------------------------------------------*/
  964.     /* Code Body                                                      */
  965.     /*----------------------------------------------------------------*/
  966.     if (!g_mmi_gui_cat425_context_p)
  967.     {
  968.         MMI_DBG_ASSERT(0);
  969.         return;
  970.     }
  971.     gui_asyncdynamic_list_error = 0;
  972.     gui_lock_double_buffer();
  973.     MMI_fixed_list_menu.n_items = number_of_items;
  974.     init_asyncdynamic_item_buffer(number_of_items, CAT425_CTX->get_item_func, CAT425_CTX->get_hint_func);
  975.     asyncdynamic_list_goto_item_no_redraw(highlighted_item);
  976.     if (gui_asyncdynamic_list_error)
  977.     {
  978.         MMI_DBG_ASSERT(0);  /* not recoverable */
  979.         category425_reset_context();
  980.         gui_unlock_double_buffer();
  981.         return;
  982.     }
  983.     set_asyncdynamic_pop_up_descriptions(highlighted_item);
  984.     gui_unlock_double_buffer();
  985.     RedrawCategoryFunction();
  986. }
  987. /*****************************************************************************
  988.  * FUNCTION
  989.  *  UpdateCategory425TabBar
  990.  * DESCRIPTION
  991.  *  
  992.  * PARAMETERS
  993.  *  title               [IN]        
  994.  *  n_tabs              [IN]        
  995.  *  highlighted_tab     [IN]        
  996.  *  tab_items           [?]         
  997.  * RETURNS
  998.  *  void
  999.  *****************************************************************************/
  1000. void UpdateCategory425TabBar(UI_string_type title, S8 n_tabs, S8 highlighted_tab, tab_bar_item_type *tab_items)
  1001. {
  1002.     /*----------------------------------------------------------------*/
  1003.     /* Local Variables                                                */
  1004.     /*----------------------------------------------------------------*/
  1005.     S32 i;
  1006.     /*----------------------------------------------------------------*/
  1007.     /* Code Body                                                      */
  1008.     /*----------------------------------------------------------------*/
  1009.     if (!CAT425_CTX || !CAT425_CTX->num_tab)
  1010.     {
  1011.         MMI_DBG_ASSERT(0);
  1012.         return;
  1013.     }
  1014.     if (title == NULL)
  1015.     {
  1016.         title = MMI_horizontal_tab_bar.hint;
  1017.     }
  1018.     gui_lock_double_buffer();
  1019.     wgui_close_horizontal_tab_bar();
  1020.     /* Setup horizontal tab bar */
  1021.     for (i = 0; i < n_tabs; i++)
  1022.     {
  1023.         MMI_tab_bar_items[i] = tab_items[i];
  1024.     }
  1025.     wgui_create_horizontal_tab_bar(TRUE, title, n_tabs, highlighted_tab, MMI_TRUE);
  1026.     gui_unlock_double_buffer();
  1027.     wgui_show_horizontal_tab_bar();
  1028. }
  1029. /*****************************************************************************
  1030.  * FUNCTION
  1031.  *  SetCategory425TabSelectCallback
  1032.  * DESCRIPTION
  1033.  *  
  1034.  * PARAMETERS
  1035.  *  select_callback     [IN]        
  1036.  * RETURNS
  1037.  *  void
  1038.  *****************************************************************************/
  1039. void SetCategory425TabSelectCallback(void (*select_callback) (int index))
  1040. {
  1041.     /*----------------------------------------------------------------*/
  1042.     /* Local Variables                                                */
  1043.     /*----------------------------------------------------------------*/
  1044.     /*----------------------------------------------------------------*/
  1045.     /* Code Body                                                      */
  1046.     /*----------------------------------------------------------------*/
  1047.     MMI_DBG_ASSERT(CAT425_CTX && CAT425_CTX->num_tab);
  1048.     wgui_set_horizontal_tab_bar_select_callback(select_callback);
  1049. }
  1050. /*****************************************************************************
  1051.  * FUNCTION
  1052.  *  Category425BlinkTab
  1053.  * DESCRIPTION
  1054.  *  
  1055.  * PARAMETERS
  1056.  *  tab     [IN]        
  1057.  * RETURNS
  1058.  *  void
  1059.  *****************************************************************************/
  1060. void Category425BlinkTab(S8 tab)
  1061. {
  1062.     /*----------------------------------------------------------------*/
  1063.     /* Local Variables                                                */
  1064.     /*----------------------------------------------------------------*/
  1065.     /*----------------------------------------------------------------*/
  1066.     /* Code Body                                                      */
  1067.     /*----------------------------------------------------------------*/
  1068.     MMI_DBG_ASSERT(CAT425_CTX && CAT425_CTX->num_tab);
  1069.     wgui_horizontal_tab_bar_start_blinking(tab);
  1070. }
  1071. /*****************************************************************************
  1072.  * FUNCTION
  1073.  *  Category425UnBlinkTab
  1074.  * DESCRIPTION
  1075.  *  
  1076.  * PARAMETERS
  1077.  *  tab     [IN]        
  1078.  * RETURNS
  1079.  *  void
  1080.  *****************************************************************************/
  1081. void Category425UnBlinkTab(S8 tab)
  1082. {
  1083.     /*----------------------------------------------------------------*/
  1084.     /* Local Variables                                                */
  1085.     /*----------------------------------------------------------------*/
  1086.     /*----------------------------------------------------------------*/
  1087.     /* Code Body                                                      */
  1088.     /*----------------------------------------------------------------*/
  1089.     MMI_DBG_ASSERT(CAT425_CTX && CAT425_CTX->num_tab);
  1090.     wgui_horizontal_tab_bar_stop_blinking(tab);
  1091. }
  1092. #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) || defined(__MMI_SMART_MESSAGE_MT__) || defined(__MMI_MYPICTURE__)
  1093. /*****************************************************************************
  1094.  * FUNCTION
  1095.  *  ShowCategoryNSM2Screen
  1096.  * DESCRIPTION
  1097.  *  Displays the category420 screen
  1098.  *  
  1099.  *  The pointer of name, mood_string, status_string are used directly  in category 420.
  1100.  *  They should not be released before category 420 exits.
  1101.  *  photo_filename can be released immediately after ShowCategory420Screen() returns.
  1102.  * PARAMETERS
  1103.  *  title                   [IN]        Title for the screen
  1104.  *  title_icon              [IN]        Icon shown with the title
  1105.  *  left_softkey            [IN]        Left softkey label
  1106.  *  left_softkey_icon       [IN]        Icon for the left softkey
  1107.  *  right_softkey           [IN]        Right softkey label
  1108.  *  right_softkey_icon      [IN]        Icon for the right softkey
  1109.  *  name                    [IN]        User Name
  1110.  *  photo_filename          [IN]        File name of photo
  1111.  *  alternative_photo       [IN]        Default photo if 'photo_filename' is NULL
  1112.  *  mood_caption            [IN]        String ID to "Mood" literally
  1113.  *  mood_string             [IN]        Text indicating mood
  1114.  *  mood_icon               [IN]        Image indicating mood
  1115.  *  status_caption          [IN]        String ID to "Status" literally
  1116.  *  status_string           [IN]        Text indicating mood
  1117.  *  status_icon             [IN]        Image indicating mood
  1118.  *  buffer                  [IN]        Buffer the input box should use.
  1119.  *  buffer_size             [IN]        Size of the buffer.
  1120.  *  history_buffer          [IN]        History buffer
  1121.  * RETURNS
  1122.  *  void
  1123.  *****************************************************************************/
  1124. void ShowCategoryNSM2Screen(
  1125.         U16 title,
  1126.         U16 title_icon,
  1127.         U16 left_softkey,
  1128.         U16 left_softkey_icon,
  1129.         U16 right_softkey,
  1130.         U16 right_softkey_icon,
  1131.         UI_string_type name,
  1132.         S8 *photo_filename,
  1133.         U16 alternative_photo,
  1134.         U16 mood_caption,
  1135.         UI_string_type mood_string,
  1136.         PU8 mood_icon,
  1137.         U16 status_caption,
  1138.         UI_string_type status_string,
  1139.         PU8 status_icon,
  1140.         U8 *buffer,
  1141.         S32 buffer_size,
  1142.         U8 *history_buffer)
  1143. {
  1144.     /*----------------------------------------------------------------*/
  1145.     /* Local Variables                                                */
  1146.     /*----------------------------------------------------------------*/
  1147.     dm_data_struct dm_data;
  1148.     S32 l;
  1149.     S16 input_type = 0;
  1150.     /*----------------------------------------------------------------*/
  1151.     /* Code Body                                                      */
  1152.     /*----------------------------------------------------------------*/
  1153.     g_mmi_gui_cat420_context_p = OslMalloc(sizeof(gui_cat420_context_struct));
  1154.     CAT420_CTX->name = name;
  1155.     CAT420_CTX->mood_caption = mood_caption;
  1156.     CAT420_CTX->mood_string = mood_string;
  1157.     CAT420_CTX->mood_icon = mood_icon;
  1158.     CAT420_CTX->status_caption = status_caption;
  1159.     CAT420_CTX->status_string = status_string;
  1160.     CAT420_CTX->status_icon = status_icon;
  1161.     CAT420_CTX->image_ori_width = 120;
  1162.     CAT420_CTX->image_ori_height = 30;
  1163.     CAT420_CTX->display_image = MMI_TRUE;
  1164.     category420_compute_layout();
  1165.     gui_lock_double_buffer();
  1166.     MMI_menu_shortcut_number = -1;
  1167.     MMI_disable_title_shortcut_display = 1;
  1168.     clear_category_screen_key_handlers();
  1169.     change_left_softkey(left_softkey, left_softkey_icon);
  1170.     change_right_softkey(right_softkey, right_softkey_icon);
  1171.     clear_left_softkey();
  1172.     clear_right_softkey();
  1173.     register_left_softkey_handler();
  1174.     register_right_softkey_handler();
  1175.     register_default_hide_softkeys();
  1176.     l = gui_strlen((UI_string_type) buffer);
  1177.     create_multiline_inputbox_set_buffer((UI_string_type) buffer, buffer_size, l, 0);
  1178.     register_multiline_inputbox_viewer_keys();
  1179.     MMI_multiline_inputbox.flags |= (UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE);
  1180.     MMI_multiline_inputbox.header_callback = mmi_nsm2_category275_draw_inbox_header;    /* To draw image */
  1181.     /* JP to fix NSM Picture image and chinese character overlapping */
  1182.     MMI_multiline_inputbox.header_height = MAX_NSM_PIC_HEIGHT;  /* CAT420_CTX->editor_header_height; */
  1183.     MMI_multiline_inputbox.min_text_height = 14;
  1184.     show_multiline_inputbox_no_draw();
  1185.     set_multiline_inputbox_category_history(MMI_CATEGORY420_ID, history_buffer, &input_type);
  1186.     MMI_title_string = (UI_string_type) get_string(title);
  1187.     MMI_title_icon = (PU8) get_image(title_icon);
  1188.     gui_unlock_double_buffer();
  1189.     ExitCategoryFunction = ExitCategoryNSM2Screen;
  1190.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  1191.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1192.     dm_data.s32CatId = MMI_CATEGORY420_ID;
  1193.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  1194.     dm_setup_data(&dm_data);
  1195.     dm_redraw_category_screen();
  1196. }
  1197. /*****************************************************************************
  1198.  * FUNCTION
  1199.  *  ExitCategoryNSM2Screen
  1200.  * DESCRIPTION
  1201.  *  Exit the categoryNS screen
  1202.  * PARAMETERS
  1203.  *  void
  1204.  * RETURNS
  1205.  *  void
  1206.  *****************************************************************************/
  1207. void ExitCategoryNSM2Screen(void)
  1208. {
  1209.     /*----------------------------------------------------------------*/
  1210.     /* Local Variables                                                */
  1211.     /*----------------------------------------------------------------*/
  1212.     /*----------------------------------------------------------------*/
  1213.     /* Code Body                                                      */
  1214.     /*----------------------------------------------------------------*/
  1215.     // category420_free_image_cache();  /*JP*/
  1216.     reset_softkeys();
  1217.     reset_multitaps();
  1218.     reset_multiline_inputbox();
  1219.     ExitCategoryFunction = MMI_dummy_function;
  1220.     RedrawCategoryFunction = MMI_dummy_function;
  1221.     GetCategoryHistory = dummy_get_history;
  1222.     GetCategoryHistorySize = dummy_get_history_size;
  1223.     OslMfree(g_mmi_gui_cat420_context_p);
  1224.     g_mmi_gui_cat420_context_p = NULL;
  1225. }
  1226. #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) || defined(__MMI_SMART_MESSAGE_MT__) || defined(__MMI_MYPICTURE__) */ 
  1227. /* 
  1228.  * Category 430
  1229.  */
  1230. /*****************************************************************************
  1231.  * FUNCTION
  1232.  *  ExitCategory430Screen
  1233.  * DESCRIPTION
  1234.  *  Exits the category430 screen
  1235.  * PARAMETERS
  1236.  *  void
  1237.  * RETURNS
  1238.  *  void
  1239.  *****************************************************************************/
  1240. void ExitCategory430Screen(void)
  1241. {
  1242.     /*----------------------------------------------------------------*/
  1243.     /* Local Variables                                                */
  1244.     /*----------------------------------------------------------------*/
  1245.     /*----------------------------------------------------------------*/
  1246.     /* Code Body                                                      */
  1247.     /*----------------------------------------------------------------*/
  1248.     reset_softkeys();
  1249.     wgui_close_inputbox();
  1250.     ExitCategoryFunction = MMI_dummy_function;
  1251.     RedrawCategoryFunction = MMI_dummy_function;
  1252.     GetCategoryHistory = dummy_get_history;
  1253.     GetCategoryHistorySize = dummy_get_history_size;
  1254.     if (CAT430_CTX->allocated_color_buffer)
  1255.     {
  1256.         OslMfree(CAT430_CTX->allocated_color_buffer);
  1257.     }
  1258.     OslMfree(g_mmi_gui_cat430_context_p);
  1259.     g_mmi_gui_cat430_context_p = NULL;
  1260. }
  1261. /*****************************************************************************
  1262.  * FUNCTION
  1263.  *  GetCategory430HistorySize
  1264.  * DESCRIPTION
  1265.  *  Gets the size of the history buffer for category430 screen
  1266.  * PARAMETERS
  1267.  *  void
  1268.  * RETURNS
  1269.  *  size in U8 of the history buffer
  1270.  *****************************************************************************/
  1271. S32 GetCategory430HistorySize(void)
  1272. {
  1273.     /*----------------------------------------------------------------*/
  1274.     /* Local Variables                                                */
  1275.     /*----------------------------------------------------------------*/
  1276.     /*----------------------------------------------------------------*/
  1277.     /* Code Body                                                      */
  1278.     /*----------------------------------------------------------------*/
  1279.     /* Use the four bytes to check if popup exists */
  1280.     return sizeof(gui_cat430_history_header_struct);
  1281. }
  1282. /*****************************************************************************
  1283.  * FUNCTION
  1284.  *  GetCategory430History
  1285.  * DESCRIPTION
  1286.  *  Gets the history buffer for category430 screen
  1287.  * PARAMETERS
  1288.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  1289.  * RETURNS
  1290.  *  Pointer to the history buffer
  1291.  *****************************************************************************/
  1292. U8 *GetCategory430History(U8 *history_buffer)
  1293. {
  1294.     /*----------------------------------------------------------------*/
  1295.     /* Local Variables                                                */
  1296.     /*----------------------------------------------------------------*/
  1297.     /*----------------------------------------------------------------*/
  1298.     /* Code Body                                                      */
  1299.     /*----------------------------------------------------------------*/
  1300.     /* Use the four bytes to check if popup exists */
  1301.     MMI_ASSERT(g_mmi_gui_cat430_context_p);
  1302.     return (history_buffer);
  1303. }
  1304. /*****************************************************************************
  1305.  * FUNCTION
  1306.  *  ShowCategory430Screen
  1307.  * DESCRIPTION
  1308.  *  Displays the category430 screen
  1309.  * PARAMETERS
  1310.  *  title                       [IN]        
  1311.  *  title_icon                  [IN]        
  1312.  *  left_softkey                [IN]        
  1313.  *  left_softkey_icon           [IN]        
  1314.  *  right_softkey               [IN]        
  1315.  *  right_softkey_icon          [IN]        
  1316.  *  log_buffer1                 [?]         
  1317.  *  log_buffer_size1            [IN]        
  1318.  *  log_buffer2                 [?]         
  1319.  *  log_buffer_size2            [IN]        
  1320.  *  show_sending_buffer         [IN]        
  1321.  *  max_sending_buffer_size     [IN]        
  1322.  *  sending_buffer              [?]         
  1323.  *  sent_count                  [IN]        
  1324.  *  name1                       [?]         
  1325.  *  name2                       [?]         
  1326.  *  history_buffer              [?]         
  1327.  * RETURNS
  1328.  *  void
  1329.  *****************************************************************************/
  1330. void ShowCategory430Screen(
  1331.         U16 title,
  1332.         U16 title_icon,
  1333.         U16 left_softkey,
  1334.         U16 left_softkey_icon,
  1335.         U16 right_softkey,
  1336.         U16 right_softkey_icon,
  1337.         U8 *log_buffer1,
  1338.         S16 log_buffer_size1,
  1339.         U8 *log_buffer2,
  1340.         S16 log_buffer_size2,
  1341.         MMI_BOOL show_sending_buffer,
  1342.         S16 max_sending_buffer_size,
  1343.         U8 *sending_buffer,
  1344.         S16 sent_count,
  1345.         U8 *name1,
  1346.         U8 *name2,
  1347.         U8 *history_buffer)
  1348. {
  1349.     /*----------------------------------------------------------------*/
  1350.     /* Local Variables                                                */
  1351.     /*----------------------------------------------------------------*/
  1352.     dm_data_struct dm_data;
  1353.     S32 font_height, log_box_height;
  1354.     /*----------------------------------------------------------------*/
  1355.     /* Global Variables                                                */
  1356.     /*----------------------------------------------------------------*/
  1357.     g_mmi_gui_cat430_context_p = OslMalloc(sizeof(gui_cat430_context_struct));
  1358.     CAT430_CTX->name1 = name1;
  1359.     CAT430_CTX->name2 = name2;
  1360.     CAT430_CTX->log_buffer1 = log_buffer1;
  1361.     CAT430_CTX->log_buffer_size1 = log_buffer_size1;
  1362.     CAT430_CTX->log_buffer2 = log_buffer2;
  1363.     CAT430_CTX->log_buffer_size2 = log_buffer_size2;
  1364.     CAT430_CTX->show_sending_buffer = show_sending_buffer;
  1365.     CAT430_CTX->max_sending_buffer_size = max_sending_buffer_size;
  1366.     CAT430_CTX->sending_buffer = sending_buffer;
  1367.     CAT430_CTX->sent_count = sent_count;
  1368.     CAT430_CTX->allocated_color_buffer_size = (max_sending_buffer_size + CAT430_MARKER_COUNT + 1) * 2;
  1369.     CAT430_CTX->allocated_color_buffer = OslMalloc(CAT430_CTX->allocated_color_buffer_size);
  1370.     /*----------------------------------------------------------------*/
  1371.     /* Compute Layout                                                  */
  1372.     /*----------------------------------------------------------------*/
  1373.     font_height = Get_CharHeightOfAllLang(CAT430_NAME_FONT_ENUM);
  1374. #ifndef CAT430_NAME_IN_LOG
  1375.     log_box_height = MMI_content_height - (font_height << 1) - (CAT430_VERTICAL_GAP * 5);
  1376.     log_box_height >>= 1;
  1377.     MMI_DBG_ASSERT(log_box_height > 0);
  1378. #else /* CAT430_NAME_IN_LOG */ 
  1379.     CAT430_CTX->log_box_header_height = font_height + CAT430_VERTICAL_GAP;
  1380.     log_box_height = MMI_content_height - (CAT430_VERTICAL_GAP * 3);
  1381.     log_box_height >>= 1;
  1382.     MMI_DBG_ASSERT(log_box_height > 0);
  1383. #endif /* CAT430_NAME_IN_LOG */ 
  1384. #ifndef CAT430_NAME_IN_LOG
  1385.     CAT430_CTX->name1_x = CAT430_HORIZONTAL_GAP;
  1386.     CAT430_CTX->name1_y = MMI_content_y + CAT430_VERTICAL_GAP;
  1387.     CAT430_CTX->log_box1_y = CAT430_CTX->name1_y + font_height + CAT430_VERTICAL_GAP;
  1388. #else /* CAT430_NAME_IN_LOG */ 
  1389.     CAT430_CTX->log_box1_y = MMI_content_y + CAT430_VERTICAL_GAP;
  1390. #endif /* CAT430_NAME_IN_LOG */ 
  1391.     CAT430_CTX->log_box1_x = CAT430_HORIZONTAL_GAP;
  1392.     CAT430_CTX->log_box1_width = MMI_content_width - CAT430_HORIZONTAL_GAP * 2;
  1393.     CAT430_CTX->log_box1_height = log_box_height;
  1394. #ifndef CAT430_NAME_IN_LOG
  1395.     CAT430_CTX->name2_x = CAT430_HORIZONTAL_GAP;
  1396.     CAT430_CTX->name2_y = CAT430_CTX->log_box1_y + CAT430_CTX->log_box1_height + CAT430_VERTICAL_GAP;
  1397.     CAT430_CTX->log_box2_y = CAT430_CTX->name2_y + font_height + CAT430_VERTICAL_GAP;
  1398. #else /* CAT430_NAME_IN_LOG */ 
  1399.     CAT430_CTX->log_box2_y = CAT430_CTX->log_box1_y + CAT430_CTX->log_box1_height + CAT430_VERTICAL_GAP;
  1400. #endif /* CAT430_NAME_IN_LOG */ 
  1401.     CAT430_CTX->log_box2_x = CAT430_HORIZONTAL_GAP;
  1402.     CAT430_CTX->log_box2_width = CAT430_CTX->log_box1_width;
  1403.     CAT430_CTX->log_box2_height = log_box_height;
  1404.     /*----------------------------------------------------------------*/
  1405.     /* Code Body                                                      */
  1406.     /*----------------------------------------------------------------*/
  1407.     gui_lock_double_buffer();
  1408.     MMI_menu_shortcut_number = -1;
  1409.     MMI_disable_title_shortcut_display = 1;
  1410.     change_left_softkey(left_softkey, left_softkey_icon);
  1411.     change_right_softkey(right_softkey, right_softkey_icon);
  1412.     SetupCategoryKeyHandlers();
  1413.     MMI_title_string = (UI_string_type) get_string(title);
  1414.     MMI_title_icon = (PU8) get_image(title_icon);
  1415.     category430_setup_sending_box();
  1416.     category430_setup_log_box1();
  1417.     category430_setup_log_box2();
  1418.     SetKeyHandler(category430_previous_line, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1419.     SetKeyHandler(category430_next_line, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1420.     SetKeyHandler(category430_previous_line, KEY_VOL_UP, KEY_EVENT_DOWN);
  1421.     SetKeyHandler(category430_next_line, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  1422.     gui_unlock_double_buffer();
  1423.     ExitCategoryFunction = ExitCategory430Screen;
  1424.     dm_register_category_controlled_callback(category430_draw_controlled_area);
  1425.     dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);
  1426.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  1427.     dm_data.s32CatId = MMI_CATEGORY430_ID;
  1428.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  1429. #ifdef __MMI_TOUCH_SCREEN__
  1430.     wgui_register_category_screen_control_area_pen_handlers(
  1431.         category430_control_area_pen_down_handler,
  1432.         MMI_PEN_EVENT_DOWN);
  1433.     wgui_register_category_screen_control_area_pen_handlers(category430_control_area_pen_up_handler, MMI_PEN_EVENT_UP);
  1434.     wgui_register_category_screen_control_area_pen_handlers(
  1435.         category430_control_area_pen_move_handler,
  1436.         MMI_PEN_EVENT_MOVE);
  1437.     wgui_register_category_screen_control_area_pen_handlers(
  1438.         category430_control_area_pen_repeat_handler,
  1439.         MMI_PEN_EVENT_REPEAT);
  1440.     wgui_register_category_screen_control_area_pen_handlers(
  1441.         category430_control_area_pen_longtap_handler,
  1442.         MMI_PEN_EVENT_LONG_TAP);
  1443.     wgui_register_category_screen_control_area_pen_handlers(
  1444.         category430_control_area_pen_abort_handler,
  1445.         MMI_PEN_EVENT_ABORT);
  1446. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1447.     dm_setup_data(&dm_data);
  1448.     dm_redraw_category_screen();
  1449. }
  1450. /*****************************************************************************
  1451.  * FUNCTION
  1452.  *  UpdateCategory430LogBox
  1453.  * DESCRIPTION
  1454.  *  
  1455.  * PARAMETERS
  1456.  *  update_log1     [IN]        
  1457.  *  update_log2     [IN]        
  1458.  * RETURNS
  1459.  *  void
  1460.  *****************************************************************************/
  1461. void UpdateCategory430LogBox(MMI_BOOL update_log1, MMI_BOOL update_log2)
  1462. {
  1463.     /*----------------------------------------------------------------*/
  1464.     /* Local Variables                                                */
  1465.     /*----------------------------------------------------------------*/
  1466.     /*----------------------------------------------------------------*/
  1467.     /* Code Body                                                      */
  1468.     /*----------------------------------------------------------------*/
  1469.     MMI_ASSERT(g_mmi_gui_cat430_context_p);
  1470.     if (update_log1)
  1471.     {
  1472.         category430_setup_log_box1();
  1473.     }
  1474.     if (update_log2)
  1475.     {
  1476.         category430_setup_log_box2();
  1477.     }
  1478.     RedrawCategoryFunction();
  1479. }
  1480. /*****************************************************************************
  1481.  * FUNCTION
  1482.  *  ConfigureCategory430SendingBox
  1483.  * DESCRIPTION
  1484.  *  
  1485.  * PARAMETERS
  1486.  *  show_sending_buffer     [IN]        
  1487.  *  sent_count              [IN]        
  1488.  * RETURNS
  1489.  *  void
  1490.  *****************************************************************************/
  1491. void ConfigureCategory430SendingBox(MMI_BOOL show_sending_buffer, S16 sent_count)
  1492. {
  1493.     /*----------------------------------------------------------------*/
  1494.     /* Local Variables                                                */
  1495.     /*----------------------------------------------------------------*/
  1496.     /*----------------------------------------------------------------*/
  1497.     /* Code Body                                                      */
  1498.     /*----------------------------------------------------------------*/
  1499.     MMI_ASSERT(g_mmi_gui_cat430_context_p);
  1500.     CAT430_CTX->show_sending_buffer = show_sending_buffer;
  1501.     CAT430_CTX->sent_count = sent_count;
  1502.     category430_setup_sending_box();
  1503.     /* Setup logbox2 because 'log_box2_footer_height' might be changed */
  1504.     category430_setup_log_box2();
  1505.     RedrawCategoryFunction();
  1506. }
  1507. /*****************************************************************************
  1508.  * FUNCTION
  1509.  *  SetCategory430SendingBoxCharacterCount
  1510.  * DESCRIPTION
  1511.  *  
  1512.  * PARAMETERS
  1513.  *  sent_count      [IN]        
  1514.  * RETURNS
  1515.  *  void
  1516.  *****************************************************************************/
  1517. void SetCategory430SendingBoxCharacterCount(S16 sent_count)
  1518. {
  1519.     /*----------------------------------------------------------------*/
  1520.     /* Local Variables                                                */
  1521.     /*----------------------------------------------------------------*/
  1522.     /*----------------------------------------------------------------*/
  1523.     /* Code Body                                                      */
  1524.     /*----------------------------------------------------------------*/
  1525.     CAT430_CTX->sent_count = sent_count;
  1526.     RedrawCategoryFunction();
  1527. }
  1528. /*****************************************************************************
  1529.  * FUNCTION
  1530.  *  UpdateCategory430LSK
  1531.  * DESCRIPTION
  1532.  *  
  1533.  * PARAMETERS
  1534.  *  left_softkey            [IN]        
  1535.  *  left_softkey_icon       [IN]        
  1536.  * RETURNS
  1537.  *  void
  1538.  *****************************************************************************/
  1539. void UpdateCategory430LSK(U16 left_softkey, U16 left_softkey_icon)
  1540. {
  1541.     /*----------------------------------------------------------------*/
  1542.     /* Local Variables                                                */
  1543.     /*----------------------------------------------------------------*/
  1544.     /*----------------------------------------------------------------*/
  1545.     /* Code Body                                                      */
  1546.     /*----------------------------------------------------------------*/
  1547.     gui_lock_double_buffer();
  1548.     change_left_softkey(left_softkey, left_softkey_icon);
  1549.     /* setup key handler again if previous softkey is empty */
  1550.     register_left_softkey_handler();
  1551.     register_right_softkey_handler();
  1552.     register_default_hide_softkeys();
  1553.     show_softkey_background();
  1554.     show_left_softkey();
  1555.     show_right_softkey();
  1556.     gui_unlock_double_buffer();
  1557.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1558. }
  1559. /*****************************************************************************
  1560.  * FUNCTION
  1561.  *  UpdateCategory430RSK
  1562.  * DESCRIPTION
  1563.  *  
  1564.  * PARAMETERS
  1565.  *  right_softkey           [IN]        
  1566.  *  right_softkey_icon      [IN]        
  1567.  * RETURNS
  1568.  *  void
  1569.  *****************************************************************************/
  1570. void UpdateCategory430RSK(U16 right_softkey, U16 right_softkey_icon)
  1571. {
  1572.     /*----------------------------------------------------------------*/
  1573.     /* Local Variables                                                */
  1574.     /*----------------------------------------------------------------*/
  1575.     /*----------------------------------------------------------------*/
  1576.     /* Code Body                                                      */
  1577.     /*----------------------------------------------------------------*/
  1578.     gui_lock_double_buffer();
  1579.     change_right_softkey(right_softkey, right_softkey_icon);
  1580.     /* setup key handler again if previous softkey is empty */
  1581.     register_left_softkey_handler();
  1582.     register_right_softkey_handler();
  1583.     register_default_hide_softkeys();
  1584.     show_softkey_background();
  1585.     show_left_softkey();
  1586.     show_right_softkey();
  1587.     gui_unlock_double_buffer();
  1588.     gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
  1589. }
  1590. /* 
  1591.  * Category 435
  1592.  */
  1593. /*****************************************************************************
  1594.  * FUNCTION
  1595.  *  category435_draw_controlled_area
  1596.  * DESCRIPTION
  1597.  *  Category-controlled area draw callback for category435 screen
  1598.  * PARAMETERS
  1599.  *  coordinate      [?]     
  1600.  * RETURNS
  1601.  *  void
  1602.  *****************************************************************************/
  1603. void category435_draw_controlled_area(dm_coordinates *coordinate)
  1604. {
  1605.     /*----------------------------------------------------------------*/
  1606.     /* Local Variables                                                */
  1607.     /*----------------------------------------------------------------*/
  1608.     /*----------------------------------------------------------------*/
  1609.     /* Code Body                                                      */
  1610.     /*----------------------------------------------------------------*/
  1611.     UI_UNUSED_PARAMETER(coordinate);
  1612.     category435_draw_content_area();
  1613. }
  1614. /*****************************************************************************
  1615.  * FUNCTION
  1616.  *  SetCategory435EditorRSKFunction
  1617.  * DESCRIPTION
  1618.  *  Set the right softkey function for editor popup in  category435 screen
  1619.  * PARAMETERS
  1620.  *  f       [IN]        
  1621.  * RETURNS
  1622.  *  void
  1623.  *****************************************************************************/
  1624. void SetCategory435EditorRSKFunction(void (*f) (void))
  1625. {
  1626.     /*----------------------------------------------------------------*/
  1627.     /* Local Variables                                                */
  1628.     /*----------------------------------------------------------------*/
  1629.     /*----------------------------------------------------------------*/
  1630.     /* Code Body                                                      */
  1631.     /*----------------------------------------------------------------*/
  1632.     CAT435_CTX->editor_RSK_func = f;
  1633.     wgui_inputbox_RSK_function = f;
  1634. }
  1635. /*****************************************************************************
  1636.  * FUNCTION
  1637.  *  SetCategory435EditorLSKFunction
  1638.  * DESCRIPTION
  1639.  *  Set the left softkey function for editor popup in  category435 screen
  1640.  * PARAMETERS
  1641.  *  f       [IN]        
  1642.  * RETURNS
  1643.  *  void
  1644.  *****************************************************************************/
  1645. void SetCategory435EditorLSKFunction(void (*f) (void))
  1646. {
  1647.     /*----------------------------------------------------------------*/
  1648.     /* Local Variables                                                */
  1649.     /*----------------------------------------------------------------*/
  1650.     /*----------------------------------------------------------------*/
  1651.     /* Code Body                                                      */
  1652.     /*----------------------------------------------------------------*/
  1653.     /* ShowCategory435Screen should be invoked first */
  1654.     MMI_ASSERT(CAT435_CTX);
  1655.     CAT435_CTX->editor_LSK_func = f;
  1656.     if (CAT435_CTX->show_popup)
  1657.     {
  1658.         SetLeftSoftkeyFunction(f, KEY_EVENT_UP);
  1659.     }
  1660. }
  1661. /*****************************************************************************
  1662.  * FUNCTION
  1663.  *  SetCategory435RSKFunction
  1664.  * DESCRIPTION
  1665.  *  Set the left softkey function category435 screen without popup
  1666.  * PARAMETERS
  1667.  *  f       [IN]        
  1668.  * RETURNS
  1669.  *  void
  1670.  *****************************************************************************/
  1671. void SetCategory435RSKFunction(void (*f) (void))
  1672. {
  1673.     /*----------------------------------------------------------------*/
  1674.     /* Local Variables                                                */
  1675.     /*----------------------------------------------------------------*/
  1676.     /*----------------------------------------------------------------*/
  1677.     /* Code Body                                                      */
  1678.     /*----------------------------------------------------------------*/
  1679.     /* ShowCategory435Screen should be invoked first */
  1680.     MMI_ASSERT(CAT435_CTX);
  1681.     CAT435_CTX->RSK_func = f;
  1682.     if (!CAT435_CTX->show_popup)
  1683.     {
  1684.         SetRightSoftkeyFunction(f, KEY_EVENT_UP);
  1685.     }
  1686. }
  1687. /*****************************************************************************
  1688.  * FUNCTION
  1689.  *  SetCategory435LSKFunction
  1690.  * DESCRIPTION
  1691.  *  Set the left softkey function category435 screen without popup
  1692.  * PARAMETERS
  1693.  *  f       [IN]        
  1694.  * RETURNS
  1695.  *  void
  1696.  *****************************************************************************/
  1697. void SetCategory435LSKFunction(void (*f) (void))
  1698. {
  1699.     /*----------------------------------------------------------------*/
  1700.     /* Local Variables                                                */
  1701.     /*----------------------------------------------------------------*/
  1702.     /*----------------------------------------------------------------*/
  1703.     /* Code Body                                                      */
  1704.     /*----------------------------------------------------------------*/
  1705.     /* ShowCategory435Screen should be invoked first */
  1706.     MMI_ASSERT(CAT435_CTX);
  1707.     CAT435_CTX->LSK_func = f;
  1708.     if (!CAT435_CTX->show_popup)
  1709.     {
  1710.         SetLeftSoftkeyFunction(f, KEY_EVENT_UP);
  1711.     }
  1712. }
  1713. /*****************************************************************************
  1714.  * FUNCTION
  1715.  *  ExitCategory435Screen
  1716.  * DESCRIPTION
  1717.  *  Exits the category435 screen
  1718.  * PARAMETERS
  1719.  *  void
  1720.  * RETURNS
  1721.  *  void
  1722.  *****************************************************************************/
  1723. void ExitCategory435Screen(void)
  1724. {
  1725.     /*----------------------------------------------------------------*/
  1726.     /* Local Variables                                                */
  1727.     /*----------------------------------------------------------------*/
  1728.     /*----------------------------------------------------------------*/
  1729.     /* Code Body                                                      */
  1730.     /*----------------------------------------------------------------*/
  1731.     reset_softkeys();
  1732.     wgui_close_horizontal_tab_bar();
  1733.     set_MMI_current_input_type();
  1734.     if (CAT435_CTX->show_popup)
  1735.     {
  1736.         category435_reset_editor_box();
  1737.     }
  1738. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1739.     dm_set_scr_bg_image_no_draw(
  1740.         editor_scr_bg_ID,
  1741.         editor_scr_bg_filename,
  1742.         editor_scr_bg_x,
  1743.         editor_scr_bg_y,
  1744.         editor_scr_bg_opacity);
  1745. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  1746.     ExitCategoryFunction = MMI_dummy_function;
  1747.     RedrawCategoryFunction = MMI_dummy_function;
  1748.     GetCategoryHistory = dummy_get_history;
  1749.     GetCategoryHistorySize = dummy_get_history_size;
  1750.     /* Restore context */
  1751.     MMI_multiline_inputbox_width = CAT435_CTX->backup_MMI_editor_width;
  1752.     MMI_multiline_inputbox_height = CAT435_CTX->backup_MMI_editor_height;
  1753.     current_information_bar_theme->background_color = CAT435_CTX->backup_information_bar_color;
  1754.     current_multitap_input_theme->f = CAT435_CTX->backup_multitap_filler;
  1755.     set_MMI_multitap_theme();
  1756.     OslMfree(g_mmi_gui_cat435_context_p);
  1757.     g_mmi_gui_cat435_context_p = NULL;
  1758. }
  1759. /*****************************************************************************
  1760.  * FUNCTION
  1761.  *  GetCategory435HistorySize
  1762.  * DESCRIPTION
  1763.  *  Gets the size of the history buffer for category435 screen
  1764.  * PARAMETERS
  1765.  *  void
  1766.  * RETURNS
  1767.  *  size in U8 of the history buffer
  1768.  *****************************************************************************/
  1769. S32 GetCategory435HistorySize(void)
  1770. {
  1771.     /*----------------------------------------------------------------*/
  1772.     /* Local Variables                                                */
  1773.     /*----------------------------------------------------------------*/
  1774.     /*----------------------------------------------------------------*/
  1775.     /* Code Body                                                      */
  1776.     /*----------------------------------------------------------------*/
  1777.     /* Use the four bytes to check if popup exists */
  1778.     return sizeof(gui_cat435_history_header_struct) + sizeof(multiline_inputbox_category_history);
  1779. }
  1780. /*****************************************************************************
  1781.  * FUNCTION
  1782.  *  GetCategory435History
  1783.  * DESCRIPTION
  1784.  *  Gets the history buffer for category435 screen
  1785.  * PARAMETERS
  1786.  *  history_buffer      [IN]        Is the buffer into which the history data is stored (pre-allocated)
  1787.  * RETURNS
  1788.  *  Pointer to the history buffer
  1789.  *****************************************************************************/
  1790. U8 *GetCategory435History(U8 *history_buffer)
  1791. {
  1792.     /*----------------------------------------------------------------*/
  1793.     /* Local Variables                                                */
  1794.     /*----------------------------------------------------------------*/
  1795.     /* Use the four bytes to check if popup exists */
  1796.     gui_cat435_history_header_struct *h = (gui_cat435_history_header_struct*) history_buffer;
  1797.     /*----------------------------------------------------------------*/
  1798.     /* Code Body                                                      */
  1799.     /*----------------------------------------------------------------*/
  1800.     h->show_popup = (U8) CAT435_CTX->show_popup;
  1801.     if (CAT435_CTX->show_popup)
  1802.     {
  1803.         /* Get editor history only if editor is active */
  1804.         get_multiline_inputbox_category_history(
  1805.             MMI_CATEGORY435_ID,
  1806.             history_buffer + sizeof(gui_cat435_history_header_struct),
  1807.             MMI_current_input_type);
  1808.     }
  1809.     return (history_buffer);
  1810. }
  1811. /*****************************************************************************
  1812.  * FUNCTION
  1813.  *  UpdateCategory435LogText
  1814.  * DESCRIPTION
  1815.  *  Update the log text in category 435
  1816.  * PARAMETERS
  1817.  *  log_buffer          [IN]        
  1818.  *  log_buffer_size     [IN]        
  1819.  * RETURNS
  1820.  *  void
  1821.  *****************************************************************************/
  1822. void UpdateCategory435LogText(U8 *log_buffer, S32 log_buffer_size)
  1823. {
  1824.     /*----------------------------------------------------------------*/
  1825.     /* Local Variables                                                */
  1826.     /*----------------------------------------------------------------*/
  1827.     /*----------------------------------------------------------------*/
  1828.     /* Code Body                                                      */
  1829.     /*----------------------------------------------------------------*/
  1830.     /* ShowCategory435Screen should be invoked first */
  1831.     MMI_ASSERT(CAT435_CTX);
  1832.     gui_lock_double_buffer();
  1833.     category435_setup_log_box(log_buffer, log_buffer_size);
  1834.     gui_unlock_double_buffer();
  1835.     /* We do not update the background if popup is displayed */
  1836.     if (!CAT435_CTX->show_popup)
  1837.     {
  1838.         RedrawCategoryFunction();
  1839.     }
  1840. }
  1841. /*****************************************************************************
  1842.  * FUNCTION
  1843.  *  UpdateCategory435LogAndEditorText
  1844.  * DESCRIPTION
  1845.  *  Update the log and editor text in category 435
  1846.  * PARAMETERS
  1847.  *  buffer              [IN]        
  1848.  *  buffer_size         [IN]        
  1849.  *  log_buffer          [IN]        
  1850.  *  log_buffer_size     [IN]        
  1851.  * RETURNS
  1852.  *  void
  1853.  *****************************************************************************/
  1854. void UpdateCategory435LogAndEditorText(U8 *buffer, S32 buffer_size, U8 *log_buffer, S32 log_buffer_size)
  1855. {
  1856.     /*----------------------------------------------------------------*/
  1857.     /* Local Variables                                                */
  1858.     /*----------------------------------------------------------------*/
  1859.     /*----------------------------------------------------------------*/
  1860.     /* Code Body                                                      */
  1861.     /*----------------------------------------------------------------*/
  1862.     /* ShowCategory435Screen should be invoked first */
  1863.     MMI_ASSERT(CAT435_CTX);
  1864.     gui_lock_double_buffer();
  1865.     /* Setup log box */
  1866.     category435_setup_log_box(log_buffer, log_buffer_size);
  1867.     /* Setup editor box */
  1868.     CAT435_CTX->buffer = buffer;
  1869.     CAT435_CTX->buffer_size = buffer_size;
  1870.     if (CAT435_CTX->show_popup)
  1871.     {
  1872.         /* If IME is active. We need to abort it */
  1873.         category435_reset_editor_box();
  1874.         category435_setup_editor_box(buffer, buffer_size, CAT435_CTX->input_type, NULL);
  1875.     }
  1876.     gui_unlock_double_buffer();
  1877.     RedrawCategoryFunction();
  1878. }
  1879. /*****************************************************************************
  1880.  * FUNCTION
  1881.  *  Category435ShowPopupInternal
  1882.  * DESCRIPTION
  1883.  *  
  1884.  * PARAMETERS
  1885.  *  update_screen       [IN]        
  1886.  *  history_buffer      [?]         
  1887.  *  force_execution     [IN]        
  1888.  * RETURNS
  1889.  *  void
  1890.  *****************************************************************************/
  1891. static void Category435ShowPopupInternal(BOOL update_screen, U8 *history_buffer, BOOL force_execution)
  1892. {
  1893.     /*----------------------------------------------------------------*/
  1894.     /* Local Variables                                                */
  1895.     /*----------------------------------------------------------------*/
  1896.     /*----------------------------------------------------------------*/
  1897.     /* Code Body                                                      */
  1898.     /*----------------------------------------------------------------*/
  1899.     if (CAT435_CTX->show_popup && !force_execution)
  1900.     {
  1901.         /* Popup already displayed */
  1902.         return;
  1903.     }
  1904.     CAT435_CTX->show_popup = MMI_TRUE;
  1905. #ifdef __MMI_TOUCH_SCREEN__
  1906.     wgui_enable_horizontal_tab_bar_pen_events(MMI_FALSE);
  1907. #endif 
  1908.     gui_lock_double_buffer();
  1909.     ClearInputEventHandler(MMI_DEVICE_KEY);
  1910.     change_left_softkey(CAT435_CTX->editor_left_softkey, CAT435_CTX->editor_left_softkey_icon);
  1911.     change_right_softkey(CAT435_CTX->editor_right_softkey, CAT435_CTX->editor_right_softkey_icon);
  1912.     clear_left_softkey();
  1913.     clear_right_softkey();
  1914.     register_left_softkey_handler();
  1915.     register_right_softkey_handler();
  1916.     register_default_hide_softkeys();
  1917.     category435_setup_editor_box(CAT435_CTX->buffer, CAT435_CTX->buffer_size, CAT435_CTX->input_type, history_buffer);
  1918.     gui_unlock_double_buffer();
  1919.     if (update_screen)
  1920.     {
  1921.         RedrawCategoryFunction();
  1922.     }
  1923. }
  1924. /*****************************************************************************
  1925.  * FUNCTION
  1926.  *  Category435ShowPopup
  1927.  * DESCRIPTION
  1928.  *  
  1929.  * PARAMETERS
  1930.  *  update_screen       [IN]        
  1931.  * RETURNS
  1932.  *  void
  1933.  *****************************************************************************/
  1934. void Category435ShowPopup(BOOL update_screen)
  1935. {
  1936.     /*----------------------------------------------------------------*/
  1937.     /* Local Variables                                                */
  1938.     /*----------------------------------------------------------------*/
  1939.     /*----------------------------------------------------------------*/
  1940.     /* Code Body                                                      */
  1941.     /*----------------------------------------------------------------*/
  1942.     Category435ShowPopupInternal(update_screen, NULL, MMI_FALSE);
  1943. }
  1944. /*****************************************************************************
  1945.  * FUNCTION
  1946.  *  Category435HidePopupInternal
  1947.  * DESCRIPTION
  1948.  *  
  1949.  * PARAMETERS
  1950.  *  update_screen       [IN]        
  1951.  *  force_execution     [IN]        
  1952.  * RETURNS
  1953.  *  void
  1954.  *****************************************************************************/
  1955. static void Category435HidePopupInternal(BOOL update_screen, BOOL force_execution)
  1956. {
  1957.     /*----------------------------------------------------------------*/
  1958.     /* Local Variables                                                */
  1959.     /*----------------------------------------------------------------*/
  1960.     /*----------------------------------------------------------------*/
  1961.     /* Code Body                                                      */
  1962.     /*----------------------------------------------------------------*/
  1963.     if (!CAT435_CTX->show_popup && !force_execution)
  1964.     {
  1965.         /* Popup already hidden */
  1966.         return;
  1967.     }
  1968.     CAT435_CTX->show_popup = MMI_FALSE;
  1969. #ifdef __MMI_TOUCH_SCREEN__
  1970.     wgui_enable_horizontal_tab_bar_pen_events(MMI_TRUE);
  1971. #endif 
  1972.     gui_lock_double_buffer();
  1973.     /* Reset editor (cf. RedrawCategory435Screen) */
  1974.     category435_reset_editor_box();
  1975.     ClearInputEventHandler(MMI_DEVICE_KEY);
  1976.     change_left_softkey(CAT435_CTX->left_softkey, CAT435_CTX->left_softkey_icon);
  1977.     change_right_softkey(CAT435_CTX->right_softkey, CAT435_CTX->right_softkey_icon);
  1978.     clear_left_softkey();
  1979.     clear_right_softkey();
  1980.     register_left_softkey_handler();
  1981.     register_right_softkey_handler();
  1982.     register_default_hide_softkeys();
  1983.     SetKeyHandler(category435_log_box_previous_line, KEY_UP_ARROW, KEY_EVENT_DOWN);
  1984.     SetKeyHandler(category435_log_box_next_line, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  1985.     SetKeyHandler(category435_log_box_previous_line, KEY_VOL_UP, KEY_EVENT_DOWN);
  1986.     SetKeyHandler(category435_log_box_next_line, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  1987.     SetLeftSoftkeyFunction(CAT435_CTX->LSK_func, KEY_EVENT_UP);
  1988.     SetRightSoftkeyFunction(CAT435_CTX->RSK_func, KEY_EVENT_UP);
  1989.     gui_unlock_double_buffer();
  1990.     if (update_screen)
  1991.     {
  1992.         RedrawCategoryFunction();
  1993.     }
  1994. }
  1995. /*****************************************************************************
  1996.  * FUNCTION
  1997.  *  Category435HidePopup
  1998.  * DESCRIPTION
  1999.  *  
  2000.  * PARAMETERS
  2001.  *  update_screen       [IN]        
  2002.  * RETURNS
  2003.  *  void
  2004.  *****************************************************************************/
  2005. void Category435HidePopup(BOOL update_screen)
  2006. {
  2007.     /*----------------------------------------------------------------*/
  2008.     /* Local Variables                                                */
  2009.     /*----------------------------------------------------------------*/
  2010.     /*----------------------------------------------------------------*/
  2011.     /* Code Body                                                      */
  2012.     /*----------------------------------------------------------------*/
  2013.     Category435HidePopupInternal(update_screen, MMI_FALSE);
  2014. }
  2015. /* Check if popup editor in category 435 is displayed */
  2016. /*****************************************************************************
  2017.  * FUNCTION
  2018.  *  Category435IsPopupDisplayed
  2019.  * DESCRIPTION
  2020.  *  
  2021.  * PARAMETERS
  2022.  *  void
  2023.  * RETURNS
  2024.  *  
  2025.  *****************************************************************************/
  2026. BOOL Category435IsPopupDisplayed(void)
  2027. {
  2028.     /*----------------------------------------------------------------*/
  2029.     /* Local Variables                                                */
  2030.     /*----------------------------------------------------------------*/
  2031.     /*----------------------------------------------------------------*/
  2032.     /* Code Body                                                      */
  2033.     /*----------------------------------------------------------------*/
  2034.     /* ShowCategory435Screen should be invoked first */
  2035.     MMI_ASSERT(CAT435_CTX);
  2036.     return CAT435_CTX->show_popup;
  2037. }
  2038. /* Typically used to insert mood symbols. Not efficient for inserting long string */
  2039. /*****************************************************************************
  2040.  * FUNCTION
  2041.  *  Category435DirectInsertString
  2042.  * DESCRIPTION
  2043.  *  
  2044.  * PARAMETERS
  2045.  *  s                   [IN]        
  2046.  *  redraw_screen       [IN]        
  2047.  * RETURNS
  2048.  *  void
  2049.  *****************************************************************************/
  2050. void Category435DirectInsertString(UI_string_type s, BOOL redraw_screen)
  2051. {
  2052.     /*----------------------------------------------------------------*/
  2053.     /* Local Variables                                                */
  2054.     /*----------------------------------------------------------------*/
  2055.     S32 i, l;
  2056.     /*----------------------------------------------------------------*/
  2057.     /* Code Body                                                      */
  2058.     /*----------------------------------------------------------------*/
  2059.     /* ShowCategory435Screen should be invoked first */
  2060.     MMI_ASSERT(CAT435_CTX);
  2061.     gui_lock_double_buffer();
  2062.     l = gui_strlen(s);
  2063.     for (i = 0; i < l; i++)
  2064.     {
  2065.         if (MMI_multiline_inputbox.text_length >= MMI_multiline_inputbox.available_length)
  2066.         {
  2067.             gui_multi_line_input_box_insert_character(&MMI_multiline_inputbox, s[i]);
  2068.             break;
  2069.         }
  2070.         else
  2071.         {
  2072.             gui_multi_line_input_box_insert_character(&MMI_multiline_inputbox, s[i]);
  2073.         }
  2074.     }
  2075.     multiline_inputbox_input_callback();
  2076.     category435_sync_with_T9(); /* While double buffer locked */
  2077.     gui_unlock_double_buffer();
  2078.     if (redraw_screen && CAT435_CTX->show_popup)
  2079.     {
  2080.         wgui_show_inputbox();
  2081.     }
  2082. }
  2083. /*****************************************************************************
  2084.  * FUNCTION
  2085.  *  Category435BlinkTab
  2086.  * DESCRIPTION
  2087.  *  
  2088.  * PARAMETERS
  2089.  *  tab     [IN]        
  2090.  * RETURNS
  2091.  *  void
  2092.  *****************************************************************************/
  2093. void Category435BlinkTab(S8 tab)
  2094. {
  2095.     /*----------------------------------------------------------------*/
  2096.     /* Local Variables                                                */
  2097.     /*----------------------------------------------------------------*/
  2098.     /*----------------------------------------------------------------*/
  2099.     /* Code Body                                                      */
  2100.     /*----------------------------------------------------------------*/
  2101.     wgui_horizontal_tab_bar_start_blinking(tab);
  2102. }
  2103. /*****************************************************************************
  2104.  * FUNCTION
  2105.  *  Category435UnBlinkTab
  2106.  * DESCRIPTION
  2107.  *  
  2108.  * PARAMETERS
  2109.  *  tab     [IN]        
  2110.  * RETURNS
  2111.  *  void
  2112.  *****************************************************************************/
  2113. void Category435UnBlinkTab(S8 tab)
  2114. {
  2115.     /*----------------------------------------------------------------*/
  2116.     /* Local Variables                                                */
  2117.     /*----------------------------------------------------------------*/
  2118.     /*----------------------------------------------------------------*/
  2119.     /* Code Body                                                      */
  2120.     /*----------------------------------------------------------------*/
  2121.     wgui_horizontal_tab_bar_stop_blinking(tab);
  2122. }
  2123. /*****************************************************************************
  2124.  * FUNCTION
  2125.  *  UpdateCategory435TabBar
  2126.  * DESCRIPTION
  2127.  *  
  2128.  * PARAMETERS
  2129.  *  title               [IN]        
  2130.  *  n_tabs              [IN]        
  2131.  *  highlighted_tab     [IN]        
  2132.  *  tab_items           [?]         
  2133.  * RETURNS
  2134.  *  void
  2135.  *****************************************************************************/
  2136. void UpdateCategory435TabBar(UI_string_type title, S8 n_tabs, S8 highlighted_tab, tab_bar_item_type *tab_items)
  2137. {
  2138.     /*----------------------------------------------------------------*/
  2139.     /* Local Variables                                                */
  2140.     /*----------------------------------------------------------------*/
  2141.     S32 i;
  2142.     /*----------------------------------------------------------------*/
  2143.     /* Code Body                                                      */
  2144.     /*----------------------------------------------------------------*/
  2145.     if (!CAT435_CTX)
  2146.     {
  2147.         MMI_DBG_ASSERT(0);
  2148.         return;
  2149.     }
  2150.     if (title == NULL)
  2151.     {
  2152.         title = MMI_horizontal_tab_bar.hint;
  2153.     }
  2154.     gui_lock_double_buffer();
  2155.     wgui_close_horizontal_tab_bar();
  2156.     /* Setup horizontal tab bar */
  2157.     for (i = 0; i < n_tabs; i++)
  2158.     {
  2159.         MMI_tab_bar_items[i] = tab_items[i];
  2160.     }
  2161.     wgui_create_horizontal_tab_bar(TRUE, title, n_tabs, highlighted_tab, MMI_TRUE);
  2162.     gui_unlock_double_buffer();
  2163. #ifdef CAT435_POPUP_OVERLAP_TAB_BAR
  2164.     if (CAT435_CTX->show_popup)
  2165.     {
  2166.         wgui_show_horizontal_tab_bar_tab_area();
  2167.     }
  2168.     else
  2169.     {
  2170.         wgui_show_horizontal_tab_bar();
  2171.     }
  2172. #else /* CAT435_POPUP_OVERLAP_TAB_BAR */ 
  2173.     wgui_show_horizontal_tab_bar();
  2174. #endif /* CAT435_POPUP_OVERLAP_TAB_BAR */ 
  2175. }
  2176. /*****************************************************************************
  2177.  * FUNCTION
  2178.  *  SetCategory435TabSelectCallback
  2179.  * DESCRIPTION
  2180.  *  
  2181.  * PARAMETERS
  2182.  *  select_callback     [IN]        
  2183.  * RETURNS
  2184.  *  void
  2185.  *****************************************************************************/
  2186. void SetCategory435TabSelectCallback(void (*select_callback) (int index))
  2187. {
  2188.     /*----------------------------------------------------------------*/
  2189.     /* Local Variables                                                */
  2190.     /*----------------------------------------------------------------*/
  2191.     /*----------------------------------------------------------------*/
  2192.     /* Code Body                                                      */
  2193.     /*----------------------------------------------------------------*/
  2194.     MMI_DBG_ASSERT(g_mmi_gui_cat435_context_p);
  2195.     wgui_set_horizontal_tab_bar_select_callback(select_callback);
  2196. }
  2197. /*****************************************************************************
  2198.  * FUNCTION
  2199.  *  ShowCategory435Screen
  2200.  * DESCRIPTION
  2201.  *  Displays the category435 screen
  2202.  *  
  2203.  *  1. Category 435 is composed by one background log and one popup text editor.
  2204.  *  2. icon_callback is typically set as wgui_general_multiline_icon_handler()
  2205.  *  (configured by wgui_config_general_multiline_icon_handler)
  2206.  * PARAMETERS
  2207.  *  title                           [IN]        Title for the screen
  2208.  *  left_softkey                    [IN]        Left softkey label
  2209.  *  left_softkey_icon               [IN]        Icon for the left softkey
  2210.  *  right_softkey                   [IN]        Right softkey label
  2211.  *  right_softkey_icon              [IN]        Icon for the right softkey
  2212.  *  editor_left_softkey             [IN]        Left softkey label when popup editor is active
  2213.  *  editor_left_softkey_icon        [IN]        Icon for the left softkey when popup editor is active
  2214.  *  editor_right_softkey            [IN]        Right softkey label when popup editor is active
  2215.  *  editor_right_softkey_icon       [IN]        Icon for the right softkey when popup editor is active
  2216.  *  n_tabs                          [IN]        Number of tabs
  2217.  *  highlighted_tab                 [IN]        Highlighted tab
  2218.  *  tab_items                       [IN]        Tab list
  2219.  *  show_popup                      [IN]        Whether to display popup editor
  2220.  *  popup_title                     [IN]        The title of popup editor
  2221.  *  input_type                      [IN]        Input method type
  2222.  *  buffer                          [IN]        Buffer the text input
  2223.  *  buffer_size                     [IN]        Character count of the text input buffer. (without '')
  2224.  *  log_buffer                      [IN]        Buffer the background log
  2225.  *  log_buffer_size                 [IN]        Character count of the background log buffer.  (without '')
  2226.  *  icon_callback                   [IN]        Callback to translate a string to an icon
  2227.  *  sample_icon                     [IN]        
  2228.  *  history_buffer                  [IN]        History buffer
  2229.  *  NULL(?)                         [IN]        If no icon is required.
  2230.  *  For(?)                          [IN]        Example, 5 means only 5 characters (5*2 + 2 bytes) can be input in this screen.
  2231.  * RETURNS
  2232.  *  void
  2233.  *****************************************************************************/
  2234. void ShowCategory435Screen(
  2235.         UI_string_type title,
  2236.         U16 left_softkey,
  2237.         U16 left_softkey_icon,
  2238.         U16 right_softkey,
  2239.         U16 right_softkey_icon,
  2240.         U16 editor_left_softkey,
  2241.         U16 editor_left_softkey_icon,
  2242.         U16 editor_right_softkey,
  2243.         U16 editor_right_softkey_icon,
  2244.         S8 n_tabs,
  2245.         S8 highlighted_tab,
  2246.         tab_bar_item_type *tab_items,
  2247.         BOOL show_popup,
  2248.         UI_string_type popup_title,
  2249.         S16 input_type,
  2250.         U8 *buffer,
  2251.         S32 buffer_size,
  2252.         U8 *log_buffer,
  2253.         S32 log_buffer_size,
  2254.         multi_line_input_box_icon_hdlr icon_callback,
  2255.         PU8 sample_icon,
  2256.         U8 *history_buffer)
  2257. {
  2258.     /*----------------------------------------------------------------*/
  2259.     /* Local Variables                                                */
  2260.     /*----------------------------------------------------------------*/
  2261.     int i;
  2262.     S32 sample_icon_width = 0, sample_icon_height = 0;
  2263.     dm_data_struct dm_data;
  2264.     /*----------------------------------------------------------------*/
  2265.     /* Code Body                                                      */
  2266.     /*----------------------------------------------------------------*/
  2267.     g_mmi_gui_cat435_context_p = OslMalloc(sizeof(gui_cat435_context_struct));
  2268.     CAT435_CTX->right_softkey = right_softkey;
  2269.     CAT435_CTX->right_softkey_icon = right_softkey_icon;
  2270.     CAT435_CTX->left_softkey = left_softkey;
  2271.     CAT435_CTX->left_softkey_icon = left_softkey_icon;
  2272.     CAT435_CTX->editor_right_softkey = editor_right_softkey;
  2273.     CAT435_CTX->editor_right_softkey_icon = editor_right_softkey_icon;
  2274.     CAT435_CTX->editor_left_softkey = editor_left_softkey;
  2275.     CAT435_CTX->editor_left_softkey_icon = editor_left_softkey_icon;
  2276.     CAT435_CTX->popup_title = popup_title;
  2277.     CAT435_CTX->editor_RSK_func = UI_dummy_function;
  2278.     CAT435_CTX->editor_LSK_func = UI_dummy_function;
  2279.     CAT435_CTX->LSK_func = UI_dummy_function;
  2280.     CAT435_CTX->RSK_func = UI_dummy_function;
  2281.     /* We might need to setup/close editor later */
  2282.     CAT435_CTX->buffer = buffer;
  2283.     CAT435_CTX->buffer_size = buffer_size;
  2284.     CAT435_CTX->editor_created = 0;
  2285.     CAT435_CTX->input_type = input_type;
  2286.     CAT435_CTX->icon_callback = icon_callback;
  2287.     gui_measure_image(sample_icon, &sample_icon_width, &sample_icon_height);
  2288.     CAT435_CTX->icon_height = (S8) sample_icon_height;
  2289.     gui_lock_double_buffer();
  2290.     MMI_menu_shortcut_number = -1;
  2291.     MMI_disable_title_shortcut_display = 1;
  2292.     MMI_title_string = NULL;
  2293.     MMI_title_icon = NULL;
  2294.     clear_category_screen_key_handlers();
  2295.     clear_left_softkey();
  2296.     clear_right_softkey();
  2297.     register_left_softkey_handler();
  2298.     register_right_softkey_handler();
  2299.     register_default_hide_softkeys();
  2300.     /* Setup horizontal tab bar */
  2301.     for (i = 0; i < n_tabs; i++)
  2302.     {
  2303.         MMI_tab_bar_items[i] = tab_items[i];
  2304.     }
  2305.     wgui_create_horizontal_tab_bar(TRUE, title, n_tabs, highlighted_tab, MMI_FALSE);
  2306.     /* Setup log area */
  2307.     category435_setup_log_box(log_buffer, log_buffer_size);
  2308.     /* Setup editor area */
  2309.     CAT435_CTX->backup_MMI_editor_width = MMI_multiline_inputbox_width;
  2310.     CAT435_CTX->backup_MMI_editor_height = MMI_multiline_inputbox_height;
  2311.     CAT435_CTX->backup_information_bar_color = current_information_bar_theme->background_color;
  2312.     CAT435_CTX->backup_multitap_filler = current_multitap_input_theme->f;
  2313.     current_information_bar_theme->background_color = g_mmi_gui_cat435_popup_color;
  2314.     current_multitap_input_theme->f = (UI_filled_area*)&g_mmi_gui_cat435_multitap_filler;
  2315.     set_MMI_multitap_theme();
  2316.     if (history_buffer)
  2317.     {
  2318.         /* Check the first four bytes on whether popup exists */
  2319.         gui_cat435_history_header_struct *h = (gui_cat435_history_header_struct*) history_buffer;
  2320.         show_popup = (BOOL) (h->show_popup ? MMI_TRUE : MMI_FALSE);
  2321.         if (show_popup)
  2322.         {
  2323.             history_buffer += sizeof(gui_cat435_history_header_struct);
  2324.         }
  2325.         else
  2326.         {
  2327.             /* No history for editor */
  2328.             history_buffer = NULL;
  2329.         }
  2330.     }
  2331.     /* Setup key */
  2332.     if (show_popup)
  2333.     {
  2334.         Category435ShowPopupInternal(MMI_FALSE, history_buffer, MMI_TRUE);
  2335.     }
  2336.     else
  2337.     {
  2338.         Category435HidePopupInternal(MMI_FALSE, MMI_TRUE);
  2339.     }
  2340. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  2341.     dm_get_scr_bg_image(
  2342.         &editor_scr_bg_ID,
  2343.         &editor_scr_bg_filename,
  2344.         &editor_scr_bg_x,
  2345.         &editor_scr_bg_y,
  2346.         &editor_scr_bg_opacity);
  2347.     dm_set_scr_bg_image(
  2348.         editor_scr_bg_ID,
  2349.         editor_scr_bg_filename,
  2350.         editor_scr_bg_x,
  2351.         editor_scr_bg_y,
  2352.         current_MMI_theme->bg_opacity_low);
  2353. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  2354.     gui_unlock_double_buffer();
  2355.     ExitCategoryFunction = ExitCategory435Screen;
  2356.     dm_register_category_controlled_callback(category435_draw_controlled_area);
  2357.     /* Do not use dm_get_category_history{_size} */
  2358.     dm_setup_category_functions(dm_redraw_category_screen, GetCategory435History, GetCategory435HistorySize);
  2359.     dm_data.s32ScrId = (S32) GetActiveScreenId();
  2360.     dm_data.s32CatId = MMI_CATEGORY435_ID;
  2361.     dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;
  2362.     dm_data.s32flags |= DM_SHOW_VKPAD;
  2363. #ifdef __MMI_TOUCH_SCREEN__
  2364.     wgui_register_category_screen_control_area_pen_handlers(
  2365.         category435_control_area_pen_down_handler,
  2366.         MMI_PEN_EVENT_DOWN);
  2367.     wgui_register_category_screen_control_area_pen_handlers(category435_control_area_pen_up_handler, MMI_PEN_EVENT_UP);
  2368.     wgui_register_category_screen_control_area_pen_handlers(
  2369.         category435_control_area_pen_move_handler,
  2370.         MMI_PEN_EVENT_MOVE);
  2371.     wgui_register_category_screen_control_area_pen_handlers(
  2372.         category435_control_area_pen_repeat_handler,
  2373.         MMI_PEN_EVENT_REPEAT);
  2374.     wgui_register_category_screen_control_area_pen_handlers(
  2375.         category435_control_area_pen_longtap_handler,
  2376.         MMI_PEN_EVENT_LONG_TAP);
  2377.     wgui_register_category_screen_control_area_pen_handlers(
  2378.         category435_control_area_pen_abort_handler,
  2379.         MMI_PEN_EVENT_ABORT);
  2380. #endif /* __MMI_TOUCH_SCREEN__ */ 
  2381.     dm_setup_data(&dm_data);
  2382.     dm_redraw_category_screen();
  2383. }