]> git.saurik.com Git - wxWidgets.git/commitdiff
Made wxPageSetupDialog a pimpl implementation.
authorRobert Roebling <robert@roebling.de>
Sat, 20 Nov 2004 14:46:25 +0000 (14:46 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 20 Nov 2004 14:46:25 +0000 (14:46 +0000)
  Added a few clean-ups.
  Added native GNOME page setup dialog.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30669 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

14 files changed:
include/wx/generic/prntdlgg.h
include/wx/gtk/gnome/gprint.h
include/wx/gtk1/gnome/gprint.h
include/wx/mac/carbon/printdlg.h
include/wx/msw/printdlg.h
include/wx/printdlg.h
include/wx/prntbase.h
src/generic/prntdlgg.cpp
src/gtk/gnome/gprint.cpp
src/gtk1/gnome/gprint.cpp
src/mac/carbon/printdlg.cpp
src/mac/carbon/printmac.cpp
src/msw/dcprint.cpp
src/msw/printdlg.cpp

index 229886a97aa8c5e4afbc4c0c54340a6c8df79777..2e224659813f8f7275b685d7287f042b08d0859e 100644 (file)
@@ -221,20 +221,20 @@ private:
 #endif
     // wxUSE_POSTSCRIPT
 
-class WXDLLEXPORT wxGenericPageSetupDialog : public wxDialog
+class WXDLLEXPORT wxGenericPageSetupDialog : public wxPageSetupDialogBase
 {
 public:
     wxGenericPageSetupDialog(wxWindow *parent = NULL,
-                             wxPageSetupData* data = NULL);
+                             wxPageSetupDialogData* data = NULL);
     virtual ~wxGenericPageSetupDialog();
 
     virtual bool TransferDataFromWindow();
     virtual bool TransferDataToWindow();
 
-    void OnPrinter(wxCommandEvent& event);
+    virtual wxPageSetupDialogData& GetPageSetupDialogData();
 
+    void OnPrinter(wxCommandEvent& event);
     wxComboBox *CreatePaperTypeChoice(int* x, int* y);
-    wxPageSetupData& GetPageSetupData() { return m_pageData; }
 
 public:
     wxButton*       m_printerButton;
@@ -245,7 +245,7 @@ public:
     wxTextCtrl*     m_marginBottomText;
     wxComboBox*       m_paperTypeChoice;
 
-    wxPageSetupData m_pageData;
+    wxPageSetupDialogData m_pageData;
 
 private:
     DECLARE_EVENT_TABLE()
index 77e924d71134dc456f9b4e5c5a93c58a42bd58cd..0c107301d4c403ad539da198955940093c7289ce 100644 (file)
@@ -77,7 +77,10 @@ public:
                                                   wxPrintDialogData *data = NULL );
     virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, 
                                                   wxPrintData *data );
-                                                  
+
+    virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
+                                                          wxPageSetupDialogData * data = NULL );
+          
     virtual bool HasPrintSetupDialog();
     virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
     virtual bool HasOwnPrintToFile();
@@ -97,7 +100,7 @@ class wxGnomePrintDialog: public wxPrintDialogBase
 {
 public:
     wxGnomePrintDialog( wxWindow *parent,
-                         wxPrintDialogData* data = (wxPrintDialogData*)NULL );
+                         wxPrintDialogData* data = NULL );
     wxGnomePrintDialog( wxWindow *parent, wxPrintData* data);
     ~wxGnomePrintDialog();
 
@@ -130,6 +133,40 @@ private:
     DECLARE_DYNAMIC_CLASS(wxGnomePrintDialog)
 };
 
+//----------------------------------------------------------------------------
+// wxGnomePageSetupDialog
+//----------------------------------------------------------------------------
+
+class wxGnomePageSetupDialog: public wxPageSetupDialogBase
+{
+public:
+    wxGnomePageSetupDialog( wxWindow *parent,
+                            wxPageSetupDialogData* data = NULL );
+    ~wxGnomePageSetupDialog();
+
+    virtual wxPageSetupDialogData& GetPageSetupDialogData();
+
+    virtual int ShowModal();
+
+    virtual bool Validate();
+    virtual bool TransferDataToWindow();
+    virtual bool TransferDataFromWindow();
+
+private:    
+    // Implement some base class methods to do nothing to avoid asserts and
+    // GTK warnings, since this is not a real wxDialog.
+    virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
+                           int WXUNUSED(width), int WXUNUSED(height),
+                           int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
+    virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
+                              int WXUNUSED(width), int WXUNUSED(height)) {}
+                              
+    wxPageSetupDialogData   m_pageDialogData;
+    
+private:
+    DECLARE_DYNAMIC_CLASS(wxGnomePageSetupDialog)
+};
+
 //----------------------------------------------------------------------------
 // wxGnomePrinter
 //----------------------------------------------------------------------------
