X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c67daf87774c71ae9f73af9969008af220e52a11..605c9c8318875c590fce53cd2ce5d5aabcc92564:/src/gtk/dialog.cpp diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 929a4ecd77..589ef94f45 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -2,9 +2,8 @@ // Name: dialog.cpp // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,7 +21,8 @@ extern wxList wxPendingDelete; //----------------------------------------------------------------------------- -// delete +// "delete_event" +//----------------------------------------------------------------------------- bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win ) { @@ -42,14 +42,14 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED // wxDialog //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(wxDialog,wxWindow) +BEGIN_EVENT_TABLE(wxDialog,wxPanel) EVT_BUTTON (wxID_OK, wxDialog::OnOK) EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel) EVT_BUTTON (wxID_APPLY, wxDialog::OnApply) EVT_CLOSE (wxDialog::OnCloseWindow) END_EVENT_TABLE() -IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxWindow) +IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxPanel) wxDialog::wxDialog(void) { @@ -98,6 +98,9 @@ bool wxDialog::Create( wxWindow *parent, gtk_widget_set_usize( m_widget, m_width, m_height ); + if (m_parent) m_parent->AddChild( this ); + + PostCreation(); return TRUE; @@ -207,7 +210,7 @@ void wxDialog::Centre( int direction ) bool wxDialog::Show( bool show ) { - if (!show && IsModal() && m_modalShowing) + if (!show && IsModal()) { EndModal( wxID_CANCEL ); } @@ -219,17 +222,29 @@ bool wxDialog::Show( bool show ) return TRUE; } -void wxDialog::SetModal(bool flag) +bool wxDialog::IsModal(void) const { + return m_modalShowing; +} + +void wxDialog::SetModal( bool WXUNUSED(flag) ) +{ +/* if (flag) m_windowStyle |= wxDIALOG_MODAL; else if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL; +*/ + wxFAIL_MSG( "wxDialog:SetModal obsolete now" ); } int wxDialog::ShowModal(void) { - if (m_modalShowing) return GetReturnCode(); + if (IsModal()) + { + wxFAIL_MSG( "wxDialog:ShowModal called twice" ); + return GetReturnCode(); + } Show( TRUE ); @@ -246,15 +261,17 @@ void wxDialog::EndModal( int retCode ) { SetReturnCode( retCode ); - if (!m_modalShowing) + if (!IsModal()) { - wxFAIL_MSG( "wxDialog: called EndModal twice" ); + wxFAIL_MSG( "wxDialog:EndModal called twice" ); return; } m_modalShowing = FALSE; gtk_main_quit(); + + Show( FALSE ); } void wxDialog::InitDialog(void) @@ -262,12 +279,6 @@ void wxDialog::InitDialog(void) wxWindow::InitDialog(); } -void wxDialog::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(incW) ) -{ - gdk_window_set_hints( m_widget->window, -1, -1, - minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE ); -} - void wxDialog::SetIcon( const wxIcon &icon ) { m_icon = icon; @@ -279,5 +290,3 @@ void wxDialog::SetIcon( const wxIcon &icon ) gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm ); } - -