45 #include <private/qapplication_p.h> 46 #include <private/qprintengine_mac_p.h> 47 #include <private/qabstractpagesetupdialog_p.h> 49 #ifndef QT_NO_PRINTDIALOG 55 @interface QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate) : NSObject {
59 - (void)pageLayoutDidEnd:(NSPageLayout *)pageLayout
60 returnCode:(
int)returnCode contextInfo:(
void *)contextInfo;
63 @implementation QT_MANGLE_NAMESPACE(QCocoaPageLayoutDelegate)
73 - (void)pageLayoutDidEnd:(NSPageLayout *)pageLayout
74 returnCode:(
int)returnCode contextInfo:(
void *)contextInfo
78 if (returnCode == NSOKButton) {
80 PMGetUnadjustedPaperRect(pe->format, &paperRect);
81 pe->customSize =
QSizeF(paperRect.right - paperRect.left,
82 paperRect.bottom - paperRect.top);
99 #ifndef QT_MAC_USE_COCOA
107 #ifndef QT_MAC_USE_COCOA 109 DisposePMSheetDoneUPP(upp);
113 while (it != sheetCallbackMap.end()) {
114 if (it.
value() ==
this) {
115 it = sheetCallbackMap.erase(it);
123 #ifndef QT_MAC_USE_COCOA 125 void closeCarbonPageLayout();
129 qWarning(
"%s:%d: QPageSetupDialog::exec: Could not retrieve data structure, " 130 "you most likely now have an infinite modal loop", __FILE__, __LINE__);
137 void closeCocoaPageLayout();
141 #ifndef QT_MAC_USE_COCOA 145 NSPageLayout *pageLayout;
149 #ifndef QT_MAC_USE_COCOA 156 if (ep->session == 0)
159 sheetCallbackMap.insert(ep->session,
this);
167 PMSessionPageSetupDialog(ep->session, ep->format, &accepted);
170 pageSetupDialogSheetDoneCallback(ep->session, 0, accepted);
177 PMSessionPageSetupDialog(ep->session, ep->format, &unused);
187 PMPaperMargins margins;
188 PMGetPageFormatPaper(ep->format, &paper);
189 PMPaperGetMargins(paper, &margins);
190 ep->leftMargin = margins.left;
191 ep->topMargin = margins.top;
192 ep->rightMargin = margins.right;
193 ep->bottomMargin = margins.bottom;
196 PMGetUnadjustedPaperRect(ep->format, &paperRect);
197 ep->customSize =
QSizeF(paperRect.right - paperRect.left,
198 paperRect.bottom - paperRect.top);
200 sheetCallbackMap.remove(ep->session);
209 if (ep->session == 0)
213 pageLayout = [NSPageLayout pageLayout];
219 int rval = [pageLayout runModalWithPrintInfo:ep->printInfo];
220 [delegate pageLayoutDidEnd:pageLayout returnCode:rval contextInfo:q];
223 [pageLayout beginSheetWithPrintInfo:ep->printInfo
224 modalForWindow:qt_mac_window_for(q->parentWidget())
226 didEndSelector:@selector(pageLayoutDidEnd:returnCode:contextInfo:)
233 void QPageSetupDialogPrivate::closeCocoaPageLayout()
238 ep->session =
static_cast<PMPrintSession
>([
ep->printInfo PMPrintSession]);
240 [pageLayout release];
266 #ifndef QT_MAC_USE_COCOA 267 bool isCurrentlyVisible =
d->sheetCallbackMap.contains(
d->ep->session);
269 bool isCurrentlyVisible = (
d->pageLayout != 0);
271 if (!visible == !isCurrentlyVisible)
275 #ifndef QT_MAC_USE_COCOA 280 : Qt::ApplicationModal);
284 #ifndef QT_MAC_USE_COCOA 285 d->closeCarbonPageLayout();
288 d->closeCocoaPageLayout();
302 #ifndef QT_MAC_USE_COCOA 304 d->closeCarbonPageLayout();
308 d->closeCocoaPageLayout();
#define QT_END_NAMESPACE
This macro expands to.
#define it(className, varName)
void macStartInterceptWindowTitle(QWidget *window)
struct OpaqueWindowPtr * WindowRef
void closeCarbonPageLayout()
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
T & value() const
Returns a modifiable reference to the current item's value.
The QAbstractPageSetupDialog class provides a base for implementations of page setup dialogs...
The QHash class is a template class that provides a hash-table-based dictionary.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
OSWindowRef qt_mac_window_for(const QWidget *)
void setObjectName(const QString &name)
QPageSetupDialog(QPrinter *printer, QWidget *parent=0)
Constructs a page setup dialog that configures printer with parent as the parent widget.
void done(int result)
Reimplemented Function
~QPageSetupDialogPrivate()
The QPageSetupDialog class provides a configuration dialog for the page-related options on a printer...
#define QT_BEGIN_NAMESPACE
This macro expands to.
QMacPrintEnginePrivate * pe
The QPrinter class is a paint device that paints on a printer.
Q_CORE_EXPORT void qWarning(const char *,...)
QPageSetupDialogPrivate()
static QHash< PMPrintSession, QPageSetupDialogPrivate * > sheetCallbackMap
QMacPrintEnginePrivate * ep
static void pageSetupDialogSheetDoneCallback(PMPrintSession printSession, WindowRef, Boolean accepted)
void openCarbonPageLayout(Qt::WindowModality modality)
#define Q_DECLARE_PUBLIC(Class)
#define QT_MANGLE_NAMESPACE(name)
QObject * parent() const
Returns a pointer to the parent object.
int result() const
In general returns the modal dialog's result code, Accepted or Rejected.
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
static bool native_modal_dialog_active
void macStopInterceptWindowTitle()
#define QT_USE_NAMESPACE
This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined and nothing otherwise.
static void leaveModal(QWidget *)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static void enterModal(QWidget *)
virtual void setVisible(bool visible)
Reimplemented Function