📄 gui_fixed_menus.c
字号:
* void
*****************************************************************************/
void gui_fixed_list_menu_goto_item(fixed_list_menu *m, S32 i)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 last_highlighted_item;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if ((i < 0) || (i > m->n_items - 1))
{
return;
}
if (i == m->highlighted_item)
{
return;
}
last_highlighted_item = m->highlighted_item;
m->highlighted_item = i;
gui_fixed_list_menu_locate_highlighted_item(m);
switch_fixed_list_highlighted_item(m, last_highlighted_item);
}
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_goto_next_item
* DESCRIPTION
* Higlights the next item
*
* The fixed list is not redrawn
* PARAMETERS
* m [IN] Is the fixed list menu object
* RETURNS
* void
*****************************************************************************/
void gui_fixed_list_menu_goto_next_item(fixed_list_menu *m)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 last_highlighted_item;
U8 loop_flag = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (m->highlighted_item >= (m->n_items - 1))
{
if (m->flags & UI_LIST_MENU_LOOP)
{
loop_flag = 1;
}
else
{
return;
}
}
last_highlighted_item = m->highlighted_item;
if (loop_flag)
{
m->highlighted_item = 0;
gui_fixed_list_menu_locate_previous_item(m);
}
else
{
m->highlighted_item++;
gui_fixed_list_menu_locate_next_item(m);
}
switch_fixed_list_highlighted_item(m, last_highlighted_item);
}
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_goto_previous_item
* DESCRIPTION
* Higlights the previous item
*
* The fixed list is not redrawn
* PARAMETERS
* m [IN] Is the fixed list menu object
* RETURNS
* void
*****************************************************************************/
void 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;
gui_fixed_list_menu_locate_next_item(m);
}
else
{
m->highlighted_item--;
gui_fixed_list_menu_locate_previous_item(m);
}
switch_fixed_list_highlighted_item(m, last_highlighted_item);
}
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_goto_next_page
* DESCRIPTION
* Higlights an item in the next page
*
* The fixed list is not redrawn
* PARAMETERS
* m [IN] Is the fixed list menu object
* RETURNS
* void
*****************************************************************************/
void 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++)
{
#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->last_displayed_item = i - 1;
}
}
}
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;
}
}
m->highlighted_item = m->first_displayed_item;
switch_fixed_list_highlighted_item(m, last_highlighted_item);
}
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_goto_previous_page
* DESCRIPTION
* Higlights an item in the previous page
*
* The fixed list is not redrawn
* PARAMETERS
* m [IN] Is the fixed list menu object
* RETURNS
* void
*****************************************************************************/
void 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;
}
gui_fixed_list_menu_locate_highlighted_item(m);
switch_fixed_list_highlighted_item(m, last_highlighted_item);
}
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_goto_first_item
* DESCRIPTION
* Higlights the first item
*
* The fixed list is not redrawn
* PARAMETERS
* m [IN] Is the fixed list menu object
* RETURNS
* void
*****************************************************************************/
void 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;
gui_fixed_list_menu_locate_highlighted_item(m);
switch_fixed_list_highlighted_item(m, last_highlighted_item);
}
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_goto_last_item
* DESCRIPTION
* Higlights the last item
*
* The fixed list is not redrawn
* PARAMETERS
* m [IN] Is the fixed list menu object
* RETURNS
* void
*****************************************************************************/
void 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);
gui_fixed_list_menu_locate_highlighted_item(m);
switch_fixed_list_highlighted_item(m, last_highlighted_item);
}
/*****************************************************************************
* FUNCTION
* gui_show_menu_background_filler_from_cache
* DESCRIPTION
* Displays the menu background in another GDI layer
* PARAMETERS
* x1 [IN]
* y1 [IN]
* x2 [IN]
* y2 [IN]
* f [IN] Background filler
* RETURNS
* void
*****************************************************************************/
#ifdef __MMI_UI_LIST_CACHE_BACKGROUND__
/* Check compile option dependency */
#if !defined(__GDI_MEMORY_PROFILE_2__) || defined(__MMI_WALLPAPER_ON_BOTTOM__)
#error "__MMI_UI_LIST_CACHE_BACKGROUND__ require __GDI_MEMORY_PROFILE_2__"
#endif
#ifdef __MMI_UI_LIST_RESIDENT_FILLER_CACHE__
void gui_show_menu_background_filler_from_cache(S32 x1, S32 y1, S32 x2, S32 y2, UI_filled_area *f)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!f)
{
return;
}
if (g_gui_list_menu_filler_cache_target != f)
{
/* Cache filler */
gdi_handle cache_layer;
g_gui_list_menu_filler_cache_target = f;
gdi_layer_create_using_outside_memory(
0,
0,
GUI_LIST_MENU_FILLER_CACHE_MAX_WIDTH,
GUI_LIST_MENU_FILLER_CACHE_MAX_HEIGHT,
&cache_layer,
(U8*) g_gui_list_menu_filler_cache,
sizeof(g_gui_list_menu_filler_cache));
gdi_layer_push_and_set_active(cache_layer);
gui_draw_filled_area(
0,
0,
GUI_LIST_MENU_FILLER_CACHE_MAX_WIDTH - 1,
GUI_LIST_MENU_FILLER_CACHE_MAX_HEIGHT - 1,
f);
gdi_layer_pop_and_restore_active();
gdi_layer_free(cache_layer);
}
if ((x2 - x1 + 1 > GUI_LIST_MENU_FILLER_CACHE_MAX_WIDTH) || (y2 - y1 + 1 > GUI_LIST_MENU_FILLER_CACHE_MAX_HEIGHT))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -