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

📄 im_gui.c

📁 MTK平台QQ移植
💻 C
📖 第 1 页 / 共 5 页
字号:
 * PARAMETERS
 *  m       [IN]        fixed list menu object     
 * RETURNS
 *  void
 *****************************************************************************/
void IM_gui_fixed_list_menu_goto_previous_item(fixed_list_menu *m)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 last_highlighted_item;
    U8 loop_flag = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (m->highlighted_item <= 0)
    {
        if (m->flags & UI_LIST_MENU_LOOP)
        {
            loop_flag = 1;
        }
        else
        {
            return;
        }
    }
    last_highlighted_item = m->highlighted_item;
    if (loop_flag)
    {
        m->highlighted_item = m->n_items - 1;
        IM_gui_fixed_list_menu_locate_next_item(m);
    }
    else
    {
        m->highlighted_item--;
        IM_gui_fixed_list_menu_locate_previous_item(m);
    }

    IM_gui_fixed_list_menu_switch_highlighted_item(m, last_highlighted_item);
}


/*****************************************************************************
 * FUNCTION
 *  IM_gui_fixed_list_menu_goto_next_page
 * DESCRIPTION
 *  Go to the next page.
 * PARAMETERS
 *  m       [IN]        fixed list menu object
 * RETURNS
 *  void
 *****************************************************************************/
void IM_gui_fixed_list_menu_goto_next_page(fixed_list_menu *m)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 last_highlighted_item;
    S32 iwidth, iheight;
    U8 done = 0;
    S32 total_height = 0, i;
    S32 list_height = m->height - 4;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    last_highlighted_item = m->highlighted_item;
    m->first_displayed_item += m->displayed_items;
    if (m->first_displayed_item > (m->n_items - 1))
    {
        m->first_displayed_item = (m->n_items - 1);
        m->last_displayed_item = m->first_displayed_item;
    }
    else
    {
        for (i = m->first_displayed_item; (i < m->n_items) && (!done); i++)
        {
                IM_current_fixed_list_display_index = i;
            m->item_measure_function(m->items[i], m->common_item_data, &iwidth, &iheight);
            total_height += iheight;
            if (total_height > list_height + 1)
            {
                done = 1;
                m->last_displayed_item = i - 1;
            }
        }
    }
    for (i = m->last_displayed_item; i >= 0 && (!done); i--)
    {
            IM_current_fixed_list_display_index = i;
        m->item_measure_function(m->items[i], m->common_item_data, &iwidth, &iheight);
        total_height += iheight;
        if (total_height > list_height + 1)
        {
            done = 1;
            m->first_displayed_item = i + 1;
        }
    }
    m->highlighted_item = m->first_displayed_item;

    IM_gui_fixed_list_menu_switch_highlighted_item(m, last_highlighted_item);
}


/*****************************************************************************
 * FUNCTION
 *  IM_gui_fixed_list_menu_goto_previous_page
 * DESCRIPTION
 *  Go to the previous page.
 * PARAMETERS
 *  m       [IN]        fixed list menu object
 * RETURNS
 *  void
 *****************************************************************************/
void IM_gui_fixed_list_menu_goto_previous_page(fixed_list_menu *m)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 last_highlighted_item;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    last_highlighted_item = m->highlighted_item;
    m->first_displayed_item -= m->displayed_items;
    if (m->first_displayed_item < 0)
    {
        m->first_displayed_item = 0;
    }
    m->highlighted_item = m->first_displayed_item;
    if (last_highlighted_item == m->highlighted_item)
    {
        return;
    }
    IM_gui_fixed_list_menu_locate_highlighted_item(m);

    IM_gui_fixed_list_menu_switch_highlighted_item(m, last_highlighted_item);
}


/*****************************************************************************
 * FUNCTION
 *  IM_gui_fixed_list_menu_goto_first_item
 * DESCRIPTION
 *  Go to the first item.
 * PARAMETERS
 *  m       [IN]        fixed list menu object
 * RETURNS
 *  void
 *****************************************************************************/
void IM_gui_fixed_list_menu_goto_first_item(fixed_list_menu *m)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 last_highlighted_item;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (m->highlighted_item == 0)
    {
        return;
    }
    last_highlighted_item = m->highlighted_item;
    m->highlighted_item = 0;
    IM_gui_fixed_list_menu_locate_highlighted_item(m);

    IM_gui_fixed_list_menu_switch_highlighted_item(m, last_highlighted_item);
}


/*****************************************************************************
 * FUNCTION
 *  IM_gui_fixed_list_menu_goto_last_item
 * DESCRIPTION
 *  Go to the last item.
 * PARAMETERS
 *  m       [IN]        fixed list menu object
 * RETURNS
 *  void
 *****************************************************************************/
void IM_gui_fixed_list_menu_goto_last_item(fixed_list_menu *m)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 last_highlighted_item;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (m->highlighted_item == (m->n_items - 1))
    {
        return;
    }
    last_highlighted_item = m->highlighted_item;
    m->highlighted_item = (m->n_items - 1);
    IM_gui_fixed_list_menu_locate_highlighted_item(m);

    IM_gui_fixed_list_menu_switch_highlighted_item(m, last_highlighted_item);
}


