Fixed wxNotebook::RemovePage(),

Made modal dialogs children of wxApp->GetTopWindow() if
    no parent is given.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2000-05-01 20:20:16 +00:00
parent 3d3cbc05f6
commit dc3f2c920f
6 changed files with 43 additions and 7 deletions

View File

@@ -267,7 +267,7 @@ void MyFrame::LogDialog(wxCommandEvent& event)
void MyFrame::MessageBox(wxCommandEvent& WXUNUSED(event) )
{
wxMessageDialog dialog( this, "This is a message box\nA long, long string to test out the message box properly",
wxMessageDialog dialog( NULL, "This is a message box\nA long, long string to test out the message box properly",
"Message box text", wxYES_NO|wxCANCEL|wxICON_INFORMATION);
dialog.ShowModal();

View File

@@ -241,13 +241,25 @@ void MyFrame::OnInsertPage(wxCommandEvent& WXUNUSED(event))
m_notebook->SetSelection(0);
}
wxWindow *test = NULL;
void MyFrame::OnDeletePage(wxCommandEvent& WXUNUSED(event))
{
if (m_notebook->GetPageCount() > 0)
m_notebook->DeletePage( m_notebook->GetPageCount()-1 );
// VZ: this crashes wxGTK
//m_notebook->RemovePage( m_notebook->GetPageCount()-1 );
/*
if (test)
{
m_notebook->AddPage( test, "Readded" );
test = NULL;
}
else
{
test = m_notebook->GetPage( m_notebook->GetPageCount()-1 );
m_notebook->RemovePage( m_notebook->GetPageCount()-1 );
}
*/
}
void MyFrame::OnNextPage(wxCommandEvent& WXUNUSED(event))

View File

@@ -619,6 +619,16 @@ int wxDialog::ShowModal()
return GetReturnCode();
}
if ( !GetParent() )
{
wxWindow *parent = wxTheApp->GetTopWindow();
if ( parent && parent != this )
{
m_parent = parent;
gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(parent->m_widget) );
}
}
wxBusyCursorSuspender cs; // temporarily suppress the busy cursor
Show( TRUE );

View File

@@ -538,9 +538,11 @@ bool wxNotebook::RemovePage( int page )
wxCHECK_MSG( nb_page, FALSE, _T("wxNotebook::RemovePage: invalid page") );
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
gtk_widget_ref( nb_page->m_client->m_widget );
gtk_widget_unrealize( nb_page->m_client->m_widget );
gtk_widget_unparent( nb_page->m_client->m_widget );
nb_page->m_client->Destroy();
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
m_pages.DeleteObject( nb_page );

View File

@@ -619,6 +619,16 @@ int wxDialog::ShowModal()
return GetReturnCode();
}
if ( !GetParent() )
{
wxWindow *parent = wxTheApp->GetTopWindow();
if ( parent && parent != this )
{
m_parent = parent;
gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(parent->m_widget) );
}
}
wxBusyCursorSuspender cs; // temporarily suppress the busy cursor
Show( TRUE );

View File

@@ -538,9 +538,11 @@ bool wxNotebook::RemovePage( int page )
wxCHECK_MSG( nb_page, FALSE, _T("wxNotebook::RemovePage: invalid page") );
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
gtk_widget_ref( nb_page->m_client->m_widget );
gtk_widget_unrealize( nb_page->m_client->m_widget );
gtk_widget_unparent( nb_page->m_client->m_widget );
nb_page->m_client->Destroy();
gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );
m_pages.DeleteObject( nb_page );