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


C++ TRect类代码示例

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


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

示例1: InitLayout

void CSelectGroup::InitLayout(TRect aRect)
{
    iRect=aRect;
    iStartPoint=aRect.iTl;

    iLineWidth = aRect.Width();

    iLineHeight=iMainEngine.ScreenLayout().FontHeight();

    iLineHeight+=iLineHeight>>1;

    iItemSize.iHeight=iLineHeight;
    iItemSize.iWidth=iLineWidth;

    iMaxLinePerPage = iMainEngine.ScreenLayout().GetClientRect().Height()/iLineHeight-1;
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:16,代码来源:SelectGroup.cpp

示例2: initialPos

void TCacheResource::addRef2(const TRect &rect)
{
	//DIAGNOSTICS_NUMBEREDSTRSET(prefix + QString::number((UINT) this) + " | Stack | ",
	//"crStack", "addRef", ::traduce(rect));

	//Add a reference to all cells intersecting the passed one
	TPoint initialPos(getCellPos(rect.getP00()));
	TPoint pos;
	for (pos.x = initialPos.x; pos.x <= rect.x1; pos.x += latticeStep)
		for (pos.y = initialPos.y; pos.y <= rect.y1; pos.y += latticeStep) {
			PointLess cellIndex(getCellIndex(pos));
			CellData &cellData = m_cellDatas[cellIndex];
			cellData.m_referenced = true;
			cellData.m_refsCount++;
		}
}
开发者ID:GREYFOXRGR,项目名称:opentoonz,代码行数:16,代码来源:tcacheresource.cpp

示例3: TRect

/** If the display mode of iBitmapInfo is not expected, return EFalse
 * or render to the back buffer and returns ETrue
*/
TBool CCommonInterfaces::DrawColor(const TRect& aRect,const TRgb& aColour)
	{
	TRect local = TRect(aRect.iTl-iRect.iTl, aRect.Size());
	TUint16* pBuffer16;
	TUint32* pBuffer32;

	if (iBitmapInfo.iDisplayMode != iDispMode)
		{
		return EFalse;
		}
	for (TInt y = local.iTl.iY; y < local.iBr.iY; y++)
		{
		for (TInt x = local.iTl.iX; x < local.iBr.iX; x++)
			{
			switch (iDispMode)
				{
				case EColor64K:
					pBuffer16 = (TUint16*)iBitmapInfo.iAddress;
					pBuffer16[y*iBitmapInfo.iLinePitch/2+x] = aColour._Color64K();
					break;
				case EColor16M:
					pBuffer16 = (TUint16*)iBitmapInfo.iAddress;
					pBuffer16[y*iBitmapInfo.iLinePitch/2+x] = aColour._Color64K();
					break;
				case EColor16MU:
					pBuffer32 = (TUint32*)iBitmapInfo.iAddress;
					pBuffer32[y*iBitmapInfo.iLinePitch/4+x] = aColour._Color16MU();
					break;
				case EColor16MA:
					pBuffer32 = (TUint32*)iBitmapInfo.iAddress;
					pBuffer32[y*iBitmapInfo.iLinePitch/4+x] = aColour._Color16MA();
					break;
				case EColor4K:
					pBuffer16 = (TUint16*)iBitmapInfo.iAddress;
					pBuffer16[y*iBitmapInfo.iLinePitch/2+x] = aColour._Color4K();
					break;
				case EColor16MAP:
					pBuffer32 = (TUint32*)iBitmapInfo.iAddress;
					pBuffer32[y*iBitmapInfo.iLinePitch/4+x] = aColour._Color16MAP();
					break;
				default:
					break;
				}
			}
		}
	return ETrue;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:50,代码来源:TDirectScreenBitmap.cpp

示例4: primaryFontTotalHeight

void CTcContainer::CreateLabelsL( const TRect& aRect )
{
    // Create labels
    CEikLabel* label;

    TInt primaryFontTotalHeight( FontTotalHeightInPixels( EAknLogicalFontPrimaryFont ) );
    TInt secondaryFontTotalHeight( FontTotalHeightInPixels( EAknLogicalFontSecondaryFont ) );

    TInt labelBase = KLabelTlY + primaryFontTotalHeight;
    AknLayoutUtils::SAknLayoutTextMultiline labelLayout =
        GetLabelLayout( aRect, labelBase, EAknLogicalFontPrimaryFont );
    TRect rect( KLabelTlX, KLabelTlY,
                aRect.Width() - KLabelTlX, KLabelTlY + primaryFontTotalHeight );

    label = CreateLabelL( rect, KTestCase );
    AknLayoutUtils::LayoutLabel( label, rect, labelLayout );

    rect.Move( 0, secondaryFontTotalHeight );
    labelBase += secondaryFontTotalHeight;
    labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontSecondaryFont );
    label = CreateLabelL( rect, KNone );
    AknLayoutUtils::LayoutLabel( label, rect, labelLayout );

    rect.Move( 0, primaryFontTotalHeight );
    labelBase += primaryFontTotalHeight;
    labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontPrimaryFont );
    label = CreateLabelL( rect, KRequest );
    AknLayoutUtils::LayoutLabel( label, rect, labelLayout );
    rect.Move( 0, secondaryFontTotalHeight );
    labelBase += secondaryFontTotalHeight;
    labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontSecondaryFont );
    label = CreateLabelL( rect, KNone );
    AknLayoutUtils::LayoutLabel( label, rect, labelLayout );


    rect.Move( 0, primaryFontTotalHeight );
    labelBase += primaryFontTotalHeight;
    labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontPrimaryFont );
    label = CreateLabelL( rect, KStatus );
    AknLayoutUtils::LayoutLabel( label, rect, labelLayout );
    rect.Move( 0, secondaryFontTotalHeight );
    labelBase += secondaryFontTotalHeight;
    labelLayout = GetLabelLayout( aRect, labelBase, EAknLogicalFontSecondaryFont );
    label = CreateLabelL( rect, KNone );
    AknLayoutUtils::LayoutLabel( label, rect, labelLayout );
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:46,代码来源:CTcContainer.cpp