index 77e924d71134dc456f9b4e5c5a93c58a42bd58cd..0c107301d4c403ad539da198955940093c7289ce 100644 (file)
@@ -77,7 +77,10 @@ public:
                                                   wxPrintDialogData *data = NULL );
     virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, 
                                                   wxPrintData *data );
-                                                  
+
+    virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
+                                                          wxPageSetupDialogData * data = NULL );
+          
     virtual bool HasPrintSetupDialog();
     virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
     virtual bool HasOwnPrintToFile();
@@ -97,7 +100,7 @@ class wxGnomePrintDialog: public wxPrintDialogBase
 {
 public:
     wxGnomePrintDialog( wxWindow *parent,
-                         wxPrintDialogData* data = (wxPrintDialogData*)NULL );
+                         wxPrintDialogData* data = NULL );
     wxGnomePrintDialog( wxWindow *parent, wxPrintData* data);
     ~wxGnomePrintDialog();
 
@@ -130,6 +133,40 @@ private:
     DECLARE_DYNAMIC_CLASS(wxGnomePrintDialog)
 };
 
+//----------------------------------------------------------------------------
+// wxGnomePageSetupDialog
+//----------------------------------------------------------------------------
+
+class wxGnomePageSetupDialog: public wxPageSetupDialogBase
+{
+public:
+    wxGnomePageSetupDialog( wxWindow *parent,
+                            wxPageSetupDialogData* data = NULL );
+    ~wxGnomePageSetupDialog();
+
+    virtual wxPageSetupDialogData& GetPageSetupDialogData();
+
+    virtual int ShowModal();
+
+    virtual bool Validate();
+    virtual bool TransferDataToWindow();
+    virtual bool TransferDataFromWindow();
+
+private:    
+    // Implement some base class methods to do nothing to avoid asserts and
+    // GTK warnings, since this is not a real wxDialog.
+    virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
+                           int WXUNUSED(width), int WXUNUSED(height),
+                           int WXUNUSED(sizeFlags) = wxSIZE_AUTO) {}
+    virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
+                              int WXUNUSED(width), int WXUNUSED(height)) {}
+                              
+    wxPageSetupDialogData   m_pageDialogData;
+    
+private:
+    DECLARE_DYNAMIC_CLASS(wxGnomePageSetupDialog)
+};
+
 //----------------------------------------------------------------------------
 // wxGnomePrinter
 //----------------------------------------------------------------------------
index c7f92db66cc6c04c18202346dc1fc4eb8b9a4ca8..5ea44000980ec72afbfedc2d0f6359243d6313ca 100644 (file)
@@ -40,8 +40,8 @@ public:
 };
     
 /*
- * wxPrinterDialog
- * The common dialog for printing.
+ * wxMacPrintDialog
+ * The Mac dialog for printing
  */
 
 class WXDLLEXPORT wxDC;
@@ -70,22 +70,28 @@ private:
     DECLARE_DYNAMIC_CLASS(wxPrintDialog)
 };
 
-class WXDLLEXPORT wxPageSetupDialog: public wxDialog
-{
-  DECLARE_DYNAMIC_CLASS(wxPageSetupDialog)
-
- public:
-  wxPageSetupDialog();
-  wxPageSetupDialog(wxWindow *parent, wxPageSetupData *data = NULL);
-  ~wxPageSetupDialog();
+/*
+ * wxMacPageSetupDialog
+ * The Mac page setup dialog
+ */
 
-  bool Create(wxWindow *parent, wxPageSetupData *data = NULL);
-  virtual int ShowModal();
+class WXDLLEXPORT wxMacPageSetupDialog: public wxPageSetupDialogBase
+{
+public:
+    wxMacPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL);
+    ~wxMacPageSetupDialog();
 
-  inline wxPageSetupData& GetPageSetupData() { return m_pageSetupData; }
- private:
-  wxPageSetupData   m_pageSetupData;
-  wxWindow*         m_dialogParent;
+    virtual wxPageSetupData& GetPageSetupDialogData();
+    
+    bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL);
+    virtual int ShowModal();
+  
+private:
+    wxPageSetupDialogData   m_pageSetupData;
+    wxWindow*               m_dialogParent;
+  
+private:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacPageSetupDialog)
 };
 
 #endif
index 1396ddc026bdd04addb499c10fe91f9767ed9e47..dba9a454129d61e0b9fb32c50677d47c45637436 100644 (file)
@@ -54,7 +54,7 @@ private:
 };
     
 // ---------------------------------------------------------------------------
