X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/960b193e59a7700570cfcae914ef2f698e6ba3b8..ebe47451544561fbe6e57808d604641d24109359:/src/msw/frame.cpp?ds=sidebyside diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 6c5aaef10e..6c412d00f0 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -194,8 +194,6 @@ bool wxFrame::Create(wxWindow *parent, SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); - wxModelessWindows.Append(this); - return TRUE; } @@ -320,7 +318,7 @@ void wxFrame::PositionStatusBar() void wxFrame::AttachMenuBar(wxMenuBar *menubar) { -#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)) +#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)) if (!GetToolBar()) { wxToolBar* toolBar = new wxToolBar(this, -1, @@ -356,7 +354,7 @@ void wxFrame::AttachMenuBar(wxMenuBar *menubar) } else // set new non NULL menu bar { -#if !defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP)) +#if !defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) // Can set a menubar several times. if ( menubar->GetHMenu() ) { @@ -419,7 +417,7 @@ bool wxFrame::ShowFullScreen(bool show, long style) if (show) { #if wxUSE_TOOLBAR -#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)) +#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)) // TODO: hide commandbar #else wxToolBar *theToolBar = GetToolBar(); @@ -464,7 +462,7 @@ bool wxFrame::ShowFullScreen(bool show, long style) else { #if wxUSE_TOOLBAR -#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)) +#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)) // TODO: show commandbar #else wxToolBar *theToolBar = GetToolBar(); @@ -510,7 +508,7 @@ bool wxFrame::ShowFullScreen(bool show, long style) wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) { -#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)) +#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)) // We may already have a toolbar from calling SetMenuBar. if (GetToolBar()) return GetToolBar(); @@ -528,7 +526,7 @@ void wxFrame::PositionToolBar() wxToolBar *toolbar = GetToolBar(); if ( toolbar && toolbar->IsShown() ) { -#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)) +#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)) // We want to do something different in WinCE, because // the toolbar should be associated with the commandbar, // and not an independent window. @@ -547,6 +545,18 @@ void wxFrame::PositionToolBar() } #endif // wxUSE_STATUSBAR + int x = 0; + int y = 0; +#if defined(__WXWINCE__) + // We're using a commandbar - so we have to allow for it. + if (GetMenuBar() && GetMenuBar()->GetCommandBar()) + { + RECT rect; + ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); + y = rect.bottom - rect.top; + } +#endif + int tx, ty; int tw, th; toolbar->GetPosition(&tx, &ty); @@ -602,7 +612,7 @@ void wxFrame::PositionToolBar() } if (tx != 0 || ty != 0 || widthChanging || heightChanging) - toolbar->SetSize(0, 0, desiredW, desiredH, wxSIZE_NO_ADJUSTMENTS); + toolbar->SetSize(x, y, desiredW, desiredH, wxSIZE_NO_ADJUSTMENTS); #endif // __WXWINCE__ } @@ -795,6 +805,23 @@ bool wxFrame::HandleSize(int x, int y, WXUINT id) PositionToolBar(); #endif // wxUSE_TOOLBAR +#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) + // Position the menu command bar + if (GetMenuBar() && GetMenuBar()->GetCommandBar()) + { + RECT rect; + ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); + wxSize clientSz = GetClientSize(); + + if ( !::MoveWindow((HWND) GetMenuBar()->GetCommandBar(), 0, 0, clientSz.x, rect.bottom - rect.top, true ) ) + { + wxLogLastError(wxT("MoveWindow")); + } + + } +#endif + + processed = wxWindow::HandleSize(x, y, id); } @@ -969,3 +996,45 @@ bool wxFrame::HandleInitMenuPopup(WXHMENU hMenu) return GetEventHandler()->ProcessEvent(event); } + +// ---------------------------------------------------------------------------- +// wxFrame size management: we exclude the areas taken by menu/status/toolbars +// from the client area, so the client area is what's really available for the +// frame contents +// ---------------------------------------------------------------------------- + +// get the origin of the client area in the client coordinates +wxPoint wxFrame::GetClientAreaOrigin() const +{ + wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin(); + +#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) && \ + (!defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))) + wxToolBar *toolbar = GetToolBar(); + if ( toolbar && toolbar->IsShown() ) + { + int w, h; + toolbar->GetSize(&w, &h); + + if ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL ) + { + pt.x += w; + } + else + { + pt.y += h; + } + } +#endif // wxUSE_TOOLBAR + +#if defined(__WXWINCE__) && defined(__WINCE_STANDARDSDK__) + if (GetMenuBar() && GetMenuBar()->GetCommandBar()) + { + RECT rect; + ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); + pt.y += (rect.bottom - rect.top); + } +#endif + + return pt; +}