fixes for Raise() to work correctly with both top level and child windows
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11430 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -45,6 +45,7 @@ public:
|
|||||||
virtual ~wxFrameMSW();
|
virtual ~wxFrameMSW();
|
||||||
|
|
||||||
// implement base class pure virtuals
|
// implement base class pure virtuals
|
||||||
|
virtual void Raise();
|
||||||
virtual void Maximize(bool maximize = TRUE);
|
virtual void Maximize(bool maximize = TRUE);
|
||||||
virtual bool IsMaximized() const;
|
virtual bool IsMaximized() const;
|
||||||
virtual void Iconize(bool iconize = TRUE);
|
virtual void Iconize(bool iconize = TRUE);
|
||||||
|
@@ -347,6 +347,16 @@ bool wxFrameMSW::Show(bool show)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxFrameMSW::Raise()
|
||||||
|
{
|
||||||
|
#ifdef __WIN16__
|
||||||
|
// no SetForegroundWindow() in Win16
|
||||||
|
wxFrameBase::Raise();
|
||||||
|
#else // Win32
|
||||||
|
::SetForegroundWindow(GetHwnd());
|
||||||
|
#endif // Win16/32
|
||||||
|
}
|
||||||
|
|
||||||
void wxFrameMSW::Iconize(bool iconize)
|
void wxFrameMSW::Iconize(bool iconize)
|
||||||
{
|
{
|
||||||
DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE);
|
DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE);
|
||||||
|
@@ -157,7 +157,27 @@ static void TranslateKbdEventToMouse(wxWindowMSW *win,
|
|||||||
static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win);
|
static TEXTMETRIC wxGetTextMetrics(const wxWindowMSW *win);
|
||||||
|
|
||||||
// check if the mouse is in the window or its child
|
// check if the mouse is in the window or its child
|
||||||
//static bool IsMouseInWindow(HWND hwnd);
|
static bool IsMouseInWindow(HWND hwnd);
|
||||||
|
|
||||||
|
// wrapper around BringWindowToTop() API
|
||||||
|
static inline wxBringWindowToTop(HWND hwnd)
|
||||||
|
{
|
||||||
|
#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 // !__WXMICROWIN__
|
||||||
|
if ( !::BringWindowToTop(hwnd) )
|
||||||
|
{
|
||||||
|
wxLogLastError(_T("BringWindowToTop"));
|
||||||
|
}
|
||||||
|
#endif // __WXMICROWIN__/!__WXMICROWIN__
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// event tables
|
// event tables
|
||||||
@@ -503,19 +523,7 @@ bool wxWindowMSW::Show(bool show)
|
|||||||
|
|
||||||
if ( show )
|
if ( show )
|
||||||
{
|
{
|
||||||
#ifdef __WXMICROWIN__
|
wxBringWindowToTop(hWnd);
|
||||||
// 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;
|
return TRUE;
|
||||||
@@ -524,22 +532,7 @@ bool wxWindowMSW::Show(bool show)
|
|||||||
// Raise the window to the top of the Z order
|
// Raise the window to the top of the Z order
|
||||||
void wxWindowMSW::Raise()
|
void wxWindowMSW::Raise()
|
||||||
{
|
{
|
||||||
#ifdef __WIN16__
|
wxBringWindowToTop(GetHwnd());
|
||||||
::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
|
// Lower the window to the bottom of the Z order
|
||||||
|
Reference in New Issue
Block a user