X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/45f272841cd2faca5fd3ad2560cbf06eb81465bc..edf1dfa16db5bc9df60b30d01ca9892b298be34f:/src/common/framecmn.cpp diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 1b8448f0ad..6127486170 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -155,8 +155,7 @@ wxPoint wxFrameBase::GetClientAreaOrigin() const { wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin(); -#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) && \ - (!defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))) +#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) wxToolBar *toolbar = GetToolBar(); if ( toolbar && toolbar->IsShown() ) { @@ -174,18 +173,18 @@ wxPoint wxFrameBase::GetClientAreaOrigin() const } #endif // wxUSE_TOOLBAR -#if defined(__WXWINCE__) && defined(WCE_PLATFORM_STANDARDSDK) - if (GetMenuBar() && GetMenuBar()->GetCommandBar()) - { - RECT rect; - ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect); - pt.y += (rect.bottom - rect.top); - } -#endif - return pt; } + +void wxFrameBase::SendSizeEvent() +{ + wxSizeEvent event( GetSize(), GetId() ); + event.SetEventObject( this ); + GetEventHandler()->AddPendingEvent( event ); +} + + // ---------------------------------------------------------------------------- // misc // ---------------------------------------------------------------------------- @@ -228,7 +227,7 @@ bool wxFrameBase::ProcessCommand(int id) void wxFrameBase::UpdateWindowUI(long flags) { wxWindowBase::UpdateWindowUI(flags); - + #if wxUSE_TOOLBAR if (GetToolBar()) GetToolBar()->UpdateWindowUI(flags); @@ -277,7 +276,7 @@ void wxFrameBase::OnMenuOpen(wxMenuEvent& WXUNUSED(event)) void wxFrameBase::OnMenuClose(wxMenuEvent& WXUNUSED(event)) { // do we have real status text to restore? - if ( m_oldStatusText.length() > 1 || m_oldStatusText[0u] ) + if ( !m_oldStatusText.empty() ) { if ( m_statusBarPane >= 0 ) { @@ -296,7 +295,7 @@ void wxFrameBase::OnMenuClose(wxMenuEvent& WXUNUSED(event)) void wxFrameBase::OnInternalIdle() { wxTopLevelWindow::OnInternalIdle(); - + #if wxUSE_MENUS && wxUSE_IDLEMENUUPDATES if (wxUpdateUIEvent::CanUpdate(this)) DoMenuUpdates(); @@ -319,9 +318,7 @@ wxStatusBar* wxFrameBase::CreateStatusBar(int number, wxCHECK_MSG( !m_frameStatusBar, (wxStatusBar *)NULL, wxT("recreating status bar in wxFrame") ); - m_frameStatusBar = OnCreateStatusBar( number, style, id, name ); - if ( m_frameStatusBar ) - PositionStatusBar(); + SetStatusBar(OnCreateStatusBar(number, style, id, name)); return m_frameStatusBar; } @@ -390,12 +387,25 @@ bool wxFrameBase::ShowMenuHelp(wxStatusBar *WXUNUSED(statbar), int menuId) DoGiveHelp(helpString, show); - return !helpString.IsEmpty(); + return !helpString.empty(); #else // !wxUSE_MENUS return false; #endif // wxUSE_MENUS/!wxUSE_MENUS } +void wxFrameBase::SetStatusBar(wxStatusBar *statBar) +{ + bool hadBar = m_frameStatusBar != NULL; + m_frameStatusBar = statBar; + + if ( (m_frameStatusBar != NULL) != hadBar ) + { + PositionStatusBar(); + + DoLayout(); + } +} + #endif // wxUSE_STATUSBAR void wxFrameBase::DoGiveHelp(const wxString& text, bool show) @@ -436,6 +446,9 @@ void wxFrameBase::DoGiveHelp(const wxString& text, bool show) } statbar->SetStatusText(help, m_statusBarPane); +#else + wxUnusedVar(text); + wxUnusedVar(show); #endif // wxUSE_STATUSBAR } @@ -467,7 +480,7 @@ wxToolBar* wxFrameBase::CreateToolBar(long style, style = wxBORDER_NONE | wxTB_HORIZONTAL | wxTB_FLAT; } - m_frameToolBar = OnCreateToolBar(style, id, name); + SetToolBar(OnCreateToolBar(style, id, name)); return m_frameToolBar; } @@ -476,9 +489,28 @@ wxToolBar* wxFrameBase::OnCreateToolBar(long style, wxWindowID id, const wxString& name) { +#if defined(__WXWINCE__) && defined(__POCKETPC__) + return new wxToolMenuBar(this, id, + wxDefaultPosition, wxDefaultSize, + style, name); +#else return new wxToolBar(this, id, wxDefaultPosition, wxDefaultSize, style, name); +#endif +} + +void wxFrameBase::SetToolBar(wxToolBar *toolbar) +{ + bool hadBar = m_frameToolBar != NULL; + m_frameToolBar = toolbar; + + if ( (m_frameToolBar != NULL) != hadBar ) + { + PositionToolBar(); + + DoLayout(); + } } #endif // wxUSE_TOOLBAR @@ -537,3 +569,12 @@ void wxFrameBase::SetMenuBar(wxMenuBar *menubar) } #endif // wxUSE_MENUS + +#if WXWIN_COMPATIBILITY_2_2 + +bool wxFrameBase::Command(int winid) +{ + return ProcessCommand(winid); +} + +#endif // WXWIN_COMPATIBILITY_2_2