]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/print.cpp
Fix deprecating warning introduced in r72446.
[wxWidgets.git] / src / gtk / print.cpp
index 2fd307b42c3b5f4cccd34a6f90a5da715ab0bcb6..7ef941c86264676ed84612c0fedbaf21c6ee3de2 100644 (file)
@@ -74,7 +74,7 @@ public:
     {
 #if wxUSE_LIBGNOMEPRINT
         // This module must be initialized AFTER gnomeprint's one
     {
 #if wxUSE_LIBGNOMEPRINT
         // This module must be initialized AFTER gnomeprint's one
-        AddDependency(CLASSINFO(wxGnomePrintModule));
+        AddDependency(wxCLASSINFO(wxGnomePrintModule));
 #endif
     }
     bool OnInit();
 #endif
     }
     bool OnInit();
@@ -86,8 +86,12 @@ private:
 
 bool wxGtkPrintModule::OnInit()
 {
 
 bool wxGtkPrintModule::OnInit()
 {
+#ifndef __WXGTK3__
     if (gtk_check_version(2,10,0) == NULL)
     if (gtk_check_version(2,10,0) == NULL)
+#endif
+    {
         wxPrintFactory::SetPrintFactory( new wxGtkPrintFactory );
         wxPrintFactory::SetPrintFactory( new wxGtkPrintFactory );
+    }
     return true;
 }
 
     return true;
 }
 
@@ -619,8 +623,6 @@ wxGtkPrintDialog::~wxGtkPrintDialog()
 // This is called even if we actually don't want the dialog to appear.
 int wxGtkPrintDialog::ShowModal()
 {
 // This is called even if we actually don't want the dialog to appear.
 int wxGtkPrintDialog::ShowModal()
 {
-    GtkPrintOperationResult response;
-
     // We need to restore the settings given in the constructor.
     wxPrintData data = m_printDialogData.GetPrintData();
     wxGtkPrintNativeData *native =
     // We need to restore the settings given in the constructor.
     wxPrintData data = m_printDialogData.GetPrintData();
     wxGtkPrintNativeData *native =
@@ -654,10 +656,17 @@ int wxGtkPrintDialog::ShowModal()
 
     // Show the dialog if needed.
     GError* gError = NULL;
 
     // Show the dialog if needed.
     GError* gError = NULL;
-    if (GetShowDialog())
-        response = gtk_print_operation_run (printOp, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW(gtk_widget_get_toplevel(m_parent->m_widget) ), &gError);
-    else
-        response = gtk_print_operation_run (printOp, GTK_PRINT_OPERATION_ACTION_PRINT, GTK_WINDOW(gtk_widget_get_toplevel(m_parent->m_widget)), &gError);
+    GtkPrintOperationResult response = gtk_print_operation_run
+                                       (
+                                           printOp,
+                                           GetShowDialog()
+                                            ? GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG
+                                            : GTK_PRINT_OPERATION_ACTION_PRINT,
+                                           m_parent
+                                            ? GTK_WINDOW(gtk_widget_get_toplevel(m_parent->m_widget))
+                                            : NULL,
+                                           &gError
+                                       );
 
     // Does everything went well?
     if (response == GTK_PRINT_OPERATION_RESULT_CANCEL)
 
     // Does everything went well?
     if (response == GTK_PRINT_OPERATION_RESULT_CANCEL)
@@ -770,7 +779,9 @@ int wxGtkPageSetupDialog::ShowModal()
         title = _("Page Setup");
     GtkWidget *
         dlg = gtk_page_setup_unix_dialog_new(title.utf8_str(),
         title = _("Page Setup");
     GtkWidget *
         dlg = gtk_page_setup_unix_dialog_new(title.utf8_str(),
-                                             GTK_WINDOW(m_parent->m_widget));
+                                             m_parent
+                                                ? GTK_WINDOW(m_parent->m_widget)
+                                                : NULL);
 
     gtk_page_setup_unix_dialog_set_print_settings(
         GTK_PAGE_SETUP_UNIX_DIALOG(dlg), nativeData);
 
     gtk_page_setup_unix_dialog_set_print_settings(
         GTK_PAGE_SETUP_UNIX_DIALOG(dlg), nativeData);
@@ -1205,6 +1216,11 @@ void* wxGtkPrinterDCImpl::GetCairoContext() const
     return (void*) cairo_reference( m_cairo );
 }
 
     return (void*) cairo_reference( m_cairo );
 }
 
+void* wxGtkPrinterDCImpl::GetHandle() const
+{
+    return GetCairoContext();
+}
+
 bool wxGtkPrinterDCImpl::DoFloodFill(wxCoord WXUNUSED(x1),
                                wxCoord WXUNUSED(y1),
                                const wxColour& WXUNUSED(col),
 bool wxGtkPrinterDCImpl::DoFloodFill(wxCoord WXUNUSED(x1),
                                wxCoord WXUNUSED(y1),
                                const wxColour& WXUNUSED(col),
@@ -1698,9 +1714,11 @@ void wxGtkPrinterDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoor
     y = wxCoord(YLOG2DEV(y));
     int bw = bitmap.GetWidth();
     int bh = bitmap.GetHeight();
     y = wxCoord(YLOG2DEV(y));
     int bw = bitmap.GetWidth();
     int bh = bitmap.GetHeight();
+#ifndef __WXGTK3__
     wxBitmap bmpSource = bitmap;  // we need a non-const instance.
     if (!useMask && !bitmap.HasPixbuf() && bitmap.GetMask())
         bmpSource.SetMask(NULL);
     wxBitmap bmpSource = bitmap;  // we need a non-const instance.
     if (!useMask && !bitmap.HasPixbuf() && bitmap.GetMask())
         bmpSource.SetMask(NULL);
+#endif
 
     cairo_save(m_cairo);
 
 
     cairo_save(m_cairo);
 
@@ -1712,12 +1730,16 @@ void wxGtkPrinterDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoor
     wxDouble scaleY = (wxDouble) YLOG2DEVREL(bh) / (wxDouble) bh;
     cairo_scale(m_cairo, scaleX, scaleY);
 
     wxDouble scaleY = (wxDouble) YLOG2DEVREL(bh) / (wxDouble) bh;
     cairo_scale(m_cairo, scaleX, scaleY);
 
+#ifdef __WXGTK3__
+    bitmap.Draw(m_cairo, 0, 0, useMask, &m_textForegroundColour, &m_textBackgroundColour);
+#else
     gdk_cairo_set_source_pixbuf(m_cairo, bmpSource.GetPixbuf(), 0, 0);
     cairo_pattern_set_filter(cairo_get_source(m_cairo), CAIRO_FILTER_NEAREST);
     // Use the original size here since the context is scaled already.
     cairo_rectangle(m_cairo, 0, 0, bw, bh);
     // Fill the rectangle using the pattern.
     cairo_fill(m_cairo);
     gdk_cairo_set_source_pixbuf(m_cairo, bmpSource.GetPixbuf(), 0, 0);
     cairo_pattern_set_filter(cairo_get_source(m_cairo), CAIRO_FILTER_NEAREST);
     // Use the original size here since the context is scaled already.
     cairo_rectangle(m_cairo, 0, 0, bw, bh);
     // Fill the rectangle using the pattern.
     cairo_fill(m_cairo);
+#endif
 
     CalcBoundingBox(0,0);
     CalcBoundingBox(bw,bh);
 
     CalcBoundingBox(0,0);
     CalcBoundingBox(bw,bh);