/** * 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); } } }
void Panel::paintCaptionButtons( UINT hitButton ) { CBrush brush; CPen pen; CWindowDC dc(this); if ( isActive_ ) { brush.CreateSolidBrush( GetSysColor(COLOR_ACTIVECAPTION) ); pen.CreatePen( PS_SOLID, 1, GetSysColor(COLOR_CAPTIONTEXT) ); } else { brush.CreateSolidBrush( GetSysColor(COLOR_BTNFACE) ); pen.CreatePen( PS_SOLID, 1, GetSysColor(COLOR_BTNTEXT) ); } // Draw background CRect rect; GetWindowRect(&rect); rect.right = rect.Width(); if ( activeTab_ && activeTab_->isClonable() ) rect.left = rect.right - CAPTION_HEIGHT*3; else rect.left = rect.right - CAPTION_HEIGHT*2; rect.top = 0; rect.bottom = rect.top + CAPTION_HEIGHT - 1; dc.FillRect(&rect,&brush); // Draw buttons CPen* oldPen = dc.SelectObject( &pen ); rect.top += CAPTION_TOPMARGIN; // Draw the "Close" button rect.left = rect.right - CAPTION_HEIGHT; CRect butRect( rect ); butRect.DeflateRect( 0, 0, 1, 1 ); if ( hitButton == BUT_CLOSE ) if ( buttonDown_ == hitButton ) dc.Draw3dRect( &butRect, GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT) ); else dc.Draw3dRect( &butRect, GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW) ); butRect.DeflateRect( 5, 4, 5, 5 ); dc.MoveTo( butRect.left, butRect.top ); dc.LineTo( butRect.right, butRect.bottom+1 ); dc.MoveTo( butRect.left, butRect.bottom ); dc.LineTo( butRect.right, butRect.top-1 ); // Draw the "Rollup" button rect.OffsetRect( -CAPTION_HEIGHT, 0 ); butRect = rect; butRect.DeflateRect( 0, 0, 1, 1 ); if ( hitButton == BUT_ROLLUP ) if ( buttonDown_ == hitButton ) dc.Draw3dRect( &butRect, GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT) ); else dc.Draw3dRect( &butRect, GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW) ); butRect.DeflateRect( 5, 4, 5, 5 ); if ( isExpanded_ ) { dc.MoveTo( ( butRect.left + butRect.right ) /2, butRect.top ); dc.LineTo( butRect.left, butRect.bottom ); dc.MoveTo( ( butRect.left + butRect.right ) /2, butRect.top ); dc.LineTo( butRect.right, butRect.bottom ); dc.MoveTo( butRect.left, butRect.bottom ); dc.LineTo( butRect.right, butRect.bottom ); } else { dc.MoveTo( ( butRect.left + butRect.right ) /2, butRect.bottom ); dc.LineTo( butRect.left, butRect.top ); dc.MoveTo( ( butRect.left + butRect.right ) /2, butRect.bottom ); dc.LineTo( butRect.right, butRect.top ); dc.MoveTo( butRect.left, butRect.top ); dc.LineTo( butRect.right, butRect.top ); } // Draw the "Clone" button if ( activeTab_ && activeTab_->isClonable() ) { rect.OffsetRect( -CAPTION_HEIGHT, 0 ); butRect = rect; butRect.DeflateRect( 0, 0, 1, 1 ); if ( hitButton == BUT_CLONE ) if ( buttonDown_ == hitButton ) dc.Draw3dRect( &butRect, ::GetSysColor(COLOR_BTNSHADOW), ::GetSysColor(COLOR_BTNHIGHLIGHT) ); else dc.Draw3dRect( &butRect, ::GetSysColor(COLOR_BTNHIGHLIGHT), ::GetSysColor(COLOR_BTNSHADOW) ); butRect.DeflateRect( 5, 4, 5, 5 ); dc.MoveTo( butRect.left, ( butRect.top + butRect.bottom ) / 2 ); dc.LineTo( butRect.right, ( butRect.top + butRect.bottom ) / 2 ); dc.MoveTo( ( butRect.left + butRect.right ) /2, butRect.bottom ); dc.LineTo( ( butRect.left + butRect.right ) /2, butRect.top -1 ); } // Restore old DC objects dc.SelectObject( oldPen ); }