コード例 #1
0
ファイル: windowmover.cpp プロジェクト: kolayuk/SwipeUnlock
void CWindowMover::startAnim(CWindowMover::TAnimationAxis axis, int to)
{
    CCoeControl* control =(viewer->winId());
    if (axis==EXAxis)
    {
    xAnim->setStartValue(QVariant(control->Position().iX));
    xAnim->setEndValue(QVariant(to));
    xAnim->start();
    qDebug()<<"start x anim"<<to;

    }
    else
    {
        yAnim->setStartValue(QVariant(control->Position().iY));
        yAnim->setEndValue(QVariant(to));
        yAnim->start();
        qDebug()<<"start y anim"<<to;
    }
}
コード例 #2
0
ファイル: windowmover.cpp プロジェクト: kolayuk/SwipeUnlock
void CWindowMover::finished()
{
    qDebug()<<"finished anim";
    CCoeControl* control =(viewer->winId());
    TPoint p=control->Position();
    int val=0;
    if (p.iX==0) val=p.iY;
    else if (p.iY==0) val=p.iX;
    if ((abs(val)==control->Size().iHeight||abs(val)==control->Size().iWidth)&&iCallBack) iCallBack->Hide();
}
コード例 #3
0
ファイル: LAFMENUP.CPP プロジェクト: cdaffara/symbiandump-mw1
/**
 * Draws the joints between menu pane and menu pane title into the graphics
 * context aGc, in the rectangle aRect.
 */
EXPORT_C void LafMenuPane::DrawTitlePaneJoint(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const CCoeControl* aMenuPaneTitle, const TRect& aInnerRect)
	{
	PrepareGcForDrawingItems(aLafEnv, aMenuPane, aGc);
    aGc.SetPenStyle(CGraphicsContext::ENullPen);
    aGc.DrawRect(aInnerRect);
	if (aMenuPaneTitle)
		{// pane has title, so make sure they are joined up correctly
		const TPoint titlePos = aMenuPaneTitle->Position();
		const TInt width = aMenuPaneTitle->Size().iWidth;
		const TPoint position = aMenuPane.Position();

		// left straight join
		aGc.SetPenStyle(CGraphicsContext::ESolidPen);
		aGc.SetPenColor(aLafEnv.ControlColor(EColorMenuPaneBackground, aMenuPane));
		// get rid of the gray bit of border
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+5,4),TPoint(titlePos.iX-position.iX+width-5,4));
		// get rid of the black bit of border
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+4,0),TPoint(titlePos.iX-position.iX+width-4,0));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+4,1),TPoint(titlePos.iX-position.iX+width-4,1));

		aGc.DrawLine(TPoint(titlePos.iX-position.iX+5,4),TPoint(titlePos.iX-position.iX+width-5,4));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,0),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),0));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,1),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),1));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,2),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),2));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,3),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),3));

		// draw in black line seperator
		aGc.SetPenColor(KRgbBlack);
		aGc.DrawLine(TPoint(titlePos.iX-position.iX +MenuPaneSeparatorMargin(),0),TPoint(titlePos.iX-position.iX+width-3-MenuPaneSeparatorMargin(),0));

		TGulBorder::TColors borderColors;
		GetBorderColors(borderColors, aLafEnv, *aMenuPaneTitle);

		aGc.SetPenColor(borderColors.iMidlight);
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+1,0),TPoint(titlePos.iX-position.iX+4,0));
		aGc.DrawLine(TPoint(titlePos.iX-position.iX+1,1),TPoint(titlePos.iX-position.iX+4,1));

		if (aMenuPaneTitle->Rect().iBr.iX==aMenuPane.Rect().iBr.iX)
			{// right straight join
			aGc.SetPenColor(borderColors.iMid);
			aGc.DrawLine(TPoint(aInnerRect.iBr.iX,0),TPoint(aInnerRect.iBr.iX,5));
			aGc.DrawLine(TPoint(aInnerRect.iBr.iX+1,0),TPoint(aInnerRect.iBr.iX+1,4));
			aGc.DrawLine(TPoint(aInnerRect.iBr.iX+2,0),TPoint(aInnerRect.iBr.iX+2,3));
			}
		else
			{// right corner join
			TInt xPos=titlePos.iX-position.iX+width-4;
			aGc.SetPenColor(borderColors.iMid);
			aGc.DrawLine(TPoint(xPos,0),TPoint(xPos,4));
			aGc.DrawLine(TPoint(xPos+1,0),TPoint(xPos+1,3));
			aGc.DrawLine(TPoint(xPos+2,0),TPoint(xPos+2,2));
			}
		}
	}
