#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;
wxTextCtrl* m_marginBottomText;
wxComboBox* m_paperTypeChoice;
- wxPageSetupData m_pageData;
+ wxPageSetupDialogData m_pageData;
private:
DECLARE_EVENT_TABLE()
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();
{
public:
wxGnomePrintDialog( wxWindow *parent,
- wxPrintDialogData* data = (wxPrintDialogData*)NULL );
+ wxPrintDialogData* data = NULL );
wxGnomePrintDialog( wxWindow *parent, wxPrintData* data);
~wxGnomePrintDialog();
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
//----------------------------------------------------------------------------
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();
{
public:
wxGnomePrintDialog( wxWindow *parent,
- wxPrintDialogData* data = (wxPrintDialogData*)NULL );
+ wxPrintDialogData* data = NULL );
wxGnomePrintDialog( wxWindow *parent, wxPrintData* data);
~wxGnomePrintDialog();
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
//----------------------------------------------------------------------------
};
/*
- * wxPrinterDialog
- * The common dialog for printing.
+ * wxMacPrintDialog
+ * The Mac dialog for printing
*/
class WXDLLEXPORT wxDC;
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
};
// ---------------------------------------------------------------------------
-// wxPrinterDialog: the common dialog for printing.
+// wxWindowsPrintDialog: the MSW dialog for printing
// ---------------------------------------------------------------------------
class WXDLLEXPORT wxWindowsPrintDialog : public wxPrintDialogBase
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
// ---------------------------------------------------------------------------
-// wxPrintDialogBase: interface for the common dialog for printing.
+// wxPrintDialogBase: interface for the dialog for printing
// ---------------------------------------------------------------------------
class WXDLLEXPORT wxPrintDialogBase : public wxDialog
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;
};
// ---------------------------------------------------------------------------
-// wxPrintDialog: the common dialog for printing.
+// wxPrintDialog: the dialog for printing.
// ---------------------------------------------------------------------------
class WXDLLEXPORT wxPrintDialog : public wxObject
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
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;
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;
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();
// 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),
// 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 );
{
}
+wxPageSetupDialogData& wxGenericPageSetupDialog::GetPageSetupDialogData()
+{
+ return m_pageData;
+}
+
bool wxGenericPageSetupDialog::TransferDataToWindow()
{
if (m_marginLeftText)
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
#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
return new wxGnomePrintDialog( parent, data );
}
+wxPageSetupDialogBase *wxGnomePrintFactory::CreatePageSetupDialog( wxWindow *parent,
+ wxPageSetupDialogData * data )
+{
+ return new wxGnomePageSetupDialog( parent, data );
+}
+
bool wxGnomePrintFactory::HasPrintSetupDialog()
{
return false;
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
//----------------------------------------------------------------------------
#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
return new wxGnomePrintDialog( parent, data );
}
+wxPageSetupDialogBase *wxGnomePrintFactory::CreatePageSetupDialog( wxWindow *parent,
+ wxPageSetupDialogData * data )
+{
+ return new wxGnomePageSetupDialog( parent, data );
+}
+
bool wxGnomePrintFactory::HasPrintSetupDialog()
{
return false;
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
//----------------------------------------------------------------------------
#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"
// Use generic page setup dialog: use your own native one if one exists.
IMPLEMENT_DYNAMIC_CLASS(wxMacPrintDialog, wxPrintDialogBase)
-IMPLEMENT_CLASS(wxPageSetupDialog, wxDialog)
wxMacPrintDialog::wxMacPrintDialog()
{
}
/*
-* 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;
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;
}
#include "wx/dcprint.h"
#include "wx/printdlg.h"
+#include "wx/mac/printdlg.h"
#include <stdlib.h>
#include "wx/dcprint.h"
#include "wx/printdlg.h"
+#include "wx/msw/printdlg.h"
#include "math.h"
#if wxUSE_COMMON_DIALOGS
#include "wx/cmndata.h"
#include "wx/printdlg.h"
+#include "wx/msw/printdlg.h"
#include "wx/dcprint.h"
#include "wx/paper.h"
}
// ---------------------------------------------------------------------------
-// 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;
return true;
}
-wxPageSetupDialog::~wxPageSetupDialog()
+wxWindowsPageSetupDialog::~wxWindowsPageSetupDialog()
{
PAGESETUPDLG *pd = (PAGESETUPDLG *)m_pageDlg;
if ( pd && pd->hDevMode )
delete pd;
}
-int wxPageSetupDialog::ShowModal()
+int wxWindowsPageSetupDialog::ShowModal()
{
ConvertToNative( m_pageSetupData );
return wxID_CANCEL;
}
-bool wxPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data )
+bool wxWindowsPageSetupDialog::ConvertToNative( wxPageSetupDialogData &data )
{
wxWindowsPrintNativeData *native_data =
(wxWindowsPrintNativeData *) data.GetPrintData().GetNativeData();
return true;
}
-bool wxPageSetupDialog::ConvertFromNative( wxPageSetupDialogData &data )
+bool wxWindowsPageSetupDialog::ConvertFromNative( wxPageSetupDialogData &data )
{
PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageDlg;
if ( !pd )