// For some reason, wxWindows can activate another task altogether
// when a frame is destroyed after a modal dialog has been invoked.
// Try to bring the parent to the top.
+ // MT:Only do this if this frame is currently the active window, else weird
+ // things start to happen
+ if ( wxGetActiveWindow() == this )
if (GetParent() && GetParent()->GetHWND())
::BringWindowToTop((HWND) GetParent()->GetHWND());
}
rect.bottom -= pt.y;
rect.right -= pt.x;
- *x = rect.right;
- *y = rect.bottom;
+ if ( x )
+ *x = rect.right;
+ if ( y )
+ *y = rect.bottom;
}
// Set the client size (i.e. leave the calculation of borders etc.
*y = point.y;
}
-void wxFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags)
-{
- wxWindow::DoSetSize(x, y, width, height, sizeFlags);
-
- wxSizeEvent event(wxSize(width, height), m_windowId);
- event.SetEventObject( this );
- GetEventHandler()->ProcessEvent(event);
-}
-
bool wxFrame::Show(bool show)
{
int cshow;
{
// VZ: calling CreateStatusBar twice is an error - why anyone would do it?
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE,
- _T("recreating status bar in wxFrame") );
+ wxT("recreating status bar in wxFrame") );
m_frameStatusBar = OnCreateStatusBar(number, style, id,
name);
void wxFrame::SetStatusText(const wxString& text, int number)
{
- wxCHECK_RET( m_frameStatusBar != NULL, _T("no statusbar to set text for") );
+ wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set text for") );
m_frameStatusBar->SetStatusText(text, number);
}
void wxFrame::SetStatusWidths(int n, const int widths_field[])
{
- wxCHECK_RET( m_frameStatusBar != NULL, _T("no statusbar to set widths for") );
+ wxCHECK_RET( m_frameStatusBar != NULL, wxT("no statusbar to set widths for") );
m_frameStatusBar->SetStatusWidths(n, widths_field);
PositionStatusBar();
}
#endif // wxUSE_STATUSBAR
+void wxFrame::DetachMenuBar()
+{
+ if (m_frameMenuBar)
+ {
+ m_frameMenuBar->Detach();
+ m_frameMenuBar = NULL;
+ }
+}
+
void wxFrame::SetMenuBar(wxMenuBar *menu_bar)
{
if (!menu_bar)
{
- m_frameMenuBar = NULL;
+ DetachMenuBar();
return;
}
- wxCHECK_RET( !menu_bar->GetFrame(), _T("this menubar is already attached") );
+ wxCHECK_RET( !menu_bar->GetFrame(), wxT("this menubar is already attached") );
if (m_frameMenuBar)
delete m_frameMenuBar;
return FALSE;
wxMenuItem *item = bar->FindItemForId(id);
- if ( !item )
- return FALSE;
- if ( item->IsCheckable() )
+ if ( item && item->IsCheckable() )
{
bar->Check(id, !bar->IsChecked(id)) ;
}
return pt;
}
-void wxFrame::ScreenToClient(int *x, int *y) const
+void wxFrame::DoScreenToClient(int *x, int *y) const
{
- wxWindow::ScreenToClient(x, y);
+ wxWindow::DoScreenToClient(x, y);
// We may be faking the client origin.
// So a window that's really at (0, 30) may appear
*y -= pt.y;
}
-void wxFrame::ClientToScreen(int *x, int *y) const
+void wxFrame::DoClientToScreen(int *x, int *y) const
{
// We may be faking the client origin.
// So a window that's really at (0, 30) may appear
*x += pt1.x;
*y += pt1.y;
- wxWindow::ClientToScreen(x, y);
+ wxWindow::DoClientToScreen(x, y);
}
#if wxUSE_TOOLBAR
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxCHECK_MSG( m_frameToolBar == NULL, FALSE,
- _T("recreating toolbar in wxFrame") );
+ wxT("recreating toolbar in wxFrame") );
wxToolBar* toolBar = OnCreateToolBar(style, id, name);
if (toolBar)
return rc;
}
+