bool CWebBrowserDownloadHandler::OnContextButton(int itemNumber, unsigned int button)
{
  if (button == 30092)
    m_items[itemNumber]->Cancel();
  else if (button == 30093)
    m_items[itemNumber]->Pause();
  else if (button == 30094)
    m_items[itemNumber]->Resume();
  else if (button == 30097)
  {
    ResetHistory();
    OnInit();
  }
  else if (button == 30091)
  {
    bool canceled = false;
    std::string text = StringUtils::Format(kodi::GetLocalizedString(30098).c_str(), m_items[itemNumber]->GetName().c_str());
    bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput(kodi::GetLocalizedString(30016), text, canceled,
                                                          kodi::GetLocalizedString(30018), kodi::GetLocalizedString(30017));
    if (canceled)
      return false;

    if (ret)
      kodi::vfs::DeleteFile(m_items[itemNumber]->GetPath());

    RemovedFinishedDownload(m_items[itemNumber]);
    OnInit();
  }
  return true;
}
Example #2
0
void Thread::Create()
{
	prctl(PR_SET_NAME, name_.c_str());
	OnInit();
	OnLoop();
	OnStop();
}
Example #3
0
void YAddingSong::Notify(TNotifyUI& msg)
{
	if (msg.sType.Compare(kClick)==0)
		OnClick(msg);
	else if(msg.sType.Compare(kWindowInit)==0)
		OnInit(msg);
}
/**
* 重新加载
* @param void
* @return void
*/
void CPointCodeList::OnReload()
{
	// 关闭
	OnClose();
	// 初始化
	OnInit();
}
Example #5
0
void CMessageTask::Run() {

    // call task specific initialization code.
    if ( !OnInit() ) {
#if INCLUDE_vTaskDelete == 1
        Delete();
        return;
#else
        // The task must not start due to initialization problem, but the FreeRTOS
        // vTaskDelete function is not defined by configuration file. Suspend the task.
        Suspend();
#endif
    }

    CMessage msg;
    for (;;) {

        if ( m_queue.Receive(&msg, m_nTimeOut) == pdTRUE ) {
            // Message Handling routine

            // Call the delegate, if one, before try to dispatch the event
            if (m_pDelegate) m_pDelegate->OnHandleEvent(msg);
            DispatchMessage(msg);
            // Call the delegate, if one, after tried to dispatch the event
            if (m_pDelegate) m_pDelegate->DidHandleEvent(msg);
        }
        else {
            // TODO: STF - timeout expired.
            OnTimeOut();
        }
    }
}
Example #6
0
int CApp::OnExecute(){

    if (OnInit() == false){
        return -1;
    }

    SDL_Event Event;

    while(Running){

        while(SDL_PollEvent(&Event)){

            OnEvent(&Event);

        }

        OnLoop();
        OnRender();

    }


    OnCleanup();

    return 0;
}
/**
* 重新加载
* @param void
* @return void
*/
void CMarkerList::OnReload()
{
	// 关闭
	OnClose();
	// 初始化
	OnInit();
}
Example #8
0
    int OnExecute()
    {
        if (OnInit() == false)
        {
            return -1;
        }

        SDL_Event Event;

        while(Running)
        {
            if (g_engine)
            {
                for (int x = 0; x < 5 && SDL_WaitEventTimeout(&Event, 10); ++x)
                {
                    if(!g_engine->IsPaused())
                        OnEvent(&Event);
                }
                if(!g_engine->IsPaused())
                    OnUpdate();
            }
        }

        OnCleanup();

        return 0;
    };
