X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9d5cfd0e64a2c09d957517405758de680806e674..7c60222510bc5e197b12f153c4bf05db66cb0f4a:/src/osx/cocoa/printdlg.mm?ds=sidebyside diff --git a/src/osx/cocoa/printdlg.mm b/src/osx/cocoa/printdlg.mm index d10cea723a..f453778334 100644 --- a/src/osx/cocoa/printdlg.mm +++ b/src/osx/cocoa/printdlg.mm @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/osx/carbon/printdlg.cpp +// Name: src/osx/cocoa/printdlg.mm // Purpose: wxPrintDialog, wxPageSetupDialog // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 -// RCS-ID: $Id: printdlg.cpp 55419 2008-09-02 16:53:23Z SC $ +// RCS-ID: $Id$ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -14,6 +14,7 @@ #if wxUSE_PRINTING_ARCHITECTURE #include "wx/printdlg.h" +#include "wx/modalhook.h" #ifndef WX_PRECOMP #include "wx/object.h" @@ -33,10 +34,10 @@ IMPLEMENT_CLASS(wxOSXCocoaPrintData, wxOSXPrintData) wxOSXCocoaPrintData::wxOSXCocoaPrintData() { m_macPrintInfo = [[NSPrintInfo alloc] init]; - // TODO add 10.4 code m_macPageFormat = (PMPageFormat) [m_macPrintInfo PMPageFormat]; m_macPrintSettings = (PMPrintSettings) [m_macPrintInfo PMPrintSettings]; m_macPrintSession = (PMPrintSession) [m_macPrintInfo PMPrintSession] ; + PMGetPageFormatPaper(m_macPageFormat, &m_macPaper); } wxOSXCocoaPrintData::~wxOSXCocoaPrintData() @@ -46,14 +47,12 @@ wxOSXCocoaPrintData::~wxOSXCocoaPrintData() void wxOSXCocoaPrintData::UpdateFromPMState() { - // TODO add 10.4 code [m_macPrintInfo updateFromPMPageFormat]; [m_macPrintInfo updateFromPMPrintSettings]; } void wxOSXCocoaPrintData::UpdateToPMState() { - // TODO add 10.4 code m_macPageFormat = (PMPageFormat) [m_macPrintInfo PMPageFormat]; m_macPrintSettings = (PMPrintSettings) [m_macPrintInfo PMPrintSettings]; m_macPrintSession = (PMPrintSession) [m_macPrintInfo PMPrintSession] ; @@ -61,12 +60,19 @@ void wxOSXCocoaPrintData::UpdateToPMState() int wxMacPrintDialog::ShowModal() { + WX_HOOK_MODAL_DIALOG(); + m_printDialogData.GetPrintData().ConvertToNative(); int result = wxID_CANCEL; - + NSPrintPanel* panel = [NSPrintPanel printPanel]; NSPrintInfo* printInfo = ((wxOSXCocoaPrintData*)m_printDialogData.GetPrintData().GetNativeData())->GetNSPrintInfo(); + + NSMutableDictionary* dict = [printInfo printSettings]; + [dict setValue:[NSNumber numberWithInt:m_printDialogData.GetMinPage()] forKey:@"com_apple_print_PrintSettings_PMFirstPage"]; + [dict setValue:[NSNumber numberWithInt:m_printDialogData.GetMaxPage()] forKey:@"com_apple_print_PrintSettings_PMLastPage"]; + if ( (NSInteger)[panel runModalWithPrintInfo:printInfo] == NSOKButton ) { result = wxID_OK; @@ -79,6 +85,8 @@ int wxMacPrintDialog::ShowModal() int wxMacPageSetupDialog::ShowModal() { + WX_HOOK_MODAL_DIALOG(); + m_pageSetupData.GetPrintData().ConvertToNative(); ((wxOSXCocoaPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferFrom( &m_pageSetupData ); @@ -92,7 +100,7 @@ int wxMacPageSetupDialog::ShowModal() m_pageSetupData.GetPrintData().ConvertFromNative(); m_pageSetupData.SetPaperSize( m_pageSetupData.GetPrintData().GetPaperSize() ); } - + return result; }