X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2646f485163f410baaad5bcf49028c604a352d19..3f4a2351e4c677c88c18ea812b609477adee7380:/src/mac/classic/dialog.cpp diff --git a/src/mac/classic/dialog.cpp b/src/mac/classic/dialog.cpp index f29ed3e59e..198acc1f4c 100644 --- a/src/mac/classic/dialog.cpp +++ b/src/mac/classic/dialog.cpp @@ -1,33 +1,31 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dialog.cpp +// Name: src/mac/classic/dialog.cpp // Purpose: wxDialog class // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "dialog.h" -#endif +#include "wx/wxprec.h" #include "wx/dialog.h" -#include "wx/utils.h" -#include "wx/frame.h" -#include "wx/app.h" -#include "wx/settings.h" + +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/utils.h" + #include "wx/frame.h" + #include "wx/settings.h" +#endif // WX_PRECOMP #include "wx/mac/uma.h" // Lists to keep track of windows, so we can disable/enable them // for modal dialogs wxList wxModalDialogs; -//wxList wxModelessWindows; // Frames and modeless dialogs -extern wxList wxPendingDelete; -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow) BEGIN_EVENT_TABLE(wxDialog, wxDialogBase) @@ -42,11 +40,9 @@ BEGIN_EVENT_TABLE(wxDialog, wxDialogBase) EVT_CLOSE(wxDialog::OnCloseWindow) END_EVENT_TABLE() -#endif - -wxDialog::wxDialog() +void wxDialog::Init() { - m_isShown = FALSE; + m_isModalStyle = false; SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); } @@ -61,21 +57,21 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id, if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) - return FALSE; + return false; MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style) & ~(wxYES|wxOK|wxNO|wxCANCEL) , name ) ; m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ; SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ; - return TRUE; + return true; } void wxDialog::SetModal(bool flag) { if ( flag ) { - m_windowStyle |= wxDIALOG_MODAL; + m_isModalStyle = true; wxModelessWindows.DeleteObject(this); #if TARGET_CARBON @@ -84,7 +80,7 @@ void wxDialog::SetModal(bool flag) } else { - m_windowStyle &= ~wxDIALOG_MODAL; + m_isModalStyle = false; wxModelessWindows.Append(this); } @@ -92,8 +88,8 @@ void wxDialog::SetModal(bool flag) wxDialog::~wxDialog() { - m_isBeingDeleted = TRUE; - Show(FALSE); + m_isBeingDeleted = true; + Show(false); } // By default, pressing escape cancels the dialog , on mac command-stop does the same thing @@ -117,7 +113,7 @@ void wxDialog::OnCharHook(wxKeyEvent& event) bool wxDialog::IsModal() const { - return (GetWindowStyleFlag() & wxDIALOG_MODAL) != 0; + return m_isModalStyle; } @@ -131,7 +127,7 @@ bool wxDialog::Show(bool show) if ( !wxDialogBase::Show(show) ) { // nothing to do - return FALSE; + return false; } if ( show ) @@ -148,13 +144,13 @@ bool wxDialog::Show(bool show) } else // end of modal dialog { - // this will cause IsModalShowing() return FALSE and our local + // this will cause IsModalShowing() return false and our local // message loop will terminate wxModalDialogs.DeleteObject(this); } } - return TRUE; + return true; } #if !TARGET_CARBON @@ -189,15 +185,15 @@ void wxDialog::DoShowModal() } -// Replacement for Show(TRUE) for modal dialogs - returns return code +// Replacement for Show(true) for modal dialogs - returns return code int wxDialog::ShowModal() { if ( !IsModal() ) { - SetModal(TRUE); + SetModal(true); } - Show(TRUE); + Show(true); return GetReturnCode(); } @@ -205,8 +201,8 @@ int wxDialog::ShowModal() // dialogs and should work for both of them void wxDialog::EndModal(int retCode) { - SetReturnCode(retCode); - Show(FALSE); + SetReturnCode(retCode); + Show(false); } // Standard buttons @@ -265,4 +261,3 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); Refresh(); } -