X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/45956e3776450527af201a3e254716daeb080109..04cc1e93edd19f0430f9681ef1fdaf81ccdabf8f:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 93bb8f27c8..fec6a59d91 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -339,7 +339,9 @@ wxCONSTRUCTOR_DUMMY(wxWindow) BEGIN_EVENT_TABLE(wxWindowMSW, wxWindowBase) EVT_ERASE_BACKGROUND(wxWindowMSW::OnEraseBackground) EVT_SYS_COLOUR_CHANGED(wxWindowMSW::OnSysColourChanged) +#ifdef __WXWINCE__ EVT_INIT_DIALOG(wxWindowMSW::OnInitDialog) +#endif END_EVENT_TABLE() // =========================================================================== @@ -1535,15 +1537,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 ) { @@ -1557,11 +1559,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(); } @@ -1599,8 +1601,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; } @@ -1671,7 +1673,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)); @@ -1742,9 +1748,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); @@ -3005,7 +3012,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 @@ -3018,7 +3025,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; } @@ -3062,16 +3069,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; } @@ -3307,6 +3314,8 @@ bool wxWindowMSW::MSWOnNotify(int WXUNUSED(idCtrl), return true; } } +#else + wxUnusedVar(lParam); #endif // wxUSE_TOOLTIPS return false; @@ -3423,6 +3432,13 @@ bool wxWindowMSW::HandleActivate(int state, bool wxWindowMSW::HandleSetFocus(WXHWND hwnd) { + // Strangly enough, some controls get set focus events when they are being + // deleted, even if they already had focus before. + if ( m_isBeingDeleted ) + { + return false; + } + // notify the parent keeping track of focus for the kbd navigation // purposes that we got it wxChildFocusEvent eventFocus((wxWindow *)this); @@ -4173,6 +4189,7 @@ bool wxWindowMSW::HandleSizing(wxRect& rect) bool wxWindowMSW::HandleGetMinMaxInfo(void *mmInfo) { #ifdef __WXWINCE__ + wxUnusedVar(mmInfo); return false; #else MINMAXINFO *info = (MINMAXINFO *)mmInfo; @@ -4184,25 +4201,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; @@ -4886,12 +4903,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); @@ -5878,3 +5894,36 @@ IMPLEMENT_DYNAMIC_CLASS(wxIdleWakeUpModule, wxModule) #endif // __WXWINCE__ +#ifdef __WXWINCE__ + +#if wxUSE_STATBOX +static void wxAdjustZOrder(wxWindow* parent) +{ + if (parent->IsKindOf(CLASSINFO(wxStaticBox))) + { + // Set the z-order correctly + SetWindowPos((HWND) parent->GetHWND(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); + } + + wxWindowList::compatibility_iterator current = parent->GetChildren().GetFirst(); + while (current) + { + wxWindow *childWin = current->GetData(); + wxAdjustZOrder(childWin); + current = current->GetNext(); + } +} +#endif + +// We need to adjust the z-order of static boxes in WinCE, to +// make 'contained' controls visible +void wxWindowMSW::OnInitDialog( wxInitDialogEvent& event ) +{ +#if wxUSE_STATBOX + wxAdjustZOrder(this); +#endif + + event.Skip(); +} +#endif +