Ejemplo n.º 1
0
void cbBarDragPlugin::OnDrawHintRect( cbDrawHintRectEvent& event )
{
    if ( !mpScrDc ) StartTracking();

    DoDrawHintRect( event.mRect, event.mIsInClient );

    if ( event.mLastTime )
        FinishTracking();
}
Ejemplo n.º 2
0
void cbHintAnimationPlugin::OnDrawHintRect( cbDrawHintRectEvent& event )
{
    if ( !mAnimStarted && !mpScrDc )
    {
        StartTracking();

        mPrevInClient = event.mIsInClient;

        mPrevRect = event.mRect;

        mStopPending = false;
    }

    if ( !event.mEraseRect )
    {
        // pass on current hint-rect info to the animation "thread", in
        // order to make adjustments to the morph-target on-the-fly

        mCurRect.x = event.mRect.x;
        mCurRect.y = event.mRect.y;
        mCurRect.width  = event.mRect.width;
        mCurRect.height = event.mRect.height;
    }

    // check the amount of change in the shape of hint,
    // and start morph-effect if change is "sufficient"

    int change = abs( mCurRect.width  - mPrevRect.width  ) +
                 abs( mCurRect.height - mPrevRect.height );

    if ( change > 10 && !event.mLastTime && !event.mEraseRect )
    {
        if ( !mpAnimTimer )

            mpAnimTimer  = new cbHintAnimTimer();

        // init the animation "thread", or reinit if already started

        mpAnimTimer->Init( this, mAnimStarted );

        mAnimStarted = true;
    }
    else if ( !mAnimStarted )
    {
        DoDrawHintRect( event.mRect, event.mIsInClient );

        if ( event.mLastTime )

            FinishTracking();

        mPrevInClient = event.mIsInClient;
    }
    else
    {
        mCurInClient = event.mIsInClient;

        if ( event.mLastTime && mpAnimTimer )
        {
            mStopPending = true;

            if ( mpAnimTimer->mPrevMorphed.x != POS_UNDEFINED )

                // erase previous rect
                DoDrawHintRect( mpAnimTimer->mPrevMorphed, mPrevInClient );
        }
    }

    mPrevRect = event.mRect;
}