当前位置: 首页>>代码示例>>C++>>正文


C++ PegRect::Shift方法代码示例

本文整理汇总了C++中PegRect::Shift方法的典型用法代码示例。如果您正苦于以下问题:C++ PegRect::Shift方法的具体用法?C++ PegRect::Shift怎么用?C++ PegRect::Shift使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PegRect的用法示例。


在下文中一共展示了PegRect::Shift方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Draw

/*--------------------------------------------------------------------------*/
void PegBitmapWindow::Draw()
{
	PegPoint tPutBitmap;
	PegRect CaptureRect;

  if (!mbCaptured)
  {
      // Capture the four bitmaps on my corners
      CaptureRect.wLeft = mReal.wLeft;
      CaptureRect.wTop = mReal.wTop;
      CaptureRect.wRight = CaptureRect.wLeft + CORNER_RADIUS;
      CaptureRect.wBottom = CaptureRect.wTop + CORNER_RADIUS;
      Screen()->Capture(&mCaptures[TOP_LEFT], CaptureRect);

			CaptureRect.Shift(mReal.Width() - CORNER_RADIUS, 0);
      Screen()->Capture(&mCaptures[TOP_RIGHT], CaptureRect);

			CaptureRect.Shift(0, mReal.Height() - CORNER_RADIUS);
      Screen()->Capture(&mCaptures[BOTTOM_RIGHT], CaptureRect);

      CaptureRect.Shift(-(mReal.Width() - CORNER_RADIUS), 0);
      Screen()->Capture(&mCaptures[BOTTOM_LEFT], CaptureRect);
      mbCaptured = TRUE;
  }

	BeginDraw();

  muColors[PCI_NORMAL] = mFillColor; /* set default value with given color */

	if (mpBitmap == NULL)
	{ /* no bitmap given, so fill frame with given color */
		DrawFrame();
	}
	else
	{
		Screen()->Restore(this, &mCaptures[TOP_LEFT]);
    Screen()->Restore(this, &mCaptures[TOP_RIGHT]);
    Screen()->Restore(this, &mCaptures[BOTTOM_RIGHT]);
    Screen()->Restore(this, &mCaptures[BOTTOM_LEFT]);

		if (mBitmapStyle == kCenterBitmap)
		{ /* center bitmap in window */
			tPutBitmap.x = mReal.wLeft + ((mReal.wRight - mReal.wLeft) - mpBitmap->wWidth)/2;
			tPutBitmap.y = mReal.wTop + ((mReal.wBottom - mReal.wTop) - mpBitmap->wHeight)/2;
		}
		else
    {
      tPutBitmap.x = mReal.wLeft;
      tPutBitmap.y = mReal.wTop;
    }

		Bitmap(tPutBitmap, mpBitmap); /* set bitmap */
	}

	DrawChildren(); /* draw buttons */
	EndDraw();
}
开发者ID:garyqinyu,项目名称:abv,代码行数:58,代码来源:pbitmwin.cpp

示例2: PegDecoratedWindow

