PUBLIC MMI_HANDLE_T MMK_CreateWin( uint32* win_table_ptr, ADD_DATA add_data_ptr ) { MMI_WINDOW_TABLE_CREATE_T win_table_create = {0}; #ifdef LCD_ROTATION_PART MMI_WIN_ID_T winid; winid = GetWinId(win_table_ptr); if(GUILCD_GetLcdRotMode(MAIN_LCD_ID)==GUI_LCD_ROTATE_90) { if(!IsSpecialWin(winid)) { HandleLcdRotation(FALSE); } } else { #ifndef WIN32 #ifndef KEY_TRIGGER_ROTATION if(Lcd_Rotate_Status_Get()==LCD_ROTATE_H) { if(IsSpecialWin(winid)) { HandleLcdRotation(FALSE); } } #endif #endif } #endif win_table_create.applet_handle = MMK_GetFirstAppletHandle(); win_table_create.parent_win_handle = 0; win_table_create.win_table_ptr = win_table_ptr; win_table_create.add_data_ptr = add_data_ptr; return MMK_CreateWinTable( &win_table_create ); } 其返回是MMK_CreateWinTable() PUBLIC MMI_HANDLE_T MMK_CreateWinTable( const MMI_WINDOW_TABLE_CREATE_T* create_ptr ) { MMI_WINDOW_TABLE_CREATE_T create = {0}; SCI_ASSERT( PNULL != create_ptr ); create = *create_ptr; create.parent_win_handle = MMK_ConvertIdToHandle( create_ptr->parent_win_handle ); return AppletCreateWindow( (void*)&create, TRUE ); } 其返回是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; } }