}
#ifndef __WXWINCE__
- if ( style & wxSYSTEM_MENU )
+ // notice that if wxCLOSE_BOX is specified we need to use WS_SYSMENU too as
+ // otherwise the close box doesn't appear
+ if ( style & (wxSYSTEM_MENU | wxCLOSE_BOX) )
msflags |= WS_SYSMENU;
-#endif
+#endif // !__WXWINCE__
// NB: under CE these 2 styles are not supported currently, we should
// call Minimize()/Maximize() "manually" if we want to support them
return false;
}
- WXDWORD exflags;
- (void)MSWGetCreateWindowFlags(&exflags);
-
- if ( exflags )
- {
- ::SetWindowLong(GetHwnd(), GWL_EXSTYLE, exflags);
- ::SetWindowPos(GetHwnd(),
- exflags & WS_EX_TOPMOST ? HWND_TOPMOST : 0,
- 0, 0, 0, 0,
- SWP_NOSIZE |
- SWP_NOMOVE |
- (exflags & WS_EX_TOPMOST ? 0 : SWP_NOZORDER) |
- SWP_NOACTIVATE);
- }
-
#if !defined(__WXWINCE__)
// For some reason, the system menu is activated when we use the
// WS_EX_CONTEXTHELP style, so let's set a reasonable icon
- if ( exflags & WS_EX_CONTEXTHELP )
+ if ( HasExtraStyle(wxWS_EX_CONTEXTHELP) )
{
wxFrame *winTop = wxDynamicCast(wxTheApp->GetTopWindow(), wxFrame);
if ( winTop )
}
}
}
-#endif
+#endif // !__WXWINCE__
// move the dialog to its initial position without forcing repainting
int x, y, w, h;
// reuse the code in MSWGetStyle() but correct the results slightly for
// the dialog
- dlgTemplate->style = MSWGetStyle(style, NULL);
+ dlgTemplate->style = MSWGetStyle(style, &dlgTemplate->dwExtendedStyle);
// all dialogs are popups
dlgTemplate->style |= WS_POPUP;
bool wxTopLevelWindowMSW::IsMaximized() const
{
return IsAlwaysMaximized() ||
-#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
+#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) && !defined(__WINCE_STANDARDSDK__)
+
(::IsZoomed(GetHwnd()) != 0) ||
#endif
m_maximizeOnShow;
// finally send an event allowing the window to relayout itself &c
wxSizeEvent event(rect.GetSize(), GetId());
- GetEventHandler()->ProcessEvent(event);
+ HandleWindowEvent(event);
}
else // stop showing full screen
{
return GetLabel();
}
-void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
+void wxTopLevelWindowMSW::DoSelectAndSetIcon(const wxIconBundle& icons,
+ int smX,
+ int smY,
+ int i)
{
- wxTopLevelWindowBase::SetIcons(icons);
+ const wxSize size(::GetSystemMetrics(smX), ::GetSystemMetrics(smY));
-#if !defined(__WXMICROWIN__)
- const wxIcon& sml = icons.GetIconOfExactSize(16);
- if( sml.Ok() )
+ const wxIcon icon = icons.GetIconOfExactSize(size);
+ if ( icon.Ok() )
{
- ::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_SMALL,
- (LPARAM)GetHiconOf(sml) );
+ ::SendMessage(GetHwnd(), WM_SETICON, i, (LPARAM)GetHiconOf(icon));
}
+}
- const wxIcon& big = icons.GetIconOfExactSize(32);
- if( big.Ok() )
- {
- ::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_BIG,
- (LPARAM)GetHiconOf(big) );
- }
-#endif // !__WXMICROWIN__
+void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
+{
+ wxTopLevelWindowBase::SetIcons(icons);
+
+ DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL);
+ DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG);
}
bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)
// provide FlashWindowEx() declaration, so try to detect whether we have
// real headers for WINVER 0x0500 by checking for existence of a symbol not
// declated in MSVC6 header
-#if defined(FLASHW_STOP) && defined(VK_XBUTTON1)
+#if defined(FLASHW_STOP) && defined(VK_XBUTTON1) && wxUSE_DYNLIB_CLASS
// available in the headers, check if it is supported by the system
typedef BOOL (WINAPI *FlashWindowEx_t)(FLASHWINFO *pfwi);
FlashWindowEx_t s_pfnFlashWindowEx = NULL;
bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
{
+#if wxUSE_DYNLIB_CLASS
typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD);
static PSETLAYEREDWINDOWATTR pSetLayeredWindowAttributes = NULL;
}
if ( pSetLayeredWindowAttributes == NULL )
return false;
+#endif // wxUSE_DYNLIB_CLASS
LONG exstyle = GetWindowLong(GetHwnd(), GWL_EXSTYLE);
return true;
}
+#if wxUSE_DYNLIB_CLASS
// Otherwise, set the layered style if needed and set the alpha value
if ((exstyle & WS_EX_LAYERED) == 0 )
SetWindowLong(GetHwnd(), GWL_EXSTYLE, exstyle | WS_EX_LAYERED);
- return pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) != 0;
+ if ( pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) )
+ return true;
+#endif // wxUSE_DYNLIB_CLASS
+
+ return false;
}
bool wxTopLevelWindowMSW::CanSetTransparent()
return (os_type == wxOS_WINDOWS_NT && ver_major >= 5);
}
+
+void wxTopLevelWindowMSW::Freeze()
+{
+ if ( !m_frozenness++) {
+ if (IsShown()) {
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxWindow *child = node->GetData();
+ if ( child->IsTopLevel() )
+ continue;
+ else
+ child->Freeze();
+ }
+ }
+ }
+}
+
+void wxTopLevelWindowMSW::Thaw()
+{
+ wxASSERT_MSG( m_frozenness > 0, _T("Thaw() without matching Freeze()") );
+ if ( --m_frozenness == 0 )
+ {
+ if ( IsShown() ) {
+ for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxWindow *child = node->GetData();
+ if ( child->IsTopLevel() )
+ continue;
+ else
+ child->Thaw();
+ }
+ }
+ }
+}
+
+
+void wxTopLevelWindowMSW::AddChild(wxWindowBase *child )
+{
+ //adding a child while frozen will assert when thawn,
+ // so freeze it
+ if (child && !child->IsTopLevel() && IsFrozen()) {
+ //need to match our current freeze level
+ for (unsigned int ii=0;ii< m_frozenness;ii++) {
+ child->Freeze();
+ }
+ }
+ wxTopLevelWindowBase::AddChild(child);
+}
+
+
// ----------------------------------------------------------------------------
// wxTopLevelWindow event handling
// ----------------------------------------------------------------------------