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

📄 gui_fixed_menuitems.c

📁 详细介绍MTK平台图层运用的好东西
💻 C
📖 第 1 页 / 共 5 页
字号:

/*****************************************************************************
 * FUNCTION
 *  gui_fixed_icontext_menuitem_set_text_position
 * DESCRIPTION
 *  Set the text position of a common icontext menuitem.
 * PARAMETERS
 *  m           [IN]        common icontext menu item object
 *  x           [IN]        text x
 *  y           [IN]        text y
 * RETURNS
 *  void
 *****************************************************************************/
void gui_fixed_icontext_menuitem_set_text_position(fixed_icontext_menuitem *m, S32 x, S32 y)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    m->text_x = x;
    m->text_y = y;
    if (m->icon_x > m->text_x)
    {
        m->scroll_width = m->icon_x - m->text_x;
    }
    else
    {
        m->scroll_width = m->width - m->text_x;
    }
}


/*****************************************************************************
 * FUNCTION
 *  gui_fixed_icontext_menuitem_set_icon_position
 * DESCRIPTION
 *  Set the icon position of a common icontext menuitem.
 * PARAMETERS
 *  m           [IN]        common icontext menu item object
 *  x           [IN]        icon x
 *  y           [IN]        icon y
 * RETURNS
 *  void
 *****************************************************************************/
void gui_fixed_icontext_menuitem_set_icon_position(fixed_icontext_menuitem *m, S32 x, S32 y)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    m->icon_x = x;
    m->icon_y = y;
    if (m->icon_x > m->text_x)
    {
        m->scroll_width = m->icon_x - m->text_x;
    }
    else
    {
        m->scroll_width = m->width - m->text_x;
    }
}


/*****************************************************************************
 * FUNCTION
 *  gui_resize_fixed_icontext_menuitem
 * DESCRIPTION
 *  Resize a common icontext menu item.
 * PARAMETERS
 *  m           [IN]        common icontext menu item object
 *  width       [IN]        new width
 *  height      [IN]        new height
 * RETURNS
 *  void
 *****************************************************************************/
void gui_resize_fixed_icontext_menuitem(fixed_icontext_menuitem *m, S32 width, S32 height)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    m->width = width;
    m->height = height;
    if (m->icon_x > m->text_x)
    {
        m->scroll_width = m->icon_x - m->text_x;
    }
    else
    {
        m->scroll_width = m->width - m->text_x;
    }

    /* keep the text right clip spacing for list menu image highlight */
    if (MMI_current_menu_type == LIST_MENU)
    {
        /* check whether the image highlight is applicable */
        gui_menuitem_verify_image_highlight_dimension(m);

        /* adjust the scrolling width if image highlight is used */
        if (gui_menuitem_is_image_highlight(m))
        {
            m->scroll_width -= GUI_MENUITEM_TEXT_RIGHT_GAP;
        }
    }
}


/* Text scrolling related functions within the menu item */
fixed_icontext_menuitem *GUI_current_fixed_icontext_menuitem_common_data = NULL;
fixed_icontext_menuitem_type *GUI_current_fixed_icontext_menuitem_data = NULL;
U8 GUI_current_fixed_icontext_menuitem_scroll = 0;
U8 GUI_current_fixed_icontext_menuitem_scroll_direction;
S32 GUI_current_fixed_icontext_menuitem_x;
S32 GUI_current_fixed_icontext_menuitem_y;
S32 GUI_current_fixed_icontext_menuitem_scroll_counter = 0;
UI_string_type GUI_current_fixed_icontext_menuitem_scroll_text = NULL;
UI_string_type GUI_current_fixed_icontext_menuitem_scroll_text_end = NULL;


/*****************************************************************************
 * FUNCTION
 *  gui_fixed_icontext_menuitem_scroll_handler
 * DESCRIPTION
 *  Scroll handler of the highlighted icontext menu item.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void gui_fixed_icontext_menuitem_scroll_handler(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U32 flags = GUI_current_fixed_icontext_menuitem_common_data->flags;
    gdi_handle act_lcd;

	S32 layer_offset_x, layer_offset_y;
	S32	x1, y1;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (!(flags & UI_MENUITEM_MARQUEE_SCROLL) && !(flags & UI_MENUITEM_TWO_DIRECTION_SCROLL))
    {
        return;
    }

    if (GUI_current_fixed_icontext_menuitem_scroll == 0)
    {
        return;
    }

#ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
    /* If the flash feeling list effect is running, wait for it to finish. */
    if ((gui_get_current_list_effect() == MMI_UI_LIST_HIGHLIGHT_EFFECT_FLASH_FEELING) &&
        (MMI_current_menu_type == LIST_MENU) &&
        (g_flash_feel_state != GUI_LIST_EFFECT_FLASH_FEELING_STOP))        
    {        
        return;
    }
#endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */

    if (GUI_current_fixed_icontext_menuitem_common_data->parent_list)
    {
        fixed_list_menu *parent_list = GUI_current_fixed_icontext_menuitem_common_data->parent_list;
        gdi_lcd_get_active(&act_lcd);
        gdi_lcd_set_active(parent_list->act_lcd_handle);
        gdi_layer_push_and_set_active(parent_list->act_layer_handle);

        GUI_current_fixed_icontext_menuitem_common_data->parent_list->current_displayed_item = GUI_current_fixed_icontext_menuitem_common_data->parent_list->highlighted_item;
    }

    flags |= GUI_current_fixed_icontext_menuitem_data->flags;
    if (GUI_current_fixed_icontext_menuitem_scroll_counter)
    {
        GUI_current_fixed_icontext_menuitem_scroll_counter--;
    }
    else
    {
    #if(UI_USE_WORD_SCROLLING_TEXT)
        GUI_current_fixed_icontext_menuitem_scroll_text = GUI_current_fixed_icontext_menuitem_scroll_text_end;
    #else /* (UI_USE_WORD_SCROLLING_TEXT) */ 
        if (flags & UI_MENUITEM_MARQUEE_SCROLL)
        {
            if (r2lMMIFlag)
            {
                GUI_current_fixed_icontext_menuitem_common_data->scroll_x += UI_text_menuitem_scroll_size;
                if (GUI_current_fixed_icontext_menuitem_common_data->scroll_x >=
                    (GUI_current_fixed_icontext_menuitem_common_data->text_width + UI_text_menuitem_scroll_gap))
                {
                    GUI_current_fixed_icontext_menuitem_common_data->scroll_x = 0;
                }
            }
            else
            {
                GUI_current_fixed_icontext_menuitem_common_data->scroll_x -= UI_text_menuitem_scroll_size;
                if (GUI_current_fixed_icontext_menuitem_common_data->scroll_x <=
                    (-(GUI_current_fixed_icontext_menuitem_common_data->text_width + UI_text_menuitem_scroll_gap)))
                {
                    GUI_current_fixed_icontext_menuitem_common_data->scroll_x = 0;
                }
            }
        }
        else
        {
            if (GUI_current_fixed_icontext_menuitem_scroll_direction == 0)
            {
                GUI_current_fixed_icontext_menuitem_common_data->scroll_x -= UI_text_menuitem_scroll_size;
                if ((GUI_current_fixed_icontext_menuitem_common_data->scroll_x +
                     GUI_current_fixed_icontext_menuitem_common_data->text_width) <=
                    (GUI_current_fixed_icontext_menuitem_common_data->scroll_width))
                {
                    GUI_current_fixed_icontext_menuitem_scroll_direction = 1;
                    GUI_current_fixed_icontext_menuitem_scroll_counter = UI_text_menuitem_scroll_pause;
                }
            }
            else if (GUI_current_fixed_icontext_menuitem_scroll_direction == 1)
            {
                GUI_current_fixed_icontext_menuitem_common_data->scroll_x += UI_text_menuitem_scroll_size;
                if (GUI_current_fixed_icontext_menuitem_common_data->scroll_x >= 0)
                {
                    GUI_current_fixed_icontext_menuitem_scroll_direction = 0;
                    GUI_current_fixed_icontext_menuitem_scroll_counter = UI_text_menuitem_scroll_pause;
                }
            }
        }
    #endif /* (UI_USE_WORD_SCROLLING_TEXT) */ 
        GUI_current_fixed_icontext_menuitem_common_data->ext_flags |= UI_MENUITEM_EXT_SHOW_IN_MARQUEE;

    #ifdef __MMI_UI_TRANSPARENT_EFFECT__
        if (!gui_is_current_transparency_with_multi_layer())
        {
            gui_fixed_icontext_disable_transparent_effect(GUI_current_fixed_icontext_menuitem_common_data);     /* To hide text below scrolling text */
        }
    #endif /* __MMI_UI_TRANSPARENT_EFFECT__ */ 

    #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
        /*
         * Disable the list effect for showing the highlighted menu item later.
         * When scrolling, no list effect is allowed. e.g., HIGHLIGHT_EFFECT_FLASH_FEELING.
         */
        gui_reset_current_list_effect();
    #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */
    
        gui_show_fixed_icontext_menuitem(
            (void*)GUI_current_fixed_icontext_menuitem_data,
            (void*)GUI_current_fixed_icontext_menuitem_common_data,
            GUI_current_fixed_icontext_menuitem_x,
            GUI_current_fixed_icontext_menuitem_y);

    #ifdef __MMI_UI_LIST_HIGHLIGHT_EFFECTS__
        /* restore list effect */
        gui_restore_current_list_effect();
    #endif /* __MMI_UI_LIST_HIGHLIGHT_EFFECTS__ */

    #ifdef __MMI_UI_TRANSPARENT_EFFECT__
        gui_fixed_icontext_enable_transparent_effect(GUI_current_fixed_icontext_menuitem_common_data);  /* Enable after scrolling text */
    #endif 

        GUI_current_fixed_icontext_menuitem_common_data->ext_flags &= ~UI_MENUITEM_EXT_SHOW_IN_MARQUEE;

		/* consider layer offset for JUI category 176 */
		gdi_layer_get_position(&layer_offset_x, &layer_offset_y);
		x1 = GUI_current_fixed_icontext_menuitem_x + layer_offset_x;
		y1 = GUI_current_fixed_icontext_menuitem_y + layer_offset_y;

    #if defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) && defined(__MMI_UI_HINTS_IN_MENUITEM__)
        if (GUI_current_fixed_icontext_menuitem_common_data->ext_flags & UI_MENUITEM_EXT_SHOW_TWO_LINE_SELECT)
        {
            gui_BLT_double_buffer(
                x1,
                y1,
                x1 + GUI_current_fixed_icontext_menuitem_common_data->width - 1,
                y1 + (GUI_current_fixed_icontext_menuitem_common_data->height << 1) - 1);
        }
        else if ((GUI_current_fixed_icontext_menuitem_common_data->ext_flags & UI_MENUITEM_SHOW_ALL_HINTS ||
                  ((GUI_current_fixed_icontext_menuitem_data->flags & UI_MENUITEM_STATE_FOCUSSED) &&
                   (GUI_current_fixed_icontext_menuitem_common_data->ext_flags & UI_MENUITEM_SHOW_HIGHLIGHTED_HINT))) &&
                 (gui_get_current_pop_up_description_string()))
        {
            gui_BLT_double_buffer(
                x1,
                y1,
                x1 + GUI_current_fixed_icontext_menuitem_common_data->width - 1,
                y1 + (GUI_current_fixed_icontext_menuitem_common_data->height << 1) - 1);
        }
        else
        {
            gui_BLT_double_buffer(
                x1,
                y1,
                x1 + GUI_current_fixed_icontext_menuitem_common_data->width - 1,
                y1 + GUI_current_fixed_icontext_menuitem_common_data->height - 1);
        }        
    #else /* defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) && defined(__MMI_UI_HINTS_IN_MENUITEM__) */ 
    #ifdef __MMI_UI_TWO_LINE_MENUITEM_STYLES__
        if (GUI_current_fixed_icontext_menuitem_common_data->ext_flags & UI_MENUITEM_EXT_SHOW_TWO_LINE_SELECT)
        {
            gui_BLT_double_buffer(
                x1,
                y1,
                x1 + GUI_current_fixed_icontext_menuitem_common_data->width - 1,
                y1 + (GUI_current_fixed_icontext_menuitem_common_data->height << 1) - 1);
        }
        else
        {
            gui_BLT_double_buffer(
                x1,
                y1,
                x1 + GUI_current_fixed_icontext_menuitem_common_data->width - 1,
                y1 + GUI_current_fixed_icontext_menuitem_common_data->height - 1);
        }
    #else /* __MMI_UI_TWO_LINE_MENUITEM_STYLES__ */ 

    #ifdef __MMI_UI_HINTS_IN_MENUITEM__
        if ((GUI_current_fixed_icontext_menuitem_common_data->ext_flags & UI_MENUITEM_SHOW_ALL_HINTS ||
             ((GUI_current_fixed_icontext_menuitem_data->flags & UI_MENUITEM_STATE_FOCUSSED) &&
              (GUI_current_fixed_icontext_menuitem_common_data->ext_flags & UI_MENUITEM_SHOW_HIGHLIGHTED_HINT))) &&
            (gui_get_current_pop_up_description_string()))
        {
            gui_BLT_double_buffer(
                x1,
                y1,
                x1 + GUI_current_fixed_icontext_menuitem_common_data->width - 1,
                y1 + (GUI_current_fixed_icontext_menuitem_common_data->height << 1) - 1);
        }
        else
        {
            gui_BLT_double_buffer(
                x1,
                y1,
                x1 + GUI_current_fixed_icontext_menuitem_common_data->width - 1,
                y1 + GUI_current_fixed_icontext_men

⌨️ 快捷键说明

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