Exemple #1
0
void wxQtTimerImpl::timerEvent( QTimerEvent * event )
{
    if ( event->timerId() == m_timerId )
    {
        if ( IsOneShot() )
        {
            Stop();
        }
        Notify();
    }
}
Exemple #2
0
void wxMotifTimerImpl::Notify()
{
    if ( IsOneShot() )
    {
        // nothing to do, timeout is removed automatically by X
        m_id = 0;
    }
    else // rearm the timer
    {
        DoStart();
    }

    wxTimerImpl::Notify();
}
// ----------------------------------------------------------------------------
void CAnimActionTriState::Stop()
{
	if ((GetStatus() == IAction::None) || (GetStatus() == IAction::Pending))
	{
		assert(m_subState == eSS_None);
		TBase::Stop();
	}
	else
	{
		if (m_subState < eSS_Middle)
		{
			m_triStateFlags |= eTSF_SkipMiddle;
		}
		else if (m_subState == eSS_Middle)
		{
			if ( !IsOneShot() )
				TransitionToNextSubState();
		}
	}
}
Exemple #4
0
bool wxCarbonTimerImpl::Start( int milliseconds, bool mode )
{
    (void)wxTimerImpl::Start(milliseconds, mode);

    wxCHECK_MSG( m_milli > 0, false, wxT("invalid value for timer timeout") );
    wxCHECK_MSG( m_info->m_timerRef == NULL, false, wxT("attempting to restart a timer") );

    m_info->m_timer = this;
    m_info->m_proc = NewEventLoopTimerUPP( &wxProcessTimer );

    OSStatus err = InstallEventLoopTimer(
        GetMainEventLoop(),
        m_milli*kEventDurationMillisecond,
        IsOneShot() ? 0 : m_milli * kEventDurationMillisecond,
        m_info->m_proc,
        this,
        &m_info->m_timerRef );
    verify_noerr( err );

    return true;
}
Exemple #5
0
bool wxOSXTimerImpl::Start( int milliseconds, bool mode )
{
    (void)wxTimerImpl::Start(milliseconds, mode);

    wxCHECK_MSG( m_milli > 0, false, wxT("invalid value for timer timeout") );
    wxCHECK_MSG( m_info->m_timerRef == NULL, false, wxT("attempting to restart a timer") );
    
    CFGregorianUnits gumilli ;
    memset(&gumilli,0,sizeof(gumilli) );
    gumilli.seconds = m_milli / 1000.0;

    CFRunLoopTimerContext ctx ;
    memset( &ctx, 0 , sizeof(ctx) );
    ctx.version = 0;
    ctx.info = this;

    m_info->m_timer = this;
    m_info->m_timerRef = CFRunLoopTimerCreate(
        kCFAllocatorDefault, 
        CFAbsoluteTimeAddGregorianUnits( CFAbsoluteTimeGetCurrent() , NULL, gumilli ),
        IsOneShot() ? 0 : CFTimeInterval( m_milli / 1000.0 ) ,
        0, 0, wxProcessTimer, &ctx);
    
    wxASSERT_MSG( m_info->m_timerRef != NULL, wxT("unable to create timer"));
    
    CFRunLoopRef runLoop = 0;
#if wxOSX_USE_IPHONE
    runLoop = CFRunLoopGetMain();
#else
    runLoop = CFRunLoopGetCurrent();
#endif
    CFRunLoopAddTimer( runLoop, m_info->m_timerRef, kCFRunLoopCommonModes) ;


    return true;
}