📄 gui_fixed_menus.c
字号:
/* Size of cache pool in byte */
#define GUI_LIST_MENU_FILLER_CACHE_SIZE \
((GUI_LIST_MENU_FILLER_CACHE_MAX_WIDTH * GUI_LIST_MENU_FILLER_CACHE_MAX_HEIGHT * GDI_MAINLCD_BIT_PER_PIXEL + 7) / 8)
/* Cached filler */
static UI_filled_area *g_gui_list_menu_filler_cache_target = NULL;
/* Cache pool of background filler (4-byte aligned for potential optimization) */
static U32 g_gui_list_menu_filler_cache[(GUI_LIST_MENU_FILLER_CACHE_SIZE + 3) / 4];
#endif /* __MMI_UI_LIST_RESIDENT_FILLER_CACHE__ */
S32 mmi_fixed_menu_bg_id = -1;
/* for R2L characters */
extern BOOL r2lMMIFlag;
extern S32 menu_item_inline_multiline_box(void);
extern int gdi_layer_get_bit_per_pixel(void);
extern PU8 get_image(U16 i);
//zx add begin 20070802
#ifdef __MT190_SUBMENU_STYLE__
extern BOOL gDynamicMenus;
#endif
//zx add end 20070802
/* GUI: fixed list menu functions */
UI_fixed_list_menu_theme *current_fixed_list_menu_theme = NULL;
S32 current_fixed_list_menuitem_display_index = -1;
/*****************************************************************************
* FUNCTION
* UI_dummy_menuitem_displayed_function
* DESCRIPTION
*
* PARAMETERS
* index [IN]
* x1 [IN]
* y1 [IN]
* x2 [IN]
* y2 [IN]
* RETURNS
* void
*****************************************************************************/
void UI_dummy_menuitem_displayed_function(S32 index, S32 x1, S32 y1, S32 x2, S32 y2)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
UI_UNUSED_PARAMETER(index);
UI_UNUSED_PARAMETER(x1);
UI_UNUSED_PARAMETER(y1);
UI_UNUSED_PARAMETER(x2);
UI_UNUSED_PARAMETER(y2);
}
/*****************************************************************************
* FUNCTION
* gui_set_fixed_list_menu_current_theme
* DESCRIPTION
* Applies the current theme to a fixed list menu
* PARAMETERS
* m [IN] Is the fixed list menu object
* RETURNS
* void
*****************************************************************************/
void gui_set_fixed_list_menu_current_theme(fixed_list_menu *m)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
m->flags |= current_fixed_list_menu_theme->flags;
m->focussed_filler = current_fixed_list_menu_theme->focussed_filler;
m->normal_filler = current_fixed_list_menu_theme->normal_filler;
gui_resize_vertical_scrollbar(&m->vbar, current_fixed_list_menu_theme->vbar_width, m->vbar.height);
gui_move_vertical_scrollbar(&m->vbar, m->x + m->width - current_fixed_list_menu_theme->vbar_width, m->y);
}
/*****************************************************************************
* FUNCTION
* gui_set_fixed_list_menu_theme
* DESCRIPTION
* Applies the given theme to a fixed list menu
* PARAMETERS
* m [IN] Is the fixed list menu object
* t [IN] Is the theme
* RETURNS
* void
*****************************************************************************/
void gui_set_fixed_list_menu_theme(fixed_list_menu *m, UI_fixed_list_menu_theme *t)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
m->flags |= t->flags;
m->focussed_filler = t->focussed_filler;
m->normal_filler = t->normal_filler;
gui_resize_vertical_scrollbar(&m->vbar, t->vbar_width, m->vbar.height);
gui_move_vertical_scrollbar(&m->vbar, m->x + m->width - current_fixed_list_menu_theme->vbar_width, m->y);
}
/*****************************************************************************
* FUNCTION
* gui_create_fixed_list_menu
* DESCRIPTION
* Creates a fixed list menu object
* PARAMETERS
* m [IN] Is the fixed list menu object (pre-allocated)
* x [IN] Is the left-top corner position
* y [IN] Is the left-top corner position
* width [IN] Are the dimensions
* height [IN] Are the dimensions
* RETURNS
* void
*****************************************************************************/
void gui_create_fixed_list_menu(fixed_list_menu *m, S32 x, S32 y, S32 width, S32 height)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
m->flags = 0;
m->x = x;
m->y = y;
m->width = width;
m->height = height;
m->n_items = 0;
m->highlighted_item = 0;
m->first_displayed_item = 0;
m->last_displayed_item = 0;
m->displayed_items = 0;
m->spacing = 0;
m->top = 0;
gui_set_fixed_list_menu_current_theme(m);
gui_create_vertical_scrollbar(
&m->vbar,
m->x + m->width - current_fixed_list_menu_theme->vbar_width,
m->y,
current_fixed_list_menu_theme->vbar_width,
m->height);
m->item_highlighted = UI_dummy_function_s32;
m->item_unhighlighted = UI_dummy_function_s32;
m->item_display_function = UI_fixed_menuitem_dummy_display_function;
m->item_hide_function = UI_fixed_menuitem_dummy_display_function;
m->item_measure_function = UI_fixed_menuitem_dummy_measure_function;
m->item_highlight_function = UI_fixed_menuitem_dummy_highlight_function;
m->item_remove_highlight_function = UI_fixed_menuitem_dummy_remove_highlight_function;
m->item_resize_function = UI_fixed_menuitem_dummy_resize_function;
m->items = NULL;
m->common_item_data = NULL;
m->item_displayed_callback = UI_dummy_menuitem_displayed_function;
m->resized_before_locate = MMI_FALSE;
m->act_layer_handle = GDI_LAYER_MAIN_BASE_LAYER_HANDLE;
m->act_lcd_handle = GDI_LCD_MAIN_LCD_HANDLE;
#ifdef __MMI_TOUCH_SCREEN__
m->pen_event_current_selected_callback_function = NULL;
m->pen_event_default_selected_callback_function = NULL;
m->pen_redraw_menu_function = NULL;
m->item_pen_function = UI_fixed_menuitem_dummy_pen_function;
m->disable_move_highlight = MMI_FALSE;
m->disable_up_select = MMI_FALSE;
m->pen_scroll_delay_time = 0;
m->pen_scroll_after_delay = -1;
memset(&(m->pen_state), 0, sizeof(gui_list_pen_state_struct));
#endif /* __MMI_TOUCH_SCREEN__ */
}
/*****************************************************************************
* FUNCTION
* gui_resize_fixed_list_menu
* DESCRIPTION
* Changes the size of a fixed list menu
* PARAMETERS
* m [IN] Is the fixed list menu object
* width [IN] Is the new width
* height [IN] Is the new height
* RETURNS
* void
*****************************************************************************/
void gui_resize_fixed_list_menu(fixed_list_menu *m, S32 width, S32 height)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
m->width = width;
m->height = height;
/*
* Example: change highlight in inline editor, list menu is resized
* according to virtual keyboard.
* We have to recompute m->first_displayed_item
*/
m->resized_before_locate = MMI_TRUE;
gui_move_vertical_scrollbar(&m->vbar, m->x + m->width - current_fixed_list_menu_theme->vbar_width, m->y);
gui_resize_vertical_scrollbar(&m->vbar, m->vbar.width, m->height);
}
/*****************************************************************************
* FUNCTION
* gui_move_fixed_list_menu
* DESCRIPTION
* Moves the fixed list menu to a different co-ordinate
* PARAMETERS
* m [IN] Is the fixed list menu object
* x [IN] Is the new left-top corner position
* y [IN] Is the new left-top corner position
* RETURNS
* void
*****************************************************************************/
void gui_move_fixed_list_menu(fixed_list_menu *m, S32 x, S32 y)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
m->x = x;
m->y = y;
gui_move_vertical_scrollbar(&m->vbar, m->x + m->width - current_fixed_list_menu_theme->vbar_width, m->y);
}
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_locate_highlighted_item
* DESCRIPTION
* Used to locate the highlighted item in the fixed list menu
*
* This is an internal function
* PARAMETERS
* m [IN] Is the fixed list menu object
* RETURNS
* void
*****************************************************************************/
void gui_fixed_list_menu_locate_highlighted_item(fixed_list_menu *m)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 iwidth, iheight;
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /* 0 */
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (m->flags & UI_LIST_MENU_FIRST_SHIFT_HIGHLIGHTED_ITEM)
{
S32 total_height = 0, i;
U8 done = 0;
S32 list_height = m->height;
m->flags &= ~UI_LIST_MENU_FIRST_SHIFT_HIGHLIGHTED_ITEM;
m->first_displayed_item = m->highlighted_item;
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 + 1)
{
if (m->first_displayed_item > i)
{
done = 1;
m->first_displayed_item = i + 1;
m->last_displayed_item = m->n_items - 1;
}
break;
}
}
if (total_height <= list_height)
{
m->first_displayed_item = 0;
}
total_height = 0;
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;
}
}
}
else if (m->flags & UI_LIST_MENU_LAST_SHIFT_HIGHLIGHTED_ITEM)
{
S32 total_height = 0, i;
U8 done = 0;
S32 list_height = m->height;
m->flags &= ~UI_LIST_MENU_LAST_SHIFT_HIGHLIGHTED_ITEM;
m->last_displayed_item = m->highlighted_item;
/* Check if in the first page */
for (i = 0; (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)
{
if (m->last_displayed_item < i)
{
done = 1;
m->first_displayed_item = 0;
m->last_displayed_item = i - 1;
}
break;
}
}
/* Check if in the last page */
if (!done && total_height <= list_height)
{
done = 1;
m->first_displayed_item = 0;
m->last_displayed_item = m->n_items - 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -