+#ifdef __WXMAC__
+void wxPageSetupDialogData::ConvertToNative()
+{
+ if ( !m_macPageSetupInfo )
+ {
+ m_macPageSetupInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
+ if ( m_macPageSetupInfo )
+ {
+ ::PrintDefault( m_macPageSetupInfo ) ;
+ }
+ }
+ if ( m_macPageSetupInfo )
+ {
+ // on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0
+ (**m_macPageSetupInfo).rPaper.left = int( ((double) m_minMarginTopLeft.x)*mm2pt ) ;
+ (**m_macPageSetupInfo).rPaper.top = int( ((double) m_minMarginTopLeft.y)*mm2pt ) ;
+
+ (**m_macPageSetupInfo).rPaper.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x)*mm2pt ) ;
+ (**m_macPageSetupInfo).rPaper.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y)*mm2pt ) ;
+
+ (**m_macPageSetupInfo).prInfo.rPage.left = 0 ;
+ (**m_macPageSetupInfo).prInfo.rPage.top = 0 ;
+ (**m_macPageSetupInfo).prInfo.rPage.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x - m_minMarginBottomRight.x)*mm2pt ) ;
+ (**m_macPageSetupInfo).prInfo.rPage.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y - m_minMarginBottomRight.y)*mm2pt ) ;
+
+ //TODO add custom fields in dialog for margins
+
+ }
+}
+
+void wxPageSetupDialogData::ConvertFromNative()
+{
+ if ( m_macPageSetupInfo )
+ {
+ m_paperSize.x = ((double) (**m_macPageSetupInfo).rPaper.right - (**m_macPageSetupInfo).rPaper.left ) * pt2mm ;
+ m_paperSize.y = ((double) (**m_macPageSetupInfo).rPaper.bottom - (**m_macPageSetupInfo).rPaper.top ) * pt2mm ;
+
+ m_minMarginTopLeft.x = ((double) -(**m_macPageSetupInfo).rPaper.left ) * pt2mm ;
+ m_minMarginTopLeft.y = ((double) -(**m_macPageSetupInfo).rPaper.top ) * pt2mm ;
+
+ m_minMarginBottomRight.x = ((double) (**m_macPageSetupInfo).rPaper.right - (**m_macPageSetupInfo).prInfo.rPage.right ) * pt2mm ;
+ m_minMarginBottomRight.y = ((double)(**m_macPageSetupInfo).rPaper.bottom - (**m_macPageSetupInfo).prInfo.rPage.bottom ) * pt2mm ;
+
+ // adjust minimal values
+ //TODO add custom fields in dialog for margins
+
+ if ( m_marginTopLeft.x < m_minMarginTopLeft.x )
+ m_marginTopLeft.x = m_minMarginTopLeft.x ;
+
+ if ( m_marginBottomRight.x < m_minMarginBottomRight.x )
+ m_marginBottomRight.x = m_minMarginBottomRight.x ;
+
+ if ( m_marginTopLeft.y < m_minMarginTopLeft.y )
+ m_marginTopLeft.y = m_minMarginTopLeft.y ;
+
+ if ( m_marginBottomRight.y < m_minMarginBottomRight.y )
+ m_marginBottomRight.y = m_minMarginBottomRight.y ;
+
+ }
+}
+#endif
+
+