/*****************************************************************************
 * FUNCTION
 *  IM_gui_show_fixed_list_menu_no_draw
 * DESCRIPTION
 *  Calculate the first and the last displayed item indices.
 * PARAMETERS
 *  m       [IN]        fixed list menu object
 * RETURNS
 *  void
 *****************************************************************************/
void IM_gui_show_fixed_list_menu_no_draw(fixed_list_menu *m)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 i;
    S32 iwidth, iheight;
    U8 done = 0;
    S32 total_height, counter, list_height;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    list_height = m->height;
    total_height = 0;
    counter = 0;
    IM_current_fixed_list_display_index = -1;
    for (i = m->first_displayed_item; (i < m->n_items && !done); i++)
    {
        IM_current_fixed_list_display_index = i;
        m->item_measure_function(m->items[i], m->common_item_data, &iwidth, &iheight);
        total_height += iheight;
        if (total_height > list_height + 1)
        {
            done = 1;
        }
        else
        {
            counter++;
        }
    }
    IM_current_fixed_list_display_index = -1;
    if (counter == 0)
    {
        m->last_displayed_item = m->first_displayed_item;
    }
    else
    {
        m->last_displayed_item = m->first_displayed_item + counter - 1;
    }
    m->displayed_items = counter;
    if (!(m->flags & UI_LIST_MENU_DISABLE_SCROLLBAR))
    {
        gui_set_vertical_scrollbar_range(&m->vbar, m->n_items);
        gui_set_vertical_scrollbar_scale(&m->vbar, m->displayed_items);
        gui_set_vertical_scrollbar_value(&m->vbar, m->first_displayed_item);
    }
}

/*****************************************************************************
 * FUNCTION
 *  IM_gui_show_fixed_list_menu
 * DESCRIPTION
 *  Show the fixed list menu.
 * PARAMETERS
 *  m       [IN]        fixed list menu object
 * RETURNS
 *  void
 *****************************************************************************/
void IM_gui_show_fixed_list_menu(fixed_list_menu *m)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 x1, y1, x2, y2, y_offset;

    UI_filled_area *f;
    S32 i;
    S32 cx1, cy1, cx2, cy2;
    S32 tx1, ty1, tx2, ty2;
    S32 iwidth, iheight;
    U8 done = 0;
    S32 total_height, counter, list_height;
    U8 disable_draw = 0;
    MMI_BOOL show_scrollbar;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/  

    if (m->flags & UI_LIST_MENU_DISABLE_DRAW)
    {
        disable_draw = 1;
    }
    gui_get_clip(&cx1, &cy1, &cx2, &cy2);
    gui_get_text_clip(&tx1, &ty1, &tx2, &ty2);

    x1 = m->x;
    y1 = m->y;
    x2 = x1 + m->width - 1;
    y2 = y1 + m->height - 1;

    /* Use the original x1, y1, x2, y2 for background filler */

    if (IM_gui_curr_theme_index == 0)
    {
        if (m->flags & UI_LIST_MENU_STATE_FOCUSSED)
        {
            f = m->focussed_filler;
        }
        else
        {
            f = m->normal_filler;
        }
        if (!disable_draw && (!(m->flags & UI_LIST_MENU_DISABLE_BACKGROUND)) && MMI_current_menu_type != PAGE_MENU)
        {
            gui_set_clip(x1, y1, x2, y2);

            if (!(m->flags & UI_LIST_MENU_DISABLE_BKGRND_IN_LAYER) && (wgui_is_wallpaper_on_bottom() == MMI_TRUE))
            {
                gdi_draw_solid_rect(x1, y1, x2, y2, GDI_COLOR_TRANSPARENT);

            }
            else
            {
            #if !defined(MT6205B) && !defined(MT6208)
                gui_draw_filled_area(x1, y1, x2, y2, f);
            #else /* !defined(MT6205B) && !defined(MT6208) */
                /* For low-end phone, disable list menu background can greately improve menu performance. 
                   We use the color of filler to draw the background (typically white). */
                color c = f->c;
                gdi_draw_solid_rect(x1, y1, x2, y2, gdi_act_color_from_rgb(255, c.r, c.g, c.b));
            #endif /* !defined(MT6205B) && !defined(MT6208) */
            }
        }
    }
    else
    {
        f = IM_theme[IM_gui_curr_theme_index].list_background;
        gui_set_clip(x1, y1, x2, y2);
        gui_draw_filled_area(x1, y1, x2, y2, f);
    }


    if (m->flags & UI_LIST_MENU_ENABLE_TRANSITION)
    {
        color c = gui_color(255, 255, 255);

        gui_push_clip();
        gui_set_clip(x1, y1, x2, y2);
        gui_fill_rectangle(x1, y1, x2, y2, c);
        gui_pop_clip();
    }

    if (m->n_items <= 0)
    {
        return;
    }

    /* Check presence of scrollbar */
    show_scrollbar = MMI_FALSE;
    if (!(m->flags & UI_LIST_MENU_DISABLE_SCROLLBAR))

⌨️ 快捷键说明

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