📄 gui_fixed_menus.c
字号:
/* Align to the bottom */
total_height = 0;
if (!done)
{
for (i = m->last_displayed_item; (i >= 0) && (!done); i--)
{
#if defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__)
if (i == m->highlighted_item)
{
current_fixed_list_menuitem_display_index = -1;
}
else
{
current_fixed_list_menuitem_display_index = i;
}
#endif /* defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__) */
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;
}
}
if (!done)
{
m->first_displayed_item = 0;
}
}
}
else if (m->flags & UI_LIST_MENU_CENTER_HIGHLIGHTED)
{
m->first_displayed_item = m->highlighted_item - 1;
if (m->first_displayed_item < 0)
{
m->first_displayed_item = m->n_items - 1;
}
m->last_displayed_item = m->highlighted_item + 1;
if (m->last_displayed_item >= m->n_items)
{
m->last_displayed_item = 0;
}
}
else
{
if (m->highlighted_item < m->first_displayed_item)
{
m->first_displayed_item = m->highlighted_item;
}
else if (m->highlighted_item > m->last_displayed_item)
{
U8 done = 0;
S32 total_height = 0, i;
S32 list_height = m->height;
m->last_displayed_item = m->highlighted_item;
for (i = m->last_displayed_item; i >= 0 && (!done); i--)
{
#if defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__)
if (i == m->highlighted_item)
{
current_fixed_list_menuitem_display_index = -1;
}
else
{
current_fixed_list_menuitem_display_index = i;
}
#endif /* defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__) */
m->item_measure_function(m->items[i], m->common_item_data, &iwidth, &iheight);
total_height += iheight;
if (total_height > list_height)
{
done = 1;
m->first_displayed_item = i + 1;
}
}
}
else
{
U8 done = 0;
S32 total_height = 0, i;
S32 list_height = m->height;
for (i = m->first_displayed_item; i < m->n_items && (!done); i++)
{
#if defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__)
if (i == m->highlighted_item)
{
current_fixed_list_menuitem_display_index = -1;
}
else
{
current_fixed_list_menuitem_display_index = i;
}
#endif /* defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__) */
m->item_measure_function(m->items[i], m->common_item_data, &iwidth, &iheight);
total_height += iheight;
if (total_height > list_height)
{
done = 1;
m->last_displayed_item = i - 1;
}
}
if (!done)
{
total_height = 0;
for (i = m->n_items - 1; (i >= 0) && (!done); i--)
{
#if defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__)
if (i == m->highlighted_item)
{
current_fixed_list_menuitem_display_index = -1;
}
else
{
current_fixed_list_menuitem_display_index = i;
}
#endif /* defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__) */
m->item_measure_function(m->items[i], m->common_item_data, &iwidth, &iheight);
total_height += iheight;
if (total_height > list_height)
{
done = 1;
m->first_displayed_item = i + 1;
m->last_displayed_item = m->n_items - 1;
break;
}
}
if (!done)
{
m->first_displayed_item = 0;
m->last_displayed_item = m->n_items - 1;
}
}
if (m->highlighted_item > m->last_displayed_item)
{
done = 0;
total_height = 0;
m->last_displayed_item = m->highlighted_item;
for (i = m->last_displayed_item; i >= 0 && (!done); i--)
{
#if defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__)
if (i == m->highlighted_item)
{
current_fixed_list_menuitem_display_index = -1;
}
else
{
current_fixed_list_menuitem_display_index = i;
}
#endif /* defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__) */
m->item_measure_function(m->items[i], m->common_item_data, &iwidth, &iheight);
total_height += iheight;
if (total_height > list_height)
{
done = 1;
m->first_displayed_item = i + 1;
}
}
}
}
}
/* Located after resized */
m->resized_before_locate = MMI_FALSE;
}
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_locate_previous_item
* DESCRIPTION
*
* PARAMETERS
* m [?]
* RETURNS
* void
*****************************************************************************/
void gui_fixed_list_menu_locate_previous_item(fixed_list_menu *m)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (m->flags & UI_LIST_MENU_CENTER_HIGHLIGHTED)
{
if (m->highlighted_item == 0)
{
m->first_displayed_item = m->n_items - 1;
m->last_displayed_item = 1;
}
else
{
m->first_displayed_item = m->highlighted_item - 1;
if (m->first_displayed_item < 0)
{
m->first_displayed_item = m->n_items - 1;
}
m->last_displayed_item = m->highlighted_item + 1;
if (m->last_displayed_item > m->n_items - 1)
{
m->last_displayed_item = 0;
}
}
}
else
{
if (m->highlighted_item < m->first_displayed_item)
{
m->first_displayed_item = m->highlighted_item;
}
else if (m->resized_before_locate)
{
gui_fixed_list_menu_locate_highlighted_item(m);
}
#if defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__)
else if (m->highlighted_item == m->last_displayed_item - 1)
{
S32 iwidth, iheight;
U8 done = 0;
S32 total_height = 0, i;
S32 list_height = m->height;
current_fixed_list_menuitem_display_index = -1;
for (i = m->last_displayed_item; i >= 0 && (!done); i--)
{
if (i == m->highlighted_item)
{
current_fixed_list_menuitem_display_index = -1;
}
else
{
current_fixed_list_menuitem_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;
}
}
}
#endif /* defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__) */
}
/* Located after resized */
m->resized_before_locate = MMI_FALSE;
}
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_locate_next_item
* DESCRIPTION
*
* PARAMETERS
* m [?]
* RETURNS
* void
*****************************************************************************/
void gui_fixed_list_menu_locate_next_item(fixed_list_menu *m)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 iwidth, iheight;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (m->flags & UI_LIST_MENU_CENTER_HIGHLIGHTED)
{
m->first_displayed_item = m->highlighted_item - 1;
if (m->first_displayed_item < 0)
{
m->first_displayed_item = m->n_items - 1;
}
m->last_displayed_item = m->highlighted_item + 1;
if (m->last_displayed_item >= m->n_items)
{
m->last_displayed_item = 0;
}
}
else
{
#if defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__)
if (m->highlighted_item >= m->last_displayed_item)
#else
if (m->highlighted_item > m->last_displayed_item)
#endif
{
U8 done = 0;
S32 total_height = 0, i;
S32 list_height = m->height;
m->last_displayed_item = m->highlighted_item;
for (i = m->last_displayed_item; i >= 0 && (!done); i--)
{
#if defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__)
if (i == m->highlighted_item)
{
current_fixed_list_menuitem_display_index = -1;
}
else
{
current_fixed_list_menuitem_display_index = i;
}
#endif /* defined(__MMI_UI_TWO_LINE_MENUITEM_STYLES__) || defined(__MMI_UI_HINTS_IN_MENUITEM__) */
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;
}
}
}
else if (m->resized_before_locate)
{
gui_fixed_list_menu_locate_highlighted_item(m);
}
}
/* Located after resized */
m->resized_before_locate = MMI_FALSE;
}
/*****************************************************************************
* FUNCTION
* switch_fixed_list_highlighted_item
* DESCRIPTION
*
* PARAMETERS
* m [?]
* last_highlighted_item [IN]
* RETURNS
* void
*****************************************************************************/
static void switch_fixed_list_highlighted_item(fixed_list_menu *m, S32 last_highlighted_item)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (last_highlighted_item != m->highlighted_item)
{
if ((last_highlighted_item >= 0) && (last_highlighted_item < m->n_items))
{
m->item_remove_highlight_function(m->items[last_highlighted_item], m->common_item_data);
}
if ((m->highlighted_item >= 0) && (m->highlighted_item < m->n_items))
{
m->item_highlight_function(m->items[m->highlighted_item], m->common_item_data);
}
m->item_unhighlighted(last_highlighted_item);
#ifdef __MMI_TOUCH_SCREEN__
m->pen_event_current_selected_callback_function = m->pen_event_default_selected_callback_function;
#endif
m->item_highlighted(m->highlighted_item);
}
}
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_goto_item
* DESCRIPTION
* Highlights a particular item
*
* The fixed list is not redrawn
* PARAMETERS
* m [IN] Is the fixed list menu object
* i [IN] Is the index of the item to be highlighted (zero based)
* RETURNS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -