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:
Robert Roebling
2004-11-20 14:46:25 +00:00
parent 14470b4477
commit 08680429a2
14 changed files with 448 additions and 133 deletions

View File

@@ -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
//----------------------------------------------------------------------------