1) 在文件bra_opt.c开头增加一全局变量作为是否需要旋转的标志:
int rotate_browsing=0;
......
2)修改函数bra_opt_action_menu()
{
......
if (MSF_WIDGET_CHOICE_GET_ELEM_STATE(p->windowHandle, (idx++)) & MSF_CHOICE_ELEMENT_SELECTED)
{
/*Home*/
/*找到hom分支,将原有语句注掉,替换为以下代码。即:这里用浏览器option菜单中的homepage子菜单来触发横、竖屏切换。*/
rotate_browsing++;
rotate_browsing%=2; /*每执行一次option中的homepage便切换横、竖显示模式*/
if(!rotate_browsing) //普通浏览模式
{
WGUI_CTX->display_size.width = (short)MMI_CONTENT_WIDTH;
WGUI_CTX->display_size.height = (short)MMI_CONTENT_HEIGHT;
WGUI_CTX->default_display_size.width = (short)MMI_CONTENT_WIDTH;
WGUI_CTX->default_display_size.height = (short)MMI_CONTENT_HEIGHT;
WGUI_CTX->display_pos.x = MMI_CONTENT_X;
WGUI_CTX->display_pos.y =MMI_CONTENT_Y;
BRSif_resizeWindow (MSF_MODID_BRA, bra_sif_get_brs_id (),
WGUI_CTX->display_pos.x, WGUI_CTX->display_pos.y,
WGUI_CTX->display_size.height,
WGUI_CTX->display_size.width);
gdi_layer_resize(MAIN_LCD_DEVICE_WIDTH,MAIN_LCD_DEVICE_HEIGHT);
}
else //旋转浏览模式
{
WGUI_CTX->display_size.width = (short)MAIN_LCD_DEVICE_HEIGHT;
WGUI_CTX->display_size.height = (short)MAIN_LCD_DEVICE_WIDTH;
WGUI_CTX->default_display_size.width = (short)MAIN_LCD_DEVICE_HEIGHT;
WGUI_CTX->default_display_size.height = (short)MAIN_LCD_DEVICE_WIDTH;
WGUI_CTX->display_pos.x = MMI_CONTENT_X;
WGUI_CTX->display_pos.y =MMI_CONTENT_X;
BRSif_resizeWindow (MSF_MODID_BRA, bra_sif_get_brs_id (),
WGUI_CTX->display_pos.x, WGUI_CTX->display_pos.y,
WGUI_CTX->display_size.height,
WGUI_CTX->display_size.width);
gdi_layer_resize(MAIN_LCD_DEVICE_HEIGHT,MAIN_LCD_DEVICE_WIDTH);
}
第二步的主要目的在于修改浏览器显示范围,并通过BRSif_resizeWindow()通知浏览器engine.
3) 在文件widget_paint.c开头声明外部变量rotate_browsing;
extern int rotate_browsing;
4)修改函数widget_paint_outside_look()
{
......
WIDGET_LOG(WIDGET_LOG_GROUP, MMI_WIDGET_PAINT_OUTSIDE_LOOK);
if ((!rotate_browsing)||(!widget_is_paintbox_focused())) /*add this condition, 旋转显示时只显示网页内容。屏蔽status bar,softkey bar的显示,(非网页内容,需在mmi端提供rotate方案)*/
{
if (!widget_has_status_icons()) //original code
......
......
if (!rotate_browsing) //在该函数最后加上该条件
gdi_layer_set_rotate(0); //正常显示
else
gdi_layer_set_rotate(3); //旋转270度,旋转角度可参考mmi_frm_screen_rotate_enum。
}
【说明】
1、以上参考代码用于旋转浏览网页时的webpage screen, 至于其它菜单屏,如菜单(包括status bar,softkey bar等非网页内容) 的旋转,需MMI端提供旋转方法。
2、该设计的关键是第二步中修改WGUI_CTX相关参数,并通知brower engine.09B.10.12之后版本设置WGUI_CTX可参考函数bam_notify_screen_info(),另外BRSif_resizeWindow()的第一个参数固定设置为MSF_MODIF_BAM_ENUM,第二表参数固定设为1即可。
3、注意,相关函数的调用需在WAP task内。如:MMI可发一个消息给WAP,WAP收到该消息后再做以上操作,MMI->WAP的消息发送及处理流程可以MSG_IDWAP_BAM_CREAT_INSTANCE_REQ为参考。
int rotate_browsing=0;
......
2)修改函数bra_opt_action_menu()
{
......
if (MSF_WIDGET_CHOICE_GET_ELEM_STATE(p->windowHandle, (idx++)) & MSF_CHOICE_ELEMENT_SELECTED)
{
/*Home*/
/*找到hom分支,将原有语句注掉,替换为以下代码。即:这里用浏览器option菜单中的homepage子菜单来触发横、竖屏切换。*/
rotate_browsing++;
rotate_browsing%=2; /*每执行一次option中的homepage便切换横、竖显示模式*/
if(!rotate_browsing) //普通浏览模式
{
WGUI_CTX->display_size.width = (short)MMI_CONTENT_WIDTH;
WGUI_CTX->display_size.height = (short)MMI_CONTENT_HEIGHT;
WGUI_CTX->default_display_size.width = (short)MMI_CONTENT_WIDTH;
WGUI_CTX->default_display_size.height = (short)MMI_CONTENT_HEIGHT;
WGUI_CTX->display_pos.x = MMI_CONTENT_X;
WGUI_CTX->display_pos.y =MMI_CONTENT_Y;
BRSif_resizeWindow (MSF_MODID_BRA, bra_sif_get_brs_id (),
WGUI_CTX->display_pos.x, WGUI_CTX->display_pos.y,
WGUI_CTX->display_size.height,
WGUI_CTX->display_size.width);
gdi_layer_resize(MAIN_LCD_DEVICE_WIDTH,MAIN_LCD_DEVICE_HEIGHT);
}
else //旋转浏览模式
{
WGUI_CTX->display_size.width = (short)MAIN_LCD_DEVICE_HEIGHT;
WGUI_CTX->display_size.height = (short)MAIN_LCD_DEVICE_WIDTH;
WGUI_CTX->default_display_size.width = (short)MAIN_LCD_DEVICE_HEIGHT;
WGUI_CTX->default_display_size.height = (short)MAIN_LCD_DEVICE_WIDTH;
WGUI_CTX->display_pos.x = MMI_CONTENT_X;
WGUI_CTX->display_pos.y =MMI_CONTENT_X;
BRSif_resizeWindow (MSF_MODID_BRA, bra_sif_get_brs_id (),
WGUI_CTX->display_pos.x, WGUI_CTX->display_pos.y,
WGUI_CTX->display_size.height,
WGUI_CTX->display_size.width);
gdi_layer_resize(MAIN_LCD_DEVICE_HEIGHT,MAIN_LCD_DEVICE_WIDTH);
}
第二步的主要目的在于修改浏览器显示范围,并通过BRSif_resizeWindow()通知浏览器engine.
3) 在文件widget_paint.c开头声明外部变量rotate_browsing;
extern int rotate_browsing;
4)修改函数widget_paint_outside_look()
{
......
WIDGET_LOG(WIDGET_LOG_GROUP, MMI_WIDGET_PAINT_OUTSIDE_LOOK);
if ((!rotate_browsing)||(!widget_is_paintbox_focused())) /*add this condition, 旋转显示时只显示网页内容。屏蔽status bar,softkey bar的显示,(非网页内容,需在mmi端提供rotate方案)*/
{
if (!widget_has_status_icons()) //original code
......
......
if (!rotate_browsing) //在该函数最后加上该条件
gdi_layer_set_rotate(0); //正常显示
else
gdi_layer_set_rotate(3); //旋转270度,旋转角度可参考mmi_frm_screen_rotate_enum。
}
【说明】
1、以上参考代码用于旋转浏览网页时的webpage screen, 至于其它菜单屏,如菜单(包括status bar,softkey bar等非网页内容) 的旋转,需MMI端提供旋转方法。
2、该设计的关键是第二步中修改WGUI_CTX相关参数,并通知brower engine.09B.10.12之后版本设置WGUI_CTX可参考函数bam_notify_screen_info(),另外BRSif_resizeWindow()的第一个参数固定设置为MSF_MODIF_BAM_ENUM,第二表参数固定设为1即可。
3、注意,相关函数的调用需在WAP task内。如:MMI可发一个消息给WAP,WAP收到该消息后再做以上操作,MMI->WAP的消息发送及处理流程可以MSG_IDWAP_BAM_CREAT_INSTANCE_REQ为参考。