X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b70362998b8f562923f6ed6708f06537ac056cd4..90f6792f530002cf3718b0ab0ce7727be1d21729:/src/msw/toplevel.cpp diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index a3b75ce292..359c874cb8 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -27,7 +27,6 @@ #include "wx/toplevel.h" #ifndef WX_PRECOMP - #include "wx/msw/missing.h" #include "wx/app.h" #include "wx/dialog.h" #include "wx/string.h" @@ -48,10 +47,10 @@ #if _WIN32_WCE < 400 || !defined(__WINCE_STANDARDSDK__) #include #endif - #include "wx/msw/wince/missing.h" #endif #include "wx/msw/winundef.h" +#include "wx/msw/missing.h" #include "wx/display.h" @@ -480,7 +479,7 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, if ( !title.empty() ) { - ::SetWindowText(GetHwnd(), title); + ::SetWindowText(GetHwnd(), title.wx_str()); } SubclassWin(m_hWnd); @@ -508,7 +507,7 @@ bool wxTopLevelWindowMSW::CreateFrame(const wxString& title, exflags |= WS_EX_LAYOUTRTL; #endif - return MSWCreate(wxCanvasClassName, title, pos, sz, flags, exflags); + return MSWCreate(wxCanvasClassName, title.wx_str(), pos, sz, flags, exflags); } bool wxTopLevelWindowMSW::Create(wxWindow *parent, @@ -784,11 +783,10 @@ void wxTopLevelWindowMSW::SetLayoutDirection(wxLayoutDirection dir) // wxTopLevelWindowMSW geometry // ---------------------------------------------------------------------------- -void wxTopLevelWindowMSW::DoGetPosition(int *x, int *y) const -{ - #ifndef __WXWINCE__ +void wxTopLevelWindowMSW::DoGetPosition(int *x, int *y) const +{ if ( IsIconized() ) { WINDOWPLACEMENT wp; @@ -824,15 +822,11 @@ void wxTopLevelWindowMSW::DoGetPosition(int *x, int *y) const } //else: normal case -#endif // __WXWINCE__ - wxTopLevelWindowBase::DoGetPosition(x, y); } void wxTopLevelWindowMSW::DoGetSize(int *width, int *height) const { -#ifndef __WXWINCE__ - if ( IsIconized() ) { WINDOWPLACEMENT wp; @@ -853,11 +847,11 @@ void wxTopLevelWindowMSW::DoGetSize(int *width, int *height) const } //else: normal case -#endif - wxTopLevelWindowBase::DoGetSize(width, height); } +#endif // __WXWINCE__ + // ---------------------------------------------------------------------------- // wxTopLevelWindowMSW fullscreen // ---------------------------------------------------------------------------- @@ -983,25 +977,20 @@ wxString wxTopLevelWindowMSW::GetTitle() const return GetLabel(); } -void wxTopLevelWindowMSW::SetIcon(const wxIcon& icon) -{ - SetIcons( wxIconBundle( icon ) ); -} - void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons) { wxTopLevelWindowBase::SetIcons(icons); #if !defined(__WXMICROWIN__) - const wxIcon& sml = icons.GetIcon( wxSize( 16, 16 ) ); - if( sml.Ok() && sml.GetWidth() == 16 && sml.GetHeight() == 16 ) + const wxIcon& sml = icons.GetIconOfExactSize(16); + if( sml.Ok() ) { ::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_SMALL, (LPARAM)GetHiconOf(sml) ); } - const wxIcon& big = icons.GetIcon( wxSize( 32, 32 ) ); - if( big.Ok() && big.GetWidth() == 32 && big.GetHeight() == 32 ) + const wxIcon& big = icons.GetIconOfExactSize(32); + if( big.Ok() ) { ::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_BIG, (LPARAM)GetHiconOf(big) ); @@ -1098,7 +1087,7 @@ void wxTopLevelWindowMSW::RequestUserAttention(int flags) // 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; @@ -1144,6 +1133,7 @@ void wxTopLevelWindowMSW::RequestUserAttention(int flags) bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha) { +#if wxUSE_DYNLIB_CLASS typedef DWORD (WINAPI *PSETLAYEREDWINDOWATTR)(HWND, DWORD, BYTE, DWORD); static PSETLAYEREDWINDOWATTR pSetLayeredWindowAttributes = NULL; @@ -1155,6 +1145,7 @@ bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha) } if ( pSetLayeredWindowAttributes == NULL ) return false; +#endif // wxUSE_DYNLIB_CLASS LONG exstyle = GetWindowLong(GetHwnd(), GWL_EXSTYLE); @@ -1166,11 +1157,16 @@ bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha) 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()