コード例 #4
0
ファイル: windowmover.cpp プロジェクト: kolayuk/SwipeUnlock
void CWindowMover::checkLaunchArea()
{
    CCoeControl* control =(viewer->winId());
    int y=control->Position().iY;
    int x=control->Position().iX;
    float verSense=settings->value("settings/versense",0.5).toFloat();
    int height=control->Size().iHeight;
    if (x==0&&abs(y-prevY)<40&&y>(-height*verSense)&&y<-40)
    {
        qDebug()<<"will show launch area";
        emit showLaunchArea();
        startAnim(EYAxis,0);
    }
    prevY=y;
}
コード例 #5
0
ファイル: windowmover.cpp プロジェクト: kolayuk/SwipeUnlock
void CWindowMover::HandlePointerEventL(const TPointerEvent& aPointerEvent)
    {
    CCoeControl* control =(viewer->winId());
    if (aPointerEvent.iType == TPointerEvent::EButton1Down)
        {
        iPointerPoint1=aPointerEvent.iPosition;
        iPointerPoint2=aPointerEvent.iPosition;
        MovingChanged(true);

        QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress);
        pressEvent.setScenePos(QPointF(iPointerPoint1.iX-control->Position().iX, iPointerPoint1.iY-control->Position().iY));
        qDebug()<<pressEvent.scenePos().x()<<pressEvent.scenePos().y();
        pressEvent.setButton(Qt::LeftButton);
        pressEvent.setButtons(Qt::LeftButton);
        QApplication::sendEvent(viewer->scene(), &pressEvent);
        }
    else if (aPointerEvent.iType == TPointerEvent::EDrag)
        {
        iDragged=ETrue;
        TInt dx=aPointerEvent.iPosition.iX-iPointerPoint1.iX;
        TInt dy=aPointerEvent.iPosition.iY-iPointerPoint1.iY;
        if (!axisSet)
        {
            if (abs(dy)>abs(dx)) {axisX=0; axisY=1;}
            else {axisX=1;axisY=0;}
            axisSet=true;
        }
        RWindow rWindow=(control->Window());
        control->SetPosition(TPoint(dx*axisX,dy*axisY));
        control->DrawBackground(TRect(control->Position(),control->Size()));
        }
    else if (aPointerEvent.iType==TPointerEvent::EButton1Up)
        {
        iPointerPoint2=aPointerEvent.iPosition;
        //MakeVisible(EFalse);
        int gest=settings->value("settings/gesture").toInt();
        if (gest==0) axisSet=false;

        float horSense=settings->value("settings/horsense",0.5).toFloat();
        float verSense=settings->value("settings/versense",0.5).toFloat();
        int width=control->Size().iWidth;
        int height=control->Size().iHeight;
        int x=control->Position().iX;
        int y=control->Position().iY;
        qDebug()<<"("<<x<<","<<y<<")"<<horSense<<verSense;
        if (x>(horSense)*width)
           {startAnim(EXAxis,width);}
        else if (x<(-horSense)*width)
           {startAnim(EXAxis,-width);}
        else if (x!=0)
           {startAnim(EXAxis,0);}
        if (y>(verSense)*height)
           {startAnim(EYAxis,height);}
        else if (y<(-verSense)*height)
           {startAnim(EYAxis,-height);}
        else if (y!=0)
           {startAnim(EYAxis,0);}
        if (abs(iPointerPoint1.iX-iPointerPoint2.iX)<20&&abs(iPointerPoint1.iY-iPointerPoint2.iY)<20)
        {
            QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease);
            releaseEvent.setScenePos(QPointF(iPointerPoint1.iX-control->Position().iX, iPointerPoint1.iY-control->Position().iY));
            releaseEvent.setButton(Qt::LeftButton);
            releaseEvent.setButtons(Qt::LeftButton);
            QApplication::sendEvent(viewer->scene(), &releaseEvent);
        }
        else
        {
            QGraphicsSceneMouseEvent moveEvent(QEvent::GraphicsSceneMouseMove);
            moveEvent.setScenePos(QPointF(iPointerPoint1.iX-control->Position().iX-10,iPointerPoint1.iY-control->Position().iY-10));
            moveEvent.setButton(Qt::LeftButton);
            moveEvent.setButtons(Qt::LeftButton);
            QApplication::sendEvent(viewer->scene(), &moveEvent);
            QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease);
            releaseEvent.setScenePos(QPointF(0,0));
            releaseEvent.setButton(Qt::LeftButton);
            releaseEvent.setButtons(Qt::LeftButton);
            QApplication::sendEvent(viewer->scene(), &releaseEvent);

        }
        MovingChanged(false);
        }
    CCoeControl::HandlePointerEventL(aPointerEvent);
    }