-// wxPrinterDialog: the common dialog for printing.
+// wxWindowsPrintDialog: the MSW dialog for printing
 // ---------------------------------------------------------------------------
 
 class WXDLLEXPORT wxWindowsPrintDialog : public wxPrintDialogBase
@@ -89,28 +89,33 @@ private:
     DECLARE_CLASS(wxWindowsPrintDialog)
 };
 
-class WXDLLEXPORT wxPageSetupDialog: public wxDialog
-{
-    DECLARE_DYNAMIC_CLASS(wxPageSetupDialog)
+// ---------------------------------------------------------------------------
+// wxWindowsPageSetupDialog: the MSW page setup dialog 
+// ---------------------------------------------------------------------------
 
+class WXDLLEXPORT wxWindowsPageSetupDialog: public wxPageSetupDialogBase
+{
 public:
-    wxPageSetupDialog();
-    wxPageSetupDialog(wxWindow *parent, wxPageSetupData *data = NULL);
-    virtual ~wxPageSetupDialog();
+    wxWindowsPageSetupDialog();
+    wxWindowsPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL);
+    virtual ~wxWindowsPageSetupDialog();
 
-    bool Create(wxWindow *parent, wxPageSetupData *data = NULL);
+    bool Create(wxWindow *parent, wxPageSetupDialogData *data = NULL);
     virtual int ShowModal();
     bool ConvertToNative( wxPageSetupDialogData &data );
     bool ConvertFromNative( wxPageSetupDialogData &data );
 
-    wxPageSetupData& GetPageSetupData() { return m_pageSetupData; }
+    virtual wxPageSetupData& GetPageSetupDialogData() { return m_pageSetupData; }
 
 private:
-    wxPageSetupData   m_pageSetupData;
-    wxWindow*         m_dialogParent;
-    void*             m_pageDlg;
+    wxPageSetupDialogData   m_pageSetupData;
+    wxWindow*               m_dialogParent;
+    
+    // holds MSW handle
+    void*                   m_pageDlg;
 
-    DECLARE_NO_COPY_CLASS(wxPageSetupDialog)
+private:
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxWindowsPageSetupDialog)
 };
 
 #endif // wxUSE_PRINTING_ARCHITECTURE
index dfe34ac2676ccbe83b9e8b8172cc3439c1c5b5f9..4486ab32331291ae27008256a311cdbc96c21b5c 100644 (file)
@@ -16,7 +16,7 @@
 
 
 // ---------------------------------------------------------------------------
-// wxPrintDialogBase: interface for the common dialog for printing.
+// wxPrintDialogBase: interface for the dialog for printing
 // ---------------------------------------------------------------------------
 
 class WXDLLEXPORT wxPrintDialogBase : public wxDialog
@@ -30,8 +30,6 @@ public:
                       const wxSize &size = wxDefaultSize,
                       long style = wxDEFAULT_DIALOG_STYLE);
             
-    virtual int ShowModal() = 0;
-
     virtual wxPrintDialogData& GetPrintDialogData() = 0;
     virtual wxPrintData& GetPrintData() = 0;
     virtual wxDC *GetPrintDC() = 0;
@@ -42,7 +40,7 @@ private:
 };
 
 // ---------------------------------------------------------------------------
-// wxPrintDialog: the common dialog for printing.
+// wxPrintDialog: the dialog for printing.
 // ---------------------------------------------------------------------------
 
 class WXDLLEXPORT wxPrintDialog : public wxObject
@@ -66,31 +64,51 @@ private:
     DECLARE_NO_COPY_CLASS(wxPrintDialog)
 };
 
-#endif
+// ---------------------------------------------------------------------------
+// wxPageSetupDialogBase: interface for the page setup dialog
+// ---------------------------------------------------------------------------
 
