bool wxStatusBar95::GetFieldRect(int i, wxRect& rect) const { wxCHECK_MSG( (i >= 0) && (i < m_nFields), false, _T("invalid statusbar field index") ); RECT r; if ( !::SendMessage(GetHwnd(), SB_GETRECT, i, (LPARAM)&r) ) { wxLogLastError(wxT("SendMessage(SB_GETRECT)")); } #if wxUSE_UXTHEME wxUxThemeHandle theme((wxStatusBar95 *)this, L"Status"); // const_cast if ( theme ) { // by default Windows has a 2 pixel border to the right of the left // divider (or it could be a bug) but it looks wrong so remove it if ( i != 0 ) { r.left -= 2; } wxUxThemeEngine::Get()->GetThemeBackgroundContentRect(theme, NULL, 1 /* SP_PANE */, 0, &r, &r); } #endif wxCopyRECTToRect(r, rect); return true; }
void wxDisplayInfo::Initialize() { if ( m_flags == (DWORD)-1 ) { WinStruct<MONITORINFOEX> monInfo; if ( !gs_GetMonitorInfo(m_hmon, (LPMONITORINFO)&monInfo) ) { wxLogLastError(wxT("GetMonitorInfo")); m_flags = 0; return; } wxCopyRECTToRect(monInfo.rcMonitor, m_rect); wxCopyRECTToRect(monInfo.rcWork, m_rectClient); m_devName = monInfo.szDevice; m_flags = monInfo.dwFlags; } }
UINT_PTR APIENTRY wxFileDialogHookFunction(HWND hDlg, UINT iMsg, WPARAM WXUNUSED(wParam), LPARAM lParam) { switch ( iMsg ) { #ifndef __WXWINCE__ case WM_INITDIALOG: { OPENFILENAME* ofn = reinterpret_cast<OPENFILENAME *>(lParam); reinterpret_cast<wxFileDialog *>(ofn->lCustData) ->MSWOnInitDialogHook((WXHWND)hDlg); } break; #endif // __WXWINCE__ case WM_NOTIFY: { NMHDR* const pNM = reinterpret_cast<NMHDR*>(lParam); if ( pNM->code > CDN_LAST && pNM->code <= CDN_FIRST ) { OFNOTIFY* const pNotifyCode = reinterpret_cast<OFNOTIFY *>(lParam); wxFileDialog* const dialog = reinterpret_cast<wxFileDialog *>( pNotifyCode->lpOFN->lCustData ); switch ( pNotifyCode->hdr.code ) { case CDN_INITDONE: dialog->MSWOnInitDone((WXHWND)hDlg); break; case CDN_SELCHANGE: dialog->MSWOnSelChange((WXHWND)hDlg); break; } } } break; case WM_DESTROY: // reuse the position used for the dialog the next time by default // // NB: at least under Windows 2003 this is useless as after the // first time it's shown the dialog always remembers its size // and position itself and ignores any later SetWindowPos calls wxCopyRECTToRect(wxGetWindowRect(::GetParent(hDlg)), gs_rectDialog); break; } // do the default processing return 0; }
wxRect wxDisplayMSW::GetClientArea() const { WinStruct<MONITORINFOEX> monInfo; wxRect rectClient; if ( GetMonInfo(monInfo) ) wxCopyRECTToRect(monInfo.rcWork, rectClient); return rectClient; }
wxRect wxDisplayMSW::GetGeometry() const { WinStruct<MONITORINFOEX> monInfo; wxRect rect; if ( GetMonInfo(monInfo) ) wxCopyRECTToRect(monInfo.rcMonitor, rect); return rect; }
UINT_PTR APIENTRY wxFileDialogHookFunction(HWND hDlg, UINT iMsg, WPARAM WXUNUSED(wParam), LPARAM lParam) { switch ( iMsg ) { case WM_NOTIFY: { OFNOTIFY *pNotifyCode = wx_reinterpret_cast(OFNOTIFY *, lParam); if ( pNotifyCode->hdr.code == CDN_INITDONE ) { // note that we need to move the parent window: hDlg is a // child of it when OFN_EXPLORER is used ::SetWindowPos ( ::GetParent(hDlg), HWND_TOP, gs_rectDialog.x, gs_rectDialog.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE ); } } break; case WM_DESTROY: // reuse the position used for the dialog the next time by default // // NB: at least under Windows 2003 this is useless as after the // first time it's shown the dialog always remembers its size // and position itself and ignores any later SetWindowPos calls wxCopyRECTToRect(wxGetWindowRect(::GetParent(hDlg)), gs_rectDialog); break; } // do the default processing return 0; }
wxRect wxNotebook::GetPageSize() const { wxRect r; RECT rc; ::GetClientRect(GetHwnd(), &rc); // This check is to work around a bug in TabCtrl_AdjustRect which will // cause a crash on win2k or on XP with themes disabled if either // wxNB_MULTILINE is used or tabs are placed on a side, if the rectangle // is too small. // // The value of 20 is chosen arbitrarily but seems to work if ( rc.right > 20 && rc.bottom > 20 ) { TabCtrl_AdjustRect(GetHwnd(), false, &rc); wxCopyRECTToRect(rc, r); } return r; }
bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) { if ( show == IsFullScreen() ) { // nothing to do return true; } m_fsIsShowing = show; if ( show ) { m_fsStyle = style; // zap the frame borders // save the 'normal' window style m_fsOldWindowStyle = GetWindowLong(GetHwnd(), GWL_STYLE); // save the old position, width & height, maximize state m_fsOldSize = GetRect(); m_fsIsMaximized = IsMaximized(); // decide which window style flags to turn off LONG newStyle = m_fsOldWindowStyle; LONG offFlags = 0; if (style & wxFULLSCREEN_NOBORDER) { offFlags |= WS_BORDER; #ifndef __WXWINCE__ offFlags |= WS_THICKFRAME; #endif } if (style & wxFULLSCREEN_NOCAPTION) offFlags |= WS_CAPTION | WS_SYSMENU; newStyle &= ~offFlags; // Full screen windows should logically be popups as they don't have // decorations (and are definitely not children) and while not using // this style doesn't seem to make any difference for most windows, it // breaks wxGLCanvas in some cases, see #15434, so just always use it. newStyle |= WS_POPUP; // change our window style to be compatible with full-screen mode ::SetWindowLong(GetHwnd(), GWL_STYLE, newStyle); wxRect rect; #if wxUSE_DISPLAY // resize to the size of the display containing us int dpy = wxDisplay::GetFromWindow(this); if ( dpy != wxNOT_FOUND ) { rect = wxDisplay(dpy).GetGeometry(); } else // fall back to the main desktop #endif // wxUSE_DISPLAY { // resize to the size of the desktop wxCopyRECTToRect(wxGetWindowRect(::GetDesktopWindow()), rect); #ifdef __WXWINCE__ // FIXME: size of the bottom menu (toolbar) // should be taken in account rect.height += rect.y; rect.y = 0; #endif } SetSize(rect); // now flush the window style cache and actually go full-screen long flags = SWP_FRAMECHANGED; // showing the frame full screen should also show it if it's still // hidden if ( !IsShown() ) { // don't call wxWindow version to avoid flicker from calling // ::ShowWindow() -- we're going to show the window at the correct // location directly below -- but do call the wxWindowBase version // to sync the internal m_isShown flag wxWindowBase::Show(); flags |= SWP_SHOWWINDOW; } SetWindowPos(GetHwnd(), HWND_TOP, rect.x, rect.y, rect.width, rect.height, flags); #if !defined(__HANDHELDPC__) && (defined(__WXWINCE__) && (_WIN32_WCE < 400)) ::SHFullScreen(GetHwnd(), SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON); #endif // finally send an event allowing the window to relayout itself &c wxSizeEvent event(rect.GetSize(), GetId()); event.SetEventObject(this); HandleWindowEvent(event); } else // stop showing full screen { #if !defined(__HANDHELDPC__) && (defined(__WXWINCE__) && (_WIN32_WCE < 400)) ::SHFullScreen(GetHwnd(), SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON); #endif Maximize(m_fsIsMaximized); SetWindowLong(GetHwnd(),GWL_STYLE, m_fsOldWindowStyle); SetWindowPos(GetHwnd(),HWND_TOP,m_fsOldSize.x, m_fsOldSize.y, m_fsOldSize.width, m_fsOldSize.height, SWP_FRAMECHANGED); } return true; }