- HICON the_icon;
- if (m_icon.Ok())
- the_icon = (HICON) m_icon.GetHICON();
- else
- the_icon = (HICON) m_defaultIcon;
-
- PAINTSTRUCT ps;
- // Hold a pointer to the dc so long as the OnPaint() message
- // is being processed
- HDC cdc = BeginPaint((HWND) GetHWND(), &ps);
-
- // Erase background before painting or we get white background
- this->MSWDefWindowProc(WM_ICONERASEBKGND,(WORD)(LONG) ps.hdc,0L);
-
- if (the_icon)
- {
- RECT rect;
- ::GetClientRect((HWND) GetHWND(), &rect);
- int icon_width = 32;
- int icon_height = 32;
- int icon_x = (int)((rect.right - icon_width)/2);
- int icon_y = (int)((rect.bottom - icon_height)/2);
- DrawIcon(cdc, icon_x, icon_y, the_icon);
- }
-
- EndPaint((HWND) GetHWND(), &ps);
- }
- else
- {
- wxPaintEvent event(m_windowId);
- event.m_eventObject = this;
- if (!GetEventHandler()->ProcessEvent(event))
- Default();
+ // FIXME all this is totally bogus - we need to do the same as wxPanel,
+ // but how to do it without duplicating the code?
+
+ // restore focus
+ wxWindow *child = node->GetData();
+
+ if ( !child->IsTopLevel()
+#if wxUSE_TOOLBAR
+ && !wxDynamicCast(child, wxToolBar)
+#endif // wxUSE_TOOLBAR
+#if wxUSE_STATUSBAR
+ && !wxDynamicCast(child, wxStatusBar)
+#endif // wxUSE_STATUSBAR
+ )
+ {
+ child->SetFocus();
+ return;
+ }