-#if defined(__WXUNIVERSAL__) && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
-#include "wx/generic/prntdlgg.h"
-#elif defined(__PALMOS__)
-#include "wx/palmos/printdlg.h"
-#elif defined(__WXMSW__)
-#include "wx/msw/printdlg.h"
-#elif defined(__WXMOTIF__)
-#include "wx/generic/prntdlgg.h"
-#elif defined(__WXGTK__)
-#include "wx/generic/prntdlgg.h"
-#elif defined(__WXX11__)
-#include "wx/generic/prntdlgg.h"
-#elif defined(__WXMGL__)
-#include "wx/generic/prntdlgg.h"
-#elif defined(__WXMAC__)
-#include "wx/mac/printdlg.h"
-#elif defined(__WXPM__)
-#include "wx/generic/prntdlgg.h"
-#endif
+class WXDLLEXPORT wxPageSetupDialogBase: public wxDialog
+{
+public:
+    wxPageSetupDialogBase() { }
+    wxPageSetupDialogBase(wxWindow *parent,
+                      wxWindowID id = wxID_ANY,
+                      const wxString &title = wxEmptyString,
+                      const wxPoint &pos = wxDefaultPosition,
+                      const wxSize &size = wxDefaultSize,
+                      long style = wxDEFAULT_DIALOG_STYLE);
+
+    virtual wxPageSetupDialogData& GetPageSetupDialogData() = 0;
+
+private:
+    DECLARE_ABSTRACT_CLASS(wxPageSetupDialogBase)
+    DECLARE_NO_COPY_CLASS(wxPageSetupDialogBase)
+};
+
+// ---------------------------------------------------------------------------
+// wxPageSetupDialog: the page setup dialog
+// ---------------------------------------------------------------------------
+
+class WXDLLEXPORT wxPageSetupDialog: public wxObject
+{
+public:
+    wxPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL);
+    ~wxPageSetupDialog();
+
+    int ShowModal();
+    wxPageSetupDialogData& GetPageSetupDialogData();
+    // old name
+    wxPageSetupDialogData& GetPageSetupData();
+
+private:
+    wxPageSetupDialogBase  *m_pimpl;
+    
+private:
+    DECLARE_DYNAMIC_CLASS(wxPageSetupDialog)
+    DECLARE_NO_COPY_CLASS(wxPageSetupDialog)
+};
 
-#if (defined(__WXUNIVERSAL__) && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) ) || (!defined(__WXMSW__) && !defined(__WXMAC__))
-#define wxPrintSetupDialog wxGenericPrintSetupDialog
-#define wxPageSetupDialog wxGenericPageSetupDialog
 #endif
 
 #endif
index 95bbc6291636d139ed3d2c2925c24b89c307c3a9..3307ba26af44dd8ec5dec2726adc1a215d19e8f5 100644 (file)
@@ -32,8 +32,10 @@ class WXDLLEXPORT wxButton;
 class WXDLLEXPORT wxChoice;
 class WXDLLEXPORT wxPrintout;
 class WXDLLEXPORT wxPrinterBase;
-class WXDLLEXPORT wxPrintDialog;
 class WXDLLEXPORT wxPrintDialogBase;
+class WXDLLEXPORT wxPrintDialog;
+class WXDLLEXPORT wxPageSetupDialogBase;
+class WXDLLEXPORT wxPageSetupDialog;
 class WXDLLEXPORT wxPrintPreviewBase;
 class WXDLLEXPORT wxPreviewCanvas;
 class WXDLLEXPORT wxPreviewControlBar;
@@ -76,6 +78,9 @@ public:
     virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, 
                                                   wxPrintData *data ) = 0;
                                                   
+    virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
+                                                          wxPageSetupDialogData * data = NULL ) = 0;
+                                                  
     // What to do and what to show in the wxPrintDialog
     // a) Use the generic print setup dialog or a native one?
     virtual bool HasPrintSetupDialog() = 0;
@@ -114,6 +119,9 @@ public:
     virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent, 
                                                   wxPrintData *data );
                                                   
+    virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
+                                                          wxPageSetupDialogData * data = NULL );
+                                                  
     virtual bool HasPrintSetupDialog();
     virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data );
     virtual bool HasOwnPrintToFile();
index d9e5b92604bb9e50c7748cc055d5965bbb53385f..9b9e3846c01163f0afd1eb1aba6310643eca89f2 100644 (file)
@@ -810,49 +810,15 @@ wxComboBox *wxGenericPrintSetupDialog::CreatePaperTypeChoice()
 // Generic page setup dialog
 // ----------------------------------------------------------------------------
 
-IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
+IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxPageSetupDialogBase)
 
-BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog)
+BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxPageSetupDialogBase)
     EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
 END_EVENT_TABLE()
 
-void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
-{
-    // We no longer query GetPrintMode, so we can eliminate the need
-    // to call SetPrintMode.
-    // This has the limitation that we can't explicitly call the PostScript
-    // print setup dialog from the generic Page Setup dialog under Windows,
-    // but since this choice would only happen when trying to do PostScript
-    // printing under Windows (and only in 16-bit Windows which
-    // doesn't have a Windows-specific page setup dialog) it's worth it.
-
-    // First save the current settings, so the wxPrintData object is up to date.
-    TransferDataFromWindow();
-
-    // Transfer the current print settings from this dialog to the page setup dialog.
-    
-#if 0
-    // Use print factory later    
-    
-    wxPrintDialogData data;
-    data = GetPageSetupData().GetPrintData();
-    data.SetSetupDialog(true);
-    wxPrintDialog printDialog(this, & data);
-    printDialog.ShowModal();
-
-    // Transfer the page setup print settings from the page dialog to this dialog again, in case
-    // the page setup dialog changed something.
-    GetPageSetupData().GetPrintData() = printDialog.GetPrintDialogData().GetPrintData();
-    GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
-
-    // Now update the dialog in case the page setup dialog changed some of our settings.
-    TransferDataToWindow();
-#endif
-}
-
 wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent,
