📄 gui_fixed_menus.c
字号:
{
m->highlight_x = x1;
m->highlight_y = y_offset + y1;
}
m->item_display_function(m->items[i], m->common_item_data, x1, y_offset + y1);
}
counter++;
}
}
current_fixed_list_menuitem_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;
}
gui_set_clip(cx1, cy1, cx2, cy2);
gui_set_text_clip(tx1, ty1, tx2, ty2);
/* Handle scrollbar */
if (show_scrollbar)
{
/* FIXME. debug only. we can remove the check in the future */
MMI_DBG_ASSERT(!(m->flags & UI_LIST_MENU_AUTO_DISABLE_SCROLLBAR) ||
(total_height > list_height + 1) || (m->first_displayed_item > 0));
if (r2lMMIFlag)
{
gui_move_vertical_scrollbar(&m->vbar, m->x, m->y);
}
else
{
gui_move_vertical_scrollbar(&m->vbar, m->x + m->width - m->vbar.width, m->y);
}
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);
if (!disable_draw)
{
gui_show_vertical_scrollbar(&m->vbar);
}
}
}
/*****************************************************************************
* FUNCTION
* 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 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;
current_fixed_list_menuitem_display_index = -1;
for (i = m->first_displayed_item; (i < m->n_items && !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;
}
else
{
counter++;
}
}
current_fixed_list_menuitem_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);
}
}
#ifdef __MMI_TOUCH_SCREEN__
//wangzhk 2009.02.18
#ifdef __T5650__
S32 page_item_index = 0;
extern U8 TouchIsanimation;
extern U8 Lanimation;
extern U8 Ranimation;
extern S32 MMI_main_menu_type;
BOOL item_falg = FALSE;
extern void PageShowAnimation(void);
extern void gui_goto_item_callback(void (*f) (void));
//#define MAIN_MENU_PAGE_NUM (5)
typedef struct
{
int x1;
int y1;
int x2;
int y2;
}T_PAGE_MENU_POS;
static mmi_pen_point_struct PageBackupPenDownPoint ;
static const T_PAGE_MENU_POS gPageMenuPos[] =
{
{5,236,43,295},
{44,236,89,295},
{90,236,150,295},
{151,236,196,295},
{197,236,239,295},
};
BOOL gui_fixed_page_mainmenu_list_menu_translate_pen_down_position(mmi_pen_event_type_enum pen_event,fixed_list_menu *m, S32 x,S32 y, S32 *item_index)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
BOOL ret = MMI_TRUE;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if(pen_event == MMI_PEN_EVENT_DOWN)
{
PageBackupPenDownPoint.x=x;
PageBackupPenDownPoint.y=y;
}
if (m->n_items <= 0)
{
*item_index = 0;
/* ret is false */
}
else if (y < gPageMenuPos[0].y1||y > gPageMenuPos[0].y2)
{
*item_index = m->highlighted_item;
/* ret is false */
}
else
{
kal_prompt_trace(MOD_UEM,"translate_pen_down_position::else....m->highlighted_item==%d ",m->highlighted_item);
*item_index = m->highlighted_item;
ret = MMI_TRUE;
}
return ret;
}
BOOL gui_fixed_page_mainmenu_list_menu_translate_pen_up_position(fixed_list_menu *m, S32 x,S32 y, S32 *item_index)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 i;
BOOL ret = MMI_FALSE;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
// y -= m->y;
int distance;
S32 item_x;
S32 highlight_num,offset_x;
int num;
if(PageBackupPenDownPoint.y<gPageMenuPos[0].y1 && y<gPageMenuPos[0].y1)
{
if(x == PageBackupPenDownPoint.x)
{
*item_index = m->highlighted_item;
}
else
{
if(x > PageBackupPenDownPoint.x)
{
distance=x-PageBackupPenDownPoint.x;
if (abs(distance)>10)
{
Ranimation =1;
Lanimation = 0;
*item_index =(m->highlighted_item == 0)?(m->n_items - 1):(m->highlighted_item - 1);
ret = MMI_TRUE;
}
}
else
{
distance=PageBackupPenDownPoint.x-x;
if (abs(distance)>10)
{
Ranimation =0;
Lanimation = 1;
*item_index = (m->highlighted_item >= (m->n_items - 1))?0:(m->highlighted_item + 1);
ret = MMI_TRUE;
}
}
}
}
else if ( gPageMenuPos[0].y1<y < gPageMenuPos[0].y2)
{
highlight_num=MMI_fixed_list_menu.highlighted_item;
offset_x = 31*highlight_num;
item_x = 10+48*highlight_num - offset_x;
if(PageBackupPenDownPoint.x == item_x)
{
kal_prompt_trace(MOD_UEM,"translate_pen_up_position===::m->highlighted_item==%d",m->highlighted_item);
*item_index = m->highlighted_item;
}
else if (PageBackupPenDownPoint.x>item_x)
{
num = (PageBackupPenDownPoint.x-item_x)/48;
*item_index = m->highlighted_item+num;
kal_prompt_trace(MOD_UEM,"translate_pen_up_position>>>>::m->highlighted_item==%d,num==%d",m->highlighted_item,num);
Ranimation =0;
Lanimation = 1;
}
else
{
num = (item_x-PageBackupPenDownPoint.x+30)/48;
*item_index = m->highlighted_item-num;
kal_prompt_trace(MOD_UEM,"translate_pen_up_position<<<<::m->highlighted_item==%d,num==%d",m->highlighted_item,num);
Ranimation =1;
Lanimation = 0;
}
ret = MMI_TRUE;
}
else
{
*item_index = m->highlighted_item;
kal_prompt_trace(MOD_UEM,"else::m->highlighted_item==%d",m->highlighted_item);
}
return ret;
}
void page_fixed_list_menu_goto_item(void)
{
gdi_handle act_lcd;
if((GetActiveScreenId() == MAIN_MENU_SCREENID)&&(MMI_main_menu_type == PAGE_MENU)&&(Ranimation == 1 ||Lanimation == 1))
{
if ((page_item_index < 0) || (page_item_index> MMI_fixed_list_menu.n_items - 1))
{
return;
}
item_falg=TRUE;
TouchIsanimation = 1;
PageShowAnimation();
//PenPageShowAnimation();
gui_goto_item_callback(page_fixed_list_menu_goto_item);
return;
}
TouchIsanimation = 0;
Lanimation = 0;
Ranimation = 0;
item_falg = FALSE;
gdi_lcd_get_active(&act_lcd);
gdi_lcd_set_active(MMI_fixed_list_menu.act_lcd_handle);
gdi_layer_push_and_set_active(MMI_fixed_list_menu.act_layer_handle);
gui_fixed_list_menu_goto_item(&MMI_fixed_list_menu, page_item_index);
gdi_layer_pop_and_restore_active();
gdi_lcd_set_active(act_lcd);
}
#endif
/*****************************************************************************
* FUNCTION
* gui_fixed_list_menu_translate_pen_position
* DESCRIPTION
* Translate position to item index
*
* if y < minimum bound, *item_index is first_displayed_item - 1 or 0
* if y > maximum bound, *item_index is last_displayed_item + 1 or (n_items - 1)
* Caller of this function might be sensitive to the return result.
* Be careful when modifying this function.
* PARAMETERS
* m [IN] fixed list menu object
* y [IN] y
* item_index [OUT] penned item index
* RETURNS
* Return MMI_TRUE if y is within the menu; otherwise, MMI_FALSE.
*****************************************************************************/
BOOL gui_fixed_list_menu_translate_pen_position(fixed_list_menu *m, S32 y, S32 *item_index)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 total_height = 0, i;
S32 iwidth, iheight;
BOOL ret = MMI_FALSE;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
y -= m->y;
if (m->n_items <= 0)
{
*item_index = 0;
/* ret is false */
}
else if (y < 0)
{
*item_index = (m->first_displayed_item > 0) ? m->first_displayed_item - 1 : 0;
/* ret is false */
}
else if (y >= m->height)
{
*item_index = (m->last_displayed_item < m->n_items - 1) ? m->last_displayed_item + 1 : m->n_items - 1;
/* ret is false */
}
else
{
*item_index = m->n_items - 1;
for (i = m->first_displayed_item; i < m->n_items; 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;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -