+// ---------------------------------------------------------------------------
+
+bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
+{
+#if wxUSE_DYNLIB_CLASS
+ typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD);
+ static PSETLAYEREDWINDOWATTR pSetLayeredWindowAttributes = NULL;
+
+ if ( pSetLayeredWindowAttributes == NULL )
+ {
+ wxDynamicLibrary dllUser32(_T("user32.dll"));
+ pSetLayeredWindowAttributes = (PSETLAYEREDWINDOWATTR)
+ dllUser32.GetSymbol(wxT("SetLayeredWindowAttributes"));
+ }
+ if ( pSetLayeredWindowAttributes == NULL )
+ return false;
+#endif // wxUSE_DYNLIB_CLASS
+
+ LONG exstyle = GetWindowLong(GetHwnd(), GWL_EXSTYLE);
+
+ // if setting alpha to fully opaque then turn off the layered style
+ if (alpha == 255)
+ {
+ SetWindowLong(GetHwnd(), GWL_EXSTYLE, exstyle & ~WS_EX_LAYERED);
+ Refresh();
+ 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);
+
+ if ( pSetLayeredWindowAttributes(GetHwnd(), 0, (BYTE)alpha, LWA_ALPHA) )
+ return true;
+#endif // wxUSE_DYNLIB_CLASS
+
+ return false;
+}
+
+bool wxTopLevelWindowMSW::CanSetTransparent()
+{
+ // The API is available on win2k and above
+
+ static int os_type = -1;
+ static int ver_major = -1;
+
+ if (os_type == -1)
+ os_type = ::wxGetOsVersion(&ver_major);
+
+ 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);
+}
+
+