Example #9
0
//Holds game logic together
int Game::OnStart() {
	//Initialize the game
	if (OnInit() == false) {
        return -1;
    }

	SDL_Event Event;

	//While game is running 
	while (running) {
		while (gameType == 0 && running) {
			while (SDL_PollEvent(&Event)) {
				OnEvent(&Event);
			}
			//meanwhile show menu
			showMenu();
		}
		while (SDL_PollEvent(&Event)) {
			//Handle user input
			OnEvent(&Event);
		}
		OnLoop();
		OnRender();
	}
 
    OnCleanUp();
 
    return 0;
};
Example #10
0
int main(int argc,char** argv)
{
	// initialize glut
	glutInit(&argc,argv);

	// request a depth buffer, RGBA display mode, and we want double buffering
	glutInitDisplayMode(GLUT_DEPTH|GLUT_RGBA|GLUT_DOUBLE);

	// set the initial window size
	glutInitWindowSize(800,600);

	// create the window
	glutCreateWindow("Curves");

	// set the function to use to draw our scene
	glutDisplayFunc(OnDraw);

	// set the function to handle changes in screen size
	glutReshapeFunc(OnReshape);

	// set the function for the key presses
	glutMotionFunc(GerenciaMovim);
	glutMouseFunc(GerenciaMouse);
	glutKeyboardFunc(GerenciaTeclado);
	glutSpecialFunc(GerenciaTecladoEspecial);

	// run our custom initialization
	OnInit();

	// this function runs a while loop to keep the program running.
	glutMainLoop();
}
Example #11
0
LONG APIENTRY CPlApplet(HWND hWnd, UINT uMsg, LPARAM lp1, LPARAM lp2)
{
    switch (uMsg)
    {
    case CPL_DBLCLK:
        return OnDblclk(hWnd, lp1, lp2);
    case CPL_EXIT:
        return OnExit();
    case CPL_GETCOUNT:
        return OnGetCount();
    case CPL_INIT:
        return OnInit();
    case CPL_INQUIRE:
        return OnInquire(lp1, (CPLINFO*)lp2);
    case CPL_NEWINQUIRE:
        return OnNewInquire(lp1, (NEWCPLINFO*)lp2);
    case CPL_STOP:
        return OnStop(lp1, lp2);
    case CPL_STARTWPARMS:
        return OnDblclk(hWnd, lp1, lp2);
    default:
        break;
    }

    return 1;
}
Example #12
0
int CApp::OnExecute(int argc, char **argv) {
	if(OnInit(argc, argv) == false) {
		return -1;
	}

	SDL_Event Event;
	bool calculatedFrame;
    while(Running) {
		//BulletManager::Step();

		while(SDL_PollEvent(&Event)) 
		{
			OnEvent(&Event);
		}
		calculatedFrame= false;
		while ((SDL_GetTicks() - GameBaseTime) > GameTickLength)
		{
			gameTime = SDL_GetTicks() / 1000.0f;
			GameBaseTime += GameTickLength;
			OnUpdate();
			calculatedFrame = true;
		}

		BulletManager::Step();

		OnDraw();

    }
 
    OnCleanup();
 
    return 0;
}
Example #13
0
//------------------------------------------------------------------------------
int CApp::OnExecute() {
    if(OnInit() == false) {
        return -1;
    }

    SDL_Event Event;

    while(Running) {
        if(AIenabled && CurrentPlayer && GameState == GAME_STATE_RUNNING)
        {
            GameClick(AIMove());
        }

        while(SDL_PollEvent(&Event)) {
            OnEvent(&Event);
        }

        OnLoop();
        OnRender();
    }

    OnCleanup();

    return 0;
}
/**
* 重新加载
* @param void
* @return void
*/
void CBlastMachineList::OnReload()
{
	// 关闭
	OnClose();
	// 初始化
	OnInit();
}
Example #15
0
//==============================
// OvrSliderComponent::OnEvent_Impl
eMsgStatus OvrSliderComponent::OnEvent_Impl( OvrGuiSys & guiSys, VrFrame const & vrFrame, 
		VRMenuObject * self, VRMenuEvent const & event )
{
	switch ( event.EventType )
	{
		case VRMENU_EVENT_INIT:
			return OnInit( guiSys, vrFrame, self, event );
		case VRMENU_EVENT_FRAME_UPDATE:
			return OnFrameUpdate( guiSys, vrFrame, self, event );
		case VRMENU_EVENT_TOUCH_DOWN:
			return OnTouchDown( guiSys, vrFrame, self, event );
		case VRMENU_EVENT_TOUCH_UP:
			if ( OnReleaseFunction )
			{
				( *OnReleaseFunction )( this, OnReleaseObject, SliderFrac );
			}
			TouchDown = false;
			return OnTouchUp( guiSys, vrFrame, self, event );
		case VRMENU_EVENT_TOUCH_RELATIVE:
			return OnTouchRelative( guiSys, vrFrame, self, event );
		default:
			OVR_ASSERT( false );
			return MSG_STATUS_ALIVE;
	}
    return MSG_STATUS_CONSUMED;
}
Example #16
0
BOOL Service::Initialize()
{
    m_dbgMsg(L"Entering Service::Initialize()");

    // Start the initialization
    SetStatus(SERVICE_START_PENDING);
    
    // Perform the actual initialization
    BOOL bResult = OnInit(); 
    
    // Set final state
    m_Status.dwWin32ExitCode = GetLastError();
    m_Status.dwCheckPoint = 0;
    m_Status.dwWaitHint = 0;
    if (!bResult) {
        EVLOG_ERROR(EVMSG_FAILEDINIT);
        SetStatus(SERVICE_STOPPED);
        return FALSE;    
    }
    
    EVLOG_INFO(EVMSG_STARTED);
    SetStatus(SERVICE_RUNNING);

    m_dbgMsg(L"Leaving Service::Initialize()");
    return TRUE;
}
Example #17
0
int CApp::OnExecute()
{
	// Initialize application.
	int state = OnInit();
	if (state != APP_OK) {
		return state;
	}
	
	// Enter the SDL event loop.
	SDL_Event event;

	running = true;
	
	while (running)
	{
		while (SDL_PollEvent(&event)) {
        	OnEvent(&event);
        }
		
		OnUpdate();
		OnRender();
	}
	
	return state;
}
Example #18
0
//初始化函数 
bool CBaseMainManageForZ::Init(ManageInfoStruct * pInitData, IDataBaseHandleService * pDataHandleService)
{
	if ((this==NULL)||(m_bInit==true)) return false;

	//设置数据
	UINT uMax=pInitData->uMaxPeople;//20081201
	m_InitData=*pInitData;
	if (!PreInitParameter(&m_InitData,&m_KernelData)) throw new CAFCException(TEXT("CBaseMainManageForZ::Init PreInitParameter 参数调节错误"),0x41A);
	if(m_InitData.uMaxPeople<uMax)//20081201
		m_InitData.uMaxPeople=uMax;

	//初始化组件
	if (m_KernelData.bStartTCPSocket) m_TCPSocket.Init(m_InitData.uMaxPeople,m_InitData.uListenPort,m_KernelData.bMaxVer,m_KernelData.bLessVer,m_InitData.iSocketSecretKey,this);
	if (m_KernelData.bStartSQLDataBase)	
	{
		if (pDataHandleService!=NULL) pDataHandleService->SetParameter(this,&m_SQLDataManage,&m_InitData,&m_KernelData);
		m_SQLDataManage.Init(&m_InitData,&m_KernelData,pDataHandleService,this);
	}

	//调用接口
	if (OnInit(&m_InitData,&m_KernelData)==false)  throw new CAFCException(TEXT("CBaseMainManageForZ::Init OnInit 函数错误"),0x41B);

	m_bInit=true;
	CString s = GetAppPath();
	m_TalkFilter.LoadFilterMessage(s.GetBuffer());
	return true;
}
Example #19
0
int Main::OnExecute(CL_ParamList* pCL_Params)
{
	if(!OnInit(pCL_Params))
		return -1;

	SDL_Event Event;

	Uint32 t1,t2;
	float fTime = 0.0f;

	while(Running)
	{
		t1 = SDL_GetTicks();
		while(SDL_PollEvent(&Event))
		{
			if(Event.type == SDL_QUIT)
				Running = false;
			else OnEvent(&Event);
		}
		OnMove(fTime);
		OnRender();
		t2 = SDL_GetTicks();
		fTime = (float)(t2-t1)/1000.0f;
	}

	OnExit();
	return 1;
}
Example #20
0
// 加载XML节点,解析节点中的属性信息设置到当前控件的属性中
BOOL CDuiObject::Load(DuiXmlNode pXmlElem, BOOL bLoadSubControl)
{
	// pos属性需要特殊处理,放在最后进行设置,否则有些属性会受到影响,不能正确的初始化
	CString strPosValue = _T("");
    for (DuiXmlAttribute pAttrib = pXmlElem.first_attribute(); pAttrib; pAttrib = pAttrib.next_attribute())
    {
		CString strName = pAttrib.name();
		if(strName == _T("pos"))
		{
			strPosValue = pAttrib.value();
		}else
		{
			SetAttribute(pAttrib.name(), pAttrib.value(), TRUE);
		}
    }

	if(!strPosValue.IsEmpty())
	{
		SetAttribute(_T("pos"), strPosValue, TRUE);
	}

	// 初始化
	OnInit();

    return TRUE;
}
Example #21
0
int cLayer::Init()
{
	


	return OnInit();
}
Example #22
0
	virtual void OnKeyDown(int nKey, char cAscii){       
	    switch(nKey){
		   case GLUT_KEY_DOWN: /* 2. oyuncu icin asagi tusu */
			   if(player2Y>-0.78) player2Y-=0.025;
			   break;
		   case GLUT_KEY_UP: /* 2. oyuncu icin yukari tusu */
			   if(player2Y<0.78) player2Y+=0.025;
			   break;
		}
		switch(cAscii){
		   case 27: /* Cikis */
			   this->Close();
			   break;
		   case 's': /* 1. oyuncu icin asagi tusu */
		   case 'S':
			   if(player1Y>-0.78) player1Y-=0.025;
			   break;
		   case 'w': /* 1. oyuncu icin yukari tusu */
		   case 'W':
			   if(player1Y<0.78) player1Y+=0.025;
			   break;
		   case 'r': /* Albastan */
		   case 'R':
			   OnInit();
			   break;
		}
	};
