webengine/osswebengine/WebKit/s60/webview/WebPopupDrawer.cpp
changeset 5 10e98eab6f85
parent 0 dd21522fd290
child 48 79859ed3eea9
equal deleted inserted replaced
1:7c90e6132015 5:10e98eab6f85
    80     if (textToDraw.Length() == 0)
    80     if (textToDraw.Length() == 0)
    81     {
    81     {
    82         User::Leave(KErrArgument);
    82         User::Leave(KErrArgument);
    83     }
    83     }
    84     m_textToDraw = textToDraw.AllocL();
    84     m_textToDraw = textToDraw.AllocL();
       
    85     CleanupStack::PushL(m_textToDraw);
    85     m_removePopupPeriodic = CPeriodic::NewL( CActive::EPriorityLow );
    86     m_removePopupPeriodic = CPeriodic::NewL( CActive::EPriorityLow );
       
    87     CleanupStack::PushL(m_removePopupPeriodic);
    86     m_removePopupPeriodic->Start( KPopupTimeout, 0, TCallBack( &removePopupCallback, this ) );
    88     m_removePopupPeriodic->Start( KPopupTimeout, 0, TCallBack( &removePopupCallback, this ) );
    87     sizeChangedL();
    89     sizeChangedL();
    88     constructSprite();
    90     constructSprite();
       
    91     CleanupStack::Pop(2, m_textToDraw); //m_removePopupPeriodic, m_textToDraw
    89 }
    92 }
    90 
    93 
    91 // -----------------------------------------------------------------------------
    94 // -----------------------------------------------------------------------------
    92 // Destructor
    95 // Destructor
    93 // -----------------------------------------------------------------------------
    96 // -----------------------------------------------------------------------------
   103     delete m_wrappedArray;
   106     delete m_wrappedArray;
   104     m_sprite.Close();
   107     m_sprite.Close();
   105     delete m_spriteMaskBitmapDevice;
   108     delete m_spriteMaskBitmapDevice;
   106     delete m_spriteMaskBitmapContext;
   109     delete m_spriteMaskBitmapContext;
   107     delete m_spriteMaskBitmap;
   110     delete m_spriteMaskBitmap;
       
   111     delete m_icon;
       
   112     delete m_spriteBitmapDevice;
       
   113     delete m_spriteBitmapContext;
       
   114     delete m_spriteBitmap; 
   108 }
   115 }
   109 
   116 
   110 // -----------------------------------------------------------------------------
   117 // -----------------------------------------------------------------------------
   111 // WebPopupDrawer::drawPopup
   118 // WebPopupDrawer::drawPopup
   112 // Draw the popup.
   119 // Draw the popup.
   229     delete m_spriteBitmapContext;
   236     delete m_spriteBitmapContext;
   230     m_spriteBitmapContext = NULL;
   237     m_spriteBitmapContext = NULL;
   231     delete m_spriteBitmap;
   238     delete m_spriteBitmap;
   232     m_spriteBitmap = NULL;
   239     m_spriteBitmap = NULL;
   233     m_spriteBitmap = new (ELeave) CFbsBitmap;
   240     m_spriteBitmap = new (ELeave) CFbsBitmap;
       
   241     CleanupStack::PushL(m_spriteBitmap);
   234     User::LeaveIfError( m_spriteBitmap->Create( m_size, EColor16MA ) );
   242     User::LeaveIfError( m_spriteBitmap->Create( m_size, EColor16MA ) );
   235     m_spriteBitmapDevice = CFbsBitmapDevice::NewL( m_spriteBitmap );
   243     m_spriteBitmapDevice = CFbsBitmapDevice::NewL( m_spriteBitmap );
       
   244     CleanupStack::PushL(m_spriteBitmapDevice);
   236     User::LeaveIfError( m_spriteBitmapDevice->CreateContext( m_spriteBitmapContext ) );
   245     User::LeaveIfError( m_spriteBitmapDevice->CreateContext( m_spriteBitmapContext ) );
   237     //mask
   246     //mask
   238     delete m_spriteMaskBitmapDevice;
   247     delete m_spriteMaskBitmapDevice;
   239     m_spriteMaskBitmapDevice = NULL;
   248     m_spriteMaskBitmapDevice = NULL;
   240     delete m_spriteMaskBitmapContext;
   249     delete m_spriteMaskBitmapContext;
   241     m_spriteMaskBitmapContext = NULL;
   250     m_spriteMaskBitmapContext = NULL;
   242     delete m_spriteMaskBitmap;
   251     delete m_spriteMaskBitmap;
   243     m_spriteMaskBitmap = NULL;
   252     m_spriteMaskBitmap = NULL;
   244     m_spriteMaskBitmap = new (ELeave) CFbsBitmap;
   253     m_spriteMaskBitmap = new (ELeave) CFbsBitmap;
       
   254     CleanupStack::PushL(m_spriteMaskBitmap);
   245     User::LeaveIfError( m_spriteMaskBitmap->Create( m_size, EGray2 ) );
   255     User::LeaveIfError( m_spriteMaskBitmap->Create( m_size, EGray2 ) );
   246     m_spriteMaskBitmapDevice = CFbsBitmapDevice::NewL( m_spriteMaskBitmap );
   256     m_spriteMaskBitmapDevice = CFbsBitmapDevice::NewL( m_spriteMaskBitmap );
       
   257     CleanupStack::PushL(m_spriteMaskBitmapDevice);
   247     User::LeaveIfError( m_spriteMaskBitmapDevice->CreateContext( m_spriteMaskBitmapContext ) );
   258     User::LeaveIfError( m_spriteMaskBitmapDevice->CreateContext( m_spriteMaskBitmapContext ) );
   248     TRect r( TPoint( 0, 0 ), m_spriteMaskBitmap->SizeInPixels());
   259     TRect r( TPoint( 0, 0 ), m_spriteMaskBitmap->SizeInPixels());
   249     m_spriteMaskBitmapContext->SetBrushStyle( CGraphicsContext::ESolidBrush );
   260     m_spriteMaskBitmapContext->SetBrushStyle( CGraphicsContext::ESolidBrush );
   250     m_spriteMaskBitmapContext->SetPenStyle( CGraphicsContext::ESolidPen );
   261     m_spriteMaskBitmapContext->SetPenStyle( CGraphicsContext::ESolidPen );
   251     m_spriteMaskBitmapContext->SetBrushColor( TRgb( 0, 0, 0) );
   262     m_spriteMaskBitmapContext->SetBrushColor( TRgb( 0, 0, 0) );
   274                 m_spriteBitmapContext->DrawText( text, TPoint( x, y + rowHeight - m_font->DescentInPixels()) );
   285                 m_spriteBitmapContext->DrawText( text, TPoint( x, y + rowHeight - m_font->DescentInPixels()) );
   275             }
   286             }
   276         }
   287         }
   277         m_spriteBitmapContext->DiscardFont();
   288         m_spriteBitmapContext->DiscardFont();
   278     }
   289     }
       
   290     
       
   291     CleanupStack::Pop(4, m_spriteBitmap);
   279 }
   292 }
   280 
   293 
   281 void WebPopupDrawer::constructSprite()
   294 void WebPopupDrawer::constructSprite()
   282 {        
   295 {        
   283     m_sprite = RWsSprite(m_webView.brCtl()->CCoeControlParent()->ControlEnv()->WsSession());
   296     m_sprite = RWsSprite(m_webView.brCtl()->CCoeControlParent()->ControlEnv()->WsSession());