#include "wx/log.h"
#include "wx/intl.h"
#include "wx/frame.h"
+ #include "wx/menu.h"
#include "wx/containr.h" // wxSetFocusToChild()
#include "wx/module.h"
#endif //WX_PRECOMP
#endif // __SMARTPHONE__ || __POCKETPC__
case WM_SYSCOMMAND:
+ // Keep the #ifdef block inside the case to fix a potential MSVC
+ // warning regarding switch statement containing no case or
+ // default labels (or a default only).
+#ifndef __WXUNIVERSAL__
// We may need to generate events for the items added to the system
// menu if it had been created (and presumably modified).
if ( m_menuSystem )
processed = true;
}
}
+#endif // #ifndef __WXUNIVERSAL__
break;
}
}
#endif // !__WXWINCE__
+ if ( !title.empty() )
+ {
+ ::SetWindowText(GetHwnd(), title.wx_str());
+ }
+
+ SubclassWin(m_hWnd);
+
#if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__)
// move the dialog to its initial position without forcing repainting
int x, y, w, h;
// Let the system position the window, just set its size.
::SetWindowPos(GetHwnd(), 0,
0, 0, w, h,
- SWP_NOMOVE | SWP_NOZORDER);
+ SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
else // Move the window to the desired location and set its size too.
{
}
#endif // !__WXWINCE__
- if ( !title.empty() )
- {
- ::SetWindowText(GetHwnd(), title.wx_str());
- }
-
- SubclassWin(m_hWnd);
-
#ifdef __SMARTPHONE__
// Work around title non-display glitch
Show(false);
return true;
}
-#ifndef __WXWINCE__
-
-bool wxTopLevelWindowMSW::SetShape(const wxRegion& region)
-{
- wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), false,
- wxT("Shaped windows must be created with the wxFRAME_SHAPED style."));
-
- // The empty region signifies that the shape should be removed from the
- // window.
- if ( region.IsEmpty() )
- {
- if (::SetWindowRgn(GetHwnd(), NULL, TRUE) == 0)
- {
- wxLogLastError(wxT("SetWindowRgn"));
- return false;
- }
- return true;
- }
-
- // Windows takes ownership of the region, so
- // we'll have to make a copy of the region to give to it.
- DWORD noBytes = ::GetRegionData(GetHrgnOf(region), 0, NULL);
- RGNDATA *rgnData = (RGNDATA*) new char[noBytes];
- ::GetRegionData(GetHrgnOf(region), noBytes, rgnData);
- HRGN hrgn = ::ExtCreateRegion(NULL, noBytes, rgnData);
- delete[] (char*) rgnData;
-
- // SetWindowRgn expects the region to be in coordinants
- // relative to the window, not the client area. Figure
- // out the offset, if any.
- RECT rect;
- DWORD dwStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE);
- DWORD dwExStyle = ::GetWindowLong(GetHwnd(), GWL_EXSTYLE);
- ::GetClientRect(GetHwnd(), &rect);
- ::AdjustWindowRectEx(&rect, dwStyle, ::GetMenu(GetHwnd()) != NULL, dwExStyle);
- ::OffsetRgn(hrgn, -rect.left, -rect.top);
-
- // Now call the shape API with the new region.
- if (::SetWindowRgn(GetHwnd(), hrgn, TRUE) == 0)
- {
- wxLogLastError(wxT("SetWindowRgn"));
- return false;
- }
- return true;
-}
-
-#endif // !__WXWINCE__
-
void wxTopLevelWindowMSW::RequestUserAttention(int flags)
{
// check if we can use FlashWindowEx(): unfortunately a simple test for
wxMenu *wxTopLevelWindowMSW::MSWGetSystemMenu() const
{
+#ifndef __WXUNIVERSAL__
if ( !m_menuSystem )
{
HMENU hmenu = ::GetSystemMenu(GetHwnd(), FALSE);
// correct but doesn't seem to have any serious drawbacks.
m_menuSystem->SetInvokingWindow(self);
}
+#endif // #ifndef __WXUNIVERSAL__
return m_menuSystem;
}