X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/64869ab787854e69b35893728fadd06ec69165e9..dd779a9e66c640907048ab02cb4a853ae45ea94c:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index ce75422271..223ae9ef0a 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -528,7 +528,12 @@ bool wxWindowMSW::Create(wxWindow *parent, msflags |= WS_VISIBLE; } - return MSWCreate(wxCanvasClassName, NULL, pos, size, msflags, exstyle); + if ( !MSWCreate(wxCanvasClassName, NULL, pos, size, msflags, exstyle) ) + return false; + + InheritAttributes(); + + return true; } // --------------------------------------------------------------------------- @@ -1530,15 +1535,15 @@ void wxWindowMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags) return; } - if ( x == wxDefaultPosition.x && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) + if ( x == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) x = currentX; - if ( y == wxDefaultPosition.y && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) + if ( y == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) ) y = currentY; AdjustForParentClientOrigin(x, y, sizeFlags); wxSize size = wxDefaultSize; - if ( width == wxDefaultSize.x ) + if ( width == wxDefaultCoord ) { if ( sizeFlags & wxSIZE_AUTO_WIDTH ) { @@ -1552,11 +1557,11 @@ void wxWindowMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags) } } - if ( height == wxDefaultSize.y ) + if ( height == wxDefaultCoord ) { if ( sizeFlags & wxSIZE_AUTO_HEIGHT ) { - if ( size.x == wxDefaultSize.x ) + if ( size.x == wxDefaultCoord ) { size = DoGetBestSize(); } @@ -1594,8 +1599,8 @@ void wxWindowMSW::DoSetClientSize(int width, int height) ::GetClientRect(GetHwnd(), &rectClient); // if the size is already ok, stop here (rectClient.left = top = 0) - if ( (rectClient.right == width || width == wxDefaultSize.x) && - (rectClient.bottom == height || height == wxDefaultSize.y) ) + if ( (rectClient.right == width || width == wxDefaultCoord) && + (rectClient.bottom == height || height == wxDefaultCoord) ) { break; } @@ -1666,7 +1671,11 @@ void wxWindowMSW::GetTextExtent(const wxString& string, wxASSERT_MSG( !theFont || theFont->Ok(), _T("invalid font in GetTextExtent()") ); - const wxFont fontToUse(theFont ? *theFont : GetFont()); + wxFont fontToUse; + if (theFont) + fontToUse = *theFont; + else + fontToUse = GetFont(); WindowHDC hdc(GetHwnd()); SelectInHDC selectFont(hdc, GetHfontOf(fontToUse)); @@ -1737,9 +1746,10 @@ bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y) point.y = y; ::ClientToScreen(hWnd, &point); wxCurrentPopupMenu = menu; +#if defined(__WXWINCE__) UINT flags = 0; -#if !defined(__WXWINCE__) - flags = TPM_RIGHTBUTTON; +#else + UINT flags = TPM_RIGHTBUTTON; #endif ::TrackPopupMenu(hMenu, flags, point.x, point.y, 0, hWnd, NULL); @@ -3000,7 +3010,7 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, bool nonDefault = false; - if ( pos.x == wxDefaultPosition.x ) + if ( pos.x == wxDefaultCoord ) { // if x is set to CW_USEDEFAULT, y parameter is ignored anyhow so we // can just as well set it to CW_USEDEFAULT as well @@ -3013,7 +3023,7 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, // neither because it is not handled as a special value by Windows then // and so we have to choose some default value for it x = pos.x; - y = pos.y == wxDefaultPosition.y ? DEFAULT_Y : pos.y; + y = pos.y == wxDefaultCoord ? DEFAULT_Y : pos.y; nonDefault = true; } @@ -3057,16 +3067,16 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos, // However, on PocketPC devices, we must use the default // size if possible. #ifdef _WIN32_WCE - if (size.x == wxDefaultSize.x) + if (size.x == wxDefaultCoord) w = CW_USEDEFAULT; else w = size.x; - if (size.y == wxDefaultSize.y) + if (size.y == wxDefaultCoord) h = CW_USEDEFAULT; else h = size.y; #else - if ( size.x == wxDefaultSize.x || size.y == wxDefaultSize.y) + if ( size.x == wxDefaultCoord || size.y == wxDefaultCoord) { nonDefault = true; } @@ -3302,6 +3312,8 @@ bool wxWindowMSW::MSWOnNotify(int WXUNUSED(idCtrl), return true; } } +#else + wxUnusedVar(lParam); #endif // wxUSE_TOOLTIPS return false; @@ -4168,6 +4180,7 @@ bool wxWindowMSW::HandleSizing(wxRect& rect) bool wxWindowMSW::HandleGetMinMaxInfo(void *mmInfo) { #ifdef __WXWINCE__ + wxUnusedVar(mmInfo); return false; #else MINMAXINFO *info = (MINMAXINFO *)mmInfo; @@ -4179,25 +4192,25 @@ bool wxWindowMSW::HandleGetMinMaxInfo(void *mmInfo) maxWidth = GetMaxWidth(), maxHeight = GetMaxHeight(); - if ( minWidth != wxDefaultSize.x ) + if ( minWidth != wxDefaultCoord ) { info->ptMinTrackSize.x = minWidth; rc = true; } - if ( minHeight != wxDefaultSize.y ) + if ( minHeight != wxDefaultCoord ) { info->ptMinTrackSize.y = minHeight; rc = true; } - if ( maxWidth != wxDefaultSize.x ) + if ( maxWidth != wxDefaultCoord ) { info->ptMaxTrackSize.x = maxWidth; rc = true; } - if ( maxHeight != wxDefaultSize.y ) + if ( maxHeight != wxDefaultCoord ) { info->ptMaxTrackSize.y = maxHeight; rc = true; @@ -4881,12 +4894,11 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font) { TEXTMETRIC tm; HDC dc = ::GetDC((HWND) wnd); - HFONT fnt =0; HFONT was = 0; // the_font.UseResource(); // the_font.RealizeResource(); - fnt = (HFONT)the_font.GetResourceHandle(); // const_cast + HFONT fnt = (HFONT)the_font.GetResourceHandle(); // const_cast if ( fnt ) was = (HFONT) SelectObject(dc,fnt);