CCXApplication::CCXApplication()
: m_bRunning(FALSE)
, m_bNeedStop(FALSE)
, m_bInBackground(FALSE)
{
    memset(&m_tMsg, 0, sizeof(m_tMsg));
    SS_GetCurrentGTID(&m_tMsg.gtid);
    m_tMsg.type = CCX_ON_APPLICATION_IDLE;

    Sys_RegisterMessageCallBack(CCX_ON_APPLICATION_IDLE, CCXApplication::_OnAppIdle, (UInt32)this);

    memset(m_AppDataPath, 0, sizeof(char) * EOS_FILE_MAX_PATH);

    do 
    {
        TUChar AppID[EOS_FILE_MAX_PATH] = {0};
        UInt32 nCmdType = 0;
        Int32  nRet = SS_AppRequest_GetAppName(AppID, &nCmdType);
        CCX_BREAK_IF(nRet < 0);

        TUChar AppPath[EOS_FILE_MAX_PATH] = {0};
        SS_GetApplicationPath(AppID, SS_APP_PATH_TYPE_EXECUTABLE, AppPath);
        TUString::StrUnicodeToStrUtf8((Char*) m_AppDataPath, AppPath);
    } while (0);
}
예제 #2
0
// 控件点击事件处理
	// 0: 新鲜事	1: 个人主页	2: 好友
	// 3: 站内信	4: 地点		5: 相册
	// 6: 应用		7: 公共主页	8: 日志
