⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wgui_fixed_menus.c

📁 详细介绍MTK平台图层运用的好东西
💻 C
📖 第 1 页 / 共 5 页
字号:
 *  void
 *****************************************************************************/
void wgui_list_tranisition_abort_cleanup_function(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    wgui_stop_list_transition_non_blocking();
}


/*****************************************************************************
 * FUNCTION
 *  draw_transition_list_non_blocking
 * DESCRIPTION
 *  Draw nonblocking list transition with timer.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void draw_transition_list_non_blocking(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    static S32 temp_count, transition_count;
    static S32 transition_resolution;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch (MMI_list_transition_style)
    {
        case WGUI_TRANSITION_D2T:
            if (is_in_nonblocking_list_transition() == 0)
            {
                g_in_list_transition = 1;
                save_copy_original_list_data();

                temp_count = transition_count = MMI_UI_LIST_TRANSITION_COUNT;
                transition_resolution = MMI_fixed_list_menu.height / transition_count;
                MMI_fixed_list_menu.y = MMI_fixed_list_menu.y + MMI_fixed_list_menu.height - 1;
                MMI_fixed_list_menu.height = 0;
                MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_BACKGROUND | UI_LIST_MENU_ENABLE_TRANSITION;
                gui_add_cleanup_hook(wgui_list_tranisition_abort_cleanup_function);
            }
            MMI_fixed_list_menu.y -= transition_resolution;
            MMI_fixed_list_menu.height += transition_resolution;
            move_fixed_list(MMI_fixed_list_menu.x, MMI_fixed_list_menu.y);
            resize_fixed_list(MMI_fixed_list_menu.width, MMI_fixed_list_menu.height);
            MMI_fixed_list_menu.top = 0;
            show_fixed_list();
            gui_BLT_double_buffer(
                MMI_fixed_list_menu.x,
                g_prev_list_y,
                MMI_fixed_list_menu.x + MMI_fixed_list_menu.width,
                g_prev_list_y + g_prev_list_height - 1);
            temp_count--;
            if (temp_count > 1)
            {
                gui_start_timer(LIST_TRANSITION_NON_BLOCKING_TIMER, draw_transition_list_non_blocking);
            }
            else
            {
                restore_saved_original_list_data();
                wgui_stop_list_transition_non_blocking();
                g_in_list_transition = 0;
                move_fixed_list(MMI_fixed_list_menu.x, MMI_fixed_list_menu.y);
                resize_fixed_list(MMI_fixed_list_menu.width, MMI_fixed_list_menu.height);
                show_fixed_list();
            }
            break;

        case WGUI_TRANSITION_T2D:
            if (is_in_nonblocking_list_transition() == 0)
            {
                g_in_list_transition = 1;
                save_copy_original_list_data();

                temp_count = transition_count = MMI_UI_LIST_TRANSITION_COUNT;
                transition_resolution = MMI_fixed_list_menu.height / transition_count;
                MMI_fixed_list_menu.y -= (MMI_fixed_list_menu.height - 1);
                MMI_fixed_list_menu.flags |= UI_LIST_MENU_DISABLE_BACKGROUND | UI_LIST_MENU_ENABLE_TRANSITION;
                gui_add_cleanup_hook(wgui_list_tranisition_abort_cleanup_function);
            }
            MMI_fixed_list_menu.y += transition_resolution;
            move_fixed_list(MMI_fixed_list_menu.x, MMI_fixed_list_menu.y);
            resize_fixed_list(MMI_fixed_list_menu.width, MMI_fixed_list_menu.height);
            MMI_fixed_list_menu.top = 0;
            gui_lock_double_buffer();
            gui_push_clip();
            gui_set_clip(
                MMI_fixed_list_menu.x,
                g_prev_list_y,
                MMI_fixed_list_menu.x + MMI_fixed_list_menu.width,
                g_prev_list_y + g_prev_list_height - 1);
            show_fixed_list();
            gui_pop_clip();
            draw_title();
            show_status_icons();
            gui_unlock_double_buffer();
            gui_BLT_double_buffer(
                MMI_fixed_list_menu.x,
                0,
                MMI_fixed_list_menu.x + MMI_fixed_list_menu.width,
                g_prev_list_y + g_prev_list_height - 1);
            temp_count--;
            if (temp_count > 1)
            {
                gui_start_timer(LIST_TRANSITION_NON_BLOCKING_TIMER, draw_transition_list_non_blocking);
            }
            else
            {
                restore_saved_original_list_data();
                move_fixed_list(MMI_fixed_list_menu.x, MMI_fixed_list_menu.y);
                resize_fixed_list(MMI_fixed_list_menu.width, MMI_fixed_list_menu.height);
                wgui_stop_list_transition_non_blocking();
                show_fixed_list();
                gui_BLT_double_buffer(
                    MMI_fixed_list_menu.x,
                    g_prev_list_y,
                    MMI_fixed_list_menu.x + MMI_fixed_list_menu.width,
                    g_prev_list_y + g_prev_list_height - 1);
            }
            break;
    }
}


/*****************************************************************************
 * FUNCTION
 *  wgui_stop_list_transition_non_blocking
 * DESCRIPTION
 *  Stop the timer for list transition and reset variables.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void wgui_stop_list_transition_non_blocking(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (is_in_nonblocking_list_transition())
    {
        MMI_fixed_list_menu.height = g_prev_list_height;
        MMI_fixed_list_menu.y = g_prev_list_y;
        g_in_list_transition = 0;
    }
    reset_list_transition();
    gui_cancel_timer(draw_transition_list_non_blocking);
}


/*****************************************************************************
 * FUNCTION
 *  is_in_nonblocking_list_transition
 * DESCRIPTION
 *  Return the non blocking list transition flag.
 * PARAMETERS
 *  void
 * RETURNS
 *  List transition flag
 *****************************************************************************/
