本文整理汇总了C++中CWindowGc::SetPenStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ CWindowGc::SetPenStyle方法的具体用法?C++ CWindowGc::SetPenStyle怎么用?C++ CWindowGc::SetPenStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWindowGc
的用法示例。
在下文中一共展示了CWindowGc::SetPenStyle方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawFramePart
EXPORT_C TBool AknsDrawUtils::DrawFramePart( MAknsSkinInstance* aInstance,
CWindowGc& aGc, const TRect& aRect, const TAknsItemID& aFrameID,
const TAknsFrameElementIndex aFrameElement )
{
if( !aInstance )
{
return EFalse;
}
CAknsImageTableItemData* data = static_cast<CAknsImageTableItemData*>(
aInstance->GetCachedItemData( aFrameID, EAknsITImageTable ) );
if( data && (data->NumberOfImages()==EAknsFrameElementsN) )
{
aGc.SetPenStyle(CGraphicsContext::ENullPen);
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
TBool retVal = CheckAndDrawCachedImage( aInstance, aGc, aRect,
data->ImageIID( aFrameElement ), KAknsDrawParamDefault );
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
return retVal;
}
return EFalse;
}
示例2: 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));
}
}
}
示例3:
/**
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 Blue and paints an ellipse on the control.\n
*/
void CConeBackgroundTestDrawer2::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
{
aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
aGc.SetPenStyle(CGraphicsContext::ENullPen);
aGc.SetBrushColor(TRgb(0x0000ff));
aGc.DrawEllipse(aRect);
}
示例4: 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);
}
}
}
示例5: 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));
}
}
示例6: 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();
}
示例7: 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 )
{
//.........这里部分代码省略.........
示例8: HandleDraw
EXPORT_C void AknPopupLayouts::HandleDraw(CEikonEnv* /*aEikEnv*/,
CWindowGc &aGc,
const TAknPopupWindowLayoutDef &aDef,
CEikListBox* aListBox,
CAknPopupHeadingPane* aHeading)
{
TRect windowRect = MenuRect(const_cast<TAknPopupWindowLayoutDef&>(aDef));
MAknsSkinInstance *skin = AknsUtils::SkinInstance();
MAknsControlContext *cc = AknsDrawUtils::ControlContext( aListBox );
TBool windowFrameDrawn = EFalse;
if (!cc) cc = aListBox->View()->ItemDrawer()->SkinBackgroundControlContext();
TRegionFix<5> dontDrawRegion;
TRegionFix<22> drawRegion;
if ( aListBox )
{
dontDrawRegion.AddRect( aListBox->Rect() );
// If there are scroll bars and they draw their own background, take
// them out of clipping region
CEikScrollBarFrame* scrollBarFrame = aListBox->ScrollBarFrame();
if (scrollBarFrame)
{
CEikScrollBar* hBar = scrollBarFrame->GetScrollBarHandle(
CEikScrollBar::EHorizontal);
CEikScrollBar* vBar = scrollBarFrame->GetScrollBarHandle(
CEikScrollBar::EVertical);
TBool drawHorizontal = ETrue;
TBool drawVertical = ETrue;
scrollBarFrame->DrawBackgroundState(drawHorizontal, drawVertical);
drawHorizontal = drawHorizontal && hBar && hBar->IsVisible();
drawVertical = drawVertical && vBar && vBar->IsVisible();
if (drawHorizontal)
{
TRect scrollBarRect(hBar->Rect());
if (hBar->OwnsWindow())
{
TPoint windowPos = aDef.iWindowRect.iTl;
TPoint scrollBarPos = hBar->PositionRelativeToScreen();
scrollBarRect.Move(scrollBarPos - windowPos);
}
dontDrawRegion.AddRect(scrollBarRect);
}
if (drawVertical)
{
TRect scrollBarRect(vBar->Rect());
if (vBar->OwnsWindow())
{
TPoint windowPos = aDef.iWindowRect.iTl;
TPoint scrollBarPos = vBar->PositionRelativeToScreen();
scrollBarRect.Move(scrollBarPos - windowPos);
}
dontDrawRegion.AddRect(scrollBarRect);
}
}
}
if ( aHeading )
{
dontDrawRegion.AddRect( aHeading->Rect() );
}
drawRegion.AddRect( windowRect );
drawRegion.SubRegion( dontDrawRegion );
if (cc)
{
const TAknsItemID *popupBgId = &KAknsIIDQsnBgPopupBackground;
TAknLayoutRect popupBgRect;
popupBgRect.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__background_slice__Line_1(windowRect));
AknsDrawUtils::DrawCachedImage(skin, aGc, popupBgRect.Rect(), *popupBgId);
const TAknsItemID *sliceId = &KAknsIIDQsnBgSlicePopup;
TAknLayoutRect sliceRect;
sliceRect.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__background_slice__Line_2());
AknsDrawUtils::DrawCachedImage(skin, aGc, sliceRect.Rect(), *sliceId);
TAknLayoutRect topLeft;
topLeft.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__frame_general__Line_2());
TAknLayoutRect bottomRight;
bottomRight.LayoutRect(windowRect, SkinLayout::Popup_windows_skin_placing__frame_general__Line_5());
TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr);
TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl);
aGc.SetPenStyle(CGraphicsContext::ENullPen);
const TAknsItemID *frameId = &KAknsIIDQsnFrPopup;
const TAknsItemID *frameCenterId = &KAknsIIDQsnFrPopupCenter;
aGc.SetClippingRegion( drawRegion );
windowFrameDrawn = AknsDrawUtils::DrawFrame(skin, aGc, outerRect, innerRect, *frameId, *frameCenterId);
aGc.CancelClippingRegion();
}
if (!windowFrameDrawn)
{
AknDraw::DrawWindowShadow(aGc, aDef.iCover, aDef.iSecond, aDef.iFirst, aDef.iOutline, aDef.iInside);
}
}