+ const wxColour& colFor = GetForegroundColour();
+ ::SetTextColor(hdc, RGB(colFor.Red(), colFor.Green(), colFor.Blue()));
+
+ ::SetBkMode(hdc, OPAQUE);
+
+ wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(colBack,
+ wxSOLID);
+ backgroundBrush->RealizeResource();
+ return (WXHBRUSH)backgroundBrush->GetResourceHandle();
+}
+
+long wxButton::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+{
+ // make sure that we won't have BS_DEFPUSHBUTTON style any more if the
+ // focus is being transfered to another button with the same parent -
+ // otherwise, we could finish with 2 default buttons inside one panel
+ if ( (nMsg == WM_KILLFOCUS) &&
+ (GetWindowLong(GetHwnd(), GWL_STYLE) & BS_DEFPUSHBUTTON) )
+ {
+ wxWindow *parent = GetParent();
+ wxWindow *win = wxFindWinFromHandle((WXHWND)wParam);
+ if ( win && win->GetParent() == parent )
+ {
+ wxPanel *panel = wxDynamicCast(parent, wxPanel);
+ if ( panel )
+ {
+ panel->SetDefaultItem(this);
+ }
+ // else: I don't know what to do - we'll still have the problem
+ // with multiple default buttons in a dialog...
+ }
+ }
+
+ // let the base class do all real processing
+ return wxControl::MSWWindowProc(nMsg, wParam, lParam);
+}