- if ( destBmp != 0 ) return;
-
- // render lables on-demand
-
- wxMemoryDC srcDc;
- srcDc.SelectObject( *srcBmp );
-
- bool hasText = ( mTextAlignment != NB_NO_TEXT ) &&
- ( mLabelText.length() != 0 );
-
- bool hasImage = (mTextAlignment != NB_NO_IMAGE);
-
- wxSize destDim;
- wxPoint txtPos;
- wxPoint imgPos;
-
- if ( hasText )
- {
- long txtWidth, txtHeight;
-
- srcDc.SetFont( wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT) );
- srcDc.GetTextExtent( mLabelText, &txtWidth, &txtHeight );
-
- if ( mTextAlignment == NB_ALIGN_TEXT_RIGHT )
- {
- destDim.x = srcBmp->GetWidth() + 2*mTextToLabelGap + txtWidth;
-
- destDim.y =
- wxMax( srcBmp->GetHeight(), txtHeight );
-
- txtPos.x = srcBmp->GetWidth() + mTextToLabelGap;
- txtPos.y = (destDim.y - txtHeight)/2;
- imgPos.x = 0;
- imgPos.y = (destDim.y - srcBmp->GetHeight())/2;
- }
- else
- if ( mTextAlignment == NB_ALIGN_TEXT_BOTTOM )
- {
- destDim.x =
- wxMax( srcBmp->GetWidth(), txtWidth );
-
- destDim.y = srcBmp->GetHeight() + mTextToLabelGap + txtHeight;
-
- txtPos.x = (destDim.x - txtWidth)/2;
- txtPos.y = srcBmp->GetHeight() + mTextToLabelGap;
- imgPos.x = (destDim.x - srcBmp->GetWidth())/2;
- imgPos.y = 0;
- }
- else
- {
- int avoidCompilerWarning = 0;
- wxASSERT(avoidCompilerWarning);// unsupported alignment type
- }
- }
- else
- {
- imgPos.x = 0;
- imgPos.y = 0;
- destDim.x = srcBmp->GetWidth();
- destDim.y = srcBmp->GetHeight();
- }
-
- destBmp = new wxBitmap( int(destDim.x), int(destDim.y) );
-
- wxMemoryDC destDc;
- destDc.SelectObject( *destBmp );
-
- wxBrush grayBrush( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_3DFACE), wxSOLID );
- wxPen nullPen( wxColour(0,0,0), 1, wxTRANSPARENT );
-
- destDc.SetBrush( grayBrush );
- destDc.SetPen( nullPen );
-
- destDc.DrawRectangle( 0,0, destDim.x+1, destDim.y+1 );
-
- if ( isPressed )
- {
- ++imgPos.x; ++imgPos.y;
- ++txtPos.x; ++txtPos.y;
- }
-
- if ( hasImage )
- {
-
- destDc.Blit( imgPos.x, imgPos.y,
- srcBmp->GetWidth()+1,
- srcBmp->GetHeight()+1,
- &srcDc, 0,0, wxCOPY,TRUE );
- }
-
- if ( hasText )
- {
- wxWindow* pTopWnd = this;
-
- do
- {
- wxWindow* pParent = pTopWnd->GetParent();
-
- if ( pParent == 0 )
- break;