Example #23
0
void iCtlCnst::Init()
{
	check(state == Built && !bInited);
	OnInit();
	if (pCastle->Visitor()) OnVisitorEnter(pCastle->Visitor());
	bInited = true;
}
BOOL CNTService::Initialize()
{
    DebugMsg("Entering CNTService::Initialize()");

    // Start the initialization
    SetStatus(SERVICE_START_PENDING);
    
    // Perform the actual initialization
    BOOL bResult = OnInit(); 
    
    // Set final state
    m_Status.dwWin32ExitCode = GetLastError();
    m_Status.dwCheckPoint = 0;
    m_Status.dwWaitHint = 0;
    if (!bResult) {
        LogEvent(EVENTLOG_ERROR_TYPE, EVMSG_FAILEDINIT);
        SetStatus(SERVICE_STOPPED);
        return FALSE;    
    }
    
    LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_STARTED);
    SetStatus(SERVICE_RUNNING);

    DebugMsg("Leaving CNTService::Initialize()");
    return TRUE;
}
Example #25
0
////////////////////////////////////////////////////////////
/// Called when the widget is shown ;
/// we use it to initialize our SFML window
////////////////////////////////////////////////////////////
void QSFMLCanvas::showEvent(QShowEvent*)
{
    if (!myInitialized)
    {
        // Under X11, we need to flush the commands sent to the server to ensure that
        // SFML will get an updated view of the windows
        #ifdef Q_WS_X11
            XFlush(QX11Info::display());
        #endif

        #ifdef Q_OS_WIN
            // Create the SFML window with the widget handle (Windows)
            static_cast<sf::Window*>(this)->create(reinterpret_cast<sf::WindowHandle>(winId()));
        #endif
        #ifdef Q_OS_LINUX
            // Create the SFML window with the widget handle (Linux)
            static_cast<sf::Window*>(this)->create(winId());
        #endif

        // Let the derived class do its specific stuff
        OnInit();

        // Setup the timer to trigger a refresh at specified framerate
        connect(&myTimer, SIGNAL(timeout()), this, SLOT(repaint()));
        myTimer.start();

        myInitialized = true;
    }
}
Example #26
0
int App::OnExecute()
{
    if(OnInit() == false)
    {
        return -1;
    }

	controller->Initialize();

    SDL_Event Event;
    while(running)
    {
        Scene* scene = controller->GetCurrentScene();
		if (scene == NULL)
		{
			break;
		}

        if(SDL_PollEvent(&Event))
        {
            OnEvent(scene, &Event);
        }

        OnLoop(scene);
        OnRender(scene);
    }

    OnCleanup();

    return 0;
}
/**
* 重新加载
* @param void
* @return void
*/
void CMuteList::OnReload()
{
	// 关闭
	OnClose();
	// 初始化
	OnInit();
}
Example #28
0
//-------------------------------------------------------------------------------------------
//      メインエントリーポイントです.
//-------------------------------------------------------------------------------------------
int main( int argc, char** argv )
{
#if defined(DEBUG) || defined(_DEBUG)
    // メモリリーク検出
    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif//defined(DEBUG) || defined(_DEBUG)
    {
        glutInit( &argc, argv );
        glutSetOption( GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS );
        glutInitWindowPosition( g_WindowPositionX, g_WindowPositionY );
        glutInitWindowSize( g_WindowWidth, g_WindowHeight );
        glutInitDisplayMode( GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE );
        glutCreateWindow( g_WindowTitle );
        glutDisplayFunc( OnDisplay );
        glutReshapeFunc( OnReshape );
        glutIdleFunc( OnIdle );
        glutMouseFunc( OnMouse );
        glutMotionFunc( OnMotion );
        glutPassiveMotionFunc( OnPassiveMotion );
        glutKeyboardFunc( OnKeyboard );
        glutSpecialFunc( OnSpecial );

        if ( OnInit() )
        { glutMainLoop(); }

        OnTerm();
    }

    return 0;
}
/**
* 重新加载
* @param void
* @return void
*/
void CTestLimitList::OnReload()
{
	// 关闭
	OnClose();
	// 初始化
	OnInit();
}
Example #30
0
//------------------------------------------------------------  main()
//
int main(int argc, char **argv)
{	
	OnInit();

	main_loop(); 
	
    exit(APPSUCCESS);
}