Made wxPageSetupDialog a pimpl implementation.
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
This commit is contained in:
@@ -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()
|
||||
|
@@ -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
|
||||
//----------------------------------------------------------------------------
|
||||
|
@@ -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
|
||||
//----------------------------------------------------------------------------
|
||||
|
@@ -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
|
||||
/*
|
||||
* wxMacPageSetupDialog
|
||||
* The Mac page setup dialog
|
||||
*/
|
||||
|
||||
class WXDLLEXPORT wxMacPageSetupDialog: public wxPageSetupDialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPageSetupDialog)
|
||||
public:
|
||||
wxMacPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = NULL);
|
||||
~wxMacPageSetupDialog();
|
||||
|
||||
public:
|
||||
wxPageSetupDialog();
|
||||
wxPageSetupDialog(wxWindow *parent, wxPageSetupData *data = NULL);
|
||||
~wxPageSetupDialog();
|
||||
|
||||
bool Create(wxWindow *parent, wxPageSetupData *data = NULL);
|
||||
virtual int ShowModal();
|
||||
|
||||
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
|
||||
|
@@ -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
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxWindowsPageSetupDialog: the MSW page setup dialog
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxWindowsPageSetupDialog: public wxPageSetupDialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPageSetupDialog)
|
||||
|
||||
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
|
||||
|
@@ -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
|
||||
|
@@ -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();
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -27,11 +27,13 @@
|
||||
#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
|
||||
//----------------------------------------------------------------------------
|
||||
|
@@ -27,11 +27,13 @@
|
||||
#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
|
||||
//----------------------------------------------------------------------------
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -39,6 +39,7 @@
|
||||
|
||||
#include "wx/dcprint.h"
|
||||
#include "wx/printdlg.h"
|
||||
#include "wx/mac/printdlg.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@@ -45,6 +45,7 @@
|
||||
|
||||
#include "wx/dcprint.h"
|
||||
#include "wx/printdlg.h"
|
||||
#include "wx/msw/printdlg.h"
|
||||
#include "math.h"
|
||||
|
||||
#if wxUSE_COMMON_DIALOGS
|
||||
|
@@ -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 )
|
||||
|
Reference in New Issue
Block a user