void DockCamera::MouseMove( const os::Point& cNewPos, int nCode, uint32 nButtons, os::Message* pcData ) { if (nCode == MOUSE_INSIDE) { if (m_bHover) { Bitmap* pcBitmap = m_pcIcon->LockBitmap(); m_bHover = false; if( pcPaint == NULL ) { pcPaint = new BitmapImage(pcBitmap->LockRaster(),IPoint((int)m_pcIcon->GetSize().x,(int)m_pcIcon->GetSize().y),pcBitmap->GetColorSpace());; pcPaint->ApplyFilter(BitmapImage::F_HIGHLIGHT); pcBitmap->UnlockRaster(); pcPaint->UnlockBitmap(); } Invalidate(GetBounds()); Flush(); } } else { m_bHover = true; Invalidate(GetBounds()); Flush(); } if( nCode != MOUSE_ENTERED && nCode != MOUSE_EXITED ) { /* Create dragging operation */ if( m_bCanDrag ) { BitmapImage* pcIcon = m_pcIcon; m_bDragging = true; os::Message* pcMsg = new os::Message(); BeginDrag( pcMsg, os::Point( pcIcon->GetBounds().Width() / 2, pcIcon->GetBounds().Height() / 2 ),pcIcon->LockBitmap() ); delete( pcMsg ); m_bCanDrag = false; Paint(GetBounds()); } } os::View::MouseMove( cNewPos, nCode, nButtons, pcData ); }
void Icon::Paint( const Rect &cUpdateRect ) { EraseRect( cUpdateRect ); if( m_bSelected ) { Rect cUpdateFrame = GetBounds(); cUpdateFrame.top += 2; cUpdateFrame.left += 2; /* XXXKV: This is a hack; why is the height from GetBounds() so large? */ cUpdateFrame.right = m_cSize.x - 2; cUpdateFrame.bottom = m_cSize.y - 2; FillRect( cUpdateFrame, m_sHighlightColor ); /* Round edges */ SetDrawingMode( DM_COPY ); SetFgColor( m_sHighlightColor ); DrawLine( os::Point( cUpdateFrame.left + 2, cUpdateFrame.top - 2 ), os::Point( cUpdateFrame.right - 2, cUpdateFrame.top - 2 ) ); DrawLine( os::Point( cUpdateFrame.left, cUpdateFrame.top - 1 ), os::Point( cUpdateFrame.right, cUpdateFrame.top - 1 ) ); DrawLine( os::Point( cUpdateFrame.left - 2, cUpdateFrame.top + 2 ), os::Point( cUpdateFrame.left - 2, cUpdateFrame.bottom - 2 ) ); DrawLine( os::Point( cUpdateFrame.left - 1, cUpdateFrame.top ), os::Point( cUpdateFrame.left - 1, cUpdateFrame.bottom ) ); DrawLine( os::Point( cUpdateFrame.left + 2, cUpdateFrame.bottom + 2 ), os::Point( cUpdateFrame.right - 2, cUpdateFrame.bottom + 2 ) ); DrawLine( os::Point( cUpdateFrame.left, cUpdateFrame.bottom + 1 ), os::Point( cUpdateFrame.right, cUpdateFrame.bottom + 1 ) ); DrawLine( os::Point( cUpdateFrame.right + 2, cUpdateFrame.top + 2 ), os::Point( cUpdateFrame.right + 2, cUpdateFrame.bottom - 2 ) ); DrawLine( os::Point( cUpdateFrame.right + 1, cUpdateFrame.top ), os::Point( cUpdateFrame.right + 1, cUpdateFrame.bottom ) ); SetFgColor( m_sFgColor ); } SetDrawingMode( DM_BLEND ); /* XXXKV: Will only work with BitmapImage; should use RTTI to find type and handle accordingly */ BitmapImage *pcImage = static_cast<BitmapImage*>( m_pcImage ); Bitmap *pcBitmap = pcImage->LockBitmap(); DrawBitmap( pcBitmap, pcImage->GetBounds(), m_cImageFrame ); pcImage->UnlockBitmap(); /* Draw the icon name */ SetDrawingMode( DM_OVER ); MovePenTo( m_cNamePos ); DrawString( m_cName ); }