+ RECT rect;
+ if ( GetUpdateRect(GetHwnd(), &rect, FALSE) )
+ {
+ if ( m_iconized )
+ {
+ HICON hIcon = m_icon.Ok() ? GetIconHicon(m_icon)
+ : (HICON)m_defaultIcon;
+
+ // Hold a pointer to the dc so long as the OnPaint() message
+ // is being processed
+ PAINTSTRUCT ps;
+ HDC hdc = ::BeginPaint(GetHwnd(), &ps);
+
+ // Erase background before painting or we get white background
+ MSWDefWindowProc(WM_ICONERASEBKGND, (WORD)(LONG)ps.hdc, 0L);
+
+ if ( hIcon )
+ {
+ RECT rect;
+ ::GetClientRect(GetHwnd(), &rect);
+
+ // FIXME: why hardcoded?
+ static const int icon_width = 32;
+ static const int icon_height = 32;
+
+ int icon_x = (int)((rect.right - icon_width)/2);
+ int icon_y = (int)((rect.bottom - icon_height)/2);
+
+ ::DrawIcon(hdc, icon_x, icon_y, hIcon);
+ }
+
+ ::EndPaint(GetHwnd(), &ps);
+
+ return TRUE;
+ }
+ else
+ {
+ wxPaintEvent event(m_windowId);
+ event.m_eventObject = this;
+
+ return GetEventHandler()->ProcessEvent(event);
+ }
+ }
+ else
+ {
+ // nothing to paint - processed
+ return TRUE;
+ }