示例5: if

/// Move and resize the window so that the window is the same size as the hyperlink
/// text. This stops the hyperlink cursor being active when it is not directly over
/// the text. If the text is left justified then the window is merely shrunk, but if
/// it is centred or right justified then the window will have to be moved as well.
//
// Suggested by Pål K. Tønder
void
TUrlLink::PositionWindow()
{
  // Get the current window position
  TRect rect;
  GetWindowRect(rect);

  TWindow* pParent = GetParentO();
  if(pParent){
    pParent->ScreenToClient(rect.TopLeft());
    pParent->ScreenToClient(rect.BottomRight());
  }

  // Get the size of the window text
  TTmpBuffer<tchar> buffer(MAX_PATH);
  GetText(buffer, MAX_PATH);

  TSize size = LinkFont->GetTextExtent(&buffer[0]);

  // Get the text justification via the window style
  uint32 style = GetStyle(); //TWindow

  // Recalc the window size and position based on the text justification
  if (style & SS_CENTERIMAGE)
    rect.Inflate(0, -(rect.Height() - size.cy)/2);
  else
    rect.bottom = rect.top + size.cy;

   if (style & SS_CENTER)
    rect.Inflate( -(rect.Width() - size.cx)/2, 0);
  else if (style & SS_RIGHT)
    rect.left  = rect.right - size.cx;
  else // SS_LEFT = 0, so we can't test for it explicitly
    rect.right = rect.left + size.cx;

  // Move the window
  SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER);
}
开发者ID:Meridian59,项目名称:Meridian59,代码行数:44,代码来源:urllink.cpp

示例6: vgGetfv