S32 is_in_nonblocking_list_transition(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return g_in_list_transition;
}


/*****************************************************************************
 * FUNCTION
 *  get_original_prev_list_y_value
 * DESCRIPTION
 *  Return the original value of list start y position.
 * PARAMETERS
 *  void
 * RETURNS
 *  Start y value
 *****************************************************************************/
S32 get_original_prev_list_y_value(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return g_prev_list_y;
}


/*****************************************************************************
 * FUNCTION
 *  save_copy_original_list_data
 * DESCRIPTION
 *  Save the original value of list start y position and list height.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void save_copy_original_list_data(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    g_prev_list_y = MMI_fixed_list_menu.y;
    g_prev_list_height = MMI_fixed_list_menu.height;
}


/*****************************************************************************
 * FUNCTION
 *  restore_saved_original_list_data
 * DESCRIPTION
 *  Restore the original value of list start y position and list height.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void restore_saved_original_list_data(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    MMI_fixed_list_menu.height = g_prev_list_height;
    MMI_fixed_list_menu.y = g_prev_list_y;
}

#endif /* (LIST_TRANSITION_STYLE_NON_BLOCKING) */ 

#endif /* __MMI_UI_LIST_TRANSITION__ */ 


/*****************************************************************************
 * FUNCTION
 *  wgui_list_menu_show_empty_label_if_needed
 * DESCRIPTION
 *  Display "empty" in list menu if it is empty.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void wgui_list_menu_show_empty_label_if_needed(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 offset_x;
    S32 offset_y;
    S32 str_width;
    S32 str_height;
    S8 *str_ptr;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (MMI_fixed_list_menu.n_items > 0 || !wgui_fixed_list_show_empty)
    {
        return;
    }

    gdi_layer_set_clip(
        MMI_fixed_list_menu.x,
        MMI_fixed_list_menu.y,
        MMI_fixed_list_menu.x + MMI_fixed_list_menu.width - 1,
        MMI_fixed_list_menu.y + MMI_fixed_list_menu.height - 1);

    gui_set_font(current_MMI_theme->list_menu_font);
    gui_set_text_color(*(current_MMI_theme->list_normal_text_color));

    str_ptr = GetString(STR_GLOBAL_EMPTY);

    gui_measure_string((UI_string_type) str_ptr, &str_width, &str_height);

    offset_x = MMI_fixed_list_menu.x + ((MMI_fixed_list_menu.width - str_width) >> 1);
    offset_y = MMI_fixed_list_menu.y + ((MMI_fixed_list_menu.height - str_height) >> 1);

    if (r2lMMIFlag)
    {
        gui_move_text_cursor(offset_x + str_width, offset_y);
    }
    else
    {
        gui_move_text_cursor(offset_x, offset_y);
    }

    gui_print_text((UI_string_type) str_ptr);
}


/*****************************************************************************
 * FUNCTION
 *  show_fixed_list
 * DESCRIPTION
 *  Show the fixed list.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void show_fixed_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    gdi_handle act_lcd;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    gdi_lcd_get_active(&act_lcd);
    gdi_lcd_set_active(MMI_fixed_list_menu.act_lcd_handle);
    gdi_layer_push_and_set_active(MMI_fixed_list_menu.act_layer_handle);

#ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
    gui_stop_list_highlight_effect();
    gui_add_cleanup_hook(gui_stop_list_highlight_effect);
#endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 

#ifdef __MMI_UI_LIST_TRANSITION__
    if (MMI_check_list_for_transition && MMI_list_transition_style)
    {
    #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
        gui_reset_current_list_effect();
    #endif 

        MMI_check_list_for_transition = 0;
    #if(LIST_TRANSITION_STYLE_NON_BLOCKING)
        if (is_in_nonblocking_list_transition() == 0)
        {
            draw_transition_list_non_blocking();
        }
    #else /* (LIST_TRANSITION_STYLE_NON_BLOCKING) */ 
        draw_transition_list();
    #endif /* (LIST_TRANSITION_STYLE_NON_BLOCKING) */ 

        MMI_check_list_for_transition = 1;

    #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
    #if(LIST_TRANSITION_STYLE_NON_BLOCKING)
        if (is_in_nonblocking_list_transition() == 0)
    #endif 
            gui_restore_current_list_effect();
    #else /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 
        return;
    #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */ 

    }