-                                                    wxPageSetupData* data)
-    : wxDialog( parent,
+                                                    wxPageSetupDialogData* data)
+    : wxPageSetupDialogBase( parent,
                 wxID_ANY,
                 _("Page Setup"),
                 wxPoint(0, 0),
@@ -939,10 +905,19 @@ wxGenericPageSetupDialog::wxGenericPageSetupDialog( wxWindow *parent,
     // 6) buttons
 
     wxSizer* buttonsizer = CreateButtonSizer( wxOK|wxCANCEL);
-    m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer...") );
-    buttonsizer->Add( m_printerButton, 0, wxLEFT|wxRIGHT, 10 );
-    if ( !m_pageData.GetEnablePrinter() )
-        m_printerButton->Enable(false);
+    
+    if (wxPrintFactory::GetFactory()->HasPrintSetupDialog())
+    {
+        m_printerButton = new wxButton(this, wxPRINTID_SETUP, _("Printer...") );
+        buttonsizer->Add( m_printerButton, 0, wxLEFT|wxRIGHT, 10 );
+        if ( !m_pageData.GetEnablePrinter() )
+            m_printerButton->Enable(false);
+    }
+    else
+    {
+        m_printerButton = NULL;
+    }
+        
     //  if (m_printData.GetEnableHelp())
     //  wxButton *helpButton = new wxButton(this, (wxFunction)wxGenericPageSetupHelpProc, _("Help"), wxDefaultCoord, wxDefaultCoord, buttonWidth, buttonHeight);
     mainsizer->Add( buttonsizer, 0, wxCENTER|wxALL, 10 );
@@ -964,6 +939,11 @@ wxGenericPageSetupDialog::~wxGenericPageSetupDialog()
 {
 }
 
+wxPageSetupDialogData& wxGenericPageSetupDialog::GetPageSetupDialogData()
+{ 
+    return m_pageData;
+}
+
 bool wxGenericPageSetupDialog::TransferDataToWindow()
 {
     if (m_marginLeftText)
@@ -1080,5 +1060,39 @@ wxComboBox *wxGenericPageSetupDialog::CreatePaperTypeChoice(int *x, int *y)
     return choice;
 }
 
+void wxGenericPageSetupDialog::OnPrinter(wxCommandEvent& WXUNUSED(event))
+{
+    // We no longer query GetPrintMode, so we can eliminate the need
+    // to call SetPrintMode.
+    // This has the limitation that we can't explicitly call the PostScript
+    // print setup dialog from the generic Page Setup dialog under Windows,
+    // but since this choice would only happen when trying to do PostScript
+    // printing under Windows (and only in 16-bit Windows which
+    // doesn't have a Windows-specific page setup dialog) it's worth it.
+
+    // First save the current settings, so the wxPrintData object is up to date.
+    TransferDataFromWindow();
+
+    // Transfer the current print settings from this dialog to the page setup dialog.
+    
+#if 0
+    // Use print factory later    
+    
+    wxPrintDialogData data;
+    data = GetPageSetupData().GetPrintData();
+    data.SetSetupDialog(true);
+    wxPrintDialog printDialog(this, & data);
+    printDialog.ShowModal();
+
+    // Transfer the page setup print settings from the page dialog to this dialog again, in case
+    // the page setup dialog changed something.
+    GetPageSetupData().GetPrintData() = printDialog.GetPrintDialogData().GetPrintData();
+    GetPageSetupData().CalculatePaperSizeFromId(); // Make sure page size reflects the id in wxPrintData
+
+    // Now update the dialog in case the page setup dialog changed some of our settings.
+    TransferDataToWindow();
+#endif
+}
+
 #endif
 
index 2f35e4398735d24736014b3ee21ccca98bbe7cd6..152ff9c32a5e2e98e4cc3d17916ae59eb7c8d979 100644 (file)
 #include "wx/fontutil.h"
 #include "wx/printdlg.h"
 #include "wx/gtk/private.h"
+#include "wx/module.h"
 
 #include <libgnomeprint/gnome-print.h>
 #include <libgnomeprint/gnome-print-pango.h>
 #include <libgnomeprintui/gnome-print-dialog.h>
 #include <libgnomeprintui/gnome-print-job-preview.h>
+#include <libgnomeprintui/gnome-print-paper-selector.h>
 
 //----------------------------------------------------------------------------
 // wxGnomePrintNativeData
@@ -98,6 +100,12 @@ wxPrintDialogBase *wxGnomePrintFactory::CreatePrintDialog( wxWindow *parent,
     return new wxGnomePrintDialog( parent, data );
 }
                                                   
+wxPageSetupDialogBase *wxGnomePrintFactory::CreatePageSetupDialog( wxWindow *parent,
+                                                          wxPageSetupDialogData * data )
+{  
+    return new wxGnomePageSetupDialog( parent, data );
+}
+                                                  
 bool wxGnomePrintFactory::HasPrintSetupDialog()
 {
     return false;
@@ -270,6 +278,90 @@ bool wxGnomePrintDialog::TransferDataFromWindow()
     return true;
 }
 
+//----------------------------------------------------------------------------
+// wxGnomePageSetupDialog
+//----------------------------------------------------------------------------
+
+IMPLEMENT_CLASS(wxGnomePageSetupDialog, wxPageSetupDialogBase)
+
+wxGnomePageSetupDialog::wxGnomePageSetupDialog( wxWindow *parent,
+                            wxPageSetupDialogData* data )
+{
+    if (data)
+        m_pageDialogData = *data;
+        
+    wxGnomePrintNativeData *native =
+      (wxGnomePrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData();
+        
+    m_widget = gtk_dialog_new();
+    
+    gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( _("Page setup") ) );
+    
+    GtkWidget *main = gnome_paper_selector_new_with_flags( native->GetPrintConfig(), 
+        GNOME_PAPER_SELECTOR_MARGINS|GNOME_PAPER_SELECTOR_FEED_ORIENTATION );
+    gtk_container_set_border_width (GTK_CONTAINER (main), 8);
+    gtk_widget_show (main);
+    
+    gtk_container_add( GTK_CONTAINER (GTK_DIALOG (m_widget)->vbox), main );
+    
+       gtk_dialog_set_has_separator (GTK_DIALOG (m_widget), TRUE);
+
+       gtk_dialog_add_buttons (GTK_DIALOG (m_widget),
+                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                               GTK_STOCK_OK, GTK_RESPONSE_OK,
+                               NULL);
+
+       gtk_dialog_set_default_response (GTK_DIALOG (m_widget),
+                                        GTK_RESPONSE_OK);
+}
+
+wxGnomePageSetupDialog::~wxGnomePageSetupDialog()
+{
+}
+
+wxPageSetupDialogData& wxGnomePageSetupDialog::GetPageSetupDialogData()
+{
+    return m_pageDialogData;
+}
+
+int wxGnomePageSetupDialog::ShowModal()
+{
+    // Transfer data from m_pageDialogData to native dialog
+
+    int ret = gtk_dialog_run( GTK_DIALOG(m_widget) );
+
+    if (ret == GTK_RESPONSE_OK)
+    {
+        // Transfer data back to m_pageDialogData
+        
+        ret = wxID_OK;
+    }
+    else
+    {
+        ret = wxID_CANCEL;
+    }
+    
+    gtk_widget_destroy( m_widget );
+    m_widget = NULL;
+
+    return ret;
+}
+
+bool wxGnomePageSetupDialog::Validate()
+{
+    return true;
+}
+
+bool wxGnomePageSetupDialog::TransferDataToWindow()
+{
+    return true;
+}
+
+bool wxGnomePageSetupDialog::TransferDataFromWindow()
+{
+    return true;
+}
+
 //----------------------------------------------------------------------------
 // wxGnomePrinter
 //----------------------------------------------------------------------------
index 2f35e4398735d24736014b3ee21ccca98bbe7cd6..152ff9c32a5e2e98e4cc3d17916ae59eb7c8d979 100644 (file)
 #include "wx/fontutil.h"
 #include "wx/printdlg.h"
 #include "wx/gtk/private.h"
+#include "wx/module.h"
 
 #include <libgnomeprint/gnome-print.h>
 #include <libgnomeprint/gnome-print-pango.h>
 #include <libgnomeprintui/gnome-print-dialog.h>
 #include <libgnomeprintui/gnome-print-job-preview.h>
+#include <libgnomeprintui/gnome-print-paper-selector.h>
 
 //----------------------------------------------------------------------------
 // wxGnomePrintNativeData
@@ -98,6 +100,12 @@ wxPrintDialogBase *wxGnomePrintFactory::CreatePrintDialog( wxWindow *parent,
     return new wxGnomePrintDialog( parent, data );
 }
                                                   
+wxPageSetupDialogBase *wxGnomePrintFactory::CreatePageSetupDialog( wxWindow *parent,
+                                                          wxPageSetupDialogData * data )
+{  
+    return new wxGnomePageSetupDialog( parent, data );
+}
+                                                  
 bool wxGnomePrintFactory::HasPrintSetupDialog()
 {
     return false;
@@ -270,6 +278,90 @@ bool wxGnomePrintDialog::TransferDataFromWindow()
     return true;
 }
 
+//----------------------------------------------------------------------------
+// wxGnomePageSetupDialog
+//----------------------------------------------------------------------------
+
+IMPLEMENT_CLASS(wxGnomePageSetupDialog, wxPageSetupDialogBase)
+
+wxGnomePageSetupDialog::wxGnomePageSetupDialog( wxWindow *parent,
+                            wxPageSetupDialogData* data )
+{
+    if (data)
+        m_pageDialogData = *data;
+        
+    wxGnomePrintNativeData *native =
+      (wxGnomePrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData();
+        
+    m_widget = gtk_dialog_new();
+    
+    gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( _("Page setup") ) );
+    
+    GtkWidget *main = gnome_paper_selector_new_with_flags( native->GetPrintConfig(), 
+        GNOME_PAPER_SELECTOR_MARGINS|GNOME_PAPER_SELECTOR_FEED_ORIENTATION );
+    gtk_container_set_border_width (GTK_CONTAINER (main), 8);
+    gtk_widget_show (main);
+    
+    gtk_container_add( GTK_CONTAINER (GTK_DIALOG (m_widget)->vbox), main );
+    
+       gtk_dialog_set_has_separator (GTK_DIALOG (m_widget), TRUE);
+
+       gtk_dialog_add_buttons (GTK_DIALOG (m_widget),
+                               GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                               GTK_STOCK_OK, GTK_RESPONSE_OK,
+                               NULL);
+
+       gtk_dialog_set_default_response (GTK_DIALOG (m_widget),
+                                        GTK_RESPONSE_OK);
+}
+
+wxGnomePageSetupDialog::~wxGnomePageSetupDialog()
+{
+}
+
+wxPageSetupDialogData& wxGnomePageSetupDialog::GetPageSetupDialogData()
+{
+    return m_pageDialogData;
+}
+
+int wxGnomePageSetupDialog::ShowModal()
+{
+    // Transfer data from m_pageDialogData to native dialog
+
+    int ret = gtk_dialog_run( GTK_DIALOG(m_widget) );
+
+    if (ret == GTK_RESPONSE_OK)
+    {
+        // Transfer data back to m_pageDialogData
+        
+        ret = wxID_OK;
+    }
+    else
+    {
+        ret = wxID_CANCEL;
+    }
+    
+    gtk_widget_destroy( m_widget );
+    m_widget = NULL;
+
+    return ret;
+}
+
+bool wxGnomePageSetupDialog::Validate()
+{
+    return true;
+}
+
+bool wxGnomePageSetupDialog::TransferDataToWindow()
+{
+    return true;
+}
+
+bool wxGnomePageSetupDialog::TransferDataFromWindow()
+{
+    return true;
+}
+
 //----------------------------------------------------------------------------
 // wxGnomePrinter
 //----------------------------------------------------------------------------
index 5ea1a82e02ca82c6ec561e6e29c12cc8c647f7c1..38aa9582ae4921f9f3a8617c3edada920dde2cf9 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "wx/object.h"
 #include "wx/printdlg.h"
+#include "wx/mac/printdlg.h"
 #include "wx/dcprint.h"
 #include "wx/msgdlg.h"
 #include "wx/mac/private/print.h"
@@ -22,7 +23,6 @@
 // Use generic page setup dialog: use your own native one if one exists.
 
 IMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase)
-IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
 
 wxMacPrintDialog::wxMacPrintDialog()
 {
@@ -81,22 +81,18 @@ wxDC *wxMacPrintDialog::GetPrintDC()
 }
 
 /*
-* wxPageSetupDialog
+* wxMacPageSetupDialog
 */
 
-wxPageSetupDialog::wxPageSetupDialog():
-wxDialog()
-{
-    m_dialogParent = NULL;
-}
+IMPLEMENT_CLASS(wxMacPageSetupDialog, wxPageSetupDialogBase)
 
-wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupData *data):
-wxDialog()
+wxMacPageSetupDialog::wxMacPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data) :
+wxPageSetupDialogBase()
 {
     Create(p, data);
 }
 
-bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data)
+bool wxMacPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
 {
     m_dialogParent = p;
     
@@ -106,17 +102,24 @@ bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupData *data)
     return TRUE;
 }
 
-wxPageSetupDialog::~wxPageSetupDialog()
+wxMacPageSetupDialog::~wxMacPageSetupDialog()
 {
 }
 
-int wxPageSetupDialog::ShowModal()
+wxPageSetupData& wxMacPageSetupDialog::GetPageSetupDialogData()
+{ 
+    return m_pageSetupData;
+}
+
+int wxMacPageSetupDialog::ShowModal()
 {
-    m_pageSetupData.ConvertToNative() ;
-    int result = m_pageSetupData.GetPrintData().m_nativePrintData->ShowPageSetupDialog() ;
+    m_pageSetupData.ConvertToNative();
+    
+    int result = m_pageSetupData.GetPrintData().m_nativePrintData->ShowPageSetupDialog();
+    
     if (result == wxID_OK )
-        m_pageSetupData.ConvertFromNative() ;
+        m_pageSetupData.ConvertFromNative();
         
-    return result ;
+    return result;
 }
 
index 5befe63b86d1d56e78c353a701395f379eb385f2..bb1901b3ebbde43df4ce6ac5e8f7a1476e4da589 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "wx/dcprint.h"
 #include "wx/printdlg.h"
+#include "wx/mac/printdlg.h"
 
 #include <stdlib.h>
 
index 4de8e69a93c7253dc808f58ef61f5f674823c887..91e48e9c5e11bbcf1d24a811c5797f1c36a19d96 100644 (file)
@@ -45,6 +45,7 @@
 
 #include "wx/dcprint.h"
 #include "wx/printdlg.h"
+#include "wx/msw/printdlg.h"
 #include "math.h"
 
 #if wxUSE_COMMON_DIALOGS
index 6a5a7e4fd552474b95725551c738538fe2569109..5198ea044ad0515b198f8222cd7816101c51f3ec 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "wx/cmndata.h"
 #include "wx/printdlg.h"
+#include "wx/msw/printdlg.h"
 #include "wx/dcprint.h"
 #include "wx/paper.h"
 
@@ -756,23 +757,23 @@ bool wxWindowsPrintDialog::ConvertFromNative( wxPrintDialogData &data )
 }
 
 // ---------------------------------------------------------------------------
-// wxPageSetupDialog
+// wxWidnowsPageSetupDialog
 // ---------------------------------------------------------------------------
 
-IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
+IMPLEMENT_CLASS(wxWindowsPageSetupDialog, wxPageSetupDialogBase)
 
-wxPageSetupDialog::wxPageSetupDialog()
+wxWindowsPageSetupDialog::wxWindowsPageSetupDialog()
 {
     m_dialogParent = NULL;
     m_pageDlg = NULL;
 }
 
-wxPageSetupDialog::wxPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data)
+wxWindowsPageSetupDialog::wxWindowsPageSetupDialog(wxWindow *p, wxPageSetupDialogData *data)
 {
     Create(p, data);
 }
 
-bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
+bool wxWindowsPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
 {
     m_dialogParent = p;
     m_pageDlg = NULL;
@@ -783,7 +784,7 @@ bool wxPageSetupDialog::Create(wxWindow *p, wxPageSetupDialogData *data)
     return true;
 }
 
-wxPageSetupDialog::~wxPageSetupDialog()
+wxWindowsPageSetupDialog::~wxWindowsPageSetupDialog()
 {
     PAGESETUPDLG *pd = (PAGESETUPDLG *)m_pageDlg;
     if ( pd && pd->hDevMode )
@@ -794,7 +795,7 @@ wxPageSetupDialog::~wxPageSetupDialog()
         delete pd;
 }
 
-int wxPageSetupDialog::ShowModal()
+int wxWindowsPageSetupDialog::ShowModal()
 {
     ConvertToNative( m_pageSetupData );
     
@@ -816,7 +817,7 @@ int wxPageSetupDialog::ShowModal()
         return wxID_CANCEL;
 }
 
-bool wxPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data )
+bool wxWindowsPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data )
 {
     wxWindowsPrintNativeData *native_data =
         (wxWindowsPrintNativeData *) data.GetPrintData().GetNativeData();
@@ -920,7 +921,7 @@ bool wxPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data )
     return true;
 }
 
-bool wxPageSetupDialog::ConvertFromNative( wxPageSetupDialogData &data )
+bool wxWindowsPageSetupDialog::ConvertFromNative( wxPageSetupDialogData &data )
 {
     PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageDlg;
     if ( !pd )