]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/printdlg.cpp
Had missed one LPSTR.
[wxWidgets.git] / src / msw / printdlg.cpp
index 8639e41fbb217813582a1488b34bfa365f18191e..c9e98a3dbfa865e1c53a51b53d460f68f6433ea3 100644 (file)
@@ -6,21 +6,26 @@
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows license
+// Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 
+// ===========================================================================
+// declarations
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// headers
+// ---------------------------------------------------------------------------
+
 #ifdef __GNUG__
-#pragma implementation "printdlg.h"
+    #pragma implementation "printdlg.h"
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#if defined(__BORLANDC__)
-#pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
+#ifdef __BORLANDC__
+    #pragma hdrstop
 #endif
 
 #include "wx/printdlg.h"
 
 // Have to emulate page setup dialog for Win16
 #if !defined(__WIN95__)
-#include "wx/generic/prntdlgg.h"
+    #include "wx/generic/prntdlgg.h"
 #endif
 
 #include <stdlib.h>
-#include <windows.h>
+
+#include "wx/msw/private.h"
+
 #include <commdlg.h>
 
 #ifndef __WIN32__
-#include <print.h>
+    #include <print.h>
 #endif
 
-// Clash with Windows header files
-#ifdef StartDoc
-#undef StartDoc
-#endif
+// ---------------------------------------------------------------------------
+// wxWin macros
+// ---------------------------------------------------------------------------
 
 #if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
-IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
+    IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
+    IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
 #endif
 
-wxPrintDialog::wxPrintDialog(void):
- wxDialog()
+// ===========================================================================
+// implementation
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// wxPrintDialog
+// ---------------------------------------------------------------------------
+
+wxPrintDialog::wxPrintDialog()
 {
-  dialogParent = NULL;
-  printerDC = NULL;
-  destroyDC = TRUE;
-  deviceName = NULL;
-  driverName = NULL;
-  portName = NULL;
+    m_dialogParent = NULL;
+    m_printerDC = NULL;
+    m_destroyDC = TRUE;
 }
 
-wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data):
- wxDialog()
+wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintDialogData* data)
 {
-  Create(p, data);
+    Create(p, data);
 }
 
-bool wxPrintDialog::Create(wxWindow *p, wxPrintData* data)
+wxPrintDialog::wxPrintDialog(wxWindow *p, wxPrintData* data)
 {
-  dialogParent = p;
-  printerDC = NULL;
-  destroyDC = TRUE;
-  deviceName = NULL;
-  driverName = NULL;
-  portName = NULL;
-
-  if ( data )
-    printData = *data;
-
-#ifdef __WXMSW__
-  printData.SetOwnerWindow(p);
-#endif
+    wxPrintDialogData data2;
+    if ( data )
+        data2 = *data;
 
-  return TRUE;
+    Create(p, &data2);
 }
 
-wxPrintDialog::~wxPrintDialog(void)
+bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
 {
-  if (destroyDC && printerDC)
-    delete printerDC;
-  if (deviceName) delete[] deviceName;
-  if (driverName) delete[] driverName;
-  if (portName) delete[] portName;
+    m_dialogParent = p;
+    m_printerDC = NULL;
+    m_destroyDC = TRUE;
+
+    if ( data )
+        m_printDialogData = *data;
+
+    m_printDialogData.SetOwnerWindow(p);
+
+    return TRUE;
 }
 
-int wxPrintDialog::ShowModal(void)
+wxPrintDialog::~wxPrintDialog()
 {
-  printData.ConvertToNative();
-
-  bool ret = (PrintDlg( (PRINTDLG *)printData.printData ) != 0);
-  if ( ret != FALSE && ((PRINTDLG *)printData.printData)->hDC)
-  {
-    wxPrinterDC *pdc = new wxPrinterDC((WXHDC) ((PRINTDLG *)printData.printData)->hDC);
-    printerDC = pdc;
-    printData.ConvertFromNative();
-    return wxID_OK;
-  }
-  else
-  {
-/*
-      char buf[256];
-      DWORD exError = CommDlgExtendedError();
-      sprintf(buf, "ret = %d, ex error = %d", (int) ret, (int) exError);
-      wxMessageBox(buf);
-*/
-      return wxID_CANCEL;
-  }
+    if (m_destroyDC && m_printerDC)
+        delete m_printerDC;
 }
 
-wxDC *wxPrintDialog::GetPrintDC(void)
+int wxPrintDialog::ShowModal()
 {
-  if (printerDC)
-  {
-    destroyDC = FALSE;
-    return printerDC;
-  }
-  else
-    return NULL;
+    m_printDialogData.ConvertToNative();
+
+    bool ret = (PrintDlg( (PRINTDLG *)m_printDialogData.GetNativeData() ) != 0);
+    if ( ret != FALSE && ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC)
+    {
+        wxPrinterDC *pdc = new wxPrinterDC((WXHDC) ((PRINTDLG *)m_printDialogData.GetNativeData())->hDC);
+        m_printerDC = pdc;
+        m_printDialogData.ConvertFromNative();
+        return wxID_OK;
+    }
+    else
+    {
+        return wxID_CANCEL;
+    }
+}
+
+wxDC *wxPrintDialog::GetPrintDC()
+{
+    if (m_printerDC)
+    {
+        m_destroyDC = FALSE;
+        return m_printerDC;
+    }
+    else
+        return (wxDC*) NULL;
 }
 
-/*
- * wxPageSetupDialog
- */
+// ---------------------------------------------------------------------------
+// wxPageSetupDialog
+// ---------------------------------------------------------------------------
 
-wxPageSetupDialog::wxPageSetupDialog(void):
- wxDialog()
+wxPageSetupDialog::wxPageSetupDialog()
 {
-  m_dialogParent = NULL;
+    m_dialogParent = NULL;
 }
 
-wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data):
- wxDialog()
+wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data)
 {
-  Create(p, data);
+    Create(p, data);
 }
 
 bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data)
 {
-  m_dialogParent = p;
+    m_dialogParent = p;
 
-  if (data)
-    m_pageSetupData = (*data);
+    if (data)
+        m_pageSetupData = (*data);
 
 #if defined(__WIN95__)
-  m_pageSetupData.SetOwnerWindow(p);
+    m_pageSetupData.SetOwnerWindow(p);
 #endif
-  return TRUE;
+    return TRUE;
 }
 
-wxPageSetupDialog::~wxPageSetupDialog(void)
+wxPageSetupDialog::~wxPageSetupDialog()
 {
 }
 
-int wxPageSetupDialog::ShowModal(void)
+int wxPageSetupDialog::ShowModal()
 {
 #ifdef __WIN95__
     m_pageSetupData.ConvertToNative();
     if (PageSetupDlg( (PAGESETUPDLG *)m_pageSetupData.GetNativeData() ))
     {
-      m_pageSetupData.ConvertFromNative();
-      return wxID_OK;
+        m_pageSetupData.ConvertFromNative();
+        return wxID_OK;
     }
     else
-      return wxID_CANCEL;
+        return wxID_CANCEL;
 #else
     wxGenericPageSetupDialog *genericPageSetupDialog = new wxGenericPageSetupDialog(GetParent(), & m_pageSetupData);
     int ret = genericPageSetupDialog->ShowModal();