#endif /* __MMI_UI_LIST_TRANSITION__ */ 

    if (MMI_fixed_list_menu.flags & UI_LIST_MENU_DISABLE_BACKGROUND)
    {
        _MMI_hide_fixed_list_menu();
    }
    
    gui_show_fixed_list_menu(&MMI_fixed_list_menu);
    wgui_display_fixed_text_list_pop_up_description();

#ifdef __MMI_UI_LIST_TRANSITION__
#if(LIST_TRANSITION_STYLE_NON_BLOCKING)
    if (get_list_transition() == WGUI_TRANSITION_T2D && !MMI_check_list_for_transition ||
        is_in_nonblocking_list_transition() == 1)
    {
        return;
    }
#else /* (LIST_TRANSITION_STYLE_NON_BLOCKING) */ 
    if (get_list_transition() == WGUI_TRANSITION_T2D && !MMI_check_list_for_transition)
    {
        return;
    }
#endif /* (LIST_TRANSITION_STYLE_NON_BLOCKING) */ 
#endif /* __MMI_UI_LIST_TRANSITION__ */ 

    /* if is emtpty folder, show a empty string */
    wgui_list_menu_show_empty_label_if_needed();

    gdi_layer_blt_previous(
        MMI_fixed_list_menu.x,
        MMI_fixed_list_menu.y,
        MMI_fixed_list_menu.x + MMI_fixed_list_menu.width,
        MMI_fixed_list_menu.y + MMI_fixed_list_menu.height);
    gdi_layer_pop_and_restore_active();
    gdi_lcd_set_active(act_lcd);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -