您的位置:首页 > 移动开发

展讯MMI 动态创建窗口? MMK_CreateWindow()函数返回AppletCreateWindow()函数

2011-03-19 14:06 337 查看
PUBLIC MMI_HANDLE_T MMK_CreateWindow(
const MMI_WINDOW_CREATE_T* create_ptr
)
{
MMI_WINDOW_CREATE_T create = {0};

SCI_ASSERT( PNULL != create_ptr );
#ifdef LCD_ROTATION_PART
SCI_TRACE_LOW("MMK_CreateWindow winid=%d!",create_ptr->win_id);

if(GUILCD_GetLcdRotMode(MAIN_LCD_ID)==LCD_ANGLE_90)
{

if(!IsSpecialWin(create_ptr->win_id))
{
HandleLcdRotation(FALSE);
}
}
else
{
#ifndef KEY_TRIGGER_ROTATION
#ifndef WIN32
if(Lcd_Rotate_Status_Get()==LCD_ROTATE_H)
{
if(IsSpecialWin(create_ptr->win_id))
{
HandleLcdRotation(FALSE);
}
}

#endif
#endif
}

#endif

create = *create_ptr;
create.parent_win_handle = MMK_ConvertIdToHandle( create_ptr->parent_win_handle );

return AppletCreateWindow( (void*)&create, FALSE );
}


 

其调用的是AppletCreateWindow()

 

LOCAL MMI_HANDLE_T AppletCreateWindow(
void*   create_ptr,
BOOLEAN is_win_table
)
{
MMI_HANDLE_T         applet_handle     = 0;
MMI_HANDLE_T         parent_win_handle = 0;
MMI_APPLET_NODE_T*   applet_node_ptr   = PNULL;
MMI_TREE_NODE_T*     new_win_ptr       = PNULL;
WINDOW_HANDLE_EVENT  func              = PNULL;

if( is_win_table )
{
applet_handle     = ((MMI_WINDOW_TABLE_CREATE_T*)create_ptr)->applet_handle;
parent_win_handle = ((MMI_WINDOW_TABLE_CREATE_T*)create_ptr)->parent_win_handle;
func              = ((MMI_WINDOW_TABLE_CREATE_T*)create_ptr)->func;
}
else
{
applet_handle     = ((MMI_WINDOW_CREATE_T*)create_ptr)->applet_handle;
parent_win_handle = ((MMI_WINDOW_CREATE_T*)create_ptr)->parent_win_handle;
func              = ((MMI_WINDOW_CREATE_T*)create_ptr)->func;

// check the win_id, 使用MMK_IsExistWin, 解决关闭窗口消息中打开id相同窗口的问题
if ( MMK_IsExistWin( applet_handle, ((MMI_WINDOW_CREATE_T*)create_ptr)->win_id ) )
//if ( MMK_GetWinHandle( applet_handle, ((MMI_WINDOW_CREATE_T*)create_ptr)->win_id ) )
{
SCI_TRACE_LOW("AppletCreateWindow failed, the same window id!");

return 0;
}
}

if ( PNULL == ( applet_node_ptr = GetAppletNodePtr( applet_handle ) ) )
{
//SCI_ASSERT( FALSE );
//no applet
return 0; /*lint !e527*/
}

//parent win_handle must be valid
if( parent_win_handle &&
!MMK_FindAllTreeNode( applet_node_ptr->win_tree_root_ptr,
MMK_WindowTreeNodeCompare, MMI_TREE_NODE_FIND_HANDLE, parent_win_handle, MMI_TREE_TRAVEL_ORDER | MMI_TREE_TRAVEL_CHILD ) )
{
//SCI_ASSERT( FALSE );
//parent win error
return 0; /*lint !e527*/
}

//MMK_AddTreeNode 如果失败, 需要用户销毁tree node
if ( PNULL != ( new_win_ptr = MMK_AddTreeNode( MMK_WindowTreeNodeConstruct,
is_win_table, (uint32)create_ptr, &applet_node_ptr->win_tree_root_ptr, MMK_GetWinTreeNode( parent_win_handle ) ) ) )
{
//create win, then open win
if( MMK_OpenWin( new_win_ptr->data, parent_win_handle ) )
{
return new_win_ptr->data;
}
else
{
//changed by minghu.mao 2010-01-20 for cr168410
MMK_RemoveTreeNode( &applet_node_ptr->win_tree_root_ptr, MMK_WindowTreeNodeDestruct, new_win_ptr );
MMK_ZorderSystemUpdate();
SCI_TRACE_LOW("AppletCreateWindow failed, window is not open !");
return 0;
}
}
else
{
SCI_TRACE_LOW("AppletCreateWindow failed, can't construct!");

return 0;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  applet tree table 2010