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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  *  gui_tab.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *  MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  UI component - Tab pane (__MMI_UI_TAB_PANE__)
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  *------------------------------------------------------------------------------
  76.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  77.  *============================================================================
  78.  ****************************************************************************/
  79. #include "MMI_features.h"
  80. #include "gui_config.h"
  81. #ifdef __MMI_UI_TAB_PANE__
  82. #include "gui_data_types.h"
  83. #include "CustThemesRes.h"
  84. #include "gui_tab.h"
  85. #include "gui.h"
  86. #include "gui_themes.h"
  87. #include "wgui_categories.h"
  88. /***************************************************************************** 
  89.  * Define
  90.  *****************************************************************************/
  91. /* Defines for two icon tab pane */
  92. #define     TWO_PANE_LEFT_ARROW_X         7
  93. #define     TWO_PANE_LEFT_ARROW_Y         3
  94. #define     TWO_PANE_RIGHT_ARROW_X        105
  95. #define     TWO_PANE_RIGHT_ARROW_Y        3
  96. #define     TWO_PANE_FIRST_PANE_X         21
  97. #define     TWO_PANE_FIRST_PANE_Y         0
  98. #define     TWO_PANE_SECOND_PANE_X        64
  99. #define     TWO_PANE_SECOND_PANE_Y        0
  100. #define     TWO_PANE_TAB_PANE_BOX_WIDTH   35
  101. #define     TWO_PANE_TAB_PANE_BOX_HEIGHT  18
  102. /***************************************************************************** 
  103.  * Typedef 
  104.  *****************************************************************************/
  105. /***************************************************************************** 
  106.  * Local Variable
  107.  *****************************************************************************/
  108. /***************************************************************************** 
  109.  * Local Function
  110.  *****************************************************************************/
  111. /***************************************************************************** 
  112.  * Global Variable
  113.  *****************************************************************************/
  114. /***************************************************************************** 
  115.  * Global Function
  116.  *****************************************************************************/
  117. /*****************************************************************************
  118.  * FUNCTION
  119.  *  gui_create_tab_pane
  120.  * DESCRIPTION
  121.  *  used to create the tab pabe
  122.  * PARAMETERS
  123.  *  tab_control     [IN/OUT]        tab control
  124.  *  type            [IN]            type of tab pane
  125.  *  x               [IN]            x position of tab pnae
  126.  *  y               [IN]            y position of tab pnae
  127.  *  width           [IN]            width of tab pane
  128.  *  height          [IN]            heigth of tab pane
  129.  * RETURNS
  130.  *  void
  131.  *****************************************************************************/
  132. void gui_create_tab_pane(
  133.         struct_tab_control *tab_control,
  134.         enum_tab_control_type type,
  135.         S32 x,
  136.         S32 y,
  137.         S32 width,
  138.         S32 height)
  139. {
  140.     /*----------------------------------------------------------------*/
  141.     /* Local Variables                                                */
  142.     /*----------------------------------------------------------------*/
  143.     /*----------------------------------------------------------------*/
  144.     /* Code Body                                                      */
  145.     /*----------------------------------------------------------------*/
  146. #ifdef __MMI_TOUCH_SCREEN__
  147.     memset(tab_control->tab_pane_info, 0, sizeof(tab_control->tab_pane_info));
  148. #endif
  149.     tab_control->type = type;
  150.     tab_control->x = x;
  151.     tab_control->y = y;
  152.     tab_control->width = width;
  153.     tab_control->height = height;
  154.     tab_control->n_items = 0;
  155.     tab_control->set_callback = NULL;
  156.     tab_control->category_exit_callback = NULL;
  157.     tab_control->category_entry_callback = NULL;
  158.     tab_control->highlighted_item = 0;
  159.     tab_control->first_displayed_item = 0;
  160.     tab_control->last_displayed_item = 0;
  161.     tab_control->item_data = NULL;
  162.     tab_control->type_data = NULL;
  163.     tab_control->highlighted_pane = 0;
  164.     tab_control->parent_id = 0;
  165.     tab_control->flags = UI_TAB_CONTROL_NORMAL;
  166.     memset(&tab_control->tab_list_history, 0, sizeof(struct_tab_list_history));
  167.     switch (type)
  168.     {
  169.         case TAB_CONTROL_WITH_TWO_ICON:
  170.             tab_control->draw_function = gui_show_icon_tab_pane;
  171.             tab_control->goto_function = gui_goto_two_item_tab_pane;
  172.             tab_control->next_function = gui_next_two_item_tab_pane;
  173.             tab_control->prev_function = gui_prev_two_item_tab_pane;
  174.             break;
  175.         case TAB_CONTROL_WITH_TWO_TEXT:
  176.             tab_control->draw_function = gui_show_text_tab_pane;
  177.             tab_control->goto_function = gui_goto_two_item_tab_pane;
  178.             tab_control->next_function = gui_next_two_item_tab_pane;
  179.             tab_control->prev_function = gui_prev_two_item_tab_pane;
  180.             break;
  181.         case TAB_CONTROL_WITH_FOUR_ICON:
  182.             tab_control->draw_function = gui_show_icon_tab_pane;
  183.             tab_control->goto_function = gui_goto_four_item_tab_pane;
  184.             tab_control->next_function = gui_next_four_item_tab_pane;
  185.             tab_control->prev_function = gui_prev_four_item_tab_pane;
  186.             break;
  187.         case TAB_CONTROL_WITH_THREE_ICON:
  188.             tab_control->draw_function = gui_show_icon_tab_pane;
  189.             tab_control->goto_function = gui_goto_three_item_tab_pane;
  190.             tab_control->next_function = gui_next_three_item_tab_pane;
  191.             tab_control->prev_function = gui_prev_three_item_tab_pane;
  192.             break;
  193.         case TAB_CONTROL_WITH_ONE_ICON:
  194.             tab_control->draw_function = gui_show_icon_tab_pane;
  195.             tab_control->goto_function = gui_goto_one_item_tab_pane;
  196.             tab_control->next_function = gui_next_one_item_tab_pane;
  197.             tab_control->prev_function = gui_prev_one_item_tab_pane;
  198.             break;
  199.         default:
  200.             tab_control->draw_function = gui_show_icon_tab_pane;
  201.             tab_control->goto_function = gui_goto_two_item_tab_pane;
  202.             tab_control->next_function = gui_next_two_item_tab_pane;
  203.             tab_control->prev_function = gui_prev_two_item_tab_pane;
  204.             break;
  205.     }
  206. }
  207. /*****************************************************************************
  208.  * FUNCTION
  209.  *  gui_associate_tab_pane_type_data
  210.  * DESCRIPTION
  211.  *  Used to set data for tab control
  212.  * PARAMETERS
  213.  *  tab_control     [IN/OUT]        
  214.  *  type_data       [IN]            pointer to data for tab pane. data varies from type to type
  215.  * RETURNS
  216.  *  void
  217.  *****************************************************************************/
  218. void gui_associate_tab_pane_type_data(struct_tab_control *tab_control, void *type_data)
  219. {
  220.     /*----------------------------------------------------------------*/
  221.     /* Local Variables                                                */
  222.     /*----------------------------------------------------------------*/
  223.     /*----------------------------------------------------------------*/
  224.     /* Code Body                                                      */
  225.     /*----------------------------------------------------------------*/
  226.     tab_control->type_data = type_data;
  227. }
  228. /*****************************************************************************
  229.  * FUNCTION
  230.  *  gui_associate_tab_pane_item_data
  231.  * DESCRIPTION
  232.  *  Used to set item data for tab control
  233.  * PARAMETERS
  234.  *  tab_control     [IN/OUT]             
  235.  *  item_data       [IN]            pointer to item data for tab pane. this data depends on the items to be displayed.
  236.  * RETURNS
  237.  *  void
  238.  *****************************************************************************/
  239. void gui_associate_tab_pane_item_data(struct_tab_control *tab_control, struct_tab_items *item_data)
  240. {
  241.     /*----------------------------------------------------------------*/
  242.     /* Local Variables                                                */
  243.     /*----------------------------------------------------------------*/
  244.     /*----------------------------------------------------------------*/
  245.     /* Code Body                                                      */
  246.     /*----------------------------------------------------------------*/
  247.     tab_control->item_data = item_data;
  248. }
  249. /*****************************************************************************
  250.  * FUNCTION
  251.  *  gui_register_set_tab_pane_callback
  252.  * DESCRIPTION
  253.  *  Used to call backs for the tab pane
  254.  * PARAMETERS
  255.  *  tab_control             [IN/OUT]             
  256.  *  callback                [IN]            call back for setting up tab pane
  257.  *  set_data_callback       [IN]            call back for setting data for tab pane. specific to application
  258.  *  reset_data_callback     [IN]            call back for resetting data for tab pane. specific to application
  259.  * RETURNS
  260.  *  void
  261.  *****************************************************************************/
  262. void gui_register_set_tab_pane_callback(
  263.         struct_tab_control *tab_control,
  264.         void (*callback) (void),
  265.         void (*set_data_callback) (void),
  266.         void (*reset_data_callback) (void))
  267. {
  268.     /*----------------------------------------------------------------*/
  269.     /* Local Variables                                                */
  270.     /*----------------------------------------------------------------*/
  271.     /*----------------------------------------------------------------*/
  272.     /* Code Body                                                      */
  273.     /*----------------------------------------------------------------*/
  274.     tab_control->set_callback = callback;
  275.     tab_control->set_data_callback = set_data_callback;
  276.     tab_control->reset_data_callback = reset_data_callback;
  277. }
  278. /*****************************************************************************
  279.  * FUNCTION
  280.  *  gui_add_item_tab_pane
  281.  * DESCRIPTION
  282.  *  Used to add items to tab pane
  283.  * PARAMETERS
  284.  *  tab_control     [IN/OUT]             
  285.  *  text            [IN]            text for tab pane
  286.  *  icon            [IN]            icon for tab pane
  287.  * RETURNS
  288.  *  void
  289.  *****************************************************************************/
  290. void gui_add_item_tab_pane(struct_tab_control *tab_control, UI_string_type text, PU8 icon)
  291. {
  292.     /*----------------------------------------------------------------*/
  293.     /* Local Variables                                                */
  294.     /*----------------------------------------------------------------*/
  295.     /*----------------------------------------------------------------*/
  296.     /* Code Body                                                      */
  297.     /*----------------------------------------------------------------*/
  298.     tab_control->item_data[tab_control->n_items].item_text = text;
  299.     tab_control->item_data[tab_control->n_items].item_icon = icon;
  300.     tab_control->n_items++;
  301. }
  302. /*****************************************************************************
  303.  * FUNCTION
  304.  *  gui_show_tab_pane
  305.  * DESCRIPTION
  306.  *  Used to show tab pane
  307.  * PARAMETERS
  308.  *  tab_control     [IN/OUT]             
  309.  * RETURNS
  310.  *  void
  311.  *****************************************************************************/
  312. void gui_show_tab_pane(struct_tab_control *tab_control)
  313. {
  314.     /*----------------------------------------------------------------*/
  315.     /* Local Variables                                                */
  316.     /*----------------------------------------------------------------*/
  317.     /*----------------------------------------------------------------*/
  318.     /* Code Body                                                      */
  319.     /*----------------------------------------------------------------*/
  320.     if (tab_control->draw_function)
  321.     {
  322.         tab_control->draw_function(tab_control);
  323.     }
  324. }
  325. /*****************************************************************************
  326.  * FUNCTION
  327.  *  gui_go_to_item
  328.  * DESCRIPTION
  329.  *  Used to go to some speciffic item in tab pane
  330.  * PARAMETERS
  331.  *  tab_control     [IN/OUT]             
  332.  *  index           [IN]            item on which to go
  333.  * RETURNS
  334.  *  void
  335.  *****************************************************************************/
  336. void gui_go_to_item(struct_tab_control *tab_control, S32 index)
  337. {
  338.     /*----------------------------------------------------------------*/
  339.     /* Local Variables                                                */
  340.     /*----------------------------------------------------------------*/
  341.     /*----------------------------------------------------------------*/
  342.     /* Code Body                                                      */
  343.     /*----------------------------------------------------------------*/
  344.     if (tab_control->goto_function)
  345.     {
  346.         tab_control->goto_function(tab_control, index);
  347.     }
  348. }
  349. /*****************************************************************************
  350.  * FUNCTION
  351.  *  gui_tab_pane_next_item
  352.  * DESCRIPTION
  353.  *  Used to go tonext item in tab pane
  354.  * PARAMETERS
  355.  *  tab_control     [IN/OUT]             
  356.  * RETURNS
  357.  *  void
  358.  *****************************************************************************/
  359. void gui_tab_pane_next_item(struct_tab_control *tab_control)
  360. {
  361. #ifdef MMI_TAB_PANE_LIST_HISTORY
  362.     /*----------------------------------------------------------------*/
  363.     /* Local Variables                                                */
  364.     /*----------------------------------------------------------------*/
  365.     list_menu_category_history list_history;
  366.     /*----------------------------------------------------------------*/
  367.     /* Code Body                                                      */
  368.     /*----------------------------------------------------------------*/
  369.     get_list_menu_category_history(1, (U8*) & list_history);
  370.     tab_control->tab_list_history.first_displayed_item[tab_control->highlighted_item]
  371.         = list_history.first_displayed_item;
  372.     tab_control->tab_list_history.highlighted_item[tab_control->highlighted_item] = list_history.highlighted_item;
  373.     tab_control->tab_list_history.last_displayed_item[tab_control->highlighted_item] = list_history.last_displayed_item;
  374. #endif /* MMI_TAB_PANE_LIST_HISTORY */ 
  375.     if (tab_control->highlighted_item == tab_control->n_items - 1 && (tab_control->flags & UI_TAB_CONTROL_CYCLIC))
  376.     {
  377.         if (tab_control->goto_function)
  378.         {
  379.             tab_control->goto_function(tab_control, 0);
  380.         }
  381.         return;
  382.     }
  383.     if (tab_control->next_function)
  384.     {
  385.         tab_control->next_function(tab_control);
  386.     }
  387. }
  388. /*****************************************************************************
  389.  * FUNCTION
  390.  *  gui_tab_pane_prev_item
  391.  * DESCRIPTION
  392.  *  Used to go to previous item in tab pane
  393.  * PARAMETERS
  394.  *  tab_control     [IN/OUT]             
  395.  * RETURNS
  396.  *  void
  397.  *****************************************************************************/
  398. void gui_tab_pane_prev_item(struct_tab_control *tab_control)
  399. {
  400. #ifdef MMI_TAB_PANE_LIST_HISTORY
  401.     /*----------------------------------------------------------------*/
  402.     /* Local Variables                                                */
  403.     /*----------------------------------------------------------------*/
  404.     list_menu_category_history list_history;
  405.     /*----------------------------------------------------------------*/
  406.     /* Code Body                                                      */
  407.     /*----------------------------------------------------------------*/
  408.     get_list_menu_category_history(1, (U8*) & list_history);
  409.     tab_control->tab_list_history.first_displayed_item[tab_control->highlighted_item]
  410.         = list_history.first_displayed_item;
  411.     tab_control->tab_list_history.highlighted_item[tab_control->highlighted_item] = list_history.highlighted_item;
  412.     tab_control->tab_list_history.last_displayed_item[tab_control->highlighted_item] = list_history.last_displayed_item;
  413. #endif /* MMI_TAB_PANE_LIST_HISTORY */ 
  414.     if (tab_control->highlighted_item == 0 && (tab_control->flags & UI_TAB_CONTROL_CYCLIC))
  415.     {
  416.         if (tab_control->goto_function)
  417.         {
  418.             tab_control->goto_function(tab_control, tab_control->n_items - 1);
  419.         }
  420.         return;
  421.     }
  422.     if (tab_control->prev_function)
  423.     {
  424.         tab_control->prev_function(tab_control);
  425.     }
  426. }
  427. /*****************************************************************************
  428.  * FUNCTION
  429.  *  gui_set_tab_pane_hightlight_fucntion
  430.  * DESCRIPTION
  431.  *  Used to set hightligth function for tab pane
  432.  * PARAMETERS
  433.  *  tab_control     [IN/OUT]             
  434.  *  f               [IN]            hightlight function
  435.  * RETURNS
  436.  *  void
  437.  *****************************************************************************/
  438. void gui_set_tab_pane_hightlight_fucntion(struct_tab_control *tab_control, void (*f) (S32 item_index))
  439. {
  440.     /*----------------------------------------------------------------*/
  441.     /* Local Variables                                                */
  442.     /*----------------------------------------------------------------*/
  443.     /*----------------------------------------------------------------*/
  444.     /* Code Body                                                      */
  445.     /*----------------------------------------------------------------*/
  446.     tab_control->highlight_function = f;
  447. }
  448. /*****************************************************************************
  449.  * FUNCTION
  450.  *  gui_highlight_function
  451.  * DESCRIPTION
  452.  *  call the hightligth function for tab pane
  453.  * PARAMETERS
  454.  *  tab_control     [IN/OUT]             
  455.  *  index           [IN]            index of item to be highlighted
  456.  * RETURNS
  457.  *  void
  458.  *****************************************************************************/
  459. void gui_highlight_function(struct_tab_control *tab_control, S32 index)
  460. {
  461.     /*----------------------------------------------------------------*/
  462.     /* Local Variables                                                */
  463.     /*----------------------------------------------------------------*/
  464.     /*----------------------------------------------------------------*/
  465.     /* Code Body                                                      */
  466.     /*----------------------------------------------------------------*/
  467.     if (tab_control->highlight_function)
  468.     {
  469.         tab_control->highlight_function(index);
  470.     }
  471. }
  472. /*****************************************************************************
  473.  * FUNCTION
  474.  *  gui_move_tab_pane
  475.  * DESCRIPTION
  476.  *  call the move tab pane
  477.  * PARAMETERS
  478.  *  tab_control     [IN/OUT]             
  479.  *  x               [IN]            x position of tab pane
  480.  *  y               [IN]            y position of tab pane
  481.  * RETURNS
  482.  *  void
  483.  *****************************************************************************/
  484. void gui_move_tab_pane(struct_tab_control *tab_control, S32 x, S32 y)
  485. {
  486.     /*----------------------------------------------------------------*/
  487.     /* Local Variables                                                */
  488.     /*----------------------------------------------------------------*/
  489.     /*----------------------------------------------------------------*/
  490.     /* Code Body                                                      */
  491.     /*----------------------------------------------------------------*/
  492.     tab_control->x = x;
  493.     tab_control->y = y;
  494. }
  495. /*****************************************************************************
  496.  * FUNCTION
  497.  *  gui_resize_tab_pane
  498.  * DESCRIPTION
  499.  *  call the resize tab pane
  500.  * PARAMETERS
  501.  *  tab_control     [IN/OUT]             
  502.  *  height          [IN]            height position of tab pane
  503.  *  width           [IN]            width position of tab pane
  504.  * RETURNS
  505.  *  void
  506.  *****************************************************************************/
  507. void gui_resize_tab_pane(struct_tab_control *tab_control, S32 height, S32 width)
  508. {
  509.     /*----------------------------------------------------------------*/
  510.     /* Local Variables                                                */
  511.     /*----------------------------------------------------------------*/
  512.     /*----------------------------------------------------------------*/
  513.     /* Code Body                                                      */
  514.     /*----------------------------------------------------------------*/
  515.     tab_control->height = height;
  516.     tab_control->width = width;
  517. }
  518. /*****************************************************************************
  519.  * FUNCTION
  520.  *  gui_tab_pane_show_navigation_keys
  521.  * DESCRIPTION
  522.  *  Used to display navigation keys of the tab pane
  523.  * PARAMETERS
  524.  *  tab_control     [IN/OUT]             
  525.  * RETURNS
  526.  *  void
  527.  *****************************************************************************/
  528. void gui_tab_pane_show_navigation_keys(struct_tab_control *tab_control)
  529. {
  530. #if 0
  531. /* under construction !*/
  532. /* under construction !*/
  533. /* under construction !*/
  534. /* under construction !*/
  535. /* under construction !*/
  536. /* under construction !*/
  537. /* under construction !*/
  538. /* under construction !*/
  539. /* under construction !*/
  540. /* under construction !*/
  541. /* under construction !*/
  542. /* under construction !*/
  543. /* under construction !*/
  544. /* under construction !*/
  545. /* under construction !*/
  546. /* under construction !*/
  547. /* under construction !*/
  548. /* under construction !*/
  549. /* under construction !*/
  550. /* under construction !*/
  551. /* under construction !*/
  552. /* under construction !*/
  553. /* under construction !*/
  554. /* under construction !*/
  555. /* under construction !*/
  556. /* under construction !*/
  557. /* under construction !*/
  558. /* under construction !*/
  559. /* under construction !*/
  560. /* under construction !*/
  561. /* under construction !*/
  562. /* under construction !*/
  563. /* under construction !*/
  564. /* under construction !*/
  565. /* under construction !*/
  566. /* under construction !*/
  567. /* under construction !*/
  568. /* under construction !*/
  569. /* under construction !*/
  570. /* under construction !*/
  571. /* under construction !*/
  572. /* under construction !*/
  573. /* under construction !*/
  574. /* under construction !*/
  575. /* under construction !*/
  576. /* under construction !*/
  577. /* under construction !*/
  578. /* under construction !*/
  579. /* under construction !*/
  580. #else /* 0 */ 
  581.     S8 up, down, left, right;
  582.     /*----------------------------------------------------------------*/
  583.     /* Code Body                                                      */
  584.     /*----------------------------------------------------------------*/
  585.     up = 1;
  586.     down = 1;
  587.     if (tab_control->flags & UI_TAB_CONTROL_CYCLIC)
  588.     {
  589.         left = right = 1;
  590.     }
  591.     else
  592.     {
  593.         if (tab_control->highlighted_item == 0)
  594.         {
  595.             left = 0;
  596.         }
  597.         else
  598.         {
  599.             left = 1;
  600.         }
  601.         if (tab_control->highlighted_item == tab_control->n_items - 1)
  602.         {
  603.             right = 0;
  604.         }
  605.         else
  606.         {
  607.             right = 1;
  608.         }
  609.     }
  610.     draw_arrow_indication(left, right, up, down);
  611. #endif /* 0 */ 
  612. }
  613. #if 0
  614. /* under construction !*/
  615. /* under construction !*/
  616. /* under construction !*/
  617. /* under construction !*/
  618. /* under construction !*/
  619. /* under construction !*/
  620. /* under construction !*/
  621. /* under construction !*/
  622. /* under construction !*/
  623. /* under construction !*/
  624. /* under construction !*/
  625. /* under construction !*/
  626. /* under construction !*/
  627. /* under construction !*/
  628. /* under construction !*/
  629. /* under construction !*/
  630. /* under construction !*/
  631. /* under construction !*/
  632. /* under construction !*/
  633. /* under construction !*/
  634. /* under construction !*/
  635. /* under construction !*/
  636. /* under construction !*/
  637. /* under construction !*/
  638. /* under construction !*/
  639. /* under construction !*/
  640. /* under construction !*/
  641. /* under construction !*/
  642. /* under construction !*/
  643. /* under construction !*/
  644. /* under construction !*/
  645. /* under construction !*/
  646. /* under construction !*/
  647. /* under construction !*/
  648. /* under construction !*/
  649. /* under construction !*/
  650. /* under construction !*/
  651. /* under construction !*/
  652. /* under construction !*/
  653. /* under construction !*/
  654. /* under construction !*/
  655. /* under construction !*/
  656. /* under construction !*/
  657. /* under construction !*/
  658. /* under construction !*/
  659. /* under construction !*/
  660. /* under construction !*/
  661. /* under construction !*/
  662. #endif /* 0 */ 
  663. /*****************************************************************************
  664.  * FUNCTION
  665.  *  gui_goto_two_item_tab_pane
  666.  * DESCRIPTION
  667.  *  go to function for two item tab pane
  668.  * PARAMETERS
  669.  *  tab_control     [IN/OUT]             
  670.  *  index           [IN]            item to go to
  671.  * RETURNS
  672.  *  void
  673.  *****************************************************************************/
  674. void gui_goto_two_item_tab_pane(struct_tab_control *tab_control, S32 index)
  675. {
  676.     /*----------------------------------------------------------------*/
  677.     /* Local Variables                                                */
  678.     /*----------------------------------------------------------------*/
  679.     /*----------------------------------------------------------------*/
  680.     /* Code Body                                                      */
  681.     /*----------------------------------------------------------------*/
  682.     if (index < 0 || index > tab_control->n_items - 1)
  683.     {
  684.         return;
  685.     }
  686.     if (index == tab_control->n_items - 1)
  687.     {
  688.         tab_control->first_displayed_item = index - 1;
  689.         tab_control->highlighted_item = index;
  690.         tab_control->last_displayed_item = index;
  691.         tab_control->highlighted_pane = 1;
  692.     }
  693.     else
  694.     {
  695.         tab_control->first_displayed_item = index;
  696.         tab_control->highlighted_item = index;
  697.         tab_control->last_displayed_item = index + 1;
  698.         tab_control->highlighted_pane = 0;
  699.     }
  700. }
  701. /*****************************************************************************
  702.  * FUNCTION
  703.  *  gui_next_two_item_tab_pane
  704.  * DESCRIPTION
  705.  *  next function function for two item tab pane
  706.  * PARAMETERS
  707.  *  tab_control     [IN/OUT]             
  708.  * RETURNS
  709.  *  void
  710.  *****************************************************************************/
  711. void gui_next_two_item_tab_pane(struct_tab_control *tab_control)
  712. {
  713.     /*----------------------------------------------------------------*/
  714.     /* Local Variables                                                */
  715.     /*----------------------------------------------------------------*/
  716.     /*----------------------------------------------------------------*/
  717.     /* Code Body                                                      */
  718.     /*----------------------------------------------------------------*/
  719.     if (tab_control->highlighted_item == tab_control->n_items - 1)
  720.     {
  721.         return;
  722.     }
  723.     tab_control->highlighted_item++;
  724.     if (tab_control->highlighted_pane == 0)
  725.     {
  726.         tab_control->highlighted_pane = 1;
  727.     }
  728.     else
  729.     {
  730.         tab_control->first_displayed_item = tab_control->last_displayed_item;
  731.         tab_control->last_displayed_item = tab_control->highlighted_item;
  732.     }
  733. }
  734. /*****************************************************************************
  735.  * FUNCTION
  736.  *  gui_prev_two_item_tab_pane
  737.  * DESCRIPTION
  738.  *  previous function function for two item tab pane
  739.  * PARAMETERS
  740.  *  tab_control     [IN/OUT]             
  741.  * RETURNS
  742.  *  void
  743.  *****************************************************************************/
  744. void gui_prev_two_item_tab_pane(struct_tab_control *tab_control)
  745. {
  746.     /*----------------------------------------------------------------*/
  747.     /* Local Variables                                                */
  748.     /*----------------------------------------------------------------*/
  749.     /*----------------------------------------------------------------*/
  750.     /* Code Body                                                      */
  751.     /*----------------------------------------------------------------*/
  752.     if (tab_control->highlighted_item == 0)
  753.     {
  754.         return;
  755.     }
  756.     tab_control->highlighted_item--;
  757.     if (tab_control->highlighted_pane == 1)
  758.     {
  759.         tab_control->highlighted_pane = 0;
  760.     }
  761.     else
  762.     {
  763.         tab_control->last_displayed_item = tab_control->first_displayed_item;
  764.         tab_control->first_displayed_item = tab_control->highlighted_item;
  765.     }
  766. }
  767. /*****************************************************************************
  768.  * FUNCTION
  769.  *  gui_save_parent_id
  770.  * DESCRIPTION
  771.  *  used to save parent id for tab pane
  772.  * PARAMETERS
  773.  *  tab_control     [IN/OUT]             
  774.  *  parent_id       [IN]            parent id of tab pane
  775.  * RETURNS
  776.  *  void
  777.  *****************************************************************************/
  778. void gui_save_parent_id(struct_tab_control *tab_control, S32 parent_id)
  779. {
  780.     /*----------------------------------------------------------------*/
  781.     /* Local Variables                                                */
  782.     /*----------------------------------------------------------------*/
  783.     /*----------------------------------------------------------------*/
  784.     /* Code Body                                                      */
  785.     /*----------------------------------------------------------------*/
  786.     tab_control->parent_id = parent_id;
  787. }
  788. /*****************************************************************************
  789.  * FUNCTION
  790.  *  gui_show_text_tab_pane
  791.  * DESCRIPTION
  792.  *  used to show text tab pane
  793.  * PARAMETERS
  794.  *  tab_control     [IN/OUT]             
  795.  * RETURNS
  796.  *  void
  797.  *****************************************************************************/
  798. void gui_show_text_tab_pane(struct_tab_control *tab_control)
  799. {
  800.     /*----------------------------------------------------------------*/
  801.     /* Local Variables                                                */
  802.     /*----------------------------------------------------------------*/
  803.     struct_tab_text_data *tab_pane_data = (struct_tab_text_data*) tab_control->type_data;
  804.     S32 i;
  805.     PU8 back_image;
  806.     S32 x1, x2, y1, y2;
  807.     S32 ix, iy;
  808.     S32 swidth, sheight;
  809.     S32 width, height;
  810.     color text_color;
  811.     /*----------------------------------------------------------------*/
  812.     /* Code Body                                                      */
  813.     /*----------------------------------------------------------------*/
  814.     x1 = tab_control->x;
  815.     x2 = tab_control->x + tab_control->width - 1;
  816.     y1 = tab_control->y;
  817.     y2 = tab_control->y + tab_control->height - 1;
  818.     gui_push_clip();
  819.     gui_push_text_clip();
  820.     gui_set_clip(x1, y1, x2, y2);
  821.     gui_fill_rectangle(x1, y1, x2, y2, UI_COLOR_WHITE);
  822.     for (i = tab_control->first_displayed_item; i <= tab_control->last_displayed_item; i++)
  823.     {
  824.         if (i == tab_control->highlighted_item)
  825.         {
  826.             back_image = tab_pane_data->highlight_image;
  827.             text_color = tab_pane_data->highlight_text_color;
  828.         }
  829.         else
  830.         {
  831.             back_image = tab_pane_data->un_highlight_image;
  832.             text_color = tab_pane_data->un_highlight_text_color;
  833.         }
  834.         gui_measure_image(back_image, &width, &height);
  835.         y1 = y1 + tab_control->height - height;
  836.         gui_set_clip(x1, y1, x1 + width, y1 + height);
  837.         gui_show_image(x1, y1, back_image);
  838.         gui_set_font(tab_pane_data->font);
  839.         gui_set_text_color(text_color);
  840.         gui_measure_string(tab_control->item_data[i].item_text, &swidth, &sheight);
  841.         if (width > swidth)
  842.         {
  843.             ix = x1 + ((width - swidth) >> 1);
  844.         }
  845.         else
  846.         {
  847.             ix = x1;
  848.         }
  849.         if (height > sheight)
  850.         {
  851.             iy = y1 + ((height - sheight) >> 1);
  852.         }
  853.         else
  854.         {
  855.             iy = y1;
  856.         }
  857.         gui_set_text_clip(ix, iy, x1 + width, y1 + height);
  858.         gui_move_text_cursor(ix, iy);
  859.         gui_print_text(tab_control->item_data[i].item_text);
  860.         x1 += width;
  861.         y1 = tab_control->y;
  862.     }
  863.     gui_tab_pane_show_navigation_keys(tab_control);
  864.     gui_pop_clip();
  865.     gui_pop_text_clip();
  866. }
  867. /*****************************************************************************
  868.  * FUNCTION
  869.  *  gui_goto_three_item_tab_pane
  870.  * DESCRIPTION
  871.  *  go to function for three item tab pane
  872.  * PARAMETERS
  873.  *  tab_control     [IN/OUT]             
  874.  *  index           [IN]            
  875.  * RETURNS
  876.  *  void
  877.  *****************************************************************************/
  878. void gui_goto_three_item_tab_pane(struct_tab_control *tab_control, S32 index)
  879. {
  880.     /*----------------------------------------------------------------*/
  881.     /* Local Variables                                                */
  882.     /*----------------------------------------------------------------*/
  883.     /*----------------------------------------------------------------*/
  884.     /* Code Body                                                      */
  885.     /*----------------------------------------------------------------*/
  886.     if (index < 0 || index > tab_control->n_items - 1)
  887.     {
  888.         return;
  889.     }
  890.     if (index == tab_control->n_items - 1)
  891.     {
  892.         tab_control->first_displayed_item = index - 2;
  893.         tab_control->highlighted_item = index;
  894.         tab_control->last_displayed_item = index;
  895.         tab_control->highlighted_pane = 2;
  896.     }
  897.     else if (index == tab_control->n_items - 2)
  898.     {
  899.         tab_control->first_displayed_item = index - 1;
  900.         tab_control->highlighted_item = index;
  901.         tab_control->last_displayed_item = index + 1;
  902.         tab_control->highlighted_pane = 1;
  903.     }
  904.     else
  905.     {
  906.         tab_control->first_displayed_item = index;
  907.         tab_control->highlighted_item = index;
  908.         tab_control->last_displayed_item = index + 2;
  909.         tab_control->highlighted_pane = 0;
  910.     }
  911. }
  912. /*****************************************************************************
  913.  * FUNCTION
  914.  *  gui_next_three_item_tab_pane
  915.  * DESCRIPTION
  916.  *  next function for three item tab pane
  917.  * PARAMETERS
  918.  *  tab_control     [IN/OUT]             
  919.  * RETURNS
  920.  *  void
  921.  *****************************************************************************/
  922. void gui_next_three_item_tab_pane(struct_tab_control *tab_control)
  923. {
  924.     /*----------------------------------------------------------------*/
  925.     /* Local Variables                                                */
  926.     /*----------------------------------------------------------------*/
  927.     /*----------------------------------------------------------------*/
  928.     /* Code Body                                                      */
  929.     /*----------------------------------------------------------------*/
  930.     if (tab_control->highlighted_item == tab_control->n_items - 1)
  931.     {
  932.         return;
  933.     }
  934.     tab_control->highlighted_item++;
  935.     switch (tab_control->highlighted_pane)
  936.     {
  937.         case 0:
  938.             tab_control->highlighted_pane = 1;
  939.             break;
  940.         case 1:
  941.             tab_control->highlighted_pane = 2;
  942.             break;
  943.         default:
  944.             tab_control->first_displayed_item += 1;
  945.             tab_control->last_displayed_item = tab_control->highlighted_item;
  946.             break;
  947.     }
  948. }
  949. /*****************************************************************************
  950.  * FUNCTION
  951.  *  gui_prev_three_item_tab_pane
  952.  * DESCRIPTION
  953.  *  previous function for three item tab pane
  954.  * PARAMETERS
  955.  *  tab_control     [IN/OUT]             
  956.  * RETURNS
  957.  *  void
  958.  *****************************************************************************/
  959. void gui_prev_three_item_tab_pane(struct_tab_control *tab_control)
  960. {
  961.     /*----------------------------------------------------------------*/
  962.     /* Local Variables                                                */
  963.     /*----------------------------------------------------------------*/
  964.     /*----------------------------------------------------------------*/
  965.     /* Code Body                                                      */
  966.     /*----------------------------------------------------------------*/
  967.     if (tab_control->highlighted_item == 0)
  968.     {
  969.         return;
  970.     }
  971.     tab_control->highlighted_item--;
  972.     switch (tab_control->highlighted_pane)
  973.     {
  974.         case 2:
  975.             tab_control->highlighted_pane = 1;
  976.             break;
  977.         case 1:
  978.             tab_control->highlighted_pane = 0;
  979.             break;
  980.         default:
  981.             tab_control->last_displayed_item -= 1;
  982.             tab_control->first_displayed_item = tab_control->highlighted_item;
  983.             break;
  984.     }
  985. }
  986. /*****************************************************************************
  987.  * FUNCTION
  988.  *  gui_show_icon_tab_pane
  989.  * DESCRIPTION
  990.  *  show function for icon item tab pane
  991.  * PARAMETERS
  992.  *  tab_control     [IN/OUT]             
  993.  * RETURNS
  994.  *  void
  995.  *****************************************************************************/
  996. void gui_show_icon_tab_pane(struct_tab_control *tab_control)
  997. {
  998.     /*----------------------------------------------------------------*/
  999.     /* Local Variables                                                */
  1000.     /*----------------------------------------------------------------*/
  1001.     struct_tab_icon_data *tab_pane_data = (struct_tab_icon_data*) tab_control->type_data;
  1002.     S32 i;
  1003.     PU8 back_image;
  1004.     S32 pane=0;
  1005.     S32 x1, x2, y1, y2;
  1006.     S32 ix, iy;
  1007.     S32 iwidth, iheight;
  1008.     S32 width, height;
  1009.     /*----------------------------------------------------------------*/
  1010.     /* Code Body                                                      */
  1011.     /*----------------------------------------------------------------*/
  1012.     if (!tab_control->width || !tab_control->height)
  1013.     {
  1014.         gui_tab_pane_show_navigation_keys(tab_control);
  1015.         return;
  1016.     }
  1017.     x1 = tab_control->x;
  1018.     x2 = tab_control->x + tab_control->width - 1;
  1019.     y1 = tab_control->y;
  1020.     y2 = tab_control->y + tab_control->height - 1;
  1021.     gui_push_clip();
  1022.     gui_set_clip(x1, y1, x2, y2);
  1023.     gui_fill_rectangle(x1, y1, x2, y2, UI_COLOR_WHITE);
  1024.     for (i = tab_control->first_displayed_item; i <= tab_control->last_displayed_item; i++)
  1025.     {
  1026.         if (i == tab_control->highlighted_item)
  1027.         {
  1028.             back_image = tab_pane_data->highlight_image;
  1029.         }
  1030.         else
  1031.         {
  1032.             back_image = tab_pane_data->un_highlight_image;
  1033.         }
  1034.         gui_measure_image(back_image, &width, &height);
  1035.         y1 = y1 + tab_control->height - height;
  1036.         gui_set_clip(x1, y1, x1 + width, y1 + height);
  1037.     #ifdef __MMI_TOUCH_SCREEN__        
  1038.         tab_control->tab_pane_info[pane].x=x1;
  1039.         tab_control->tab_pane_info[pane].y=y1;
  1040.         tab_control->tab_pane_info[pane].height=height;
  1041.         tab_control->tab_pane_info[pane].width=width;
  1042.     #endif /* __MMI_TOUCH_SCREEN__ */ 
  1043.         ++pane;
  1044.         gui_show_image(x1, y1, back_image);
  1045.         gui_measure_image(tab_control->item_data[i].item_icon, &iwidth, &iheight);
  1046.         if (width > iwidth)
  1047.         {
  1048.             ix = x1 + ((width - iwidth) >> 1);
  1049.         }
  1050.         else
  1051.         {
  1052.             ix = x1;
  1053.         }
  1054.         if (height > iheight)
  1055.         {
  1056.             iy = y1 + ((height - iheight) >> 1);
  1057.         }
  1058.         else
  1059.         {
  1060.             iy = y1;
  1061.         }
  1062.         gui_set_clip(ix, iy, x1 + width, y1 + height);
  1063.         gui_show_transparent_image(ix, iy, tab_control->item_data[i].item_icon, 0);
  1064.         x1 += width;
  1065.         y1 = tab_control->y;
  1066.     }
  1067.     gui_tab_pane_show_navigation_keys(tab_control);
  1068.     gui_pop_clip();
  1069. }
  1070. /*****************************************************************************
  1071.  * FUNCTION
  1072.  *  gui_goto_four_item_tab_pane
  1073.  * DESCRIPTION
  1074.  *  go to function for four item item tab pane
  1075.  * PARAMETERS
  1076.  *  tab_control     [IN/OUT]             
  1077.  *  index           [IN]            
  1078.  * RETURNS
  1079.  *  void
  1080.  *****************************************************************************/
  1081. void gui_goto_four_item_tab_pane(struct_tab_control *tab_control, S32 index)
  1082. {
  1083.     /*----------------------------------------------------------------*/
  1084.     /* Local Variables                                                */
  1085.     /*----------------------------------------------------------------*/
  1086.     /*----------------------------------------------------------------*/
  1087.     /* Code Body                                                      */
  1088.     /*----------------------------------------------------------------*/
  1089.     if (index < 0 || index > tab_control->n_items - 1)
  1090.     {
  1091.         return;
  1092.     }
  1093.     if (index == tab_control->n_items - 1)
  1094.     {
  1095.         tab_control->first_displayed_item = index - 3;
  1096.         tab_control->highlighted_item = index;
  1097.         tab_control->last_displayed_item = index;
  1098.         tab_control->highlighted_pane = 3;
  1099.     }
  1100.     else if (index == tab_control->n_items - 2)
  1101.     {
  1102.         tab_control->first_displayed_item = index - 2;
  1103.         tab_control->highlighted_item = index;
  1104.         tab_control->last_displayed_item = index + 1;
  1105.         tab_control->highlighted_pane = 2;
  1106.     }
  1107.     else if (index == tab_control->n_items - 3)
  1108.     {
  1109.         tab_control->first_displayed_item = index - 1;
  1110.         tab_control->highlighted_item = index;
  1111.         tab_control->last_displayed_item = index + 2;
  1112.         tab_control->highlighted_pane = 1;
  1113.     }
  1114.     else
  1115.     {
  1116.         tab_control->first_displayed_item = index;
  1117.         tab_control->highlighted_item = index;
  1118.         tab_control->last_displayed_item = index + 3;
  1119.         tab_control->highlighted_pane = 0;
  1120.     }
  1121. }
  1122. /*****************************************************************************
  1123.  * FUNCTION
  1124.  *  gui_next_four_item_tab_pane
  1125.  * DESCRIPTION
  1126.  *  next function for four item item tab pane
  1127.  * PARAMETERS
  1128.  *  tab_control     [IN/OUT]             
  1129.  * RETURNS
  1130.  *  void
  1131.  *****************************************************************************/
  1132. void gui_next_four_item_tab_pane(struct_tab_control *tab_control)
  1133. {
  1134.     /*----------------------------------------------------------------*/
  1135.     /* Local Variables                                                */
  1136.     /*----------------------------------------------------------------*/
  1137.     /*----------------------------------------------------------------*/
  1138.     /* Code Body                                                      */
  1139.     /*----------------------------------------------------------------*/
  1140.     if (tab_control->highlighted_item == tab_control->n_items - 1)
  1141.     {
  1142.         return;
  1143.     }
  1144.     tab_control->highlighted_item++;
  1145.     switch (tab_control->highlighted_pane)
  1146.     {
  1147.         case 0:
  1148.             tab_control->highlighted_pane = 1;
  1149.             break;
  1150.         case 1:
  1151.             tab_control->highlighted_pane = 2;
  1152.             break;
  1153.         case 2:
  1154.             tab_control->highlighted_pane = 3;
  1155.             break;
  1156.         default:
  1157.             tab_control->first_displayed_item += 1;
  1158.             tab_control->last_displayed_item = tab_control->highlighted_item;
  1159.             break;
  1160.     }
  1161. }
  1162. /*****************************************************************************
  1163.  * FUNCTION
  1164.  *  gui_prev_four_item_tab_pane
  1165.  * DESCRIPTION
  1166.  *  previous function for four item item tab pane
  1167.  * PARAMETERS
  1168.  *  tab_control     [IN/OUT]             
  1169.  * RETURNS
  1170.  *  void
  1171.  *****************************************************************************/
  1172. void gui_prev_four_item_tab_pane(struct_tab_control *tab_control)
  1173. {
  1174.     /*----------------------------------------------------------------*/
  1175.     /* Local Variables                                                */
  1176.     /*----------------------------------------------------------------*/
  1177.     /*----------------------------------------------------------------*/
  1178.     /* Code Body                                                      */
  1179.     /*----------------------------------------------------------------*/
  1180.     if (tab_control->highlighted_item == 0)
  1181.     {
  1182.         return;
  1183.     }
  1184.     tab_control->highlighted_item--;
  1185.     switch (tab_control->highlighted_pane)
  1186.     {
  1187.         case 3:
  1188.             tab_control->highlighted_pane = 2;
  1189.             break;
  1190.         case 2:
  1191.             tab_control->highlighted_pane = 1;
  1192.             break;
  1193.         case 1:
  1194.             tab_control->highlighted_pane = 0;
  1195.             break;
  1196.         default:
  1197.             tab_control->last_displayed_item -= 1;
  1198.             tab_control->first_displayed_item = tab_control->highlighted_item;
  1199.             break;
  1200.     }
  1201. }
  1202. #if 0
  1203. /* under construction !*/
  1204. /* under construction !*/
  1205. /* under construction !*/
  1206. /* under construction !*/
  1207. /* under construction !*/
  1208. /* under construction !*/
  1209. /* under construction !*/
  1210. /* under construction !*/
  1211. /* under construction !*/
  1212. /* under construction !*/
  1213. /* under construction !*/
  1214. /* under construction !*/
  1215. /* under construction !*/
  1216. /* under construction !*/
  1217. /* under construction !*/
  1218. /* under construction !*/
  1219. /* under construction !*/
  1220. /* under construction !*/
  1221. /* under construction !*/
  1222. /* under construction !*/
  1223. /* under construction !*/
  1224. /* under construction !*/
  1225. /* under construction !*/
  1226. /* under construction !*/
  1227. /* under construction !*/
  1228. /* under construction !*/
  1229. /* under construction !*/
  1230. /* under construction !*/
  1231. /* under construction !*/
  1232. /* under construction !*/
  1233. /* under construction !*/
  1234. /* under construction !*/
  1235. /* under construction !*/
  1236. /* under construction !*/
  1237. /* under construction !*/
  1238. /* under construction !*/
  1239. /* under construction !*/
  1240. /* under construction !*/
  1241. /* under construction !*/
  1242. /* under construction !*/
  1243. #endif /* 0 */ 
  1244. /*
  1245.  * void gui_show_four_icontext_tab_pane(struct_tab_control *tab_control)
  1246.  * {
  1247.  * struct_tab_icontext_data *tab_pane_data=(struct_tab_icontext_data *)tab_control->type_data;
  1248.  * S32 i,start_x;
  1249.  * color c={0,0,0,100};
  1250.  * gui_push_clip();
  1251.  * gui_push_text_clip();
  1252.  * gui_set_clip(tab_control->x,tab_control->y,
  1253.  * tab_control->x+tab_control->width-1,tab_control->y+tab_control->height-1);
  1254.  * 
  1255.  * gui_draw_filled_area(tab_control->x,tab_control->y,
  1256.  * tab_control->x+tab_control->width-1, 
  1257.  * tab_control->y+MMI_title_height-1,tab_pane_data->title_filler);
  1258.  * gui_set_text_clip(tab_control->x,tab_control->y,
  1259.  * tab_control->x+tab_control->width-1, 
  1260.  * tab_control->y+MMI_title_height-1);
  1261.  * gui_set_font((UI_font_type)tab_pane_data->text_font);
  1262.  * gui_set_text_color(*tab_pane_data->text_color);
  1263.  * gui_move_text_cursor(tab_control->x+5,tab_control->y+1);
  1264.  * gui_set_text_border_color(*tab_pane_data->text_border_color);
  1265.  * gui_print_truncated_borderd_text(tab_control->x+5,tab_control->y+3,tab_control->width-10,
  1266.  * tab_control->item_data[tab_control->highlighted_item].item_text);
  1267.  * 
  1268.  * gui_draw_filled_area(tab_control->x,tab_control->y+MMI_title_height,
  1269.  * tab_control->x+tab_control->width, 
  1270.  * tab_control->y+MMI_title_height+27,tab_pane_data->back_filler);
  1271.  * if(tab_control->highlighted_item!=0)
  1272.  * gui_show_transparent_image(tab_control->x,tab_control->y+MMI_title_height+7,tab_pane_data->left_indicator,0);
  1273.  * if(tab_control->highlighted_item!=tab_control->n_items-1)
  1274.  * gui_show_transparent_image(tab_control->x+116,tab_control->y+MMI_title_height+7,tab_pane_data->right_indicator,0);
  1275.  * 
  1276.  * for(i=0;i<tab_control->n_items;i++)
  1277.  * {
  1278.  * start_x=tab_control->x+13+(27*i);
  1279.  * if( start_x+23 > tab_control->x + tab_control->width) break;
  1280.  * gui_set_clip(start_x,tab_control->y+MMI_title_height+2,
  1281.  * start_x+23,tab_control->y+MMI_title_height+25);
  1282.  * if(tab_control->first_displayed_item+i==tab_control->highlighted_item)
  1283.  * gui_draw_filled_area(start_x,tab_control->y+MMI_title_height+2,
  1284.  * start_x+23,tab_control->y+MMI_title_height+23,
  1285.  * tab_pane_data->high_filler);
  1286.  * gui_show_transparent_image(start_x,tab_control->y+MMI_title_height+2,
  1287.  * tab_control->item_data[tab_control->first_displayed_item+i].item_icon,0);
  1288.  * }
  1289.  * gui_set_clip(tab_control->x,tab_control->y,
  1290.  * tab_control->x+tab_control->width-1,tab_control->y+tab_control->height-1);
  1291.  * gui_draw_rectangle(tab_control->x,tab_control->y,
  1292.  * tab_control->x+tab_control->width-1,tab_control->y+tab_control->height-1,
  1293.  * c);
  1294.  * gui_draw_rectangle(tab_control->x+1,tab_control->y+1,
  1295.  * tab_control->x+tab_control->width-2,tab_control->y+tab_control->height-2,
  1296.  * c);
  1297.  * gui_tab_pane_show_navigation_keys(tab_control);
  1298.  * gui_pop_clip();
  1299.  * gui_pop_text_clip();
  1300.  * }
  1301.  */
  1302. /*****************************************************************************
  1303.  * FUNCTION
  1304.  *  gui_goto_one_item_tab_pane
  1305.  * DESCRIPTION
  1306.  *  go to function for one item tab pane
  1307.  * PARAMETERS
  1308.  *  tab_control     [IN/OUT]             
  1309.  *  index           [IN]            item to go to
  1310.  * RETURNS
  1311.  *  void
  1312.  *****************************************************************************/
  1313. void gui_goto_one_item_tab_pane(struct_tab_control *tab_control, S32 index)
  1314. {
  1315.     /*----------------------------------------------------------------*/
  1316.     /* Local Variables                                                */
  1317.     /*----------------------------------------------------------------*/
  1318.     /*----------------------------------------------------------------*/
  1319.     /* Code Body                                                      */
  1320.     /*----------------------------------------------------------------*/
  1321.     if (index < 0 || index > tab_control->n_items - 1)
  1322.     {
  1323.         return;
  1324.     }
  1325.     if (index == tab_control->n_items - 1)
  1326.     {
  1327.         tab_control->first_displayed_item = index;
  1328.         tab_control->highlighted_item = index;
  1329.         tab_control->last_displayed_item = index;
  1330.         tab_control->highlighted_pane = 0;
  1331.     }
  1332.     else
  1333.     {
  1334.         tab_control->first_displayed_item = index;
  1335.         tab_control->highlighted_item = index;
  1336.         tab_control->last_displayed_item = index;
  1337.         tab_control->highlighted_pane = 0;
  1338.     }
  1339. }
  1340. /*****************************************************************************
  1341.  * FUNCTION
  1342.  *  gui_next_one_item_tab_pane
  1343.  * DESCRIPTION
  1344.  *  next function function for one item tab pane
  1345.  * PARAMETERS
  1346.  *  tab_control     [IN/OUT]             
  1347.  * RETURNS
  1348.  *  void
  1349.  *****************************************************************************/
  1350. void gui_next_one_item_tab_pane(struct_tab_control *tab_control)
  1351. {
  1352.     /*----------------------------------------------------------------*/
  1353.     /* Local Variables                                                */
  1354.     /*----------------------------------------------------------------*/
  1355.     /*----------------------------------------------------------------*/
  1356.     /* Code Body                                                      */
  1357.     /*----------------------------------------------------------------*/
  1358.     if (tab_control->highlighted_item == tab_control->n_items - 1)
  1359.     {
  1360.         return;
  1361.     }
  1362.     tab_control->highlighted_item++;
  1363.     tab_control->first_displayed_item = tab_control->highlighted_item;
  1364.     tab_control->last_displayed_item = tab_control->highlighted_item;
  1365. }
  1366. /*****************************************************************************
  1367.  * FUNCTION
  1368.  *  gui_prev_one_item_tab_pane
  1369.  * DESCRIPTION
  1370.  *  previous function function for one item tab pane
  1371.  * PARAMETERS
  1372.  *  tab_control     [IN/OUT]             
  1373.  * RETURNS
  1374.  *  void
  1375.  *****************************************************************************/
  1376. void gui_prev_one_item_tab_pane(struct_tab_control *tab_control)
  1377. {
  1378.     /*----------------------------------------------------------------*/
  1379.     /* Local Variables                                                */
  1380.     /*----------------------------------------------------------------*/
  1381.     /*----------------------------------------------------------------*/
  1382.     /* Code Body                                                      */
  1383.     /*----------------------------------------------------------------*/
  1384.     if (tab_control->highlighted_item == 0)
  1385.     {
  1386.         return;
  1387.     }
  1388.     tab_control->highlighted_item--;
  1389.     tab_control->last_displayed_item = tab_control->highlighted_item;
  1390.     tab_control->first_displayed_item = tab_control->highlighted_item;
  1391. }
  1392. /*****************************************************************************
  1393.  * FUNCTION
  1394.  *  gui_set_tab_pane_category_exit_function
  1395.  * DESCRIPTION
  1396.  *  Used to set exit category function for tab pane
  1397.  * PARAMETERS
  1398.  *  tab_control     [IN/OUT]             
  1399.  *  f               [IN]            category exit function
  1400.  * RETURNS
  1401.  *  void
  1402.  *****************************************************************************/
  1403. void gui_set_tab_pane_category_exit_function(struct_tab_control *tab_control, void (*f) (void))
  1404. {
  1405.     /*----------------------------------------------------------------*/
  1406.     /* Local Variables                                                */
  1407.     /*----------------------------------------------------------------*/
  1408.     /*----------------------------------------------------------------*/
  1409.     /* Code Body                                                      */
  1410.     /*----------------------------------------------------------------*/
  1411.     tab_control->category_exit_callback = f;
  1412. }
  1413. /*****************************************************************************
  1414.  * FUNCTION
  1415.  *  gui_set_tab_pane_category_entry_function
  1416.  * DESCRIPTION
  1417.  *  Used to set entry category function for tab pane
  1418.  * PARAMETERS
  1419.  *  tab_control     [IN/OUT]             
  1420.  *  f               [IN]            category entry function
  1421.  * RETURNS
  1422.  *  void
  1423.  *****************************************************************************/
  1424. void gui_set_tab_pane_category_entry_function(struct_tab_control *tab_control, void (*f) (void))
  1425. {
  1426.     /*----------------------------------------------------------------*/
  1427.     /* Local Variables                                                */
  1428.     /*----------------------------------------------------------------*/
  1429.     /*----------------------------------------------------------------*/
  1430.     /* Code Body                                                      */
  1431.     /*----------------------------------------------------------------*/
  1432.     tab_control->category_entry_callback = f;
  1433. }
  1434. /*****************************************************************************
  1435.  * FUNCTION
  1436.  *  gui_set_tab_pane_flags
  1437.  * DESCRIPTION
  1438.  *  this function sets tab pane flags
  1439.  * PARAMETERS
  1440.  *  tab_control     [IN/OUT]             
  1441.  *  flags           [IN]                     
  1442.  * RETURNS
  1443.  *  void
  1444.  *****************************************************************************/
  1445. void gui_set_tab_pane_flags(struct_tab_control *tab_control, S32 flags)
  1446. {
  1447.     /*----------------------------------------------------------------*/
  1448.     /* Local Variables                                                */
  1449.     /*----------------------------------------------------------------*/
  1450.     /*----------------------------------------------------------------*/
  1451.     /* Code Body                                                      */
  1452.     /*----------------------------------------------------------------*/
  1453.     tab_control->flags = flags;
  1454. }
  1455. #ifdef __MMI_TOUCH_SCREEN__
  1456. /*****************************************************************************
  1457.  * FUNCTION
  1458.  *  gui_tab_pane_translate_pen_event
  1459.  * DESCRIPTION
  1460.  *  checks bound whether the point of contact of PEN with LCD lies within tab control.
  1461.  * PARAMETERS
  1462.  *  tab_control                     [IN/OUT]
  1463.  *  pen_event                       [IN]        
  1464.  *  x                               [IN]
  1465.  *  y                               [IN]
  1466.  *  tab_pane_event                  [OUT]
  1467.  *  tab_pane_item_to_highlight      [OUT]
  1468.  * RETURNS
  1469.  *  Whether the tab pane control accepts the pen event
  1470.  *****************************************************************************/
  1471. MMI_BOOL gui_tab_pane_translate_pen_event(
  1472.             struct_tab_control *tab_control, 
  1473.             mmi_pen_event_type_enum pen_event, 
  1474.             S32 x, 
  1475.             S32 y, 
  1476.             gui_tab_pane_event *tab_pane_event, 
  1477.             S32 *tab_pane_item_to_highlight)
  1478. {
  1479.     /*----------------------------------------------------------------*/
  1480.     /* Local Variables                                                */
  1481.     /*----------------------------------------------------------------*/    
  1482.     /*----------------------------------------------------------------*/
  1483.     /* Code Body                                                      */
  1484.     /*----------------------------------------------------------------*/
  1485.     *tab_pane_event = GUI_TAB_PEN_NONE;
  1486.     *tab_pane_item_to_highlight = -1;
  1487.     /* In our design, pen handler always returns MMI_TRUE on non-Pen-Down event */
  1488.     if (pen_event != MMI_PEN_EVENT_DOWN && tab_control->pen_down_pane_index < 0)
  1489.     {
  1490.         return MMI_TRUE;
  1491.     }
  1492.     
  1493.     if(pen_event == MMI_PEN_EVENT_DOWN || pen_event == MMI_PEN_EVENT_UP)
  1494.     {
  1495.         S32 pane;
  1496.         S32 pen_pane_index = -1;
  1497.         for (pane = 0; pane < MAX_TAB_PANES; ++pane)
  1498.         {
  1499.             /* If not all of tab panes are used then they are memset to zero. */
  1500.             if (PEN_CHECK_BOUND(
  1501.                     x, 
  1502.                     y, 
  1503.                     tab_control->tab_pane_info[pane].x, 
  1504.                     tab_control->tab_pane_info[pane].y, 
  1505.                     tab_control->tab_pane_info[pane].width, 
  1506.                     tab_control->tab_pane_info[pane].height))
  1507.             {
  1508.                 pen_pane_index = pane + tab_control->first_displayed_item;
  1509.                 break;
  1510.             }
  1511.         }
  1512.         
  1513.         if (pen_event == MMI_PEN_EVENT_DOWN)
  1514.         {
  1515.             if (pen_pane_index >= 0)
  1516.             {
  1517.                 tab_control->pen_down_pane_index = pen_pane_index;
  1518.             }
  1519.             else
  1520.             {
  1521.                 return MMI_FALSE;
  1522.             }
  1523.         }
  1524.         else /* MMI_PEN_EVENT_UP */
  1525.         {
  1526.             if (pen_pane_index >= 0 && 
  1527.                 pen_pane_index == tab_control->pen_down_pane_index)
  1528.             {
  1529.                 *tab_pane_event = GUI_TAB_PEN_ASYNC_PANE_SELECT;
  1530.                 *tab_pane_item_to_highlight = pen_pane_index;
  1531.             }
  1532.         }
  1533.     }
  1534.     return MMI_TRUE;
  1535. }
  1536. #endif /* __MMI_TOUCH_SCREEN__ */
  1537. #else /* __MMI_UI_TAB_PANE__ */ 
  1538. int g_gui_tab_dummy;    /* Get rid of compile warning */
  1539. #endif /* __MMI_UI_TAB_PANE__ */