+// ----------------------------------------------------------------------------
+// wxComboCtrl with custom popup animation
+// ----------------------------------------------------------------------------
+
+class wxComboCtrlWithCustomPopupAnim : public wxComboCtrl
+{
+public:
+
+ virtual bool AnimateShow( const wxRect& rect, int WXUNUSED(flags) )
+ {
+ MyFrame* myFrame = (MyFrame*) ::wxGetTopLevelParent(this);
+
+ if ( !myFrame->m_cbUseAnim->GetValue() )
+ return true;
+
+ int width = rect.width;
+ int height = rect.height;
+ wxBitmap bitmap( width, height, -1 );
+ wxScreenDC dc;
+ wxMemoryDC memdc( bitmap );
+ memdc.Blit( 0, 0, width, height, &dc, rect.x, rect.y );
+ memdc.SelectObject(wxNullBitmap);
+
+ wxLongLong tStart = ::wxGetLocalTimeMillis();
+ const int delay = 300;
+ const int resolution = 10;
+
+ 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 );
+ for (;;)
+ {
+ wxLongLong t = ::wxGetLocalTimeMillis();
+ int pos = (int) (t-tStart).GetLo();
+ if ( pos > delay )
+ break;
+
+ int w = (((pos*256)/delay)*width)/256;
+
+ double ratio = ((double)w / (double)width);
+ int h = (int)(d_height * ratio);
+ dc.DrawRectangle( center_x - w/2, center_y - h/2, w, h );
+ wxMilliSleep( resolution );
+ wxYield();
+ dc.DrawBitmap( bitmap, rect.x, rect.y );
+
+ if ( IsPopupWindowState(Hidden) )
+ return true;
+ }
+
+ return true;
+ }
+
+protected:
+};
+