- bool stopTimer = false;
-
- wxWindow* popup = GetPopupControl()->GetControl();
- wxScreenDC dc;
- const wxRect& rect = m_animRect;
-
- // Popup was hidden before it was fully shown?
- if ( IsPopupWindowState(Hidden) )
- {
- stopTimer = true;
- }
- else
- {
- wxLongLong t = ::wxGetLocalTimeMillis();
-
- int pos = (int) (t-m_animStart).GetLo();
- if ( pos < CUSTOM_COMBOBOX_ANIMATION_DURATION )
- {
- //
- // Actual animation happens here
- //
- int width = rect.width;
- int height = rect.height;
-
- int center_x = rect.x + (width/2);
- int center_y = rect.y + (height/2);
-
- double d_height = (double) height;
-
- dc.SetPen( *wxBLACK_PEN );
- dc.SetBrush( *wxTRANSPARENT_BRUSH );
-
- int w = (((pos*256)/CUSTOM_COMBOBOX_ANIMATION_DURATION)*width)/256;
-
- double ratio = ((double)w / (double)width);
- int h = (int)(d_height * ratio);
- dc.DrawBitmap( m_animBackBitmap, rect.x, rect.y );
- dc.DrawRectangle( center_x - w/2, center_y - h/2, w, h );
- }
- else
- {
- stopTimer = true;
- }
- }
-
- if ( stopTimer )
- {
- dc.DrawBitmap( m_animBackBitmap, rect.x, rect.y );
- popup->Move( 0, 0 );
- m_animTimer.Stop();
- DoShowPopup( m_animRect, m_animFlags );
- }