DialWindow::DialWindow(const PegRect& Rect) :
    PegDecoratedWindow(Rect)
{
    Add(new PegTitle(gsWindowTitle));

    miDial1Dir = 1;
    miDial2Dir = 1;
    miDial1Val = 0;
    miDial2Val = 0;

    PegRect WinRect;

    WinRect.Set(50, 50, 199, 199);
    mpDial1 = new PegFiniteBitmapDial(WinRect, 180, 0, 0, 100,
                                      &gbdialbkg2Bitmap);

    WinRect.Shift(160, 0);
    mpDial2 = new PegFiniteBitmapDial(WinRect, 225, 315, -25, 125,
                                      &gbdialbkg3Bitmap,
                                      &gbDialAnchor1Bitmap);
    mpDial2->Style((mpDial2->Style() | DS_POLYNEEDLE) & ~DS_THINNEEDLE);
    mpDial2->SetNeedleColor(BLUE);

    Add(mpDial1);
    Add(new PegPrompt(105, 210, 40, gsZero, 101, FF_RECESSED | TJ_RIGHT |
                      TT_COPY));
    Add(mpDial2);
    Add(new PegPrompt(265, 210, 40, gsZero, 102, FF_RECESSED | TJ_RIGHT |
                      TT_COPY));

    WinRect.Shift(160, 0);
    mpDial3 = new PegFiniteBitmapDial(WinRect, 180, 90, 0, 100,
                                      &gbdialbkg4Bitmap, NULL,
                                      0);
    mpDial3->Style(FF_NONE | AF_TRANSPARENT | DS_THICKNEEDLE | DS_USERCOR |
                   DS_CLOCKWISE);
    mpDial3->SetCOR(123, 123);
    mpDial3->SetNeedleLength(65);
    mpDial3->SetColor(PCI_NORMAL, BLUE);
    Add(mpDial3);

    SetColor(PCI_NORMAL, GREEN);

    Add(new PegPrompt(425, 210, 40, gsZero, 101, FF_RECESSED | TJ_RIGHT |
                      TT_COPY));

    WinRect.Set(245, 240, 330, 270);
    Add(new PegTextButton(WinRect, gsChangeColor, IDB_CHANGECOLOR));
}
开发者ID:garyqinyu,项目名称:abv,代码行数:49,代码来源:main.cpp

示例3: Message


