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


C++ TRect::Contains方法代码示例

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


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

示例1: PointerL

void CStatusWindow::PointerL(const TPointerEvent &aPointer,const TTime &aTime)
	{
#if defined(__WINS__)
	if (iRect1.Contains(aPointer.iPosition))
		{
		if (aPointer.iType==TPointerEvent::EButton1Down)
			ChangeXyInputType();
		}
	else
#endif
        if (iRect2.Contains(aPointer.iPosition))
		{
		if (aPointer.iType==TPointerEvent::EButton1Down)
			ChangePointerCursorMode();
		}
	else if (iRect4.Contains(aPointer.iPosition))
		iExit=ETrue;
	else
		CTTitledWindow::PointerL(aPointer,aTime);
	if ((iUpdateNeeded || iExit) && aPointer.iType==TPointerEvent::EButton1Up)
		{
		if (iExit)
			iTest->Request();
		else
			{
			Client()->iWs.SetPointerCursorMode(iMode);
		#if defined(__WINS__)
			Client()->iWs.SimulateXyInputType(iXyInputType);
		#endif
			Client()->iWs.Flush();
			iUpdateNeeded=EFalse;
			}
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:34,代码来源:TMPNTCUR.CPP

示例2: GetPixel

/** Gets the RGB colour of an individual pixel on a bitmapped graphics
device.

The function provides a concrete implementation of the pure virtual
function CBitmapDevice::GetPixel(). */
EXPORT_C void CFbsBitmapDevice::GetPixel(TRgb& aColor,const TPoint& aPoint) const
	{
	TRect deviceRect;
	iDrawDevice->GetDrawRect(deviceRect);
	if (!deviceRect.Contains(aPoint))
		return;

	iFbsBmp->BeginDataAccess();
	((CFbsBitmapDevice*)this)->SetBits();
	aColor = iDrawDevice->ReadPixel(aPoint.iX,aPoint.iY);
	iFbsBmp->EndDataAccess(ETrue);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:17,代码来源:BITMAPDV.CPP

示例3: DoMouseMoved

void TButton::DoMouseMoved(const TPoint& point, TModifierState state)
{
	if (fTrackingMouse)
	{
		TRect bounds;
		GetLocalBounds(bounds);

		if (bounds.Contains(point) != fPressed)
		{
			fPressed = !fPressed;
			Redraw();
		}
	}
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:14,代码来源:TButton.cpp

示例4: HideLines_Edwin

/**
 * Sets a clipping rectangle for hiding the whole or a part of edwin's text.
 *
 * The reason for using this function is the multiline edwins. The text inside
 * an edwin can be broken to two or more lines, which must be hidden or shown
 * independently from each other. That is why it is not enough just to move
 * the whole edwin out of the screen.
 *
 * @param aClipRect The clipping rect for edwin's text. An empty rect disables
 *   hiding.
 *
 * @return How many subcontrols were hidden
 */
static TInt HideLines_Edwin(CEikEdwin *aEdwin, TRect aClipRect)
{
    aEdwin->SetTextLinesRect(aClipRect);

    // Create rects of the first and last edwin lines
    TPoint edwinTl( aEdwin->Rect().iTl );
    TPoint edwinBr( aEdwin->Rect().iBr );
    TRect textFirstLine;
    aEdwin->TextLayout()->GetLineRect(edwinTl.iY, textFirstLine);
    textFirstLine.Move( edwinTl.iX, edwinTl.iY + aEdwin->Margins().iTop );
    TRect textLastLine;
    aEdwin->TextLayout()->GetLineRect(edwinBr.iY, textLastLine);
    textLastLine.Move( edwinBr.iX, edwinBr.iY - aEdwin->Margins().iTop - textLastLine.Height() );

    // Check if at least one line fits to the clipping rect
    if( aClipRect.Contains(textFirstLine.iTl) &&
            aClipRect.iBr.iY >= textFirstLine.iBr.iY )   // The first line fits
        return 0;
    if( aClipRect.Contains(textLastLine.iTl) &&
            aClipRect.iBr.iY >= textLastLine.iBr.iY )   // The last line fits
        return 0;
    return 1;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:36,代码来源:EIKCAPCA.CPP

示例5: HideLines_Ctrl

/**
 * Tries to hide the specified control. The control will be hidden, if it doesn't
 * fit to the specified clipping rectangle. Checks if the control exists.
 *
 * @return How many subcontrols were hidden
 */
static TInt HideLines_Ctrl(CCoeControl *aControl, TRect aClipRect)
{
    if ( !aControl )
        return 1;   // It doesn't exist and hence not visible
    TRect rect( aControl->Rect() );
    if ( !aClipRect.Contains(rect.iTl) || aClipRect.iBr.iY <= rect.iBr.iY )
        // Never use TRect::Contains() for checking the bottom right corner, see documentation
    {
        // hide it
        aControl->SetPosition( TPoint(-666,-666) );
        return 1;
    }
    else
        return 0;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:21,代码来源:EIKCAPCA.CPP

示例6: IsPointInDlgItem

/////////////////////////////////////////////////////////////////////
// TPreferencesDialog
// ------------------
//   Look if the dialog control 'resid' window contains the point
//   'clientPoint', which is a dialog client coord. of the point
BOOL TPreferencesDialog::IsPointInDlgItem (int itemId, TPoint &clientPoint)
{
	HWND hWnd = GetDlgItem (itemId);
	if ( hWnd == (HWND)NULL )
		return FALSE;

	TWindow wnd(hWnd);
	TRect wRect;
	wnd.GetWindowRect (wRect);
	TPoint TopLeft (wRect.left, wRect.top);
	TPoint BotRight(wRect.right, wRect.bottom);
	ScreenToClient (TopLeft);
	ScreenToClient (BotRight);
	TRect cRect (TopLeft, BotRight);

	return cRect.Contains (clientPoint);
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:22,代码来源:prefdlg.cpp

示例7: GetClientRect

//
/// Handles WM_MOUSEMOVE to monitor mouse location when processing mouse down/dblclk
/// requests. Updates state of button if we're in 'capture' mode.
//
void
TUrlLink::EvMouseMove(uint modKeys, const TPoint& point)
{
  TStatic::EvMouseMove(modKeys, point);
  if(bOverControl){
    TRect rect;
    GetClientRect(rect);
    if(!rect.Contains(point)){
      ReleaseCapture();
      bOverControl = false;
      Invalidate();
    }
  }
  else{
     SetCapture();
    bOverControl = true;
    Invalidate();
  }
}
开发者ID:Meridian59,项目名称:Meridian59,代码行数:23,代码来源:urllink.cpp

示例8: IdentifyPoint

ScrollBarPart TScrollBar::IdentifyPoint(const TPoint& point, TRect& outTrackingRect) const
{
	GetArrow1(outTrackingRect);
	if (outTrackingRect.Contains(point))
		return kArrow1;
	
	GetArrow2(outTrackingRect);
	if (outTrackingRect.Contains(point))
		return kArrow2;

	TRect thumb;
	GetThumb(thumb);
	if (thumb.Contains(point))
	{
		outTrackingRect = thumb;
		return kThumb;
	}

	TRect thumbArea;
	GetThumbArea(thumbArea);
	if (! thumbArea.Contains(point))
		return kNone;

	if (IsVertical())
	{
		outTrackingRect.Set(thumbArea.left, thumbArea.top, thumbArea.right, thumb.top);
		if (outTrackingRect.Contains(point))
			return kPageUp;
		else
		{
			outTrackingRect.top = thumb.bottom;
			outTrackingRect.bottom = thumbArea.bottom;
			return kPageDown;
		}
	}
	else
	{
		outTrackingRect.Set(thumbArea.left, thumbArea.top, thumb.left, thumbArea.bottom);
		if (outTrackingRect.Contains(point))
			return kPageUp;
		else
		{
			outTrackingRect.left = thumb.right;
			outTrackingRect.right = thumbArea.right;
			return kPageDown;
		}
	}
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:48,代码来源:TScrollBar.cpp

示例9: FindLastHittingChild

CHuiVisual* FindLastHittingChild( const CHuiVisual& aParentVisual, 
                                  const TPoint& aDisplayPoint )
    {
    // If we want that the pointer event are passed only to the visuals which 
    // (effective) opacity is greater than 50%, this would be the place to 
    // implement it.
    for ( TInt i = aParentVisual.Count() - 1 ; i >= 0 ; i-- )
        {
        // DisplayRect() returns the current value of the rectange. If the pointer
        // hit needs to be compared to the target rect, change this function call
        // from DisplayRect() into DisplayRectTarget()
        const TRect rect =  aParentVisual.Visual( i ).DisplayRect();
        if ( rect.Contains( aDisplayPoint ) )
            {
            CHuiVisual* leaf = 
                FindLastHittingChild( aParentVisual.Visual( i ), aDisplayPoint );
            return leaf ? leaf : &aParentVisual.Visual( i );
            }
        }
    return NULL;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:21,代码来源:alfstaticfactory.cpp

示例10: PointerL

void CListWindow::PointerL(const TPointerEvent &aPointer,const TTime& aTime)
{
    if (aPointer.iType==TPointerEvent::EButton1Down)
    {
        TRect rect;
        for(TInt index=0; index<ListCount(); index++)
        {
            RowBox(rect,index);
            if (rect.Contains(aPointer.iPosition))
            {
                if (index==iListPos && aPointer.iModifiers&EModifierDoubleClick)
                    SelectedL(iListPos);
                else
                {
                    iPrevTime=aTime;
                    SetListPos(index);
                }
                return;
            }
        }
    }
    CTTitledWindow::PointerL(aPointer,aTime);
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:23,代码来源:TTIME.CPP

示例11: HandlePointerEventL

void CSliderControl::HandlePointerEventL(const TPointerEvent& aEvent)
{
	TRawEvent ev;
	TInt x,y,middle,key;
	TRect cba;
	
	x=Position().iX+aEvent.iPosition.iX;
	y=Position().iY+aEvent.iPosition.iY;
	AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane,cba);
	middle=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iWidth/2;
	if (cba.Contains(TPoint(x,y))&&(aEvent.iType==aEvent.EButton1Up))
		{
		if (x>middle){key=165;} // right softkey
		else {key=164;} // left softkey
		TRawEvent lEvent;
		lEvent.Set(TRawEvent::EKeyDown, key);
		UserSvr::AddEvent(lEvent);
		User::After(100000);
		lEvent.Set(TRawEvent::EKeyUp, key);
		UserSvr::AddEvent(lEvent);
		}
	CCoeControl::HandlePointerEventL(aEvent);
}
开发者ID:kolayuk,项目名称:TweakS,代码行数:23,代码来源:SliderDialog.cpp

示例12: CheckIfHit

TBool CScrollBar::CheckIfHit(const STouchEventLocationConverted& aTouchEvent)
{
	 TInt lX = iTextureObject->ReturnLowerLeftCoordinate().iX.GetIntInBaseInt();
	 TInt lY = iTextureObject->ReturnLowerLeftCoordinate().iY.GetIntInBaseInt();
	 TRect lHitBox = TRect(TPoint(lX,lY + iSizeOfHitBox.iHeight), iSizeOfHitBox.iWidth, iSizeOfHitBox.iHeight); //need to add Height, since we want iY to be the bottom left corner

	 TBool lHasBeenTouched = lHitBox.Contains(aTouchEvent.VirtualLocation);

	 switch(aTouchEvent.Type)
	 {
		 case ETouchEventHandlerTouchTypeDown:
		 {
			 if(lHasBeenTouched)
			 {
				 iLastPositionDrag = aTouchEvent.VirtualLocation;
				 iState = EStateSelected;
				 iIdOfFinger = aTouchEvent.FingerId;
			 }

			 break;
		 }
		 case ETouchEventHandlerTouchTypeDrag:
		 {
			 if(iState == EStateSelected && iIdOfFinger == aTouchEvent.FingerId)
			 {
				 if(iScrollAxis == EScrollAxisY)
				 {
					 if(iLastPositionDrag.iY > aTouchEvent.VirtualLocation.iY) //move everything down
					 {
						 iScrollVariableRef += (iLastPositionDrag.iY - aTouchEvent.VirtualLocation.iY) * iScrollSpeedFactor;
						 if(iScrollVariableRef > iMaxScroll)
							 iScrollVariableRef = iMaxScroll;
					 }
					 else if(iLastPositionDrag.iY < aTouchEvent.VirtualLocation.iY)//move everything up
					 {
						 iScrollVariableRef -= (aTouchEvent.VirtualLocation.iY - iLastPositionDrag.iY) * iScrollSpeedFactor;
						 if(iScrollVariableRef < 0)
							 iScrollVariableRef = 0;
					 }
				 }
				 else
				 {
						if(iLastPositionDrag.iX < aTouchEvent.VirtualLocation.iX) //move everything to the left
						{
							iScrollVariableRef += (aTouchEvent.VirtualLocation.iX - iLastPositionDrag.iX) * iScrollSpeedFactor;
							if(iScrollVariableRef > iMaxScroll)
								iScrollVariableRef = iMaxScroll;
						}else if(iLastPositionDrag.iX > aTouchEvent.VirtualLocation.iX) //move everything to the right
						{
							iScrollVariableRef -= (iLastPositionDrag.iX - aTouchEvent.VirtualLocation.iX) * iScrollSpeedFactor;
							if(iScrollVariableRef < 0)
								iScrollVariableRef = 0;
						}
				 }

				 iLastPositionDrag = aTouchEvent.VirtualLocation;
			 }

			 break;
		 }
		 case ETouchEventHandlerTouchTypeUp:
		 {
			 if(iIdOfFinger == aTouchEvent.FingerId)
			 {
				 iState = EStateDefault;
			 }

			 break;
		 }
	 }

	 //always update ScrollBar Location, this way even if other objective modify the relative location the scroll bar will be updated as well
	 UpdateLocation();

	 return lHasBeenTouched;
}
开发者ID:DavidAStoll,项目名称:FighterPilotGameCode,代码行数:76,代码来源:CScrollBar.cpp

示例13: CheckIfHit

TBool CTouchSurface::CheckIfHit(const STouchEventLocationConverted& aTouchEvent)
{
	 TInt lX = iX.GetIntInBaseInt();
	 TInt lY = iY.GetIntInBaseInt();
	 TRect lHitBox = TRect(TPoint(lX,lY + iSizeOfSurface.iHeight), iSizeOfSurface.iWidth, iSizeOfSurface.iHeight); //need to add Height, since we want iY to be the bottom left corner

	 TBool lHasBeenTouched = lHitBox.Contains(aTouchEvent.VirtualLocation);

	 switch(aTouchEvent.Type)
	 {
		 case ETouchEventHandlerTouchTypeDown:
		 {
			 if(lHasBeenTouched)
			 {
				 iLastPositionDrag = aTouchEvent.VirtualLocation;
				 iTouched = true;
				 iIdOfFinger = aTouchEvent.FingerId;
			 }

			 break;
		 }
		 case ETouchEventHandlerTouchTypeDrag:
		 {
			 if(iTouched && iIdOfFinger == aTouchEvent.FingerId)
			 {
				 if(iScrollAxis == EScrollAxisY)
				 {
					 if(iLastPositionDrag.iY > aTouchEvent.VirtualLocation.iY) //move everything up
					 {
						 iScrollVariableRef -= (iLastPositionDrag.iY - aTouchEvent.VirtualLocation.iY) * iScrollSpeedFactor;
						 if(iScrollVariableRef < 0)
							 iScrollVariableRef = 0;
					 }
					 else if(iLastPositionDrag.iY < aTouchEvent.VirtualLocation.iY)//move everything down
					 {
						 iScrollVariableRef += (aTouchEvent.VirtualLocation.iY - iLastPositionDrag.iY) * iScrollSpeedFactor;
						 if(iScrollVariableRef > iMaxScroll)
							 iScrollVariableRef = iMaxScroll;
					 }
				 }
				 else
				 {
						if(iLastPositionDrag.iX < aTouchEvent.VirtualLocation.iX) //move everything to the right
						{
							iScrollVariableRef -= (aTouchEvent.VirtualLocation.iX - iLastPositionDrag.iX) * iScrollSpeedFactor;
							if(iScrollVariableRef < 0)
								iScrollVariableRef = 0;
						}else if(iLastPositionDrag.iX > aTouchEvent.VirtualLocation.iX) //move everything to the left
						{
							iScrollVariableRef += (iLastPositionDrag.iX - aTouchEvent.VirtualLocation.iX) * iScrollSpeedFactor;
							if(iScrollVariableRef > iMaxScroll)
								iScrollVariableRef = iMaxScroll;
						}
				 }

				 iLastPositionDrag = aTouchEvent.VirtualLocation;
			 }

			 break;
		 }
		 case ETouchEventHandlerTouchTypeUp:
		 {
			 if(iIdOfFinger == aTouchEvent.FingerId)
			 {
				 iTouched = false;
			 }

			 break;
		 }
	 }

	 return lHasBeenTouched;
}
开发者ID:DavidAStoll,项目名称:FighterPilotGameCode,代码行数:73,代码来源:CTouchSurface.cpp


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