Boolean TMainMenuForm::_OnCtrlSelectEvent(TApplication * pApp, EventType * pEvent)
{
	Boolean bHandled;
	bHandled = FALSE;
	SS_GTID			gtidMain;
	SS_GetCurrentGTID(&gtidMain);
	Int32 nCtrlID = pEvent->sParam1;

	if(m_TitleBtnRight == nCtrlID)
	{
		App_PostMessageEx(&gtidMain, MSG_LOGOUT, NULL, 0, 0, 0);	
		bHandled = TRUE; 
		//this->CloseWindow();
		return bHandled;
	}
	else if(m_TitleBtnLeft == nCtrlID)
	{
		bHandled = TRUE; 		
		return bHandled;
	}
	else if(m_QuickBarTakePhotoID == nCtrlID)
	{
		if( PopBox_UploadPhoto(pApp, this->GetWindowHwndId()) == 1)
		{
		}
		bHandled = TRUE; 		
		return bHandled;
	}
	else if(m_QuickBarStatusID == nCtrlID)
	{
		PostNotifyMsgDataType in_msgData = {0};
		TUChar pszStateContent[1024];
		
		MemSet(&in_msgData, 0, sizeof(PostNotifyMsgDataType));
		memset(pszStateContent, 0, sizeof(pszStateContent));		
		
		in_msgData.nCtrlId = 0;
		in_msgData.nHwndId = this->GetWindowHwndId();
		
		in_msgData.nAppTitleStrID = APP_RE_ID_STRING_Status; 
		in_msgData.nPublicBtnCaptionStrID = APP_RE_ID_STRING_Publish;
		
		in_msgData.nContentEditMaxChars = RENREN_LENGTH_STATUS;
		
		in_msgData.IsExpressionBtn = TRUE;
		in_msgData.nParam = RR_StatusSet;

		TAppEditForm *pComm1 = new TAppEditForm( pApp, in_msgData);
		bHandled = TRUE;		
		return bHandled;
	}
	else if(m_nFunMenuBtnID[0] == nCtrlID)
	{
		Set_Url_Params(RR_FeedGet, "uid", "");
		Set_Url_Params(RR_FeedGet, "page", "1");
		RenRenAPICommon_Download(RR_FeedGet, this->GetWindowHwndId(), 0, FEED_MODE_NEW); 		
		bHandled = TRUE; 		
		return bHandled;
	}
	else if(m_nFunMenuBtnID[1] == nCtrlID)
	{
		bIsPage = FALSE;
		Set_Url_Params(RR_ProfileGetInfo, "uid", RenRenUserInfo.szuid);
		RenRenAPICommon_Download(RR_ProfileGetInfo, this->GetWindowHwndId(), 0, FEED_MODE_MYHOME);			
		bHandled = TRUE; 		
		return bHandled;
	}
	else if(m_nFunMenuBtnID[2] == nCtrlID)
	{
		RenRenAPICommon_Download(RR_FriendsGetFriends, this->GetWindowHwndId(), 0, 0);	
		bHandled = TRUE; 		
		return bHandled;
	}
	else if(m_nFunMenuBtnID[3] == nCtrlID)
	{
		Set_Url_Params(RR_MessageGets, "box", RENREN_PARAM_INBOX);
		RenRenAPICommon_Download(RR_MessageGets, this->GetWindowHwndId(), 0, 0); 		
		bHandled = TRUE; 		
		return bHandled;
	}
	else if(m_nFunMenuBtnID[4] == nCtrlID)
	{
		//RenRenAPICommon_Download(RR_UsersGetEvent, this->GetWindowHwndId(), 0, 0);
		App_PostMessageEx(&gtidMain, MSG_SWITCHFORM_USEREVENT, NULL, 0, 0, 0);
		bHandled = TRUE; 		
		return bHandled;
	}
	else if(m_nFunMenuBtnID[5] == nCtrlID)
	{
		Set_Url_Params(RR_PhotosGetAlbums, "uid", RenRenUserInfo.szuid);
		RenRenAPICommon_Download(RR_PhotosGetAlbums, this->GetWindowHwndId(), 0, FORM_MODE_NORMAL); 			
		bHandled = TRUE; 		
		return bHandled;
	}
	else if(m_nFunMenuBtnID[6] == nCtrlID)
	{
		char url[256] = {0};
		sprintf(url, "http://3g.renren.com/ep.do?c=1100502&sid=%s", RenRenUserInfo.ticket);
		TWebPanelForm *pWin = new TWebPanelForm( pApp, TResource::LoadConstString(APP_RE_ID_STRING_RenRen),  url);	
		bHandled = TRUE; 		
		return bHandled;
	}
	else if(m_nFunMenuBtnID[7] == nCtrlID)
	{
		Set_Url_Params(RR_PagesGetList, "uid", RenRenUserInfo.szuid);
		RenRenAPICommon_Download(RR_PagesGetList, this->GetWindowHwndId(), 0, PAGESLIST_MODE_NORMAL); 		
		bHandled = TRUE; 		
		return bHandled;
	}
	else if(m_nFunMenuBtnID[8] == nCtrlID)
	{
		Set_Url_Params(RR_BlogGets, "uid", RenRenUserInfo.szuid);
		RenRenAPICommon_Download(RR_BlogGets, this->GetWindowHwndId(), 0, 0);		
		bHandled = TRUE; 		
		return bHandled;
	}


	switch(nCtrlID)
	{
		case APP_RE_ID_TestForm_Test01:
			{
				bHandled = TRUE; 	
			}
			break;
		default:
			break;
	}

	return bHandled;
}
예제 #3
0
// 控件点击事件处理
Boolean TGuestbookGetForm::_OnCtrlSelectEvent(TApplication * pApp, EventType * pEvent)
{
	Boolean bHandled;
	bHandled = FALSE;
	Int32 nCtrlID = pEvent->sParam1;
	SS_GTID			gtidMain;
	SS_GetCurrentGTID(&gtidMain);
	
	if(m_TitleBtnRight == nCtrlID)
	{
		if(m_FormMode == FORM_MODE_NORMAL)
			this->CloseWindow();
		else			
			App_PostMessageEx(&gtidMain, MSG_BACKTO_HOME, NULL, 0, 0, 0);		
		bHandled = TRUE; 
		return bHandled;
	}
	else if(m_TitleBtnLeft == nCtrlID)
	{
		PostNotifyMsgDataType in_msgData = {0};
		MemSet(&in_msgData, 0, sizeof(PostNotifyMsgDataType));

		in_msgData.nCtrlId = 0;
		in_msgData.nHwndId = this->GetWindowHwndId();
		//in_msgData.nEditType = NewBlogEdit;
		in_msgData.nAppTitleStrID = APP_RE_ID_STRING_SendComment; 
		in_msgData.nPublicBtnCaptionStrID = APP_RE_ID_STRING_Publish;
		
		in_msgData.nTitleEditMaxChars = RENREN_LENGTH_BLOG_TITLE;
		in_msgData.nContentEditMaxChars = RENREN_LENGTH_BLOG_COMMENT;
		
		in_msgData.IsExpressionBtn = FALSE;
		in_msgData.IsPhotoBtn = FALSE;
		in_msgData.IsLocationBtn = FALSE;
		in_msgData.IsPrivacyCtl = TRUE;
		in_msgData.IsTitleEdit = FALSE;

		m_SelectReplyItem = -1;
		bReply = FALSE;
				
		TAppEditForm *pWin = new TAppEditForm( pApp, in_msgData);	
		bHandled = TRUE; 		
		return bHandled;
	}
	//获取用户信息及新鲜事
	else if(BottomTabCtrID.nCtrID[0] == nCtrlID)
	{
		Set_Url_Params(RR_ProfileGetInfo, "uid", m_uid);
		RenRenAPICommon_Download(RR_ProfileGetInfo, this->GetWindowHwndId(), 0, 0); 				
		bHandled = TRUE;		
		return bHandled;
	}
	//相册
	else if(BottomTabCtrID.nCtrID[1] == nCtrlID)
	{
		Set_Url_Params(RR_PhotosGetAlbums, "uid", m_uid);
		RenRenAPICommon_Download(RR_PhotosGetAlbums, this->GetWindowHwndId(), 0, FORM_MODE_MYHOME); 				
		bHandled = TRUE;		
		return bHandled;
	}
	//日记
	else if(BottomTabCtrID.nCtrID[2] == nCtrlID)
	{
		Set_Url_Params(RR_BlogGets, "uid", m_uid);
		RenRenAPICommon_Download(RR_BlogGets, this->GetWindowHwndId(), 0, FORM_MODE_MYHOME);			
		bHandled = TRUE;
		return bHandled;
	}
	//留言本
	else if(BottomTabCtrID.nCtrID[3] == nCtrlID)
	{
		//Set_Url_Params(RR_GuestbookGet, "uid", m_uid);
		//RenRenAPICommon_Download(RR_GuestbookGet, this->GetWindowHwndId(), 0, FORM_MODE_MYHOME); 			
		bHandled = TRUE;		
		return bHandled;
	}
	//资料
	else if(BottomTabCtrID.nCtrID[4] == nCtrlID)
	{
		if(bIsPage == TRUE)
			{
			Set_Url_Params(RR_PagesGetInfo, "page_id", m_uid);
			RenRenAPICommon_Download(RR_PagesGetInfo, this->GetWindowHwndId(), 0, 0); 				
			}
		else
			{
			Set_Url_Params(RR_UsersGetInfo, "uids", m_uid);
			RenRenAPICommon_Download(RR_UsersGetInfo, this->GetWindowHwndId(), 0, 0); 				
			}
		bHandled = TRUE;		
		return bHandled;
	}
		
	//留言回复处理
	for(int i=0;i<ARR_SIZE(gItemData); i++)
		{
			if(gItemData[i].TButtonReplyID == nCtrlID)
			{
				PostNotifyMsgDataType in_msgData = {0};
				MemSet(&in_msgData, 0, sizeof(PostNotifyMsgDataType));
	
				in_msgData.nHwndId = this->GetWindowHwndId();
				in_msgData.nCtrlId = 0;
				in_msgData.nParam = 2;
				in_msgData.nAppTitleStrID = APP_RE_ID_STRING_ReplyGuestBook; 
				in_msgData.nPublicBtnCaptionStrID = APP_RE_ID_STRING_Publish;
				
				in_msgData.nTitleEditMaxChars = RENREN_LENGTH_BLOG_TITLE;
				in_msgData.nContentEditMaxChars = RENREN_LENGTH_BLOG_COMMENT;
				
				in_msgData.IsExpressionBtn = FALSE;
				in_msgData.IsPhotoBtn = FALSE;
				in_msgData.IsLocationBtn = FALSE;
				in_msgData.IsPrivacyCtl = TRUE;
				in_msgData.IsTitleEdit = FALSE;
				in_msgData.bPrivacy = gItemData[i].bWhisper;	//回复悄悄话,默认也要是悄悄话
				
				m_SelectReplyItem = i;
				bReply = TRUE;
				
				TAppEditForm *pWin = new TAppEditForm( pApp, in_msgData);	
				bHandled = TRUE;		
				return bHandled;
				
			}
		}

	switch(nCtrlID)
	{
		case APP_RE_ID_TestForm_Test01:
			{
				bHandled = TRUE; 	
			}
			break;
		default:
			break;
	}

	return bHandled;
}
// 控件点击事件处理
Boolean TPhotosGetAlbumsForm::_OnCtrlSelectEvent(TApplication * pApp, EventType * pEvent)
{
	Boolean bHandled;
	bHandled = FALSE;
	Int32 nCtrlID = pEvent->sParam1;
	SS_GTID			gtidMain;
	SS_GetCurrentGTID(&gtidMain);
	
	if(m_TitleBtnRight == nCtrlID)
	{
		if(m_FormMode == FORM_MODE_NORMAL)
			this->CloseWindow();
		else			
			App_PostMessageEx(&gtidMain, MSG_BACKTO_HOME, NULL, 0, 0, 0);			
		bHandled = TRUE; 
		return bHandled;
	}
	else if(m_TitleBtnLeft == nCtrlID)
	{
		if( PopBox_UploadPhoto(pApp, this->GetWindowHwndId()) == 1)
		{
		}
		bHandled = TRUE; 		
		return bHandled;
	}
	//获取用户信息及新鲜事
	else if(BottomTabCtrID.nCtrID[0] == nCtrlID)
	{
		Set_Url_Params(RR_ProfileGetInfo, "uid", m_uid);
		RenRenAPICommon_Download(RR_ProfileGetInfo, this->GetWindowHwndId(), 0, 0); 				
		bHandled = TRUE;		
		return bHandled;
	}
	//相册
	else if(BottomTabCtrID.nCtrID[1] == nCtrlID)
	{
		//Set_Url_Params(RR_PhotosGetAlbums, "uid", m_uid);
		//RenRenAPICommon_Download(RR_PhotosGetAlbums, this->GetWindowHwndId(), 0, FORM_MODE_MYHOME); 				
		bHandled = TRUE;		
		return bHandled;
	}
	//日记
	else if(BottomTabCtrID.nCtrID[2] == nCtrlID)
	{
		Set_Url_Params(RR_BlogGets, "uid", m_uid);
		RenRenAPICommon_Download(RR_BlogGets, this->GetWindowHwndId(), 0, FORM_MODE_MYHOME);			
		bHandled = TRUE;
		return bHandled;
	}
	//留言本
	else if(BottomTabCtrID.nCtrID[3] == nCtrlID)
	{
		Set_Url_Params(RR_GuestbookGet, "uid", m_uid);
		RenRenAPICommon_Download(RR_GuestbookGet, this->GetWindowHwndId(), 0, FORM_MODE_MYHOME); 			
		bHandled = TRUE;		
		return bHandled;
	}
	//资料
	else if(BottomTabCtrID.nCtrID[4] == nCtrlID)
	{
		if(bIsPage == TRUE)
			{
			Set_Url_Params(RR_PagesGetInfo, "page_id", m_uid);
			RenRenAPICommon_Download(RR_PagesGetInfo, this->GetWindowHwndId(), 0, 0); 				
			}
		else
			{
			Set_Url_Params(RR_UsersGetInfo, "uids", m_uid);
			RenRenAPICommon_Download(RR_UsersGetInfo, this->GetWindowHwndId(), 0, 0); 				
			}
		bHandled = TRUE;		
		return bHandled;
	}
		
	//点击界面,进入下一个界面
	switch(nCtrlID)
	{
		case APP_RE_ID_CommonListForm_CommonCoolBarList:
			{
			
				TBarListItem *lpItem;
				Int32        nIndex;
				char 	szuids[64] = "";
				char    szaids[64] = "";
			
				lpItem = (TBarListItem *)(pEvent->lParam3);
				//nIndex = lpItem->GetIndex();
				nIndex = lpItem->GetTagValue();

				sprintf(szuids, "%d", gItemData[nIndex].uid);
				sprintf(szaids, "%d", gItemData[nIndex].aid);
				Set_Url_Params(RR_PhotosGet, "uid", szuids);
				Set_Url_Params(RR_PhotosGet, "aid", szaids);
				Set_Url_Params(RR_PhotosGet, "pids", "");
				Set_Url_Params(RR_PhotosGet, "password", "");
								
				if( (gItemData[nIndex].uid != RenRenUserInfo.uid) && (gItemData[nIndex].visable == 4) )
				{
					PostNotifyMsgDataType in_msgData = {0};
					MemSet(&in_msgData, 0, sizeof(PostNotifyMsgDataType));

					in_msgData.nHwndId = this->GetWindowHwndId();
					in_msgData.nCtrlId = 0;
					in_msgData.nParam = EDIT_PARAM_PASSWORD;
					in_msgData.nAppTitleStrID = APP_RE_ID_STRING_PleaseInputPWD; 
					in_msgData.nPublicBtnCaptionStrID = APP_RE_ID_STRING_OK;
					
					in_msgData.nTitleEditMaxChars = RENREN_LENGTH_PASSWORD;
					in_msgData.nContentEditMaxChars = RENREN_LENGTH_PASSWORD;
					
					in_msgData.IsExpressionBtn = FALSE;
					in_msgData.IsPhotoBtn = FALSE;
					in_msgData.IsLocationBtn = FALSE;
					in_msgData.IsPrivacyCtl = TRUE;
					in_msgData.IsTitleEdit = FALSE;
					in_msgData.IsPopEdit = TRUE;
					in_msgData.IsPwdInput = TRUE;
							
					TAppEditForm *pWin = new TAppEditForm( pApp, in_msgData);									
				}
				else
				{
					RenRenAPICommon_Download(RR_PhotosGet, this->GetWindowHwndId(), 0, 0); 	
				}
				bHandled = TRUE;
				break;
			}
		default:
			break;
	}

	switch(nCtrlID)
	{
	case APP_RE_ID_TestForm_Test01:
		{
			bHandled = TRUE; 	
		}
		break;
	default:
		break;
	}

	return bHandled;
}
예제 #5
0
Boolean TMainForm::EventHandler(TApplication * pApp, EventType * pEvent)
{
	Boolean bHandled = FALSE;

	switch(pEvent->eType)
	{
	case EVENT_WinInit:
		{
	            bHandled = _OnWinInitEvent(pApp, pEvent);			
			bHandled = TRUE;
		}
		break;
	case EVENT_WinPaint:
		{
			DrawWindow();
			bHandled = TRUE;
		}
		break;
	case EVENT_CtrlSelect:
		{
			//switch(pEvent->sParam1)
			//{
			//case RES_SYSTEM_WINDOW_TITLE_BUTTON_ID:
			//	bHandled = TRUE;
			//	break;			
			//}

			// 处理控件点击事件或响应事件
			bHandled = _OnCtlSelectEvent( pApp, pEvent );

		}
		break;
	case EVENT_WinClose:
		{
			// Stop the application since the main form has been closed
			//pApp->SendStopEvent();
		}
		break;

	case EVENT_WinEraseClient:
		{
			TDC 	   dc(this);
			WinEraseClientEventType *pEraseEvent = reinterpret_cast< WinEraseClientEventType* >( pEvent );
			TRectangle rc(pEraseEvent->rc);
			TRectangle rcBack(5, 142, 310, 314);
			this->GetBounds(&rcBack);
		
			// 擦除
			dc.EraseRectangle(&rc, 0);
			
			dc.DrawBitmapsH(TResource::LoadConstBitmap(APP_RE_ID_BITMAP_Loading_bg), 0, 0, SCR_W, GUI_API_STYLE_ALIGNMENT_LEFT); 
	
			pEraseEvent->result = 1;				
			bHandled = TRUE;
		}
		break;		

	case EVENT_KeyCommand: 
		{ 
			// 抓取右软键事件 
			if (pEvent->sParam1 == SYS_KEY_SOFTKEY_RIGHT_UP  
				|| pEvent->sParam1 == SYS_KEY_SOFTKEY_RIGHT_LONG) 
			{ 
				// 模拟退出按钮选中消息 
				//pApp->CloseAllWindows();
				pApp->SendStopEvent();	
				bHandled = TRUE; 
			} 
		} 

		case MESSAGE_TIMER:
		{
			//容错,如果TimerID == 0, 则直接忽略
			if(pEvent->sParam1 == 0)
				break;		
			if (pEvent->sParam1 == m_nTimerId)
			{
				nLoadStep ++;
				if(nLoadStep > LOADING_FORM_MAX_COUNT)
				{
					TIMER_Release(m_nTimerId);
					m_nTimerId = -1;
					//先停止Connect Timer
					SS_GTID			gtidMain;
					SS_GetCurrentGTID(&gtidMain);
					App_PostMessageEx(&gtidMain, MSG_CONNECT_INIT_TIMEROUT, NULL, 0, 0, 0);
					
					pApp->MessageBox(TResource::LoadConstString(APP_RE_ID_STRING_DialupTimerOut), TUSTR_Re_NULL, WMB_OK);
					pApp->SendStopEvent();				
				}
				else
				{
					_DrawDot(pApp, nLoadStep%LOADING_FORM_DOT_NUM);
				}
			}
			bHandled = TRUE;
			break;
		}
	
	}
	
	if (FALSE == bHandled)
	{
		return TWindow::EventHandler(pApp,pEvent);
	}
	return bHandled;
}