//.........这里部分代码省略.........
        break;

    case PM_LBUTTONDOWN:
        if (!muMoveMode && StatusIs(PSF_SIZEABLE) && !mbMaximized)
        {
            muMoveMode = BorderContains(Mesg.Point);

            if (muMoveMode)
            {
                mbMoveFrame = FALSE;
                CapturePointer();
                mStartMove = Mesg.Point;
                mMovePoint = mStartMove;
            }
        }
        break;

    case PM_LBUTTONUP:
        if (muMoveMode)
        {
            DrawMoveFrame(TRUE);
            SetPointerType(PPT_NORMAL);
            ReleasePointer();
            PegRect OldSize = mReal;

            if (mStartMove.x == mMovePoint.x &&
                mStartMove.y == mMovePoint.y)
            {
                muMoveMode = 0;
                break;  // didn't really move or size anything
            }

            PegRect NewSize = mReal;
            int xShift = mMovePoint.x - mStartMove.x;
            int yShift = mMovePoint.y - mStartMove.y;

            switch(muMoveMode)
            {
            case PMM_MOVEALL:
                NewSize.Shift(xShift, yShift);
                break;

            case PMM_MOVERIGHT:
                NewSize.wRight += xShift;
                break;

            case PMM_MOVELEFT:
                NewSize.wLeft += xShift;
                break;

            case PMM_MOVETOP:
                NewSize.wTop += yShift;
                break;

            case PMM_MOVEBOTTOM:
                NewSize.wBottom += yShift;
                break;

            case PMM_MOVEUL:
                NewSize.wLeft += xShift;
                NewSize.wTop += yShift;
                break;

            case PMM_MOVELL:
                NewSize.wLeft += xShift;
                NewSize.wBottom += yShift;
开发者ID:garyqinyu,项目名称:abv,代码行数:67,代码来源:pwindow.cpp

示例4: DrawMoveFrame

/*--------------------------------------------------------------------------*/
void PegWindow::DrawMoveFrame(BOOL bErase)
{
    if (bErase)
    {
        if (!mbMoveFrame)
        {
            return;
        }
        mbMoveFrame = FALSE;
    }
    else
    {
        if (mbMoveFrame)
        {
            return;
        }
        mbMoveFrame = TRUE;
    }

    PegRect Invalid = mReal;

    if (mMovePoint.x > Parent()->mClient.wRight)
    {
        mMovePoint.x = Parent()->mClient.wRight;
    }
    else
    {
        if (mMovePoint.x < Parent()->mClient.wLeft)
        {
            mMovePoint.x = Parent()->mClient.wLeft;
        }
    }

    if (mMovePoint.y > Parent()->mClient.wBottom)
    {
        mMovePoint.y = Parent()->mClient.wBottom;
    }
    else
    {
        if (mMovePoint.y < Parent()->mClient.wTop)
        {
            mMovePoint.y = Parent()->mClient.wTop;
        }
    }
    int xShift = mMovePoint.x - mStartMove.x;
    int yShift = mMovePoint.y - mStartMove.y;

    switch(muMoveMode)
    {
    case PMM_MOVEALL:
        Invalid.Shift(xShift, yShift);
        break;

    case PMM_MOVERIGHT:
        Invalid.wRight += xShift;
        break;

    case PMM_MOVELEFT:
        Invalid.wLeft += xShift;
        break;

    case PMM_MOVETOP:
        Invalid.wTop += yShift;
        break;

    case PMM_MOVEBOTTOM:
        Invalid.wBottom += yShift;
        break;

    case PMM_MOVEUL:
        Invalid.wLeft += xShift;
        Invalid.wTop += yShift;
        break;

    case PMM_MOVELL:
        Invalid.wLeft += xShift;
        Invalid.wBottom += yShift;
        break;

    case PMM_MOVEUR:
        Invalid.wRight += xShift;
        Invalid.wTop += yShift;
        break;

    case PMM_MOVELR:
        Invalid.wRight += xShift;
        Invalid.wBottom += yShift;
        break;
    }

    CheckResizeRect(Invalid);

    PegRect OldClip = mClip;
    mClip = Parent()->mClip & Parent()->mClient;
    Invalidate(Invalid);
    BeginDraw();
    Screen()->RectangleXOR(this, Invalid);
    EndDraw();
    mClip = OldClip;
//.........这里部分代码省略.........
开发者ID:garyqinyu,项目名称:abv,代码行数:101,代码来源:pwindow.cpp

示例5: MoveClientObjects

/*--------------------------------------------------------------------------*/
void PegWindow::MoveClientObjects(SIGNED xShift, SIGNED yShift, BOOL bDraw)
{
    PegThing *Child = First();

    if (StatusIs(PSF_VISIBLE))
    {
        Invalidate();
    }

    while(Child)
    {
        if (!(Child->StatusIs(PSF_NONCLIENT)))
        {
            PegRect MoveRect = Child->mReal;
            MoveRect.Shift(xShift, yShift);
            Child->Resize(MoveRect);
        }
        Child = Child->Next();
    }

    if (!bDraw)
    {
        return;
    }

    #ifdef FAST_BLIT
     if (StatusIs(PSF_CURRENT))
     //if (Presentation()->First() == this)
     {
        // scroll as much as possible using RectMove()

        PegPoint Put;
        PegRect Invalid, SaveClip;

        // figure out what needs to be re-drawn

        Invalid = mClient & mClip;
        SaveClip = mClient;

        if (xShift)
        {
            Put.y = mClient.wTop;

            if (xShift > 0)
            {
                Invalid.wRight = Invalid.wLeft + xShift;
                SaveClip.wRight -= xShift;
                Put.x = mClient.wLeft + xShift;
            }
            else
            {
                Invalid.wLeft = Invalid.wRight + xShift;
                SaveClip.wLeft -= xShift;
                Put.x = mClient.wLeft;
            }
        }
        else
        {
            Put.x = mClient.wLeft;
            if (yShift > 0)
            {
                Invalid.wBottom = Invalid.wTop + yShift;
                SaveClip.wBottom -= yShift;
                Put.y = mClient.wTop + yShift;
            }
            else
            {
                Invalid.wTop = Invalid.wBottom + yShift;
                SaveClip.wTop -= yShift;
                Put.y = mClient.wTop;
            }
        }
        BeginDraw();
        Screen()->RectMove(this, SaveClip, Put);
        EndDraw();

        SaveClip = mClip;
        Invalidate(Invalid);
        mClip = Invalid;
        Draw();
        mClip = SaveClip;
        return;
    }
    #endif

     // for non-accelerated hardware,
     // forced to re-draw the client area:

     Draw();
}
开发者ID:garyqinyu,项目名称:abv,代码行数:91,代码来源:pwindow.cpp

示例6: PegAppInitialize

/*--------------------------------------------------------------------------*/
void PegAppInitialize(PegPresentationManager* pPresent)
{
	PegRect Rect;
	Rect.Set(10, 10, 630, 370);
	PegDecoratedWindow* pWindow = new PegDecoratedWindow(Rect);

	pWindow->Add(new PegTitle("PegDecoratedButton Example"));

	PegToolBar* pToolBar = new PegToolBar();
	pWindow->Add(pToolBar);

	pWindow->SetColor(PCI_NORMAL, BROWN);

	Rect = pWindow->mClient;
	Rect.wLeft += (pWindow->mClient.Width() >> 4);
	Rect.wTop += (pWindow->mClient.Height() >> 4);
	Rect.wRight = Rect.wLeft + 150;
	Rect.wBottom = Rect.wTop + 50;
	PegDecoratedButton* pButton = new PegDecoratedButton(Rect, "Text Only", NULL);
	pWindow->Add(pButton);

	Rect.Shift(175, 0);
	pButton = new PegDecoratedButton(Rect, NULL, &gbRedDotBitmap);
	pWindow->Add(pButton);

	Rect.Shift(175, 0);
	pButton = new PegDecoratedButton(Rect, "Text and Bitmap", &gbRedDotBitmap);
	pWindow->Add(pButton);

	Rect.Shift(-175, 75);
	pButton = new PegDecoratedButton(Rect, "Text on the Bottom", &gbGreenDotBitmap,
									 0, AF_ENABLED, DBF_ORIENT_TR, TRUE);
	pWindow->Add(pButton);

	Rect.Shift(-150, 50);
	pButton = new PegDecoratedButton(Rect, "Text on the Right", &gbGreenDotBitmap,
									 0, AF_ENABLED, 0, TRUE);
	pWindow->Add(pButton);

	Rect.Shift(150, 50);
	pButton = new PegDecoratedButton(Rect, "Text on the Top", &gbGreenDotBitmap,
									 0, AF_ENABLED, DBF_ORIENT_BR, TRUE);
	pWindow->Add(pButton);

	Rect.Shift(150, -50);
	pButton = new PegDecoratedButton(Rect, "Text on the Left", &gbGreenDotBitmap,
									 0, AF_ENABLED, DBF_ORIENT_TR | DBF_ORIENT_BR,
									 TRUE);
	pWindow->Add(pButton);

	// Now add some buttons to a toolbar panel. we'll just
	// let them size themselves and have the panel put them
	// where it wants them
	PegToolBarPanel* pPanel = new PegToolBarPanel();
	pButton = new PegDecoratedButton(0, 0, "Stop", &gbStopBitmap, 0, AF_ENABLED,
									 0, TRUE);
	pPanel->Add(pButton);

	pButton = new PegDecoratedButton(0, 0, "Refresh", &gbRefreshBitmap, 0, AF_ENABLED,
								     0, TRUE);
	pPanel->Add(pButton);

	pButton = new PegDecoratedButton(0, 0, "New", &gbNewBitmap, 0, AF_ENABLED,
								     0, TRUE);
	pPanel->Add(pButton);

	pToolBar->AddPanel(pPanel);

	// Center the window and add it to the presentation manager
	pPresent->Center(pWindow);
	pPresent->Add(pWindow);
}
开发者ID:garyqinyu,项目名称:abv,代码行数:73,代码来源:decbtn.cpp


注:本文中的PegRect::Shift方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。