本文整理汇总了C++中CWindowGc::DrawRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CWindowGc::DrawRect方法的具体用法?C++ CWindowGc::DrawRect怎么用?C++ CWindowGc::DrawRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWindowGc
的用法示例。
在下文中一共展示了CWindowGc::DrawRect方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoDraw
/**
Draw function for the CCtlBase class.\n
*/
void CCtlBase::DoDraw( CWindowGc& aGc, TRect aRect ) const
{
aGc.DrawRect( aRect ) ;
aRect.Shrink( 1, 1 ) ;
aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
aGc.DrawRect( aRect ) ;
WriteName( aGc, *iName ) ;
}
示例2: DrawVisualFeedback
/**
* Draws visual feedback for a menu item to indicate that it has been selected. This is shown for
* the brief interval between the item being selected and the menu being dismissed. Uses the
* environment aLafEnv for setting up the context aGc for the menu pane aMenuPane and draws inside
* the item rectangle aRect.
*
* @since App-Framework_6.1
*/
EXPORT_C void LafMenuPane::DrawVisualFeedback(const MLafEnv& /*aLafEnv*/, const CCoeControl& /*aMenuPane*/,
CWindowGc& aGc, const TRect& aRect)
{
aGc.SetPenColor(KRgbBlack);
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
aGc.DrawRect(aRect);
}
示例3: Draw
//Background drawing function
void CTestRectGc::Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const
{
if (iBmpBackground)
{
TPoint a = PositionRelativeToScreen();
TPoint b = aControl.PositionRelativeToScreen();
//The source rect of the background is the relationship between this control and the control being drawn (child)
//plus the subrect (aRect) to be drawn.
TRect SourceRect(b-a+aRect.iTl, aRect.Size());
aGc.SetDrawMode(CGraphicsContext::EDrawModePEN);
aGc.BitBlt(aRect.iTl, iBmpBackground, SourceRect);
aGc.SetDrawMode(CGraphicsContext::EDrawModePEN);
}
else
{
TRect rc;
aGc.SetClippingRect(aRect);
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
aGc.SetBrushColor(iBrushColor);
aGc.SetBrushStyle(iBrushStyle);
aGc.DrawRect(rc);
aGc.CancelClippingRect();
}
}
示例4:
/**
Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
Sets the brush style to Solid Brush and Pen Style to Null Pen.\n
Sets the brush colour to Red and paints the top left part of the control.\n
Sets the brush colour and points the bottom right part of the control.\n
*/
void CConeBackgroundTestDrawer1::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
{
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
aGc.SetPenStyle(CGraphicsContext::ENullPen);
TRect tlRect = aRect;
tlRect.iBr.iX = (tlRect.iBr.iX - tlRect.iTl.iX)/2 + tlRect.iTl.iX;
tlRect.iBr.iY = (tlRect.iBr.iY - tlRect.iTl.iY)/2 + tlRect.iTl.iY;
aGc.SetBrushColor(TRgb(0xff0000));
aGc.DrawRect(tlRect);
TRect brRect = tlRect;
brRect.Move(tlRect.Width(), tlRect.Height());
aGc.SetBrushColor(TRgb(0x00ff00));
aGc.DrawRect(brRect);
}
示例5: DrawTitlePaneJoint
/**
* 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));
}
}
}
示例6: DrawLeftAdornment
/**
* 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);
}
}
}
示例7: DrawRightAdornment
/**
* Draws the cascade symbol into the graphics context aGc, in the rectangle aRect and sets
* the pen color depending on whether the menu item is dimmed or focused.
*/
EXPORT_C void LafMenuPane::DrawRightAdornment(const MLafEnv& aLafEnv, const CCoeControl& /*aMenuPane*/, CWindowGc& aGc, const TRect& aRect, const TItemAttributes& aItemAttributes)
{
const TInt cascadeSize=Min(KLafRightAdornmentSpace,aItemAttributes.iHeight);
// Brush the background of the rect.
aGc.SetPenStyle(CGraphicsContext::ENullPen);
aGc.DrawRect(aRect);
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
if (aItemAttributes.iInternalFlags&EMenuIsRightAdornment)
{
//Sort out rect for cascade symbol
TRect cascadeRect=TRect(TPoint(aRect.iBr.iX-cascadeSize-PostRightAdornmentSpace(),aItemAttributes.iHPosition),
TSize(cascadeSize,aItemAttributes.iHeight));
cascadeRect.iTl.iY+=((aItemAttributes.iHeight-cascadeSize)/2);
cascadeRect.iBr.iY-=((aItemAttributes.iHeight-cascadeSize)/2);
TBuf<1> cascade;
cascade.Append(TChar(ESymFontMenuCascade));
aGc.UseFont(SymbolFont(aLafEnv));
aGc.DrawText(cascade,cascadeRect,cascadeRect.Height(),CGraphicsContext::ERight);
aGc.UseFont(NormalFont(aLafEnv));
}
}
示例8: MainL
void MainL()
{
RWsSession ws;
ws.Connect();
CWsScreenDevice* scr = new(ELeave) CWsScreenDevice(ws);
scr->Construct();
CWindowGc* gc = new(ELeave) CWindowGc(scr);
gc->Construct();
RWindowGroup grp(ws);
grp.Construct(0xc0decafe, ETrue);
RWindow win(ws);
win.Construct(grp, 0xbeefcafe);
win.SetExtent(TPoint(20,160), TSize(320,240));
win.Activate();
win.Invalidate();
win.BeginRedraw();
gc->Activate(win);
gc->SetPenStyle(CGraphicsContext::ENullPen);
gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
TBool color = EFalse;
if (Profiler::Start() == KErrNotFound)
{
_LIT(KProfiler,"profiler");
_LIT(KStart,"start -noui -drive=S");
RProcess p;
if (p.Create(KProfiler,KStart) == KErrNone)
{
p.Resume();
p.Close();
}
}
for (TInt col=0; col<KCol; ++col)
{
color = !color;
for (TInt row=0; row<KRow; ++row)
{
TRect rect;
rect.iTl.iX = col * KSize.iWidth;
rect.iTl.iY = row * KSize.iHeight;
rect.SetSize(KSize);
color = !color;
gc->SetBrushColor(color? KRgbBlue : KRgbBlack);
gc->DrawRect(rect);
}
}
gc->Deactivate();
win.EndRedraw();
ws.Flush();
User::After(3000000);
win.Close();
grp.Close();
delete gc;
delete scr;
ws.Close();
Profiler::Stop();
Profiler::Close();
Profiler::Unload();
}
示例9: DrawRectL
void CWelcomePageBase::DrawRectL(CWindowGc& aGc, const TRgb& aColor, const TJuikLayoutItem& aL) const
{
aGc.SetBrushColor( aColor );
aGc.DrawRect( aL.Rect() );
}
示例10: Draw
// -----------------------------------------------------------------------------
// TRectangle::Draw() const
// Virtual method that draws the shape to the specified graphics context.
// -----------------------------------------------------------------------------
//
EXPORT_C void TRectangle::Draw( CWindowGc& aActiveGraphicsContext ) const
{
aActiveGraphicsContext.DrawRect( GetRect() );
}
示例11: BackgroundBetweenRects
// -----------------------------------------------------------------------------
// AknsDrawUtils::BackgroundBetweenRects()
// (commented in the header).
// -----------------------------------------------------------------------------
//
EXPORT_C TBool AknsDrawUtils::BackgroundBetweenRects(
MAknsSkinInstance* aInstance, MAknsControlContext* aContext,
const CCoeControl* aControl, CWindowGc& aGc,
const TRect& aOuterRect,const TRect& aInnerRect, const TInt aDrawParam )
{
TInt drawParam = aDrawParam;
TInt originalParam = aDrawParam;
TBool retVal = EFalse;
TBool blitFailed = EFalse;
TBool blitAttempted = EFalse;
if ( !&aGc )
{
return retVal;
}
MAknsControlContext* parentContext = GetParentContext( aContext );
if( parentContext )
{
retVal = BackgroundBetweenRects( aInstance, parentContext, aControl, aGc,
aOuterRect, aInnerRect, aDrawParam );
drawParam |= KAknsDrawParamNoClearUnderImage;
}
else if( drawParam & KAknsDrawParamBottomLevelRGBOnly )
{
drawParam |= KAknsDrawParamRGBOnly;
}
originalParam = drawParam;
if( aContext )
{
aContext->UpdateContext();
}
TAknsBackground* bgLayout = RetrieveBackgroundLayout( aContext );
TAknsItemID imgIID( KAknsIIDNone );
CAknsImageItemData* imgData = RetrieveBackgroundImage(
aInstance, bgLayout, imgIID );
// chained background
if (imgData && imgData->ParentIID() != KAknsIIDNone)
{
TAknsItemID parentiid = imgData->ParentIID();
TRect parentDrawRect = imgData->DrawRect();
imgData = RetrieveKnownBackgroundImage(
aInstance, parentiid );
if (imgData)
{
imgData->SetDrawRect(parentDrawRect);
drawParam |= KAknsDrawParamChained ;
}
}
TPoint paDelta = GetParentAbsoluteDelta( bgLayout, aControl );
if (!(aDrawParam & KAknsDrawParamPrepareOnly))
{
aGc.SetPenStyle(CGraphicsContext::ENullPen);
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
}
TBool blit = EFalse;
//Rect for frame border
TRect rlist[4];
rlist[0] = aOuterRect;
rlist[0].iBr.iY=aInnerRect.iTl.iY;
rlist[1] = rlist[0];
rlist[1].iBr.iY=aOuterRect.iBr.iY;
rlist[1].iTl.iY=aInnerRect.iBr.iY;
rlist[2] = aInnerRect;
rlist[2].iTl.iX=aOuterRect.iTl.iX;
rlist[2].iBr.iX=aInnerRect.iTl.iX;
rlist[3] = rlist[2];
rlist[3].iTl.iX=aInnerRect.iBr.iX;
rlist[3].iBr.iX=aOuterRect.iBr.iX;
if( imgData )
{
blitAttempted = ETrue;
for ( TInt i=0; i <4 ; i++ )
{
if( (drawParam & KAknsDrawParamNoClearUnderImage) == 0 )
{
blit = BlitAndClear( aInstance, aGc, rlist[i],
imgData, imgIID, bgLayout, paDelta, drawParam );
}
else
{
blit = Blit( aInstance, aGc, rlist[i],
imgData, imgIID, bgLayout, paDelta, drawParam );
}
if ( !blit )
{
//.........这里部分代码省略.........