wgui_categories_MM.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:142k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * wgui_categories_MM.c
- *
- * Project:
- * --------
- * Maui_Software
- *
- * Description:
- * ------------
- * Main Menu related categories.
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #include "MMI_features.h"
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "PixtelDataTypes.h"
- #include "DebugInitDef.h"
- #include "GlobalDefs.h"
- #include "gui_data_types.h"
- #include "gui_themes.h"
- #include "gui.h"
- #ifdef __MMI_UI_TECHNO_STATUS_ICON__
- #include "Gui_Setting.h"
- #endif
- #include "CustDataProts.h"
- #include "CustMenuRes.h"
- #include "EventsDef.h"
- #include "CustThemesRes.h"
- #include "MainMenuDef.h"
- #include "MainMenuType.h"
- #include "gdi_include.h"
- #include "lcd_sw_rnd.h"
- #include "wgui.h"
- #include "wgui_inputs.h"
- #include "wgui_categories.h"
- #include "wgui_softkeys.h"
- #include "wgui_fixed_menus.h"
- #include "wgui_categories_defs.h"
- #include "wgui_draw_manager.h"
- #include "wgui_categories_MM.h"
- #ifdef __MMI_WGUI_MINI_TAB_BAR__
- #include "wgui_tab_bars.h"
- #endif
- #ifdef __MMI_MATRIX_MAIN_MENU_FULL_BACKGROUND__
- #include "Wgui_categories_util.h"
- #endif
- #ifdef __MMI_TOUCH_SCREEN__
- #include "wgui_touch_screen.h"
- #endif
- #include "SATGProts.h"
- /************ Global Variables *************/
- extern S32 wgui_current_pop_up_description_index;
- extern color active_title_txt_border_col;
- extern BOOL r2lMMIFlag;
- #ifdef __MMI_UI_TITLE_TRANSITION__
- extern void set_title_transition(wgui_transition_styles style);
- extern void reset_title_transition(void);
- #endif /* __MMI_UI_TITLE_TRANSITION__ */
- #ifdef __MMI_UI_MM_HORIZONTAL_PAGE_STYLE__
- extern void register_horizontal_fixed_list_keys(void);
- #endif
- extern void standard_animated_matrix_highlight_handler_type2(S32 item_index);
- extern void mtk_show_animation_frames(S32 x, S32 y, U8 *image, S32 start_frame);
- UI_string_type MMI_bg_string;
- PU8 MMI_bg_image;
- PU8 MMI_bg_animation;
- #if (ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION)
- /* Direct main menu implementation */
- /* Matrix main menu: Fixed number of items with all items being visible */
- #ifdef __MMI_MAINLCD_240X320__
- //KP Jerry modify for KP-Style 12-Matrix mainmenu on 2007-3-19 start
- #ifdef __MMI_KP_STYLE_MAIN_MENU_MATRIX__
- #define MAIN_MENU_NORMAL_IMAGE_CLIP_WIDTH (80)
- #define MAIN_MENU_NORMAL_IMAGE_CLIP_HEIGHT (80)
- #define MAIN_MENU_NORMAL_IMAGE_WIDTH (80)
- #define MAIN_MENU_NORMAL_IMAGE_HEIGHT (80)
- #define MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH (80)
- #define MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT (80)
- #else
- #define MAIN_MENU_NORMAL_IMAGE_CLIP_WIDTH (80)
- #define MAIN_MENU_NORMAL_IMAGE_CLIP_HEIGHT (60)
- #define MAIN_MENU_NORMAL_IMAGE_WIDTH (80)
- #define MAIN_MENU_NORMAL_IMAGE_HEIGHT (60)
- #define MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH (80)
- #define MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT (60)
- #endif
- //KP Jerry modify for KP-Style 12-Matrix mainmenu on 2007-3-19 end
- #else
- //jerson modify begin 20070625
- #ifdef __MMI_KP_STYLE_MAIN_MENU_MATRIX__
- #define MAIN_MENU_NORMAL_IMAGE_CLIP_WIDTH (58)
- #define MAIN_MENU_NORMAL_IMAGE_CLIP_HEIGHT (55)
- #define MAIN_MENU_NORMAL_IMAGE_WIDTH (58)
- #define MAIN_MENU_NORMAL_IMAGE_HEIGHT (55)
- #define MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH (58)
- #define MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT (55)
- #else
- #define MAIN_MENU_NORMAL_IMAGE_CLIP_WIDTH (41)
- #define MAIN_MENU_NORMAL_IMAGE_CLIP_HEIGHT (30)
- #define MAIN_MENU_NORMAL_IMAGE_WIDTH (42)
- #define MAIN_MENU_NORMAL_IMAGE_HEIGHT (31)
- #define MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH (51)
- #define MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT (37)
- #endif
- //jerson modify end 20070625
- #endif
- #define MAIN_MENU_N_ROWS (3)
- #define MAIN_MENU_N_COLUMNS (3)
- #define MAIN_MENU_MAX_ITEMS (MAIN_MENU_N_ROWS*MAIN_MENU_N_COLUMNS)
- #define MAIN_MENU_HIGHLIGHT_OFFSET_X ((MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH>>1)-(MAIN_MENU_NORMAL_IMAGE_WIDTH>>1))
- #define MAIN_MENU_HIGHLIGHT_OFFSET_Y ((MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT>>1)-(MAIN_MENU_NORMAL_IMAGE_HEIGHT>>1))
- #define MAIN_MENU_HIGHLIGHTED_GRID_COLOR { 0,0,0,100 }
- #define MAIN_MENU_NORMAL_GRID_COLOR { 160,160,160,100 }
- #define MAIN_MENU_X1 (0)
- #define MAIN_MENU_Y1 (MMI_TITLE_HEIGHT+1)
- #define MAIN_MENU_X2 (127)
- #define MAIN_MENU_Y2 (MMI_TITLE_HEIGHT+100+1)
- #define MAIN_MENU_ITEM_HIGHLIGHTED 0x00000001
- #define MAIN_MENU_LOOP 0x00000002
- #define MAIN_MENU_DISPLAY_GRID 0x00000004
- #define MAIN_MENU_DISPLAY_ITEM_GRID 0x00000008
- extern U16 title_bg_id;
- extern icontext_button MMI_softkeys[];
- extern void _show_bitmap(S32 x1, S32 y1, bitmap *b);
- extern void _get_bitmap(S32 x1, S32 y1, S32 x2, S32 y2, bitmap *b);
- extern void (*MMI_matrix_highlight_handler) (S32 index);
- U8 matrix_main_menu_highlight_bitmap_data[(MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH) * (MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT) *
- GDI_MAINLCD_BIT_PER_PIXEL / 8];
- /* structure of matrix menu */
- /* Store current main menu type..matrix,list,circular */
- S32 MMI_main_menu_type = MATRIX_MENU;
- U16 gMainMenuAnimation[MAX_MAIN_MENU_ITEMS];
- U16 gMainMenuTitleIcon[MAX_MAIN_MENU_ITEMS];
- S32 main_menu_index = -1;
- PU8 _wgui_main_menu_items[MAIN_MENU_MAX_ITEMS];
- matrix_main_menu _wgui_main_menu;
- UI_string_type _wgui_main_menu_item_strings[MAIN_MENU_MAX_ITEMS];
- #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING))
- S32 wgui_matrix_main_menu_frame_counter = 0;
- extern matrix_main_menu _wgui_main_menu;
- #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- #ifdef __MMI_MATRIX_MAIN_MENU_FULL_BACKGROUND__
- BOOL inMatrixNoTitleFlag = FALSE;
- #endif
- #ifdef __MMI_BI_DEGREE_MAIN_MENU_STYLE__
- void (*Cat414MatrixExitHandler) (S32 index) = NULL;
- #endif
- /* 082806 240x320 matrix Start */
- #if defined (__MMI_WALLPAPER_ON_BOTTOM__) || defined (__MMI_KP_STYLE_MAIN_MENU_MATRIX__) //KP Jerry add "__MMI_KP_STYLE_MAIN_MENU_MATRIX__" for KP-Style 12-Matrix mainmenu on 2007-3-19
- static MMI_ID_TYPE mm_bg_ID;
- #ifndef __MMI_KP_STYLE_MAIN_MENU_MATRIX__ //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
- static S8 *mm_bg_filename;
- static S32 mm_bg_x, mm_bg_y;
- #endif //KP Jerry add for KP-Style 12-Matrix mainmenu on 2007-3-19
- static U8 mm_bg_opacity;
- static S32 mm_bg_flags;
- #endif /* defined (__MMI_WALLPAPER_ON_BOTTOM__) */
- /* 082806 240x320 matrix End */
- /*****************************************************************************
- * FUNCTION
- * setup_main_menu
- * DESCRIPTION
- * set main menu values such as number sof itens, size of image
- * PARAMETERS
- * m [IN] Menu
- * x [IN] Start of x position
- * y [IN] Start of y position
- * n_items [IN] Number of items
- * list_of_items [IN] Images of menus
- * RETURNS
- * void
- *****************************************************************************/
- void setup_main_menu(matrix_main_menu *m, S32 x, S32 y, S32 n_items, PU8 *list_of_items)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- m->x = x;
- m->y = y;
- if (n_items < 0)
- {
- n_items = 0;
- }
- if (n_items > MAIN_MENU_MAX_ITEMS)
- {
- n_items = MAIN_MENU_MAX_ITEMS;
- }
- m->flags = 0;
- m->n_items = n_items;
- m->list_of_items = list_of_items;
- m->highlighted_item = -1;
- m->item_highlighted = UI_dummy_function_s32;
- m->item_unhighlighted = UI_dummy_function_s32;
- m->highlight_area.color_depth = 16;
- m->highlight_area.palette = NULL;
- m->highlight_area.data = matrix_main_menu_highlight_bitmap_data;
- m->highlight_area.xsize = MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH;
- m->highlight_area.ysize = MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT;
- m->highlight_area.row_bytes = m->highlight_area.xsize * 2;
- }
- /*****************************************************************************
- * FUNCTION
- * show_main_menu
- * DESCRIPTION
- * show main menu
- * PARAMETERS
- * m [IN] Menu
- * RETURNS
- * void
- *****************************************************************************/
- void show_main_menu(matrix_main_menu *m)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, row, column, x, y;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- row = column = 0;
- gui_reset_clip();
- x = m->x;
- y = m->y;
- for (i = 0; i < m->n_items; i++)
- {
- gui_set_clip(x, y, x + MAIN_MENU_NORMAL_IMAGE_CLIP_WIDTH - 1, y + MAIN_MENU_NORMAL_IMAGE_CLIP_HEIGHT - 1);
- gui_show_image(
- x + DIRECT_MAIN_MENU_FIRST_FRAME_SHIFT_X,
- y + DIRECT_MAIN_MENU_FIRST_FRAME_SHIFT_Y,
- m->list_of_items[i]);
- column++;
- x += MAIN_MENU_NORMAL_IMAGE_WIDTH;
- if (column >= MAIN_MENU_N_COLUMNS)
- {
- column = 0;
- x = m->x;
- row++;
- y += MAIN_MENU_NORMAL_IMAGE_HEIGHT;
- if (row >= MAIN_MENU_N_ROWS)
- {
- break;
- }
- }
- }
- m->flags &= ~MAIN_MENU_ITEM_HIGHLIGHTED;
- if (m->flags & MAIN_MENU_DISPLAY_GRID)
- {
- color c = MAIN_MENU_NORMAL_GRID_COLOR;
- S32 i, x, y, x1, y1, x2, y2;
- gui_reset_clip();
- x = x1 = m->x;
- y = y1 = m->y;
- x2 = x1 + (MAIN_MENU_NORMAL_IMAGE_WIDTH * MAIN_MENU_N_COLUMNS);
- y2 = y1 + (MAIN_MENU_NORMAL_IMAGE_HEIGHT * MAIN_MENU_N_ROWS);
- for (i = 0; i < 4; i++)
- {
- gui_draw_horizontal_line(x1, x2, y, c);
- gui_draw_vertical_line(y1, y2, x, c);
- x += MAIN_MENU_NORMAL_IMAGE_WIDTH;
- y += MAIN_MENU_NORMAL_IMAGE_HEIGHT;
- }
- }
- }
- #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING))
- /*****************************************************************************
- * FUNCTION
- * update_main_menu_highlight
- * DESCRIPTION
- * Enlarge the image of highlighted main menu item
- * PARAMETERS
- * m [IN] Menu
- * RETURNS
- * void
- *****************************************************************************/
- void update_main_menu_highlight(matrix_main_menu *m)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 row, column, x, y, tx, ty;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_reset_clip();
- /* Display the screen bitmap grabbed earlier */
- if (m->flags & MAIN_MENU_ITEM_HIGHLIGHTED)
- {
- _show_bitmap(m->save_x, m->save_y, &m->highlight_area);
- }
- if ((m->highlighted_item < 0) || (m->highlighted_item >= m->n_items))
- {
- m->flags &= ~MAIN_MENU_ITEM_HIGHLIGHTED;
- return;
- }
- /* Calculate (x,y) for the highlight */
- row = m->highlighted_item / MAIN_MENU_N_COLUMNS;
- column = m->highlighted_item % MAIN_MENU_N_COLUMNS;
- ty = row * MAIN_MENU_NORMAL_IMAGE_HEIGHT;
- tx = column * MAIN_MENU_NORMAL_IMAGE_WIDTH;
- x = tx - MAIN_MENU_HIGHLIGHT_OFFSET_X;
- y = ty - MAIN_MENU_HIGHLIGHT_OFFSET_Y;
- if (m->flags & MAIN_MENU_DISPLAY_ITEM_GRID)
- {
- x -= 1;
- y -= 1;
- }
- #if(DIRECT_MAIN_MENU_BOUNDARY_SPACING)
- if (x < 0)
- {
- x = 0;
- }
- if ((x + MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH) > (MAIN_MENU_N_COLUMNS * MAIN_MENU_NORMAL_IMAGE_WIDTH))
- {
- x = MAIN_MENU_N_COLUMNS * MAIN_MENU_NORMAL_IMAGE_WIDTH - MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH;
- }
- if (y < 0)
- {
- y = 0;
- }
- if ((y + MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT) > (MAIN_MENU_N_ROWS * MAIN_MENU_NORMAL_IMAGE_HEIGHT - 1))
- {
- y = MAIN_MENU_N_ROWS * MAIN_MENU_NORMAL_IMAGE_HEIGHT - MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT - 1;
- }
- #else /* (DIRECT_MAIN_MENU_BOUNDARY_SPACING) */
- if (x < -1)
- {
- x = -1;
- }
- if ((x + MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH) > (MAIN_MENU_N_COLUMNS * MAIN_MENU_NORMAL_IMAGE_WIDTH + 1))
- {
- x = MAIN_MENU_N_COLUMNS * MAIN_MENU_NORMAL_IMAGE_WIDTH - MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH + 1;
- }
- if (y < -1)
- {
- y = -1;
- }
- if ((y + MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT) > (MAIN_MENU_N_ROWS * MAIN_MENU_NORMAL_IMAGE_HEIGHT))
- {
- y = MAIN_MENU_N_ROWS * MAIN_MENU_NORMAL_IMAGE_HEIGHT - MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT;
- }
- #endif /* (DIRECT_MAIN_MENU_BOUNDARY_SPACING) */
- x += m->x;
- y += m->y;
- if (m->flags & MAIN_MENU_DISPLAY_ITEM_GRID)
- { /* Grab a new screen bitmap for the portion that will be affected */
- _get_bitmap(
- x,
- y,
- x + MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH,
- y + MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT,
- &m->highlight_area);
- m->save_x = x;
- m->save_y = y;
- /* Display the highlighted item */
- mtk_show_animation_frames(x, y, m->list_of_items[m->highlighted_item], 1);
- }
- else
- { /* Grab a new screen bitmap for the portion that will be affected */
- _get_bitmap(
- x,
- y,
- x + MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH - 1,
- y + MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT - 1,
- &m->highlight_area);
- m->save_x = x;
- m->save_y = y;
- /* Display the highlighted item */
- mtk_show_animation_frames(x, y, m->list_of_items[m->highlighted_item], 1);
- }
- m->flags |= MAIN_MENU_ITEM_HIGHLIGHTED;
- gdi_layer_blt_previous(MAIN_MENU_X1, MAIN_MENU_Y1 - 1, MAIN_MENU_X2, MAIN_MENU_Y2);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_matrix_main_menu_end_frame
- * DESCRIPTION
- * show the frames of main menu animation image of high lighted item
- * PARAMETERS
- * void
- * matrix_main_menu(?) [IN] *m :- menu
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_matrix_main_menu_end_frame(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (wgui_matrix_main_menu_frame_counter >= 1)
- {
- update_main_menu_highlight(&_wgui_main_menu);
- wgui_matrix_main_menu_frame_counter = 0;
- gui_start_timer(DIRECT_MAIN_MENU_FRAME_SKIP_RATE, wgui_matrix_main_menu_end_frame);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * show_main_menu_highlight
- * DESCRIPTION
- * show main menu highlihgted image
- * PARAMETERS
- * m [IN] Menu
- * RETURNS
- * void
- *****************************************************************************/
- void show_main_menu_highlight(matrix_main_menu *m)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (wgui_matrix_main_menu_frame_counter > 0)
- {
- wgui_matrix_main_menu_frame_counter++;
- }
- else
- {
- wgui_matrix_main_menu_frame_counter = 1;
- gui_start_timer(UI_FRAME_START_TIMEOUT, wgui_matrix_main_menu_end_frame);
- }
- }
- #else /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- /*****************************************************************************
- * FUNCTION
- * show_main_menu_highlight
- * DESCRIPTION
- * Enlarge the image of highlighted main menu item
- * PARAMETERS
- * m [IN] Menu
- * RETURNS
- * void
- *****************************************************************************/
- void show_main_menu_highlight(matrix_main_menu *m)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 row, column, x, y, tx, ty;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_reset_clip();
- /* Display the screen bitmap grabbed earlier */
- if (m->flags & MAIN_MENU_ITEM_HIGHLIGHTED)
- {
- _show_bitmap(m->save_x, m->save_y, &m->highlight_area);
- }
- if ((m->highlighted_item < 0) || (m->highlighted_item >= m->n_items))
- {
- m->flags &= ~MAIN_MENU_ITEM_HIGHLIGHTED;
- return;
- }
- /* Calculate (x,y) for the highlight */
- row = m->highlighted_item / MAIN_MENU_N_COLUMNS;
- column = m->highlighted_item % MAIN_MENU_N_COLUMNS;
- ty = row * MAIN_MENU_NORMAL_IMAGE_HEIGHT;
- tx = column * MAIN_MENU_NORMAL_IMAGE_WIDTH;
- x = tx - MAIN_MENU_HIGHLIGHT_OFFSET_X;
- y = ty - MAIN_MENU_HIGHLIGHT_OFFSET_Y;
- if (m->flags & MAIN_MENU_DISPLAY_ITEM_GRID)
- {
- x -= 1;
- y -= 1;
- }
- if (x < 0)
- {
- x = 0;
- }
- if (y < 0)
- {
- y = 0;
- }
- if ((x + MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH) > (MAIN_MENU_N_COLUMNS * MAIN_MENU_NORMAL_IMAGE_WIDTH))
- {
- x = MAIN_MENU_N_COLUMNS * MAIN_MENU_NORMAL_IMAGE_WIDTH - MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH;
- }
- if ((y + MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT) > (MAIN_MENU_N_ROWS * MAIN_MENU_NORMAL_IMAGE_HEIGHT))
- {
- y = MAIN_MENU_N_ROWS * MAIN_MENU_NORMAL_IMAGE_HEIGHT - MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT;
- }
- x += m->x;
- y += m->y;
- if (m->flags & MAIN_MENU_DISPLAY_ITEM_GRID)
- { /* Grab a new screen bitmap for the portion that will be affected */
- _get_bitmap(
- x,
- y,
- x + MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH,
- y + MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT,
- &m->highlight_area);
- m->save_x = x;
- m->save_y = y;
- /* Display the highlighted item */
- mtk_show_animation_frames(x, y, m->list_of_items[m->highlighted_item], 1);
- }
- else
- { /* Grab a new screen bitmap for the portion that will be affected */
- _get_bitmap(
- x,
- y,
- x + MAIN_MENU_HIGHLIGHTED_IMAGE_WIDTH - 1,
- y + MAIN_MENU_HIGHLIGHTED_IMAGE_HEIGHT - 1,
- &m->highlight_area);
- m->save_x = x;
- m->save_y = y;
- /* Display the highlighted item */
- mtk_show_animation_frames(x, y, m->list_of_items[m->highlighted_item], 1);
- }
- m->flags |= MAIN_MENU_ITEM_HIGHLIGHTED;
- }
- #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- /*****************************************************************************
- * FUNCTION
- * main_menu_previous_row
- * DESCRIPTION
- * move to previous row of main menu item
- * PARAMETERS
- * m [IN] Menu
- * RETURNS
- * void
- *****************************************************************************/
- void main_menu_previous_row(matrix_main_menu *m)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 row, column;
- S32 old_highlighted_item = m->highlighted_item;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- row = old_highlighted_item / MAIN_MENU_N_COLUMNS;
- column = old_highlighted_item % MAIN_MENU_N_COLUMNS;
- if (m->flags & MAIN_MENU_LOOP)
- {
- if (row <= 0)
- {
- row = MAIN_MENU_N_ROWS - 1;
- }
- else
- {
- row--;
- }
- #ifdef __MMI_MAIN_MENU_CYCLE__
- if (row == (MAIN_MENU_N_ROWS - 1))
- if (column > 0)
- {
- column--;
- }
- else
- {
- column = MAIN_MENU_N_COLUMNS - 1;
- }
- #endif /* __MMI_MAIN_MENU_CYCLE__ */
- }
- else
- {
- if (row > 0)
- {
- row--;
- }
- }
- m->highlighted_item = row * MAIN_MENU_N_COLUMNS + column;
- if (m->highlighted_item > (m->n_items - 1))
- {
- m->highlighted_item = m->n_items - 1;
- }
- if (old_highlighted_item != m->highlighted_item)
- {
- m->item_unhighlighted(old_highlighted_item);
- m->item_highlighted(m->highlighted_item);
- gui_hide_animations();
- show_main_menu_highlight(m);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * main_menu_next_row
- * DESCRIPTION
- * move to next row of main menu item
- * PARAMETERS
- * m [IN] Menu
- * RETURNS
- * void
- *****************************************************************************/
- void main_menu_next_row(matrix_main_menu *m)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 row, column;
- S32 old_highlighted_item = m->highlighted_item;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- row = old_highlighted_item / MAIN_MENU_N_COLUMNS;
- column = old_highlighted_item % MAIN_MENU_N_COLUMNS;
- if (m->flags & MAIN_MENU_LOOP)
- {
- if (row >= (MAIN_MENU_N_ROWS - 1))
- {
- row = 0;
- }
- else
- {
- row++;
- }
- #ifdef __MMI_MAIN_MENU_CYCLE__
- if (row == 0)
- {
- column = (column + 1) % MAIN_MENU_N_COLUMNS;
- }
- #endif /* __MMI_MAIN_MENU_CYCLE__ */
- }
- else
- {
- if (row < (MAIN_MENU_N_ROWS - 1))
- {
- row++;
- }
- }
- m->highlighted_item = row * MAIN_MENU_N_COLUMNS + column;
- if (m->highlighted_item > (m->n_items - 1))
- {
- m->highlighted_item = m->n_items - 1;
- }
- if (old_highlighted_item != m->highlighted_item)
- {
- m->item_unhighlighted(old_highlighted_item);
- m->item_highlighted(m->highlighted_item);
- gui_hide_animations();
- show_main_menu_highlight(m);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * main_menu_previous_column
- * DESCRIPTION
- * move to previous column of main menu item
- * PARAMETERS
- * m [IN] Menu
- * RETURNS
- * void
- *****************************************************************************/
- void main_menu_previous_column(matrix_main_menu *m)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 row, column;
- S32 old_highlighted_item = m->highlighted_item;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- row = old_highlighted_item / MAIN_MENU_N_COLUMNS;
- column = old_highlighted_item % MAIN_MENU_N_COLUMNS;
- if (m->flags & MAIN_MENU_LOOP)
- {
- if (column <= 0)
- {
- column = MAIN_MENU_N_COLUMNS - 1;
- if (row <= 0)
- {
- row = MAIN_MENU_N_ROWS - 1;
- }
- else
- {
- row--;
- }
- }
- else
- {
- column--;
- }
- }
- else
- {
- if (column > 0)
- {
- column--;
- }
- }
- m->highlighted_item = row * MAIN_MENU_N_COLUMNS + column;
- if (m->highlighted_item > (m->n_items - 1))
- {
- m->highlighted_item = m->n_items - 1;
- }
- if (old_highlighted_item != m->highlighted_item)
- {
- m->item_unhighlighted(old_highlighted_item);
- m->item_highlighted(m->highlighted_item);
- gui_hide_animations();
- show_main_menu_highlight(m);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * main_menu_next_column
- * DESCRIPTION
- * move to next column of main menu item
- * PARAMETERS
- * m [IN] Menu
- * RETURNS
- * void
- *****************************************************************************/
- void main_menu_next_column(matrix_main_menu *m)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 row, column;
- S32 old_highlighted_item = m->highlighted_item;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- row = old_highlighted_item / MAIN_MENU_N_COLUMNS;
- column = old_highlighted_item % MAIN_MENU_N_COLUMNS;
- if (m->flags & MAIN_MENU_LOOP)
- {
- if (column >= (MAIN_MENU_N_COLUMNS - 1))
- {
- column = 0;
- if (row >= (MAIN_MENU_N_ROWS - 1))
- {
- row = 0;
- }
- else
- {
- row++;
- }
- }
- else
- {
- column++;
- }
- }
- else
- {
- if (column < (MAIN_MENU_N_COLUMNS - 1))
- {
- column++;
- }
- }
- m->highlighted_item = row * MAIN_MENU_N_COLUMNS + column;
- if (m->highlighted_item > (m->n_items - 1))
- {
- m->highlighted_item = m->n_items - 1;
- }
- if (old_highlighted_item != m->highlighted_item)
- {
- m->item_unhighlighted(old_highlighted_item);
- m->item_highlighted(m->highlighted_item);
- gui_hide_animations();
- show_main_menu_highlight(m);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * main_menu_highlight_item
- * DESCRIPTION
- * handle main menu highlighted item
- * PARAMETERS
- * m [IN] Index of highlighted item
- * index [IN] Index of highlighted item
- * menu(?) [IN] Index of highlighted item
- * RETURNS
- * void
- *****************************************************************************/
- void main_menu_highlight_item(matrix_main_menu *m, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 old_highlighted_item;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((index < 0) || (index >= m->n_items))
- {
- return;
- }
- if (index == m->highlighted_item)
- {
- return;
- }
- old_highlighted_item = m->highlighted_item;
- m->highlighted_item = index;
- m->item_unhighlighted(old_highlighted_item);
- m->item_highlighted(m->highlighted_item);
- gui_hide_animations();
- show_main_menu_highlight(m);
- }
- /*****************************************************************************
- * FUNCTION
- * refresh_main_menu
- * DESCRIPTION
- * refresh main menu
- * PARAMETERS
- * m [IN] Menu
- * RETURNS
- * void
- *****************************************************************************/
- void refresh_main_menu(matrix_main_menu *m)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_hide_animations();
- show_main_menu(m);
- show_main_menu_highlight(m);
- }
- /* Main menu wrappers */
- /*****************************************************************************
- * FUNCTION
- * wgui_main_menu_previous_row
- * DESCRIPTION
- * move to main enu previous row
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_main_menu_previous_row(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- main_menu_previous_row(&_wgui_main_menu);
- #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING))
- #else /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- gdi_layer_blt_previous(MAIN_MENU_X1, MAIN_MENU_Y1, MAIN_MENU_X2, MAIN_MENU_Y2);
- #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_main_menu_next_row
- * DESCRIPTION
- * move to main menu next row
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_main_menu_next_row(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- main_menu_next_row(&_wgui_main_menu);
- #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING))
- #else /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- gdi_layer_blt_previous(MAIN_MENU_X1, MAIN_MENU_Y1, MAIN_MENU_X2, MAIN_MENU_Y2);
- #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_main_menu_previous_column
- * DESCRIPTION
- * move to main menu previous column
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_main_menu_previous_column(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- main_menu_previous_column(&_wgui_main_menu);
- #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING))
- #else /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- gdi_layer_blt_previous(MAIN_MENU_X1, MAIN_MENU_Y1, MAIN_MENU_X2, MAIN_MENU_Y2);
- #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_main_menu_next_column
- * DESCRIPTION
- * move to main menu next column
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_main_menu_next_column(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- main_menu_next_column(&_wgui_main_menu);
- #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING))
- #else /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- gdi_layer_blt_previous(MAIN_MENU_X1, MAIN_MENU_Y1, MAIN_MENU_X2, MAIN_MENU_Y2);
- #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_main_menu_goto_item
- * DESCRIPTION
- * highlight particular menu item
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_main_menu_goto_item(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- main_menu_highlight_item(&_wgui_main_menu, index);
- #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING))
- #else /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- gdi_layer_blt_previous(MAIN_MENU_X1, MAIN_MENU_Y1, MAIN_MENU_X2, MAIN_MENU_Y2);
- #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_main_menu_key_handler
- * DESCRIPTION
- * set the key handlers of main menu
- * PARAMETERS
- * vkey_code [IN] Key code
- * key_state [IN] Key state
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_main_menu_key_handler(S32 vkey_code, S32 key_state)
- {
- #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (key_state)
- {
- switch (vkey_code)
- {
- case 37:
- wgui_main_menu_previous_column();
- break;
- case 39:
- wgui_main_menu_next_column();
- break;
- case 38:
- wgui_main_menu_previous_row();
- break;
- case 40:
- wgui_main_menu_next_row();
- break;
- }
- }
- #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- UI_UNUSED_PARAMETER(vkey_code);
- UI_UNUSED_PARAMETER(key_state);
- #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_register_main_menu_keys
- * DESCRIPTION
- * register main menu keys handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_register_main_menu_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetKeyHandler(wgui_main_menu_previous_row, KEY_UP_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(wgui_main_menu_next_row, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(wgui_main_menu_previous_column, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(wgui_main_menu_next_column, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(wgui_main_menu_previous_column, KEY_VOL_UP, KEY_EVENT_DOWN);
- SetKeyHandler(wgui_main_menu_next_column, KEY_VOL_DOWN, KEY_EVENT_DOWN);
- register_keyboard_key_handler(wgui_main_menu_key_handler);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_clear_main_menu_keys
- * DESCRIPTION
- * clear key handlers of main menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_clear_main_menu_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearKeyHandler(KEY_UP_ARROW, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_DOWN_ARROW, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_main_menu_highlight_handler
- * DESCRIPTION
- * main menu highlight handler
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_main_menu_highlight_handler(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_menu_shortcut_number = index + 1;
- if (index >= 0 && index <= (_wgui_main_menu.n_items))
- {
- MMI_highlighted_item_text = _wgui_main_menu_item_strings[index];
- MMI_title_string = MMI_highlighted_item_text;
- }
- #if(!DISABLE_MAIN_MENU_HIGHLIGHT_TITLE_UPDATE)
- draw_title();
- #endif
- MMI_matrix_highlight_handler(index);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_register_main_menu_shortcut_handler
- * DESCRIPTION
- * main menu shorcut handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_register_main_menu_shortcut_handler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- register_menu_shortcut_keys();
- register_menu_shortcut_handler(wgui_main_menu_goto_item);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_setup_main_menu
- * DESCRIPTION
- * Create main menu
- * PARAMETERS
- * n_items [IN] Number of items
- * item_list [IN] Item list
- * image_list [IN] Image list
- * highlighted_item [IN] Highlighted item
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_setup_main_menu(S32 n_items, U16 *item_list, U16 *image_list, S32 highlighted_item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; (i < n_items) && (i < MAIN_MENU_MAX_ITEMS); i++)
- {
- _wgui_main_menu_items[i] = (PU8) GetImage(image_list[i]);
- _wgui_main_menu_item_strings[i] = (UI_string_type) GetString(item_list[i]);
- }
- #ifdef __MMI_MERGE_SAT_TO_MAINMENU__
- #ifndef WAP_SUPPORT
- if (IsSATPresent())
- {
- _wgui_main_menu_item_strings[7] = (UI_string_type) GetSATMainMenuAlphaID();
- }
- #endif /* WAP_SUPPORT */
- #endif /* __MMI_MERGE_SAT_TO_MAINMENU__ */
- setup_main_menu(&_wgui_main_menu, 1, (MMI_title_y + MMI_title_height) + 1, n_items, _wgui_main_menu_items);
- _wgui_main_menu.flags |= MAIN_MENU_LOOP;
- _wgui_main_menu.highlighted_item = highlighted_item;
- _wgui_main_menu.item_highlighted = wgui_main_menu_highlight_handler;
- wgui_main_menu_highlight_handler(highlighted_item);
- #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING))
- wgui_matrix_main_menu_frame_counter = 0;
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_redraw_main_menu
- * DESCRIPTION
- * redraw main menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_redraw_main_menu(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- refresh_main_menu(&_wgui_main_menu);
- }
- /*****************************************************************************
- * FUNCTION
- * set_matrix_main_menu_category_history
- * DESCRIPTION
- * set main menu matirx history
- * PARAMETERS
- * history_ID [IN]
- * history_buffer [IN]
- * RETURNS
- * void
- *****************************************************************************/
- U8 set_matrix_main_menu_category_history(U16 history_ID, U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (history_buffer != NULL)
- {
- matrix_main_menu_category_history *h = (matrix_main_menu_category_history*) history_buffer;
- if (history_valid(h->history_ID, history_ID))
- {
- _wgui_main_menu.highlighted_item = h->highlighted_item;
- _wgui_main_menu.flags = h->flags;
- return (1);
- }
- }
- return (0);
- }
- /*****************************************************************************
- * FUNCTION
- * get_matrix_main_menu_category_history
- * DESCRIPTION
- * get main menu matirx history
- * PARAMETERS
- * history_ID [IN]
- * history_buffer [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void get_matrix_main_menu_category_history(U16 history_ID, U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (history_buffer != NULL)
- {
- U16 hID = (U16) (history_ID | 0x8000);
- matrix_main_menu_category_history *h = (matrix_main_menu_category_history*) history_buffer;
- h->history_ID = hID;
- h->highlighted_item = (S16) _wgui_main_menu.highlighted_item;
- h->flags = _wgui_main_menu.flags;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_close_main_menu
- * DESCRIPTION
- * close main menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_close_main_menu(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- wgui_clear_main_menu_keys();
- #if((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING))
- gui_cancel_timer(wgui_matrix_main_menu_end_frame);
- wgui_matrix_main_menu_frame_counter = 0;
- #endif /* ((UI_ENABLE_FRAME_SKIPPING) && (ENABLE_DIRECT_MAIN_MENU_FRAME_SKIPPING)) */
- }
- #endif /* (ENABLE_DIRECT_MAIN_MENU_IMPLEMENTATION) */
- /* For 3D circular main menu */
- extern gdi_handle animation_handle;
- #ifdef __MMI_UI_TECHNO_STATUS_ICON__
- extern void arrange_status_icons();
- extern void show_status_icons();
- #endif /* __MMI_UI_TECHNO_STATUS_ICON__ */
- #if((ENABLE_CIRCULAR_3D_MENU) || (ENABLE_ROTATE_MENU))
- extern void stop_rotate_circular_menu(void);
- #endif
- /*****************************************************************************
- * FUNCTION
- * set_circular_menu_category_history
- * DESCRIPTION
- * set main menu matirx history
- * PARAMETERS
- * history_ID [IN]
- * history_buffer [IN]
- * RETURNS
- * void
- *****************************************************************************/
- U8 set_circular_menu_category_history(U16 history_ID, U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (history_buffer != NULL)
- {
- circular_menu_category_history *h = (circular_menu_category_history*) history_buffer;
- if (history_valid(h->history_ID, history_ID))
- {
- wgui_CM3D_menu.highlighted_item = h->highlighted_item;
- wgui_CM3D_menu.flags = h->flags;
- return (1);
- }
- }
- return (0);
- }
- /*****************************************************************************
- * FUNCTION
- * get_circular_menu_category_history
- * DESCRIPTION
- * get main menu matirx history
- * PARAMETERS
- * history_ID [IN]
- * history_buffer [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void get_circular_menu_category_history(U16 history_ID, U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (history_buffer != NULL)
- {
- U16 hID = (U16) (history_ID | 0x8000);
- circular_menu_category_history *h = (circular_menu_category_history*) history_buffer;
- h->history_ID = hID;
- h->highlighted_item = (S16) wgui_CM3D_menu.highlighted_item;
- h->flags = wgui_CM3D_menu.flags;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * draw_bg_animation
- * DESCRIPTION
- * Displays the background image for new mainmenu category
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void draw_bg_animation(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 iw, ih;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_measure_image(MMI_bg_animation, &iw, &ih);
- if (animation_handle != GDI_ERROR_HANDLE)
- {
- gdi_image_stop_animation(animation_handle);
- }
- wgui_set_animation_image(MMI_content_width - iw, UI_device_height - MMI_button_bar_height - ih, MMI_bg_animation);
- gui_set_clip(
- MMI_content_width - iw,
- UI_device_height - MMI_button_bar_height - ih,
- MMI_content_width - 1,
- UI_device_height - MMI_button_bar_height);
- #if defined(MMI_ON_HARDWARE_P) && USE_PLUTO_GIF_LIBRARY
- mtk_show_animation(MMI_content_width - iw, UI_device_height - MMI_button_bar_height - ih, MMI_bg_animation);
- #else /* defined(MMI_ON_HARDWARE_P) && USE_PLUTO_GIF_LIBRARY */
- gdi_image_draw_animation(
- MMI_content_width - iw,
- UI_device_height - MMI_button_bar_height - ih,
- MMI_bg_animation,
- &animation_handle);
- #endif /* defined(MMI_ON_HARDWARE_P) && USE_PLUTO_GIF_LIBRARY */
- }
- /*****************************************************************************
- * FUNCTION
- * draw_bg
- * DESCRIPTION
- * Displays the background image for new mainmenu category
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void draw_bg(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 iwidth, iheight, character_height, tx, w;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- gdi_layer_push_clip();
- gdi_layer_push_text_clip();
- gui_set_clip(0, 0, UI_device_width - 1, UI_device_height - 1);
- gdi_layer_set_text_clip(
- MMI_title_x,
- MMI_title_y,
- MMI_title_x + MMI_title_width - 1,
- MMI_title_y + MMI_title_height - 1);
- if (MMI_bg_image != NULL)
- {
- gui_measure_image(MMI_bg_image, &iwidth, &iheight);
- gui_show_image(0, 0, MMI_bg_image);
- }
- if (!r2lMMIFlag)
- {
- tx = 2;
- }
- else
- {
- tx = MMI_title_width - 2;
- }
- if (MMI_bg_string != NULL) /* Fix for long titles */
- {
- S32 tw;
- if (!r2lMMIFlag)
- {
- tw = MMI_title_width - tx;
- }
- else
- {
- tw = tx;
- }
- gui_set_font((UI_font_type) (current_MMI_theme->window_title_font));
- gui_measure_string(MMI_bg_string, &w, &character_height);
- gui_set_text_color(*current_MMI_theme->title_text_color);
- gui_set_text_border_color(*current_MMI_theme->title_text_border_color);
- if (r2lMMIFlag)
- {
- gui_move_text_cursor(
- MMI_title_x + tx + w,
- MMI_title_y + ((MMI_title_height >> 1) - (character_height >> 1)));
- }
- else
- {
- gui_move_text_cursor(MMI_title_x + tx, MMI_title_y + ((MMI_title_height >> 1) - (character_height >> 1)));
- }
- if (!MMI_disable_title_shortcut_display && MMI_menu_shortcut_number >= 0)
- {
- tw -= MMI_menu_shortcut_box.width;
- if (w < tw)
- {
- S32 _tx = tx;
- if (!r2lMMIFlag)
- {
- tx = tx + (tw >> 1) - (w >> 1); /* Centers the title */
- if (tx < _tx)
- {
- tx = _tx;
- }
- }
- else
- {
- tx = (MMI_title_width >> 1) - (w >> 1);
- tx += w;
- if (tx > _tx)
- {
- tx = _tx;
- }
- }
- }
- }
- else
- {
- if (w < tw)
- {
- S32 _tx = tx;
- if (!r2lMMIFlag)
- {
- tx = (MMI_title_width >> 1) - (w >> 1);
- if (tx < _tx)
- {
- tx = _tx;
- }
- }
- else
- {
- tx = (MMI_title_width >> 1) - (w >> 1);
- tx += w;
- if (tx > _tx)
- {
- tx = _tx;
- }
- }
- }
- }
- }
- gdi_layer_unlock_frame_buffer();
- show_menu_shortcut();
- gdi_layer_blt_previous(
- MMI_title_x,
- MMI_title_y,
- MMI_title_x + MMI_title_width - 1,
- MMI_title_y + MMI_title_height - 1);
- }
- /*****************************************************************************
- * FUNCTION
- * standard_circular_3d_highlight_handler
- * DESCRIPTION
- * System Highlight handler of 3d circular list
- *
- * Internal function
- * PARAMETERS
- * item_index [IN] Index of current highlighted item
- * RETURNS
- * void
- *****************************************************************************/
- void standard_circular_3d_highlight_handler(S32 item_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_menu_shortcut_number = item_index + 1;
- MMI_highlighted_item_text = get_item_text(item_index);
- MMI_circular_3D_highlight_handler(item_index);
- }
- /*****************************************************************************
- * FUNCTION
- * standard_bg_ani_list_highlight_handler
- * DESCRIPTION
- * System Highlight handler of bg_ani_list
- *
- * Internal function
- * PARAMETERS
- * item_index [IN] Index of current highlighted item
- * RETURNS
- * void
- *****************************************************************************/
- void standard_bg_ani_list_highlight_handler(S32 item_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_hide_animations();
- MMI_menu_shortcut_number = item_index + 1;
- MMI_highlighted_item_text = get_item_text(item_index);
- MMI_bg_string = MMI_highlighted_item_text;
- MMI_bg_image = get_image((MMI_ID_TYPE) (MAIN_MENU_BG_IMAGE_BASE + item_index));
- switch (item_index)
- {
- case 0:
- case 1:
- MMI_bg_animation = get_image((MMI_ID_TYPE) (MAIN_MENU_PHONEBOOK_ICON + item_index));
- break;
- case 2:
- MMI_bg_animation = get_image((MMI_ID_TYPE) (MAIN_MENU_CALL_HISTORY_ICON));
- break;
- case 3:
- MMI_bg_animation = get_image((MMI_ID_TYPE) (MAIN_MENU_SETTINGS_ICON));
- break;
- case 4:
- MMI_bg_animation = get_image((MMI_ID_TYPE) (MAIN_MENU_FUNANDGAMES_ICON));
- break;
- case 5:
- MMI_bg_animation = get_image((MMI_ID_TYPE) (MAIN_MENU_PROFILES_ICON));
- break;
- case 6:
- MMI_bg_animation = get_image((MMI_ID_TYPE) (MAIN_MENU_ORGANIZER_ICON));
- break;
- case 7:
- MMI_bg_animation = get_image((MMI_ID_TYPE) (MAIN_MENU_SERVICES_ICON));
- break;
- case 8:
- MMI_bg_animation = get_image((MMI_ID_TYPE) (MAIN_MENU_SHORTCUTS_ICON));
- break;
- }
- ExecuteCurrHiliteHandler(item_index);
- #if(UI_ENABLE_POP_UP_DESCRIPTIONS)
- gui_pop_up_description_stop_scroll();
- wgui_current_pop_up_description_index = item_index;
- #endif /* (UI_ENABLE_POP_UP_DESCRIPTIONS) */
- }
- /*****************************************************************************
- * FUNCTION
- * hide_main_menu_animation_frame
- * DESCRIPTION
- * Hides the animating icon in a menu
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void hide_main_menu_animation_frame(void)