void CHuiVg10CanvasGc::DoClearRenderBuffer( CHuiCanvasRenderBuffer& aImage, const TRect & aRect )
    {
    HUIFX_VG_INVARIANT();   
    const CHuiVg10CanvasRenderBuffer* vg10RenderBuffer = (const CHuiVg10CanvasRenderBuffer*) &aImage;    

    const TInt COLOR_COMPONENTS = 4;
    VGfloat savedColor[COLOR_COMPONENTS];
    vgGetfv(VG_CLEAR_COLOR, COLOR_COMPONENTS, savedColor);
    
    VGfloat color[COLOR_COMPONENTS] = 
                {
                 0.0f, 0.0f, 0.0f, 0.0f
                };
    vgSetfv(VG_CLEAR_COLOR, COLOR_COMPONENTS, color);
    vgClearImage(vg10RenderBuffer->Image(), aRect.iTl.iX, aRect.iTl.iY, aRect.Size().iWidth, aRect.Size().iHeight);
    vgSetfv(VG_CLEAR_COLOR, COLOR_COMPONENTS, savedColor);
    HUIFX_VG_INVARIANT();   
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:18,代码来源:huivg10canvasgc.cpp

示例7: YPosToLine

TInt CEikCapCArray::YPosToLine(const TRect &aRect,
                               TInt aTop, TInt aMiddle, TInt aBottom,
                               TInt aYCoord)
{
    TInt top = aTop;
    TInt middle = aMiddle;
    TInt bottom = aBottom;
    CalcItemIndexes(top, middle, bottom, aRect.Size());

    for(int i = top ; i < top+middle; i++)
    {
        CEikCaptionedControl *fst = (*this)[i];
        if (aYCoord < fst->Rect().iTl.iY)
        {
            if (i > 0)
                return i-1;
            else
                return KErrNotFound;
        }
    }
    if (Count() == 0) return -1;
    TInt ii = top+middle-1;
    CEikCaptionedControl *last = (*this)[ii];
    if ( aYCoord < last->Rect().iBr.iY )
    {
        return ii;
    }
    else
    {
        if ( ii+1 < Count() )
        {
            return ii+1;
        }
        else if ( aYCoord > last->Rect().iBr.iY )
        {
            return KErrNotFound;
        }
        else
        {
            return ii;
        }
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:43,代码来源:EIKCAPCA.CPP

示例8: fillautoInks

//-----------------------------------------------------------------------------
// questa funzione viene chiamata dopo il fill rect delle aree, e colora gli
// inchiostri di tipo "autoink"
// che confinano con le aree appena fillate con il rect. rbefore e' il rect del
// raster prima del rectfill.
void fillautoInks(TRasterCM32P &rin, TRect &rect, const TRasterCM32P &rbefore,
                  TPalette *plt) {
  assert(plt);
  TRasterCM32P r = rin->extract(rect);
  assert(r->getSize() == rbefore->getSize());
  int i, j;

  for (i = 0; i < r->getLy(); i++) {
    TPixelCM32 *pix  = r->pixels(i);
    TPixelCM32 *pixb = rbefore->pixels(i);
    for (j = 0; j < r->getLx(); j++, pix++, pixb++) {
      int paint = pix->getPaint();
      int tone  = pix->getTone();
      int ink   = pix->getInk();
      if (paint != pixb->getPaint() && tone > 0 && tone < 255 && ink != paint &&
          plt->getStyle(ink)->getFlags() != 0)
        inkFill(rin, TPoint(j, i) + rect.getP00(), paint, 0, NULL, &rect);
    }
  }
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:25,代码来源:fillutil.cpp

示例9: Draw

void CFontSizeTestControl::Draw(const TRect& aRect) const
	{
	CWindowGc& gc = SystemGc();
	gc.SetBrushColor(iBackgroundColor);
	
	// get the nearest font matching the desired height
	CFont* font = NULL;
	TFontSpec fontSpec;
	fontSpec.iTypeface.iName = KNokiaSeries60Font;
	fontSpec.iHeight = iFontSize;
	
	CWsScreenDevice* screen = CCoeEnv::Static()->ScreenDevice();
	ASSERT(screen->GetNearestFontToDesignHeightInPixels(font, fontSpec) == KErrNone);
	
	iBidiText->WrapText(aRect.Width() - ESideBearingsAllowance, *font, NULL, EMaximumTextLines);
	
	// it's recommended to create the text drawer in the actual draw function
    XCoeTextDrawer textDrawer(TextDrawer());
    textDrawer->SetMargins(iMargin);
    textDrawer->SetAlignment(TGulAlignment(EHCenterVCenter));
    textDrawer->SetTextColor(KRgbBlack);
    textDrawer->SetLineGapInPixels(EGapBetweenTextLines);
    textDrawer.SetClipRect(aRect);
    textDrawer.DrawText(gc, *iBidiText, aRect, *font);
    
    // Release font, otherwise there are problems deleting iScreen (still holds references)
    screen->ReleaseFont(font);
    	
	// Draw font 1 pixel larger or smaller next time.
	if (iIncreaseFontSize)
	    {
	    ++iFontSize;
	    }
	else
	    {
	    if (iFontSize > 1)
	        {
	        --iFontSize;
	        }
	    }
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:41,代码来源:tfontmultiplesizes.cpp

示例10: if

/**
 * Draws the left adornment to the graphics context aGc, in the rectangle aRect. The menu pane
 * flags determines the type of adornment to be drawn.
 */
EXPORT_C void LafMenuPane::DrawLeftAdornment(const MLafEnv& aLafEnv, const CCoeControl& /*aMenuPane*/, CWindowGc& aGc, const TRect& aRect, const TItemAttributes& aItemAttributes)
	{
// Brush the background of the rect.
	aGc.SetPenStyle(CGraphicsContext::ENullPen);
	aGc.DrawRect(aRect);
	aGc.SetPenStyle(CGraphicsContext::ESolidPen);
	const TInt itemFlags = aItemAttributes.iFlags;
	if (itemFlags&EEikMenuItemSymbolOn)
		{
		if (itemFlags&EEikMenuItemCheckBox)
			{
			TRect rect = aRect;
			rect.iTl.iY += aItemAttributes.iBaseLine;
			TBuf<1> buf;
			buf.Append(TChar(ESymFontTick));
			aGc.UseFont(SymbolFont(aLafEnv));
			aGc.SetPenStyle(CGraphicsContext::ESolidPen);
			// as the tick is big, ignore KPreLeftAdornment and steal 1 pixels from left.
			aGc.DrawText(buf,TPoint(rect.iTl.iX-1, rect.iTl.iY));
			aGc.UseFont(NormalFont(aLafEnv));
			}
		else if (itemFlags&KLafMenuItemRadio)
			{
			TUid bmpUid(TUid::Uid(KLafUidEikonOptiVal));
			const CFbsBitmap* bitmap = aLafEnv.Bitmap(bmpUid);
			TSize bitsize = bitmap->SizeInPixels();
			TRect butRect(TPoint(0,0), TPoint(bitsize.iWidth,bitsize.iHeight));
			TInt yoffset = (aRect.Size().iHeight - bitsize.iHeight) / 2;
			TInt xoffset = KLafPreLeftAdornmentSpace;
			TPoint offset(xoffset,yoffset);
			if (aItemAttributes.iHighlightType == SLafMenuPane::EDrawHighlight)
				{
				bmpUid=TUid::Uid(KLafUidEikonOptihVal);
				bitmap = aLafEnv.Bitmap(bmpUid);
				}
			bmpUid=TUid::Uid(KLafUidEikonOptimVal);
			const CFbsBitmap* mask = aLafEnv.Bitmap(bmpUid);
			aGc.BitBltMasked((aRect.iTl+offset), bitmap, butRect, mask,ETrue);
			}
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:45,代码来源:LAFMENUP.CPP

示例11: DrawText

EXPORT_C void DrawUtils::DrawText(CGraphicsContext& aGc,const TDesC& aString,const TRect& aBox,TInt aBaseLineOffset,
									 CGraphicsContext::TTextAlign aHoriz,TInt aMargin,const CFont* aFont)
/** Draws text inside a rectangle. 

@param aGc The graphics context.
@param aString The text string to draw. 
@param aBox The rectangle to draw the text in. 
@param aBaseLineOffset An offset from the top of the box to the text baseline. 
@param aHoriz The horizontal text alignment.
@param aMargin The margin around the text.
@param aFont The font to use. */
	{ // static
	if (aHoriz!=CGraphicsContext::ELeft)
        {
		const TInt extraWidth=aBox.Width()-aFont->TextWidthInPixels(aString)-aMargin;
        if (aHoriz==CGraphicsContext::ECenter)
            aMargin+=extraWidth/2;
		else
			aMargin=extraWidth;
        }
	aGc.DrawText(aString,aBox,aBaseLineOffset,CGraphicsContext::ELeft,aMargin);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:22,代码来源:GULUTIL.CPP

示例12: IsValidDestination

// ---------------------------------------------------------------------------
// CFepUiLayoutRootCtrl::IsValidDestination
// Test whether the rect conflicts with other controls
// (other items were commented in a header).
// ---------------------------------------------------------------------------
//    
TBool CFepUiLayoutRootCtrl::IsValidDestination(const TRect& aRect,
                                               CDragBar* aDragBar,
                                               TBool& aVInfo,
                                               TBool& aHInfo)
    {    
    aVInfo = EFalse;
    aHInfo = EFalse;
    if(!Rect().Contains(aRect.iTl) || !Rect().Contains(aRect.iBr)) //outside of the ui layout
        return EFalse;   
     
    CFepUiBaseCtrl* ctrl;

    for(TInt i = iCtrlList.Count()-1; i >= 0;i--)
        {
        ctrl = iCtrlList[i];            
        TBool bIsDragingComponent = EFalse;
        if(aDragBar)
            {
            if(aDragBar->IsDraggingComponent(ctrl))
                bIsDragingComponent = ETrue;
            }
  
        
        if(!bIsDragingComponent && aRect.Intersects(ctrl->Rect()))   //conflicts with others
            {
            //is the control one of the dragbar component.
           
            if(!ctrl->AllowOverlap()) 
                {                    
                //if the control not allow overlapping, then it's invalid pos
                return EFalse;
                }
                
            }
        }
    
    return ETrue;
}    
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:44,代码来源:peninputlayoutrootctrl.cpp

示例13: get_image

void TChain::get_image(cv::Mat& mat, const TRect& grid, unsigned int dim1, unsigned int dim2,
                       bool norm, double sigma1, double sigma2, double nsigma) const {
	assert((dim1 >= 0) && (dim1 < N) && (dim2 >= 0) && (dim2 < N) && (dim1 != dim2));
	
	mat = cv::Mat::zeros(grid.N_bins[0], grid.N_bins[1], CV_64F);
	
	//std::cout << grid.N_bins[0] << " " << grid.N_bins[1] << std::endl;
	
	unsigned int i1, i2;
	for(size_t i=0; i<length; i++) {
		if(grid.get_index(x[N*i+dim1], x[N*i+dim2], i1, i2)) {
			mat.at<double>(i1, i2) += w[i];
			//std::cerr << mat.at<double>(i1, i2) << std::endl;
		}
	}
	
	if(norm) { mat /= total_weight; }
	
	if((sigma1 >= 0.) && (sigma2 >= 0.)) {
		double s1 = sigma1 / grid.dx[0];
		double s2 = sigma2 / grid.dx[1];
		
		//std::cout << std::endl;
		//std::cout << dim1 << " " << dim2 << std::endl;
		//std::cout << "dx = " << sigma1 << " / " << grid.dx[0] << " = " << s1 << std::endl;
		//std::cout << "dy = " << sigma2 << " / " << grid.dx[1] << " = " << s2 << std::endl;
		//std::cout << std::endl;
		
		int w1 = 2 * ceil(nsigma*s1) + 1;
		int w2 = 2 * ceil(nsigma*s2) + 1;
		
		cv::GaussianBlur(mat, mat, cv::Size(w2,w1), s2, s1, cv::BORDER_REPLICATE);
	}
	
	// Convert to float
	mat.convertTo(mat, CV_32F);
}
开发者ID:gregreen,项目名称:bayestar,代码行数:37,代码来源:chain.cpp

示例14: CreateWindowL

// -----------------------------------------------------------------------------
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CPixelMetricsMapperViewContainer::ConstructL( const TRect& aRect )
    {
    CreateWindowL();
    SetCanDrawOutsideRect();

    iTexts = new( ELeave ) CDesCArrayFlat( 10 );
    iTexts->AppendL( _L( "\tStarted." ) );

    iListbox = new( ELeave ) CAknSingleStyleListBox;
    iListbox->SetContainerWindowL( *this );
    iListbox->ConstructL( this, EAknListBoxViewerFlags  );

    iListbox->Model()->SetItemTextArray( iTexts );
    iListbox->SetRect( TRect( aRect.Size() ) );

    iListbox->CreateScrollBarFrameL( ETrue );
    iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(
        CEikScrollBarFrame::EOn,
        CEikScrollBarFrame::EOn );

    SetRect( aRect );
    iListbox->ActivateL();
    ActivateL();
    }
开发者ID:mpvader,项目名称:qt,代码行数:28,代码来源:pm_mapperview.cpp

示例15: CreateWindowL

// ---------------------------------------------------------------------------
// CAppMngr2ListContainer::ConstructL()
// ---------------------------------------------------------------------------
//
void CAppMngr2ListContainer::ConstructL( const TRect& aRect )
    {
    CreateWindowL();
    SetRect( aRect );
    iListBox = new (ELeave) CAknDoubleLargeStyleListBox;
    iListBox->SetContainerWindowL( *this );
    iListBox->ConstructL( this, EAknListBoxSelectionList );
    iListBox->SetListBoxObserver( this );
    
    // Dont display default "(no data)" empty text
    iListBox->View()->SetListEmptyTextL( KNullDesC );

    LoadIconsL();
    CreateItemArrayL();
    PopulateItemArrayL();
    
    iListBox->CreateScrollBarFrameL();
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
            CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
    iListBox->SetRect( aRect.Size() );
    
    // Enable marquee effect
    iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:28,代码来源:appmngr2listcontainer.cpp


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