#ifndef __WXMICROWIN__
::SetLastError(0);
#endif
-
+
if ( !::SetFocus(hWnd) )
{
// was there really an error?
if ( show )
{
+#ifdef __WXMICROWIN__
+ // It seems that MicroWindows brings the _parent_ of the
+ // window to the top, which can be the wrong one.
+
+ // activate (set focus to) specified window
+ ::SetFocus(hWnd);
+
+ // raise top level parent to top of z order
+ ::SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0,
+ SWP_NOMOVE|SWP_NOSIZE);
+#else
BringWindowToTop(hWnd);
+#endif
}
return TRUE;
#ifdef __WIN16__
::BringWindowToTop(GetHwnd());
#else // Win32
+#ifdef __WXMICROWIN__
+ // It seems that MicroWindows brings the _parent_ of the
+ // window to the top, which can be the wrong one.
+
+ // activate (set focus to) specified window
+ ::SetFocus(GetHwnd());
+
+ // raise top level parent to top of z order
+ ::SetWindowPos(GetHwnd(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+#else
::SetForegroundWindow(GetHwnd());
#endif
+#endif
}
// Lower the window to the bottom of the Z order
wxAssociateWinWithHandle(hwnd, this);
m_oldWndProc = (WXFARPROC) GetWindowLong(hwnd, GWL_WNDPROC);
+
+ wxASSERT( (WXFARPROC) m_oldWndProc != (WXFARPROC) wxWndProc );
+
SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
}
}
break;
-#if defined(__WXUNIVERSAL__) && !defined(__WXMICROWIN__)
+#ifndef __WXMICROWIN__
case WM_ACTIVATEAPP:
wxTheApp->SetActive(wParam != 0, FindFocus());
break;
-
- case WM_NCHITTEST:
- // we shouldn't allow the windows which don't want to get focus to
- // get it
- if ( !AcceptsFocus() )
- {
- rc.result = HTTRANSPARENT;
- processed = TRUE;
- }
- break;
-#endif // __WXUNIVERSAL__
+#endif
case WM_ACTIVATE:
{
#endif
case WM_LBUTTONDOWN:
- // set focus to this window
- if (AcceptsFocus())
- SetFocus();
-
- // fall through
-
case WM_LBUTTONUP:
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MBUTTONDBLCLK:
- processed = HandleMouseEvent(message,
+ {
+ processed = FALSE;
+#ifdef __WXMICROWIN__
+ // MicroWindows seems to ignore the fact that a window is
+ // disabled. So catch mouse events and throw them away if
+ // necessary.
+ wxWindowMSW* win = this;
+ while (win)
+ {
+ if (!win->IsEnabled())
+ {
+ processed = TRUE;
+ break;
+ }
+ win = win->GetParent();
+ if (win && win->IsTopLevel())
+ break;
+ }
+#endif // __WXMICROWIN__
+ if (!processed)
+ {
+ if (message == WM_LBUTTONDOWN && AcceptsFocus())
+ SetFocus();
+ processed = HandleMouseEvent(message,
GET_X_LPARAM(lParam),
GET_Y_LPARAM(lParam),
- wParam);
- break;
+ wParam);
+ }
+ break;
+ }
-#ifdef MM_JOY1MOVE // __WXMICROWIN__
+#ifdef __WXMICROWIN__
+ case WM_NCLBUTTONDOWN:
+ case WM_NCLBUTTONUP:
+ case WM_NCLBUTTONDBLCLK:
+ case WM_NCRBUTTONDOWN:
+ case WM_NCRBUTTONUP:
+ case WM_NCRBUTTONDBLCLK:
+#if 0
+ case WM_NCMBUTTONDOWN:
+ case WM_NCMBUTTONUP:
+ case WM_NCMBUTTONDBLCLK:
+#endif
+ {
+ // MicroWindows seems to ignore the fact that a window
+ // is disabled. So catch mouse events and throw them away if necessary.
+ processed = FALSE;
+ wxWindowMSW* win = this;
+ while (win)
+ {
+ if (!win->IsEnabled())
+ {
+ processed = TRUE;
+ break;
+ }
+ win = win->GetParent();
+ if (win && win->IsTopLevel())
+ break;
+ }
+ break;
+ }
+#endif // __WXMICROWIN__
+
+#ifdef MM_JOY1MOVE
case MM_JOY1MOVE:
case MM_JOY2MOVE:
case MM_JOY1ZMOVE:
GET_Y_LPARAM(lParam),
wParam);
break;
-#endif
+#endif // __WXMICROWIN__
case WM_SYSCOMMAND:
processed = HandleSysCommand(wParam, lParam);
#endif // Win95
// for these messages we must return TRUE if process the message
-#ifdef WM_DRAWITEM // __WXMICROWIN__
+#ifdef WM_DRAWITEM
case WM_DRAWITEM:
case WM_MEASUREITEM:
{
rc.result = TRUE;
}
break;
-#endif
+#endif // defined(WM_DRAWITEM)
+
case WM_GETDLGCODE:
if ( m_lDlgCode )
{
lParam);
}
break;
-#endif
+#endif // !__WXMICROWIN__
// the return value for this message is ignored
case WM_SYSCOLORCHANGE:
}
break;
#endif // __WIN32__
+
+#ifdef __WXUNIVERSAL__
+ case WM_NCHITTEST:
+ // we shouldn't allow the windows which don't want to get focus to
+ // get it
+ if ( !AcceptsFocus() )
+ {
+ rc.result = HTTRANSPARENT;
+ processed = TRUE;
+ }
+ break;
+#endif // __WXUNIVERSAL__
}
if ( !processed )
wxWndHook = this;
+#ifndef __WXMICROWIN__
if ( dialog_template )
{
-#ifndef __WXMICROWIN__
// for the dialogs without wxDIALOG_NO_PARENT style, use the top level
// app window as parent - this avoids creating modal dialogs without
// parent
{
wxLogLastError(wxT("MoveWindow"));
}
-#endif
- // __WXMICROWIN__
}
else // creating a normal window, not a dialog
+#endif // !__WXMICROWIN__
{
int controlId = 0;
if ( style & WS_CHILD )
// finally try this window too (catches toolbar case)
return MSWOnNotify(idCtrl, lParam, result);
-#else
+#else // __WXMICROWIN__
return FALSE;
#endif
}
delete[] files;
return rc;
-#else
+#else // __WXMICROWIN__
return FALSE;
#endif
}
// cursor set, stop here
return TRUE;
}
-#endif
+#endif // __WXMICROWIN__
+
// pass up the window chain
return FALSE;
}
*brush = hBrush;
return hBrush != 0;
-#else
+#else // __WXMICROWIN__
return FALSE;
#endif
}
return (int)CallNextHookEx(wxTheKeyboardHook, nCode, wParam, lParam);
}
-#endif
+
+#endif // !__WXMICROWIN__
#ifdef __WXDEBUG__
const char *wxGetMessageName(int message)