[Xfce4-commits] r29970 - in xfc/trunk: . demos/xfc-demo examples/howto/calendar examples/howto/dnd examples/howto/packbox examples/howto/thread examples/ui libXFCcore/xfc libXFCcore/xfc/glib libXFCsourceview/xfc/sourceview libXFCui/xfc libXFCui/xfc/atk libXFCui/xfc/cairo libXFCui/xfc/gdk libXFCui/xfc/gtk libXFCui/xfc/gtk/inline libXFCui/xfc/gtk/private libXFCui/xfc/pango
Bo Lorentsen
bl at xfce.org
Fri May 22 10:41:43 CEST 2009
Author: bl
Date: 2009-05-22 08:41:32 +0000 (Fri, 22 May 2009)
New Revision: 29970
Added:
xfc/trunk/libXFCui/xfc/gtk/inline/printoperationpreview.inl
xfc/trunk/libXFCui/xfc/gtk/inline/printpagesetup.inl
xfc/trunk/libXFCui/xfc/gtk/printcontext.cc
xfc/trunk/libXFCui/xfc/gtk/printcontext.hh
xfc/trunk/libXFCui/xfc/gtk/printdialogs.cc
xfc/trunk/libXFCui/xfc/gtk/printdialogs.hh
xfc/trunk/libXFCui/xfc/gtk/printer.hh
xfc/trunk/libXFCui/xfc/gtk/printjob.cc
xfc/trunk/libXFCui/xfc/gtk/printjob.hh
xfc/trunk/libXFCui/xfc/gtk/printoperation.cc
xfc/trunk/libXFCui/xfc/gtk/printoperation.hh
xfc/trunk/libXFCui/xfc/gtk/printoperationpreview.cc
xfc/trunk/libXFCui/xfc/gtk/printoperationpreview.hh
xfc/trunk/libXFCui/xfc/gtk/printoperationpreviewsignals.cc
xfc/trunk/libXFCui/xfc/gtk/printoperationpreviewsignals.hh
xfc/trunk/libXFCui/xfc/gtk/printoperationsignals.cc
xfc/trunk/libXFCui/xfc/gtk/printoperationsignals.hh
xfc/trunk/libXFCui/xfc/gtk/printpagesetup.cc
xfc/trunk/libXFCui/xfc/gtk/printpagesetup.hh
xfc/trunk/libXFCui/xfc/gtk/printpapersize.cc
xfc/trunk/libXFCui/xfc/gtk/printpapersize.hh
xfc/trunk/libXFCui/xfc/gtk/printsetting.cc
xfc/trunk/libXFCui/xfc/gtk/printsetting.hh
xfc/trunk/libXFCui/xfc/gtk/private/printoperationclass.hh
xfc/trunk/libXFCui/xfc/gtk/private/printoperationpreviewiface.hh
xfc/trunk/libXFCui/xfc/gtk/private/printpagesetupclass.hh
Modified:
xfc/trunk/ChangeLog
xfc/trunk/TODO
xfc/trunk/configure.ac
xfc/trunk/demos/xfc-demo/demowindow.cc
xfc/trunk/examples/howto/calendar/calendar.cc
xfc/trunk/examples/howto/dnd/dnd.cc
xfc/trunk/examples/howto/packbox/packbox.cc
xfc/trunk/examples/howto/thread/thread.cc
xfc/trunk/examples/ui/Makefile.am
xfc/trunk/libXFCcore/xfc/glib/spawn.cc
xfc/trunk/libXFCcore/xfc/glib/spawn.hh
xfc/trunk/libXFCcore/xfc/glib/utils.cc
xfc/trunk/libXFCcore/xfc/trackable.cc
xfc/trunk/libXFCcore/xfc/utfstring.cc
xfc/trunk/libXFCsourceview/xfc/sourceview/Makefile.am
xfc/trunk/libXFCui/xfc/Makefile.am
xfc/trunk/libXFCui/xfc/atk/editabletext.cc
xfc/trunk/libXFCui/xfc/cairo/Makefile.am
xfc/trunk/libXFCui/xfc/cairo/context.hh
xfc/trunk/libXFCui/xfc/gdk/spawn.cc
xfc/trunk/libXFCui/xfc/gdk/window.cc
xfc/trunk/libXFCui/xfc/gtk/Makefile.am
xfc/trunk/libXFCui/xfc/gtk/private/Makefile.am
xfc/trunk/libXFCui/xfc/gtk/stock.cc
xfc/trunk/libXFCui/xfc/gtk/textbuffer.cc
xfc/trunk/libXFCui/xfc/pango/glyph.cc
xfc/trunk/libXFCui/xfc/pango/layout.cc
Log:
raw experimental printing support, stille need work
Modified: xfc/trunk/ChangeLog
===================================================================
--- xfc/trunk/ChangeLog 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/ChangeLog 2009-05-22 08:41:32 UTC (rev 29970)
@@ -1,3 +1,7 @@
+2009-05-22 10:40 bl
+
+ * Experimental printing support added
+
2008-03-22 16:11 bl
* Cairo wrapper is added, and working, but details are missing and it
Modified: xfc/trunk/TODO
===================================================================
--- xfc/trunk/TODO 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/TODO 2009-05-22 08:41:32 UTC (rev 29970)
@@ -1,3 +1,4 @@
-* Add printing from GTK+ 2.10
+* Add printing from GTK+ 2.10++
* Start wrapping Xfce4 desktop environment (libXFCde)
* Start wrapping Xfce4panel (libXFCpanel)
+* Start wraaping Xfce4xconf
Modified: xfc/trunk/configure.ac
===================================================================
--- xfc/trunk/configure.ac 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/configure.ac 2009-05-22 08:41:32 UTC (rev 29970)
@@ -23,9 +23,12 @@
m4_define([pango_required_version], [1.8.0])
m4_define([cairo_required_version], [1.2.4])
m4_define([gtk_required_version], [2.6.0])
+m4_define([unixprint_required_version], [2.10.0])
m4_define([glade_required_version], [2.4.0])
m4_define([gtksourceview_required_version], [0.21.0])
+m4_define([xfce_panel_required_version], [0.22])
+
dnl --------------------------------------------------------------
dnl Initialization macros.
dnl --------------------------------------------------------------
@@ -173,6 +176,12 @@
AC_SUBST(XFC_GLIB_CFLAGS)
AC_SUBST(XFC_GLIB_LIBS)
+PKG_CHECK_MODULES(XFC_UNIXPRINT, gtk+-unix-print-2.0 >= unixprint_required_version,
+ [UNIXPRINT_FOUND="yes"],
+ [UNIXPRINT_FOUND="no"])
+AC_SUBST(XFC_UNIXPRINT_CFLAGS)
+AC_SUBST(XFC_UNIXPRINT_LIBS)
+
PKG_CHECK_MODULES(XFC_SOURCEVIEW, gtksourceview-1.0 >= gtksourceview_required_version,
[SOURCEVIEW_SUBDIR="libXFCsourceview"; SOURCEVIEW_EXAMPLEDIR="sourceview"; SOURCEVIEW_FOUND="yes"],
[SOURCEVIEW_SUBDIR="";SOURCEVIEW_SUBDIR="";SOURCEVIEW_FOUND="no"])
@@ -214,10 +223,7 @@
AC_SUBST(XFC_GTK_CFLAGS)
AC_SUBST(XFC_GTK_LIBS)
-XFC_UI_CFLAGS="$XFC_CORE_CFLAGS $XFC_ATK_CFLAGS $XFC_PANGO_CFLAGS $XFC_CAIRO_CFLAGS $XFC_GTK_CFLAGS"
-XFC_UI_LIBS="$XFC_CORE_LIBS $XFC_GTK_LIBS"
-AC_SUBST(XFC_UI_CFLAGS)
-AC_SUBST(XFC_UI_LIBS)
+PKG_CHECK_MODULES(XFCE_PANEL, libxfce4panel-1.0 >= xfce_panel_required_version)
PKG_CHECK_MODULES(XFC_GLADE, libglade-2.0 >= glade_required_version,
[GLADE_SUBDIR="libXFCglade"; GLADE_EXAMPLESDIR="glade"; GLADE_FOUND="yes"],
@@ -227,6 +233,11 @@
AC_SUBST(GLADE_SUBDIR)
AC_SUBST(GLADE_EXAMPLESDIR)
+XFC_UI_CFLAGS="$XFC_CORE_CFLAGS $XFC_ATK_CFLAGS $XFC_PANGO_CFLAGS $XFC_CAIRO_CFLAGS $XFC_GTK_CFLAGS $XFC_UNIXPRINT_CFLAGS"
+XFC_UI_LIBS="$XFC_CORE_LIBS $XFC_GTK_LIBS $XFC_PANGO_LIBS $XFC_CAIRO_CFLAGS $XFC_UNIXPRINT_LIBS"
+AC_SUBST(XFC_UI_CFLAGS)
+AC_SUBST(XFC_UI_LIBS)
+
dnl --------------------------------------------------------------
dnl Checks for programs.
dnl --------------------------------------------------------------
@@ -434,5 +445,6 @@
echo "Compiling XFC with libglade support: $GLADE_FOUND"
echo "Compiling XFC with libcairo support: $CAIRO_FOUND"
echo "Compiling XFC with gtksourceview support: $SOURCEVIEW_FOUND"
+echo "Compiling XFC with gtk unix printing support: $UNIXPRINT_FOUND"
echo
Modified: xfc/trunk/demos/xfc-demo/demowindow.cc
===================================================================
--- xfc/trunk/demos/xfc-demo/demowindow.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/demos/xfc-demo/demowindow.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -11,6 +11,7 @@
#include <glib/gstdio.h>
#include <cstdio>
#include <cerrno>
+#include <cstring>
const int TITLE_COLUMN = 0;
const int FILENAME_COLUMN = 1;
@@ -272,7 +273,7 @@
return base;
else
{
- char *filename = g_build_filename(DEMOCODEDIR, base, 0);
+ char *filename = g_build_filename(DEMOCODEDIR, base, NULL);
if (!g_file_test(filename, G_FILE_TEST_EXISTS))
{
if (error)
@@ -409,8 +410,7 @@
return n_read > 0;
}
-void
-parse_chars(char *text, char **end_ptr, int *state, char **tag, bool start)
+void parse_chars(char *text, char **end_ptr, int *state, char **tag, bool start)
{
while (g_ascii_isspace(*text))
text++;
Modified: xfc/trunk/examples/howto/calendar/calendar.cc
===================================================================
--- xfc/trunk/examples/howto/calendar/calendar.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/examples/howto/calendar/calendar.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -4,6 +4,7 @@
#include <xfc/gtk/frame.hh>
#include <xfc/gtk/separator.hh>
#include <xfc/pango/font.hh>
+#include <cstring>
const int CalendarWindow::DEF_PAD;
const int CalendarWindow::DEF_PAD_SMALL;
Modified: xfc/trunk/examples/howto/dnd/dnd.cc
===================================================================
--- xfc/trunk/examples/howto/dnd/dnd.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/examples/howto/dnd/dnd.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -4,6 +4,7 @@
#include <xfc/gdk/color.hh>
#include <iostream>
#include <ctime>
+#include <cstring>
std::vector<Gtk::TargetEntry> SourceButton::target_entries;
Modified: xfc/trunk/examples/howto/packbox/packbox.cc
===================================================================
--- xfc/trunk/examples/howto/packbox/packbox.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/examples/howto/packbox/packbox.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -3,6 +3,7 @@
#include <xfc/gtk/label.hh>
#include <xfc/gtk/separator.hh>
#include <cstdio>
+#include <cstdlib>
// PackBox
Modified: xfc/trunk/examples/howto/thread/thread.cc
===================================================================
--- xfc/trunk/examples/howto/thread/thread.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/examples/howto/thread/thread.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -7,6 +7,7 @@
#include "thread.hh"
#include <xfc/glib/rand.hh>
#include <xfc/glib/thread.hh>
+#include <cstdlib>
using namespace Xfc;
Modified: xfc/trunk/examples/ui/Makefile.am
===================================================================
--- xfc/trunk/examples/ui/Makefile.am 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/examples/ui/Makefile.am 2009-05-22 08:41:32 UTC (rev 29970)
@@ -7,7 +7,8 @@
entrycompletion \
filechooser \
mergemenus \
- toolbar
+ toolbar \
+ printing
include $(top_srcdir)/examples/Makefile.fragment
Modified: xfc/trunk/libXFCcore/xfc/glib/spawn.cc
===================================================================
--- xfc/trunk/libXFCcore/xfc/glib/spawn.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCcore/xfc/glib/spawn.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -23,6 +23,7 @@
#include <glib/gmem.h>
#include <glib/gshell.h>
#include <glib/gstrfuncs.h>
+#include <cstring>
namespace Xfc {
Modified: xfc/trunk/libXFCcore/xfc/glib/spawn.hh
===================================================================
--- xfc/trunk/libXFCcore/xfc/glib/spawn.hh 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCcore/xfc/glib/spawn.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -38,6 +38,10 @@
#include <vector>
#endif
+#ifndef _CPP_STRING
+#include <string>
+#endif
+
namespace Xfc {
namespace G {
Modified: xfc/trunk/libXFCcore/xfc/glib/utils.cc
===================================================================
--- xfc/trunk/libXFCcore/xfc/glib/utils.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCcore/xfc/glib/utils.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -223,7 +223,7 @@
std::string
G::build_filename(const std::string& s1, const std::string& s2)
{
- char *result = g_build_filename(s1.c_str(), s2.c_str(), 0);
+ char *result = g_build_filename(s1.c_str(), s2.c_str(), NULL);
std::string s(result);
g_free(result);
return s;
@@ -232,7 +232,7 @@
std::string
G::build_filename(const std::string& s1, const std::string& s2, const std::string& s3)
{
- char *result = g_build_filename(s1.c_str(), s2.c_str(), s3.c_str(), 0);
+ char *result = g_build_filename(s1.c_str(), s2.c_str(), s3.c_str(), NULL);
std::string s(result);
g_free(result);
return s;
@@ -241,7 +241,7 @@
std::string
G::build_filename(const std::string& s1, const std::string& s2, const std::string& s3, const std::string& s4)
{
- char *result = g_build_filename(s1.c_str(), s2.c_str(), s3.c_str(), s4.c_str(), 0);
+ char *result = g_build_filename(s1.c_str(), s2.c_str(), s3.c_str(), s4.c_str(), NULL);
std::string s(result);
g_free(result);
return s;
@@ -253,7 +253,7 @@
std::string
G::build_path(const std::string& separator, const std::string& s1, const std::string& s2)
{
- char *result = g_build_path(separator.c_str(), s1.c_str(), s2.c_str(), 0);
+ char *result = g_build_path(separator.c_str(), s1.c_str(), s2.c_str(), NULL);
std::string s(result);
g_free(result);
return s;
@@ -262,7 +262,7 @@
std::string
G::build_path(const std::string& separator, const std::string& s1, const std::string& s2, const std::string& s3)
{
- char *result = g_build_path(separator.c_str(), s1.c_str(), s2.c_str(), s3.c_str(), 0);
+ char *result = g_build_path(separator.c_str(), s1.c_str(), s2.c_str(), s3.c_str(), NULL);
std::string s(result);
g_free(result);
return s;
@@ -271,7 +271,7 @@
std::string
G::build_path(const std::string& separator, const std::string& s1, const std::string& s2, const std::string& s3, const std::string& s4)
{
- char *result = g_build_path(separator.c_str(), s1.c_str(), s2.c_str(), s3.c_str(), s4.c_str(), 0);
+ char *result = g_build_path(separator.c_str(), s1.c_str(), s2.c_str(), s3.c_str(), s4.c_str(), NULL);
std::string s(result);
g_free(result);
return s;
Modified: xfc/trunk/libXFCcore/xfc/trackable.cc
===================================================================
--- xfc/trunk/libXFCcore/xfc/trackable.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCcore/xfc/trackable.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -19,6 +19,7 @@
*/
#include "trackable.hh"
+#include <algorithm>
using namespace Xfc;
Modified: xfc/trunk/libXFCcore/xfc/utfstring.cc
===================================================================
--- xfc/trunk/libXFCcore/xfc/utfstring.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCcore/xfc/utfstring.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -24,6 +24,7 @@
#include <glib/gmem.h>
#include <glib/gstrfuncs.h>
#include <iostream>
+#include <cstring>
#define std_iterator(i) (std::string::iterator(const_cast<char*>(i.base())))
Modified: xfc/trunk/libXFCsourceview/xfc/sourceview/Makefile.am
===================================================================
--- xfc/trunk/libXFCsourceview/xfc/sourceview/Makefile.am 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCsourceview/xfc/sourceview/Makefile.am 2009-05-22 08:41:32 UTC (rev 29970)
@@ -2,7 +2,7 @@
SUBDIRS = private
-AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_GTK_CFLAGS@ @XFC_SOURCEVIEW_CFLAGS@
+AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_UI_CFLAGS@ @XFC_SOURCEVIEW_CFLAGS@
hh_sources =\
sourcebuffer.hh \
Modified: xfc/trunk/libXFCui/xfc/Makefile.am
===================================================================
--- xfc/trunk/libXFCui/xfc/Makefile.am 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/Makefile.am 2009-05-22 08:41:32 UTC (rev 29970)
@@ -2,7 +2,7 @@
SUBDIRS = atk gdk gdk-pixbuf gtk pango cairo
-AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_GTK_CFLAGS@
+AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_UI_CFLAGS@
EXTRA_DIST = config.h.in
Modified: xfc/trunk/libXFCui/xfc/atk/editabletext.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/atk/editabletext.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/atk/editabletext.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -19,6 +19,7 @@
*/
#include "editabletext.hh"
+#include <cstring>
using namespace Xfc;
Modified: xfc/trunk/libXFCui/xfc/cairo/Makefile.am
===================================================================
--- xfc/trunk/libXFCui/xfc/cairo/Makefile.am 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/cairo/Makefile.am 2009-05-22 08:41:32 UTC (rev 29970)
@@ -2,7 +2,7 @@
#SUBDIRS = inline private
-AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_GTK_CFLAGS@ @XFC_CAIRO_CFLAGS@
+AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_UI_CFLAGS@
INCLUDES = \
-I$(top_builddir)/libXFCcore \
Modified: xfc/trunk/libXFCui/xfc/cairo/context.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/cairo/context.hh 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/cairo/context.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -84,9 +84,6 @@
~Context();
- /// Safely convert this to a cairo_t
- cairo_t operator*() const;
-
/**
Checks whether an error has previously occurred for this context.
@@ -396,7 +393,7 @@
void copy_page();
void show_page();
- operator cairo_t* () const;
+ operator cairo_t* () const {return m_cr;}
// Path interface
void get_current_point( double *x, double *y );
Modified: xfc/trunk/libXFCui/xfc/gdk/spawn.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gdk/spawn.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/gdk/spawn.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -25,6 +25,7 @@
#include <glib/gmessages.h>
#include <glib/gshell.h>
#include <glib/gstrfuncs.h>
+#include <cstring>
extern char **environ;
@@ -85,7 +86,7 @@
for (i = 0; i < env_len; i++)
{
if (i == display_index)
- retval[i] = g_strconcat("DISPLAY=", display_name, 0);
+ retval[i] = g_strconcat("DISPLAY=", display_name, NULL);
else
retval[i] = g_strdup(envp[i]);
}
Modified: xfc/trunk/libXFCui/xfc/gdk/window.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gdk/window.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/gdk/window.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -30,6 +30,7 @@
#include "visual.hh"
#include "../gdk-pixbuf/pixbuf.hh"
#include <gdk/gdkx.h>
+#include <cstring>
using namespace Xfc;
Modified: xfc/trunk/libXFCui/xfc/gtk/Makefile.am
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/Makefile.am 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/gtk/Makefile.am 2009-05-22 08:41:32 UTC (rev 29970)
@@ -2,7 +2,7 @@
SUBDIRS = inline private
-AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_GTK_CFLAGS@
+AM_CXXFLAGS = @CXXFLAGS@ @XFC_CORE_CFLAGS@ @XFC_GTK_CFLAGS@ @XFC_UNIXPRINT_CFLAGS@
INCLUDES = \
-I$(top_builddir)/libXFCcore \
@@ -122,6 +122,17 @@
plug.hh \
plugsignals.hh \
progressbar.hh \
+ printer.hh \
+ printcontext.hh \
+ printdialogs.hh \
+ printjob.hh \
+ printoperationpreview.hh \
+ printoperationpreviewsignals.hh \
+ printoperation.hh \
+ printoperationsignals.hh \
+ printpagesetup.hh \
+ printpapersize.hh \
+ printsetting.hh \
radioaction.hh \
radioactionsignals.hh \
radiobutton.hh \
@@ -308,6 +319,16 @@
paned.cc \
plug.cc \
plugsignals.cc \
+ printcontext.cc \
+ printdialogs.cc \
+ printjob.cc \
+ printoperationpreview.cc \
+ printoperationpreviewsignals.cc \
+ printoperation.cc \
+ printoperationsignals.cc \
+ printpagesetup.cc \
+ printpapersize.cc \
+ printsetting.cc \
progressbar.cc \
radioaction.cc \
radioactionsignals.cc \
Added: xfc/trunk/libXFCui/xfc/gtk/inline/printoperationpreview.inl
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/inline/printoperationpreview.inl (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/inline/printoperationpreview.inl 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,9 @@
+inline GtkPrintOperationPreview *Xfc::Gtk::PrintOperationPreview::gtk_printoperationpreview() const
+{
+ return reinterpret_cast<GtkPrintOperationPreview*>(instance_);
+}
+
+inline Xfc::Gtk::PrintOperationPreview::operator GtkPrintOperationPreview* () const
+{
+ return this ? ((GtkPrintOperationPreview*)instance_) : 0;
+}
Added: xfc/trunk/libXFCui/xfc/gtk/inline/printpagesetup.inl
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/inline/printpagesetup.inl (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/inline/printpagesetup.inl 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,9 @@
+inline GtkPageSetup *Xfc::Gtk::PageSetup::gtk_pagesetup() const
+{
+ return reinterpret_cast<GtkPageSetup*>(instance_);
+}
+
+inline Xfc::Gtk::PageSetup::operator GtkPageSetup* () const
+{
+ return this ? ((GtkPageSetup*)instance_) : NULL;
+}
Added: xfc/trunk/libXFCui/xfc/gtk/printcontext.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printcontext.cc (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printcontext.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,66 @@
+#include <xfc/gtk/printcontext.hh>
+
+using namespace Xfc;
+using namespace Gtk;
+
+PrintContext::PrintContext( GtkPrintContext *ctx, bool owns_reference ) :
+ G::Object( (GObject*)ctx, owns_reference )
+{
+}
+
+Cairo::Context PrintContext::get_cairo_context()
+{
+ Cairo::Context cr( gtk_print_context_get_cairo_context( gtk_printcontext() ));
+
+ return cr;
+}
+
+GtkPrintContext * PrintContext::gtk_printcontext() const
+{
+ return reinterpret_cast<GtkPrintContext*>(instance_);
+}
+
+void PrintContext::set_cairo_context ( Cairo::Context ctx, double dpi_x, double dpi_y )
+{
+ gtk_print_context_set_cairo_context( gtk_printcontext(), ctx, dpi_x, dpi_y );
+}
+
+PageSetup *PrintContext::get_page_setup()
+{
+ return G::Object::wrap<PageSetup>( gtk_print_context_get_page_setup( gtk_printcontext()));
+}
+
+gdouble PrintContext::get_width()
+{
+ return gtk_print_context_get_width( gtk_printcontext());
+}
+
+gdouble PrintContext::get_height()
+{
+ return gtk_print_context_get_height( gtk_printcontext());
+}
+
+gdouble PrintContext::get_dpi_x()
+{
+ return gtk_print_context_get_dpi_x( gtk_printcontext());
+}
+
+gdouble PrintContext::get_dpi_y()
+{
+ return gtk_print_context_get_dpi_y( gtk_printcontext());
+}
+
+Pango::FontMap* PrintContext::get_pango_fontmap()
+{
+ return G::Object::wrap<Pango::FontMap>( gtk_print_context_get_pango_fontmap( gtk_printcontext()));
+}
+
+Pango::Context* PrintContext::create_pango_context()
+{
+ return G::Object::wrap_new<Pango::Context>(gtk_print_context_create_pango_context(gtk_printcontext()), true);
+}
+
+Pango::Layout* PrintContext::create_pango_layout()
+{
+ return G::Object::wrap_new<Pango::Layout>(gtk_print_context_create_pango_layout(gtk_printcontext()), true);
+}
Added: xfc/trunk/libXFCui/xfc/gtk/printcontext.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printcontext.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printcontext.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,53 @@
+/**
+ GtkPrintContext
+*/
+
+#ifndef XFC_PRINT_CONTEXT_HH
+#define XFC_PRINT_CONTEXT_HH 1
+
+#include <xfc/gtk/printpagesetup.hh>
+#include <xfc/cairo/context.hh>
+#include <xfc/pango/context.hh>
+#include <xfc/pango/layout.hh>
+#include <xfc/pango/fontmap.hh>
+
+#include <gtk/gtkprintcontext.h>
+
+namespace Xfc {
+ namespace Gtk {
+ /**
+ A PrintContext encapsulates context information that
+ is required when drawing pages for printing, such as the
+ cairo context and important parameters like page size
+ and resolution. It also lets you easily create PangoLayout
+ and PangoContext objects that match the font metrics of the
+ cairo surface.
+
+ PrintContext objects gets passed to the ::begin-print,
+ ::end-print, ::request-page-setup and ::draw-page signals
+ on the PrintOperation.
+ */
+ class PrintContext : public G::Object {
+
+ public:
+ PrintContext( GtkPrintContext *ctx, bool owns_reference = true );
+
+ GtkPrintContext *gtk_printcontext() const;
+
+ operator GtkPrintContext* () const {return gtk_printcontext();}
+
+ Cairo::Context get_cairo_context();
+ void set_cairo_context( Cairo::Context cr, double dpi_x, double dpi_y );
+ PageSetup *get_page_setup();
+ double get_width();
+ double get_height();
+ double get_dpi_x();
+ double get_dpi_y();
+ Pango::FontMap* get_pango_fontmap();
+ Pango::Context* create_pango_context();
+ Pango::Layout* create_pango_layout();
+ };
+ }
+}
+
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/printdialogs.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printdialogs.cc (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printdialogs.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1 @@
+#include <xfc/gtk/printdialogs.hh>
Added: xfc/trunk/libXFCui/xfc/gtk/printdialogs.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printdialogs.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printdialogs.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,73 @@
+#ifndef XFC_GTK_PRINT_DIALOGS_HH
+#define XFC_GTK_PRINT_DIALOGS_HH 1
+
+#include <gtk/gtkprintunixdialog.h>
+
+#include <xfc/gtk/dialog.hh>
+
+#include <xfc/gtk/printpagesetup.hh>
+
+#include <xfc/gtk/printsetting.hh>
+
+#include <xfc/gtk/printer.hh>
+
+namespace Xfc {
+ namespace Gtk {
+
+ enum PrintCapabilities {
+ PAGE_SET = GTK_PRINT_CAPABILITY_PAGE_SET,
+ COPIES = GTK_PRINT_CAPABILITY_COPIES,
+ COLLATE = GTK_PRINT_CAPABILITY_COLLATE,
+ REVERSE = GTK_PRINT_CAPABILITY_REVERSE,
+ SCALE = GTK_PRINT_CAPABILITY_SCALE,
+ GENERATE_PDF = GTK_PRINT_CAPABILITY_GENERATE_PDF,
+ GENERATE_PS = GTK_PRINT_CAPABILITY_GENERATE_PS,
+ PREVIEW = GTK_PRINT_CAPABILITY_PREVIEW
+ };
+
+ /**
+ PrintUnixDialog implements a print dialog for platforms which
+ don't provide a native print dialog, like Unix. It can be
+ used very much like any other GTK+ dialog, at the cost of
+ the portability offered by the high-level printing API
+
+ In order to print something with PrintUnixDialog, you need
+ to use unix_dialog_get_selected_printer() to obtain a GtkPrinter
+ object and use it to construct a PrintJob using job_new().
+
+ GtkPrintUnixDialog uses the following response values:
+
+ GTK_RESPONSE_OK for the "Print" button
+ GTK_RESPONSE_APPLY for the "Preview" button
+ GTK_RESPONSE_CANCEL for the "Cancel" button
+ */
+ class PrintUnixDialog : public Dialog {
+ public:
+ void set_page_setup( GtkPageSetup *page_setup );
+ PageSetup* get_page_setup();
+ void set_current_page( gint current_page );
+ gint get_current_page();
+ void set_settings( PrintSettings *settings);
+ PrintSettings* get_settings();
+ Printer* get_selected_printer();
+ void add_custom_tab( Widget *child, Widget *tab_label);
+ void set_manual_capabilities( PrintCapabilities capabilities);
+ };
+
+ /**
+ PageSetupUnixDialog implements a page setup dialog for platforms
+ which don't provide a native page setup dialog, like Unix. It can
+ be used very much like any other GTK+ dialog, at the cost of the
+ portability offered by the high-level printing API
+ */
+ class PrintPageSetupUnixDialog : public Dialog {
+ public:
+ void set_page_setup( PageSetup *page_setup );
+ PageSetup* get_page_setup();
+ void set_print_settings( PrintSettings *print_settings);
+ PrintSettings* get_print_settings();
+ };
+ }
+}
+
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/printer.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printer.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printer.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,38 @@
+#ifndef XFC_GTK_PRINTER_HH
+#define XFC_GTK_PRINTER_HH 1
+
+#include <gtk/gtkprinter.h>
+
+#include <xfc/glib/object.hh>
+
+#include <string>
+
+namespace Xfc {
+ namespace Gtk {
+ using namespace std;
+
+ class Printer : public G::Object {
+ public:
+ Printer( const string &name, GtkPrintBackend *backend, bool virtual_);
+
+ GtkPrintBackend* get_backend();
+ string get_name();
+ string get_state_message();
+ string get_description();
+ string get_location();
+ string get_icon_name();
+ gint get_job_count();
+ bool is_active();
+ bool is_virtual();
+ bool is_default();
+ bool accepts_ps();
+ bool accepts_pdf();
+ gint compare( Printer &a, Printer &b );
+ typedef gboolean (*GtkPrinterFunc) (GtkPrinter *printer, gpointer data);
+ void printers(GtkPrinterFunc func, gpointer data,
+ GDestroyNotify destroy, gboolean wait);
+ };
+ }
+}
+
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/printjob.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printjob.cc (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printjob.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1 @@
+#include <xfc/gtk/printjob.hh>
Added: xfc/trunk/libXFCui/xfc/gtk/printjob.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printjob.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printjob.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,50 @@
+#ifndef XFC_GTK_PRINTJOB_HH
+#define XFC_GTK_PRINTJOB_HH 1
+
+#include <gtk/gtkprintjob.h>
+
+#include <xfc/glib/object.hh>
+
+#include <xfc/gtk/printsetting.hh>
+
+#include <xfc/gtk/printer.hh>
+
+namespace Xfc {
+ namespace Gtk {
+
+ class PrintJobSignals {
+ public:
+ virtual void status_changed() = 0;
+ };
+
+ /**
+ A PrintJob object represents a job that is sent to a
+ printer. You only need to deal directly with print jobs
+ if you use the non-portable PrintUnixDialog API.
+
+ Use get_surface() to obtain the cairo surface onto which
+ the pages must be drawn. Use job_send()
+ to send the finished job to the printer. If you don't use
+ cairo PrintJob also supports printing of manually generated
+ postscript, via set_source_file().
+ */
+ class PrintJob : public G::Object {
+ public:
+ PrintJob( GtkPrintJob *p, bool owned_reference = true );
+
+ PrintSettings* get_settings();
+ Printer* get_printer();
+ String get_title();
+ PrintStatus get_status();
+ bool set_source_file( const string &filename, GError **error );
+ cairo_surface_t* get_surface( GError **error );
+ void set_track_print_status( bool track_status);
+ bool get_track_print_status();
+
+ // Signals
+
+ };
+ }
+}
+
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/printoperation.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printoperation.cc (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printoperation.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,298 @@
+#include "printoperation.hh"
+#include "printoperationsignals.hh"
+#include "private/printoperationpreviewiface.hh"
+#include "private/printoperationclass.hh"
+/*
+ * Gtk::PrintOperationClass
+ */
+namespace Xfc {
+
+ namespace Gtk {
+
+ // PrintOperation
+
+ PrintOperation::PrintOperation() : G::Object((GObject*)PrintOperationClass::create()) {}
+
+ PrintOperation::PrintOperation( GtkPrintOperation *op, bool owns_reference )
+ : G::Object( (GObject*)op, owns_reference ) {}
+
+ PrintOperation::~PrintOperation() {}
+
+ void PrintOperation::set_allow_async(bool allow_async)
+ {
+ gtk_print_operation_set_allow_async( gtk_print_operation(), allow_async );
+ }
+
+ void PrintOperation::set_default_page_setup(PageSetup *default_page_setup)
+ {
+ gtk_print_operation_set_default_page_setup( gtk_print_operation(), default_page_setup->gtk_pagesetup() );
+ }
+
+ PageSetup* PrintOperation::get_default_page_setup()
+ {
+ GtkPageSetup *psetup = gtk_print_operation_get_default_page_setup(gtk_print_operation());
+ return G::Object::wrap<PageSetup>( psetup );
+ }
+
+ void PrintOperation::set_print_settings( PrintSettings *print_settings )
+ {
+ gtk_print_operation_set_print_settings( gtk_print_operation(), print_settings->gtk_print_settings() );
+ }
+
+ PrintSettings* PrintOperation::get_print_settings()
+ {
+ GtkPrintSettings *pset = gtk_print_operation_get_print_settings( gtk_print_operation());
+ return G::Object::wrap<PrintSettings>( pset );
+ }
+
+ void PrintOperation::set_job_name( const String &job_name )
+ {
+ gtk_print_operation_set_job_name( gtk_print_operation(), job_name.c_str() );
+ }
+
+ void PrintOperation::set_n_pages( int n_pages )
+ {
+ gtk_print_operation_set_n_pages( gtk_print_operation(), n_pages );
+ }
+
+ void PrintOperation::set_current_page( int current_page)
+ {
+ gtk_print_operation_set_current_page( gtk_print_operation(), current_page );
+ }
+
+ void PrintOperation::set_use_full_page( bool full_page)
+ {
+ gtk_print_operation_set_use_full_page( gtk_print_operation(), full_page );
+ }
+
+ void PrintOperation::set_unit(Gtk::Unit unit)
+ {
+ gtk_print_operation_set_unit( gtk_print_operation(), (GtkUnit)unit );
+ }
+
+ void PrintOperation::set_export_filename( const String &filename)
+ {
+ gtk_print_operation_set_export_filename( gtk_print_operation(), filename.c_str() );
+ }
+
+ void PrintOperation::set_show_progress( bool show_progress)
+ {
+ gtk_print_operation_set_show_progress( gtk_print_operation(), show_progress );
+ }
+
+ void PrintOperation::set_track_print_status( bool track_status)
+ {
+ gtk_print_operation_set_track_print_status( gtk_print_operation(), track_status );
+ }
+
+ void PrintOperation::set_custom_tab_label( const String &label )
+ {
+ gtk_print_operation_set_custom_tab_label( gtk_print_operation(), label.c_str() );
+ }
+
+ PrintOperationResult PrintOperation::run( PrintOperationAction action, Window *parent )
+ {
+ GtkWindow *pwnd = NULL;
+ GError *error;
+
+ if( parent )
+ pwnd = parent->gtk_window();
+
+ return (PrintOperationResult)gtk_print_operation_run( gtk_print_operation(), (GtkPrintOperationAction)action, pwnd, &error );
+ }
+
+ void PrintOperation::cancel()
+ {
+ gtk_print_operation_cancel( gtk_print_operation() );
+ }
+
+ // PrintOperationClass
+
+ void PrintOperationClass::init(GtkPrintOperationClass *g_class)
+ {
+ ObjectClass::init((GtkObjectClass*)g_class);
+
+ g_class->begin_print = &begin_print_proxy;
+ g_class->create_custom_widget = &create_custom_widget_proxy;
+ g_class->custom_widget_apply = &custom_widget_apply_proxy;
+ g_class->done = &done_proxy;
+ g_class->draw_page = &draw_page_proxy;
+ g_class->end_print = &end_print_proxy;
+ g_class->paginate = &paginate_proxy;
+ g_class->preview = &preview_proxy;
+ g_class->request_page_setup = &request_page_setup_proxy;
+ g_class->status_changed = &status_changed_proxy;
+ }
+
+ GtkPrintOperationClass* PrintOperationClass::get_parent_class(void *instance)
+ {
+ return static_cast<GtkPrintOperationClass*>(g_type_class_peek_parent(G_OBJECT_GET_CLASS(instance)));
+ }
+
+ GType PrintOperationClass::get_type()
+ {
+ static GType type = 0;
+ if (!type) {
+ type = G::TypeInstance::register_type(GTK_TYPE_PRINT_OPERATION, (GClassInitFunc)&init);
+ G::TypeInstance::add_interface(type, GTK_TYPE_PRINT_OPERATION_PREVIEW,
+ (GInterfaceInitFunc)&PrintOperationPreviewIface::init);
+ }
+ return type;
+ }
+
+ void* PrintOperationClass::create()
+ {
+ return g_object_new(get_type(), 0);
+ }
+
+ void PrintOperationClass::begin_print_proxy( GtkPrintOperation *operation, GtkPrintContext *context )
+ {
+ PrintOperationSignals *signals = dynamic_cast<PrintOperationSignals*>(G::ObjectSignals::pointer((GObject*)operation));
+ if (signals) {
+ PrintContext *ctx = G::Object::wrap<PrintContext>(context);
+
+ signals->on_begin_print(*ctx);
+ } else {
+ GtkPrintOperationClass *g_class = get_parent_class(operation);
+
+ if (g_class && g_class->begin_print)
+ g_class->begin_print( operation, context );
+ }
+ }
+
+ GtkWidget* PrintOperationClass::create_custom_widget_proxy( GtkPrintOperation *operation)
+ {
+ PrintOperationSignals *signals = dynamic_cast<PrintOperationSignals*>(G::ObjectSignals::pointer((GObject*)operation));
+ if (signals) {
+ Widget *w = signals->on_create_custom_widget();
+
+ return (GtkWidget *)w;
+ } else {
+ GtkPrintOperationClass *g_class = get_parent_class(operation);
+
+ if (g_class && g_class->create_custom_widget)
+ return g_class->create_custom_widget( operation );
+ }
+ return NULL;
+ }
+
+ void PrintOperationClass::custom_widget_apply_proxy(GtkPrintOperation *operation, GtkWidget *widget )
+ {
+ PrintOperationSignals *signals = dynamic_cast<PrintOperationSignals*>(G::ObjectSignals::pointer((GObject*)operation));
+ if (signals) {
+ signals->on_custom_widget_apply(*G::Object::wrap<Widget>( widget ));
+ } else {
+ GtkPrintOperationClass *g_class = get_parent_class(operation);
+
+ if (g_class && g_class->custom_widget_apply)
+ g_class->custom_widget_apply( operation, widget );
+ }
+ }
+
+ void PrintOperationClass::done_proxy(GtkPrintOperation *operation, GtkPrintOperationResult result )
+ {
+ PrintOperationSignals *signals = dynamic_cast<PrintOperationSignals*>(G::ObjectSignals::pointer((GObject*)operation));
+ if (signals) {
+ signals->on_done((PrintOperationResult)result );
+ } else {
+ GtkPrintOperationClass *g_class = get_parent_class(operation);
+
+ if (g_class && g_class->done )
+ g_class->done( operation, result );
+ }
+ }
+
+ void PrintOperationClass::draw_page_proxy(GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr )
+ {
+ PrintOperationSignals *signals = dynamic_cast<PrintOperationSignals*>(G::ObjectSignals::pointer((GObject*)operation));
+ if (signals) {
+ signals->on_draw_page(*G::Object::wrap<PrintContext>( context ), page_nr );
+ } else {
+ GtkPrintOperationClass *g_class = get_parent_class(operation);
+
+ if (g_class && g_class->draw_page)
+ g_class->draw_page( operation, context, page_nr );
+ }
+ }
+
+ void PrintOperationClass::end_print_proxy(GtkPrintOperation *operation, GtkPrintContext *context )
+ {
+ PrintOperationSignals *signals = dynamic_cast<PrintOperationSignals*>(G::ObjectSignals::pointer((GObject*)operation));
+ if (signals) {
+ signals->on_end_print(*G::Object::wrap<PrintContext>( context ));
+ } else {
+ GtkPrintOperationClass *g_class = get_parent_class(operation);
+
+ if (g_class && g_class->end_print)
+ g_class->end_print( operation, context );
+ }
+ }
+
+ gboolean PrintOperationClass::paginate_proxy(GtkPrintOperation *operation, GtkPrintContext *context )
+ {
+ PrintOperationSignals *signals = dynamic_cast<PrintOperationSignals*>(G::ObjectSignals::pointer((GObject*)operation));
+
+ if (signals) {
+ return signals->on_paginate(*G::Object::wrap<PrintContext>( context ));
+ } else {
+ GtkPrintOperationClass *g_class = get_parent_class(operation);
+
+ if (g_class && g_class->paginate)
+ return g_class->paginate( operation, context );
+ }
+ return false;
+ }
+
+ gboolean PrintOperationClass::preview_proxy(GtkPrintOperation *operation, GtkPrintOperationPreview *preview,
+ GtkPrintContext *context, GtkWindow *parent )
+ {
+ PrintOperationSignals *signals = dynamic_cast<PrintOperationSignals*>(G::ObjectSignals::pointer((GObject*)operation));
+ if (signals) {
+ PrintOperation *op = G::Object::wrap<PrintOperation>(operation);
+ PrintOperationPreview *pop = (PrintOperationPreview *)(op);
+ PrintContext *ctx = G::Object::wrap<PrintContext>(context);
+ Window *w = G::Object::wrap<Window>(parent);
+
+ return signals->on_preview(*pop, *ctx, *w);
+ } else {
+ GtkPrintOperationClass *g_class = get_parent_class(operation);
+
+ if (g_class && g_class->preview)
+ return g_class->preview( operation, preview, context, parent );
+ }
+ return false;
+ }
+
+ void PrintOperationClass::request_page_setup_proxy(GtkPrintOperation *operation, GtkPrintContext *context,
+ gint page_nr, GtkPageSetup *setup )
+ {
+ PrintOperationSignals *signals = dynamic_cast<PrintOperationSignals*>(G::ObjectSignals::pointer((GObject*)operation));
+ if (signals) {
+ PrintContext *ctx = G::Object::wrap<PrintContext>(context);
+ PageSetup *ps = G::Object::wrap<PageSetup>(setup);
+
+ signals->on_request_page_setup(*ctx, page_nr, *ps);
+ } else {
+ GtkPrintOperationClass *g_class = get_parent_class(operation);
+
+ if (g_class && g_class->request_page_setup)
+ g_class->request_page_setup(operation, context, page_nr, setup);
+ }
+ }
+
+ void PrintOperationClass::status_changed_proxy(GtkPrintOperation *operation )
+ {
+ PrintOperationSignals *signals = dynamic_cast<PrintOperationSignals*>(G::ObjectSignals::pointer((GObject*)operation));
+ if (signals) {
+ signals->on_status_changed();
+ } else {
+ GtkPrintOperationClass *g_class = get_parent_class(operation);
+
+ if (g_class && g_class->status_changed)
+ g_class->status_changed( operation );
+ }
+ }
+
+ } // Gtk namespace
+
+} // Xfc namespace
Added: xfc/trunk/libXFCui/xfc/gtk/printoperation.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printoperation.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printoperation.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,248 @@
+#ifndef XFC_GTK_PRINT_OPERATION_HH
+#define XFC_GTK_PRINT_OPERATION_HH 1
+
+/**
+ GtkPrintOperation interface
+*/
+
+#ifndef XFC_GTK_WINDOW_HH
+#include <xfc/gtk/window.hh>
+#endif
+
+#ifndef XFC_GTK_PRINT_PRINTCONTEXT_HH
+#include <xfc/gtk/printcontext.hh>
+#endif
+
+#ifndef XFC_GTK_PRINT_SETTING_HH
+#include <xfc/gtk/printsetting.hh>
+#endif
+
+#ifndef XFC_GTK_PRINT_OPERATION_PREVIEW_HH
+#include "xfc/gtk/printoperationpreview.hh"
+#endif
+
+namespace Xfc {
+ namespace Gtk {
+ class PrintSettings;
+
+ enum PrintOperationResult {
+ ERROR = GTK_PRINT_OPERATION_RESULT_ERROR,
+ APPLY = GTK_PRINT_OPERATION_RESULT_APPLY,
+ CANCEL = GTK_PRINT_OPERATION_RESULT_CANCEL,
+ IN_PROGRESS = GTK_PRINT_OPERATION_RESULT_IN_PROGRESS
+ };
+
+ enum PrintOperationAction {
+ ACTION_PRINT_DIALOG = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
+ ACTION_PRINT = GTK_PRINT_OPERATION_ACTION_PRINT,
+ ACTION_PREVIEW = GTK_PRINT_OPERATION_ACTION_PREVIEW,
+ ACTION_EXPORT = GTK_PRINT_OPERATION_ACTION_EXPORT
+ };
+
+ enum PrintStatus {
+ INITIAL = GTK_PRINT_STATUS_INITIAL,
+ PREPARING = GTK_PRINT_STATUS_PREPARING,
+ GENERATING_DATA = GTK_PRINT_STATUS_GENERATING_DATA,
+ SENDING_DATA = GTK_PRINT_STATUS_SENDING_DATA,
+ PENDING = GTK_PRINT_STATUS_PENDING,
+ PENDING_ISSUE = GTK_PRINT_STATUS_PENDING_ISSUE,
+ PRINTING = GTK_PRINT_STATUS_PRINTING,
+ FINISHED = GTK_PRINT_STATUS_FINISHED,
+ FINISHED_ABORTED = GTK_PRINT_STATUS_FINISHED_ABORTED
+ };
+
+ class PrintOperation : public G::Object, public PrintOperationPreview {
+ friend class G::Object;
+
+ PrintOperation(const PrintOperation &);
+
+ PrintOperation &operator=(const PrintOperation &);
+ protected:
+ /// @name Constructors
+ /// @{
+
+ PrintOperation();
+
+ explicit PrintOperation(GtkPrintOperation *op, bool owns_reference = false);
+
+ virtual ~PrintOperation();
+
+ /// @}
+ /// @name Signal Prototypes
+ /// @{
+
+ typedef G::Signal<void,PrintContext&> BeginPrintSignalType;
+ typedef G::SignalProxy<G::TypeInterface, BeginPrintSignalType> BeginPrintSignalProxy;
+ static const BeginPrintSignalType begin_print_signal;
+ ///< Begin print signal proxy
+
+ typedef G::Signal<void,Widget*> CreateCustomWidgetSignalType;
+ typedef G::SignalProxy<G::TypeInterface, CreateCustomWidgetSignalType> CreateCustomWidgetSignalProxy;
+ static const CreateCustomWidgetSignalType create_custom_widget_signal;
+ ///< Create custom widget signal
+
+ typedef G::Signal<void,Widget*> CustomWidgetApplySignalType;
+ typedef G::SignalProxy<G::TypeInterface, CustomWidgetApplySignalType> CustomWidgetApplySignalProxy;
+ static const CustomWidgetApplySignalType custom_widget_apply_signal;
+ ///<
+
+ typedef G::Signal<void,PrintOperationResult&> DoneSignalType;
+ typedef G::SignalProxy<G::TypeInterface,DoneSignalType> DoneSignalProxy;
+ static const DoneSignalType done_signal;
+
+ typedef G::Signal<void,PrintContext&,int> DrawPageSignalType;
+ typedef G::SignalProxy<G::TypeInterface,DrawPageSignalType> DrawPageSignalProxy;
+ static const DrawPageSignalType draw_page_signal;
+
+ typedef G::Signal<void,PrintContext&> EndPrintSignalType;
+ typedef G::SignalProxy<G::TypeInterface,EndPrintSignalType> EndPrintSignalProxy;
+ static const EndPrintSignalType end_print_signal;
+
+ typedef G::Signal<bool,PrintContext&> PaginateSignalType;
+ typedef G::SignalProxy<G::TypeInterface,PaginateSignalType> PaginateSignalProxy;
+ static const PaginateSignalType paginate_signal;
+
+ typedef G::Signal<bool,PrintOperationPreview&,PrintContext&,Window&> PreviewSignalType;
+ typedef G::SignalProxy<G::TypeInterface,PreviewSignalType> PreviewSignalProxy;
+ static const PreviewSignalType preview_signal;
+
+ typedef G::Signal<void,PrintContext&,int,PageSetup&> RequestPageSetupSignalType;
+ typedef G::SignalProxy<G::TypeInterface,RequestPageSetupSignalType> RequestPageSetupSignalProxy;
+ static const RequestPageSetupSignalType request_page_setup;
+
+ typedef G::Signal<void> StatusChangedSignalType;
+ typedef G::SignalProxy<G::TypeInterface,StatusChangedSignalType> StatusChangedSignalProxy;
+ static const StatusChangedSignalType status_changed_signal;
+
+ public:
+ /// @}
+ /// @name Accessors
+ /// @{
+
+ operator GtkPrintOperation* () const;
+
+ GtkPrintOperation* gtk_print_operation() const;
+ ///< Get a pointer to the GtkPrintOperation structure.
+
+ PrintStatus get_status();
+ String get_status_string();
+ bool is_finished();
+
+ /// @}
+ /// @name Methods
+ /// @{
+
+ void set_allow_async(bool allow_async);
+ void set_default_page_setup( PageSetup *default_page_setup);
+ PageSetup* get_default_page_setup();
+ void set_print_settings( PrintSettings *print_settings );
+ PrintSettings* get_print_settings();
+ void set_job_name( const String &job_name );
+ void set_n_pages( int n_pages );
+ void set_current_page( int current_page);
+ void set_use_full_page( bool full_page);
+ void set_unit(Gtk::Unit unit);
+ void set_export_filename( const String &filename);
+ void set_show_progress( bool show_progress);
+ void set_track_print_status( bool track_status);
+ void set_custom_tab_label( const String &label);
+ PrintOperationResult run( PrintOperationAction action, Window *parent = NULL);
+ void cancel();
+
+ /// @}
+ /// @name Signal Proxies
+ /// @{
+
+ const BeginPrintSignalProxy signal_begin_print();
+ ///< Emitted after the user has finished changing print settings in the dialog,
+ ///< before the actual rendering starts.
+ ///< A typical use for ::begin-print is to use the parameters
+ ///< from the GtkPrintContext and paginate the document accordingly, and then
+ ///< set the number of pages with gtk_print_operation_set_n_pages().
+
+ const CreateCustomWidgetSignalProxy signal_create_custom_widget();
+ ///< Emitted when displaying the print dialog. If you return a widget in a handler
+ ///< for this signal it will be added to a custom tab in the print dialog. You
+ ///< typically return a container widget with multiple widgets in it.
+ ///< The print dialog owns the returned widget, and its lifetime isn't controlled
+ ///< by the app. However, the widget is guaranteed to stay around until the
+ ///< "custom-widget-apply" signal is emitted on the operation. Then you can read
+ ///< out any information you need from the widgets.
+
+ const CustomWidgetApplySignalProxy signal_custom_widget_apply();
+ ///< Emitted right before "begin-print" if you added a custom widget in the
+ ///< create-custom-widget handler. When you get this signal you should read
+ ///< the information from the custom widgets, as the widgets are not
+ ///< guaraneed to be around at a later time.
+
+ const DoneSignalProxy signal_done();
+ ///< Emitted when the print operation run has finished doing everything
+ ///< required for printing. result gives you information about what
+ ///< happened during the run. If result is PRINT_OPERATION_RESULT_ERROR
+ ///< then you can call get_error() for more information.
+ ///< If you enabled print status tracking then is_finished() may still
+ ///< return false after "done" was emitted.
+
+ const DrawPageSignalProxy signal_draw_page();
+ ///< Emitted for every page that is printed. The signal handler must render
+ ///< the page_nr's page onto the cairo context obtained from context
+ ///< using PrintContext::get_cairo_context().
+ ///< Use set_use_full_page() and set_unit() before starting the print
+ ///< operation to set up the transformation of the cairo context according to your needs.
+
+ const EndPrintSignalProxy signal_end_print();
+ ///< Emitted after all pages have been rendered. A handler for this signal
+ ///< can clean up any resources that have been allocated in the "begin-print" handler.
+
+ const PaginateSignalProxy signal_paginate();
+ ///< Emitted after the "begin-print" signal, but before the actual rendering starts.
+ ///< It keeps getting emitted until it returns false.
+ ///<
+ ///< The paginate signal is intended to be used for paginating the document in small
+ ///< chunks, to avoid blocking the user interface for a long time. The signal handler
+ ///< should update the number of pages using set_n_pages(), and return tru if the
+ ///< document has been completely paginated.
+ ///<
+ ///< If you don't need to do pagination in chunks, you can simply do it all in the
+ ///< begin-print handler, and set the number of pages from there.
+
+ const PreviewSignalProxy signal_preview();
+ ///< Gets emitted when a preview is requested from the native dialog.
+ ///< The default handler for this signal uses an external viewer application to preview.
+ ///< To implement a custom print preview, an application must return true from its
+ ///< handler for this signal. In order to use the provided context for the preview
+ ///< implementation, it must be given a suitable cairo context with
+ ///< PrintContext::set_cairo_context().
+
+ ///< The custom preview implementation can use PrintOperationPreview::is_selected()
+ ///< and PrintOperationPreview::render_page() to find pages which are selected for
+ ///< print and render them. The preview must be finished by calling PrintOperationPreview::end_preview()
+ ///< (typically in response to the user clicking a close button).
+
+ const RequestPageSetupSignalProxy signal_request_page();
+ ///< Emitted once for every page that is printed, to give the application a
+ ///< chance to modify the page setup. Any changes done to setup will be in force
+ ///< only for printing this page.
+
+ const StatusChangedSignalProxy signal_status_changed();
+ ///< Emitted at between the various phases of the print operation. See PrintStatus
+ ///< for the phases that are being discriminated. Use get_status() to find out the
+ ///< current status.
+
+ /// @}
+ };
+
+ inline GtkPrintOperation* PrintOperation::gtk_print_operation() const
+ {
+ return reinterpret_cast<GtkPrintOperation*>(instance_);
+ }
+
+ inline PrintOperation::operator GtkPrintOperation* () const
+ {
+ return this ? gtk_print_operation() : NULL;
+ }
+
+ }
+}
+
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/printoperationpreview.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printoperationpreview.cc (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printoperationpreview.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,77 @@
+#include "printoperationpreview.hh"
+#include "printoperationpreviewsignals.hh"
+#include "private/printoperationpreviewiface.hh"
+
+#include "xfc/glib/object.hh"
+#include "xfc/glib/objectsignals.hh"
+
+namespace Xfc {
+
+ namespace Gtk {
+
+ // PrintOperationPreview
+
+ PrintOperationPreview::PrintOperationPreview() {}
+
+ PrintOperationPreview::~PrintOperationPreview() {}
+
+ void PrintOperationPreview::end_preview()
+ {
+ gtk_print_operation_preview_end_preview( gtk_printoperationpreview() );
+ }
+
+ bool PrintOperationPreview::is_selected( int page_nr )
+ {
+ return gtk_print_operation_preview_is_selected( gtk_printoperationpreview(), page_nr );
+ }
+
+ void PrintOperationPreview::render_page( int page_nr )
+ {
+ gtk_print_operation_preview_render_page( gtk_printoperationpreview(), page_nr );
+ }
+
+ // PrintOperationPreviewIface
+
+ void PrintOperationPreviewIface::init(GtkPrintOperationPreviewIface *g_iface)
+ {
+ g_iface->ready = &PrintOperationPreviewIface::ready_proxy;
+ g_iface->got_page_size = &PrintOperationPreviewIface::got_page_size_proxy;
+ }
+
+ GtkPrintOperationPreviewIface *PrintOperationPreviewIface::get_parent_iface(void *instance)
+ {
+ return static_cast<GtkPrintOperationPreviewIface*>(g_type_interface_peek_parent(GTK_PRINT_OPERATION_PREVIEW_GET_IFACE(instance)));
+ }
+
+ void PrintOperationPreviewIface::ready_proxy(GtkPrintOperationPreview *preview, GtkPrintContext *ctx)
+ {
+ PrintOperationPreviewSignals *signals = dynamic_cast<PrintOperationPreviewSignals*>
+ (G::ObjectSignals::pointer((GObject*)preview));
+
+ if (signals) {
+ signals->ready(*G::Object::wrap<PrintContext>(ctx));
+ } else {
+ GtkPrintOperationPreviewIface *g_iface = get_parent_iface(preview);
+ if (g_iface && g_iface->ready)
+ g_iface->ready(preview, ctx);
+ }
+ }
+
+ void PrintOperationPreviewIface::got_page_size_proxy( GtkPrintOperationPreview *preview,
+ GtkPrintContext *ctx, GtkPageSetup *setup )
+ {
+ PrintOperationPreviewSignals *signals = dynamic_cast<PrintOperationPreviewSignals*>
+ (G::ObjectSignals::pointer((GObject*)preview));
+
+ if(signals) {
+ signals->got_page_size( *G::Object::wrap<PrintContext>(ctx),
+ *G::Object::wrap<PageSetup>(setup) );
+ } else {
+ GtkPrintOperationPreviewIface *g_iface = get_parent_iface(preview);
+ if (g_iface && g_iface->got_page_size)
+ g_iface->got_page_size(preview, ctx, setup);
+ }
+ }
+
+ } // namespace Gtk
+} // namespace Xfc
Added: xfc/trunk/libXFCui/xfc/gtk/printoperationpreview.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printoperationpreview.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printoperationpreview.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,75 @@
+#ifndef XFC_GTK_PRINT_OPERATION_PREVIEW_HH
+#define XFC_GTK_PRINT_OPERATION_PREVIEW_HH
+
+// This also include the TypeInterface
+#ifndef XFC_G_OBJECT_HH
+#include <xfc/glib/object.hh>
+#endif
+
+#ifndef __GTK_EDITABLE_H__
+#include <gtk/gtkprintoperationpreview.h>
+#endif
+
+namespace Xfc {
+
+ namespace Gtk {
+
+ // The preview interface
+ class PrintOperationPreview : public virtual G::TypeInterface {
+ friend class G::Object;
+
+ protected:
+ /// @name Constructors
+ /// @{
+
+ PrintOperationPreview();
+
+ virtual ~PrintOperationPreview();
+
+ /// @}
+ /// @name Signal Prototypes
+ /// @{
+
+ typedef G::Signal<void, void> ReadySignalType;
+ typedef G::SignalProxy<TypeInterface, ReadySignalType> ReadySignalProxy;
+ static const ReadySignalType ready_signal;
+ ///< Report when ready
+
+ typedef G::Signal<void, void> GotPageSizeSignalType;
+ typedef G::SignalProxy<TypeInterface, GotPageSizeSignalType> GotPageSizeSignalProxy;
+ static const GotPageSizeSignalType got_page_size_signal;
+ ///< report when it got the page size
+
+ public:
+ GtkPrintOperationPreview *gtk_printoperationpreview() const;
+
+ operator GtkPrintOperationPreview* () const;
+
+ /// @}
+ /// @name Accessors
+ /// @{
+
+ bool is_selected( int page_nr );
+
+ /// @}
+ /// @name Methods
+ /// @{
+
+ void end_preview();
+
+ void render_page( int page_nr );
+
+ /// @}
+ /// @name Signal Proxies
+ /// @{
+ const ReadySignalProxy signal_ready();
+
+ const GotPageSizeSignalProxy signal_got_page_size();
+ /// @}
+ };
+ }
+}
+
+#include "xfc/gtk/inline/printoperationpreview.inl"
+
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/printoperationpreviewsignals.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printoperationpreviewsignals.cc (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printoperationpreviewsignals.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,27 @@
+#include "printoperationpreviewsignals.hh"
+#include "private/printoperationpreviewiface.hh"
+
+using namespace Xfc;
+using namespace Gtk;
+
+// Make sure we only use this signal on the prober class
+PrintOperationPreviewSignals::PrintOperationPreviewSignals(PrintOperationPreview *op)
+{
+}
+
+PrintOperationPreviewSignals::~PrintOperationPreviewSignals() {}
+
+void PrintOperationPreviewSignals::ready(PrintContext &ctx)
+{
+ GtkPrintOperationPreviewIface *g_iface = PrintOperationPreviewIface::get_parent_iface(instance_);
+ if (g_iface && g_iface->ready)
+ g_iface->ready((GtkPrintOperationPreview*)instance_, (GtkPrintContext*)ctx);
+}
+
+void PrintOperationPreviewSignals::got_page_size(PrintContext &ctx, PageSetup &setup)
+{
+ GtkPrintOperationPreviewIface *g_iface = PrintOperationPreviewIface::get_parent_iface(instance_);
+ if (g_iface && g_iface->got_page_size)
+ g_iface->got_page_size((GtkPrintOperationPreview*)instance_, (GtkPrintContext*)ctx, (GtkPageSetup*)setup);
+}
+
Added: xfc/trunk/libXFCui/xfc/gtk/printoperationpreviewsignals.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printoperationpreviewsignals.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printoperationpreviewsignals.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,33 @@
+#ifndef XFC_PRINT_OPERATION_PREVIEW_SIGNALS_HH
+#define XFC_PRINT_OPERATION_PREVIEW_SIGNALS_HH 1
+
+// printoperationpreviewsignals
+
+#ifndef XFC_PRINT_CONTEXT_HH
+#include <xfc/gtk/printcontext.hh>
+#endif
+
+#ifndef XFC_GTK_PRINT_OPERATION_PREVIEW_HH
+#include <xfc/gtk/printoperationpreview.hh>
+#endif
+
+namespace Xfc {
+
+ namespace Gtk {
+
+ class PrintOperationPreviewSignals : public virtual G::TypeInterface
+ {
+ protected:
+ PrintOperationPreviewSignals( PrintOperationPreview *op );
+
+ virtual ~PrintOperationPreviewSignals() = 0;
+ public:
+ virtual void ready( PrintContext &ctx );
+
+ virtual void got_page_size( PrintContext &ctx, PageSetup &setup );
+ };
+
+ }
+}
+
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/printoperationsignals.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printoperationsignals.cc (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printoperationsignals.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,101 @@
+
+#include "printoperationsignals.hh"
+#include "private/printoperationclass.hh"
+
+using namespace Xfc;
+
+/* Gtk::PrintOperationSignals
+ */
+
+Gtk::PrintOperationSignals::PrintOperationSignals(Gtk::PrintOperation *op) :
+ Gtk::PrintOperationPreviewSignals(op)
+{
+}
+
+Gtk::PrintOperationSignals::~PrintOperationSignals()
+{
+}
+
+void Gtk::PrintOperationSignals::on_begin_print( Gtk::PrintContext &context )
+{
+ GtkPrintOperationClass *g_class = PrintOperationClass::get_parent_class(instance_);
+ if (g_class && g_class->begin_print)
+ g_class->begin_print((GtkPrintOperation*)instance_, (GtkPrintContext*)context);
+}
+
+Gtk::Widget *Gtk::PrintOperationSignals::on_create_custom_widget()
+{
+ GtkPrintOperationClass *g_class = PrintOperationClass::get_parent_class(instance_);
+ if (g_class && g_class->create_custom_widget) {
+ GtkWidget *wnd = g_class->create_custom_widget((GtkPrintOperation*)instance_);
+
+ return G::Object::wrap_new<Gtk::Widget>(wnd);
+ }
+
+ return NULL;
+}
+
+void Gtk::PrintOperationSignals::on_custom_widget_apply(Gtk::Widget &widget)
+{
+ GtkPrintOperationClass *g_class = PrintOperationClass::get_parent_class(instance_);
+ if (g_class && g_class->custom_widget_apply)
+ g_class->custom_widget_apply((GtkPrintOperation*)instance_, (GtkWidget*)widget);
+}
+
+void Gtk::PrintOperationSignals::on_done(Gtk::PrintOperationResult result)
+{
+ GtkPrintOperationClass *g_class = PrintOperationClass::get_parent_class(instance_);
+ if (g_class && g_class->done)
+ g_class->done((GtkPrintOperation*)instance_, (GtkPrintOperationResult)result);
+ }
+
+void Gtk::PrintOperationSignals::on_draw_page(Gtk::PrintContext &context, int page_nr)
+{
+ GtkPrintOperationClass *g_class = PrintOperationClass::get_parent_class(instance_);
+ if (g_class && g_class->draw_page)
+ g_class->draw_page((GtkPrintOperation*)instance_, (GtkPrintContext*)context, page_nr);
+}
+
+void Gtk::PrintOperationSignals::on_end_print(Gtk::PrintContext &context)
+{
+ GtkPrintOperationClass *g_class = PrintOperationClass::get_parent_class(instance_);
+ if (g_class && g_class->end_print)
+ g_class->end_print((GtkPrintOperation*)instance_, (GtkPrintContext*)context);
+
+}
+
+bool Gtk::PrintOperationSignals::on_paginate(Gtk::PrintContext &context)
+{
+ GtkPrintOperationClass *g_class = PrintOperationClass::get_parent_class(instance_);
+ if (g_class && g_class->paginate)
+ return g_class->paginate((GtkPrintOperation*)instance_, (GtkPrintContext*)context);
+
+ return false;
+}
+
+bool Gtk::PrintOperationSignals::on_preview (Gtk::PrintOperationPreview &preview,
+ Gtk::PrintContext &context, Gtk::Window &parent)
+{
+ GtkPrintOperationClass *g_class = PrintOperationClass::get_parent_class(instance_);
+ if (g_class && g_class->preview)
+ return g_class->preview((GtkPrintOperation*)instance_, (GtkPrintOperationPreview*)preview,
+ (GtkPrintContext*)context, (GtkWindow*)parent);
+
+ return false;
+}
+
+void Gtk::PrintOperationSignals::on_request_page_setup(Gtk::PrintContext &context,
+ int page_nr, Gtk::PageSetup &setup)
+{
+ GtkPrintOperationClass *g_class = PrintOperationClass::get_parent_class(instance_);
+ if (g_class && g_class->request_page_setup)
+ g_class->request_page_setup((GtkPrintOperation*)instance_, (GtkPrintContext*)context,
+ page_nr, (GtkPageSetup*)setup );
+}
+
+void Gtk::PrintOperationSignals::on_status_changed()
+{
+ GtkPrintOperationClass *g_class = PrintOperationClass::get_parent_class(instance_);
+ if (g_class && g_class->status_changed)
+ g_class->status_changed((GtkPrintOperation*)instance_);
+}
Added: xfc/trunk/libXFCui/xfc/gtk/printoperationsignals.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printoperationsignals.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printoperationsignals.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,60 @@
+/// @file xfc/gtk/widgetsignals.hh
+/// @brief Gtk::Widget virtual signal handlers.
+///
+/// Provides Gtk::WidgetSignals, an abstract base class that implements
+/// the overridable virtual signal handlers for Gtk::Widget objects.
+
+#ifndef XFC_GTK_PRINT_OPERATION_SIGNALS_HH
+#define XFC_GTK_PRINT_OPERATION_SIGNALS_HH 1
+
+#ifndef XFC_OBJECT_HH
+#include <xfc/object.hh>
+#endif
+
+#ifndef XFC_GTK_OBJECT_SIGNALS_HH
+#include <xfc/gtk/objectsignals.hh>
+#endif
+
+#ifndef XFC_GTK_PRINT_OPERATION_HH
+#include <xfc/gtk/printoperation.hh>
+#endif
+
+#ifndef XFC_PRINT_OPERATION_PREVIEW_SIGNALS_HH
+#include <xfc/gtk/printoperationpreviewsignals.hh>
+#endif
+
+namespace Xfc {
+
+ namespace Gtk {
+
+ /// @class PrintOperationSignals printoperationsignals.hh xfc/gtk/printoperationsignals.hh
+ /// @brief Abstract base class that implements the virtual signal handlers for Gtk::PrintOperation.
+
+ class PrintOperationSignals : public PrintOperationPreviewSignals {
+ protected:
+ PrintOperationSignals(PrintOperation *operation);
+
+ virtual ~PrintOperationSignals();
+ public:
+ /// @name Basic print operation signal handlers
+ /// {@
+ virtual void on_begin_print(PrintContext &context);
+ virtual Widget *on_create_custom_widget();
+ virtual void on_custom_widget_apply(Widget &widget);
+ virtual void on_done(PrintOperationResult result);
+ virtual void on_draw_page(PrintContext &context, int page_nr);
+ virtual void on_end_print(PrintContext &context);
+ virtual bool on_paginate(PrintContext &context);
+ virtual bool on_preview (PrintOperationPreview &preview,
+ PrintContext &context, Window &parent);
+ virtual void on_request_page_setup(PrintContext &context,
+ int page_nr, PageSetup &setup);
+ virtual void on_status_changed();
+ /// @}
+ };
+
+ } // namespace Xfc
+
+} // namespace Gtk
+
+#endif // XFC_GTK_PRINT_OPERATION_SIGNALS_HH
Added: xfc/trunk/libXFCui/xfc/gtk/printpagesetup.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printpagesetup.cc (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printpagesetup.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,19 @@
+#include "printpagesetup.hh"
+//#include "private/printpagesetupclass.hh"
+#include "atk/object.hh"
+
+namespace Xfc {
+
+namespace Gtk {
+
+//PageSetup::PageSetup( const PageSetup *pagesetup ) : Object( PageSetupClass::create())
+//{
+//}
+
+PageSetup::PageSetup( GtkPageSetup *ctx, bool owns_reference ) : G::Object((GObject *)ctx, owns_reference )
+{
+}
+
+}
+
+}
Added: xfc/trunk/libXFCui/xfc/gtk/printpagesetup.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printpagesetup.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printpagesetup.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,77 @@
+#ifndef XFC_GTK_PAGE_SETUP_HH
+#define XFC_GTK_PAGE_SETUP_HH 1
+
+#include <xfc/config.h>
+
+#ifdef XFC_CAIRO
+
+#ifndef __GTK_PAGE_SETUP_H__
+#include <gtk/gtkpagesetup.h>
+#endif
+
+#ifndef XFC_G_OBJECT_HH
+#include <xfc/glib/object.hh>
+#endif
+
+#ifndef XFC_GTK_OBJECT_HH
+#include <xfc/gtk/object.hh>
+#endif
+
+// #ifndef XFC_GTK_PAPER_SIZE_HH
+// #include <xfc/printpapersize.hh>
+// #endif
+
+namespace Xfc {
+ namespace Gtk {
+
+ class PaperSize;
+
+ enum Unit {
+ UNIT_PIXEL = GTK_UNIT_PIXEL,
+ UNIT_POINTS = GTK_UNIT_POINTS,
+ UNIT_INCH = GTK_UNIT_INCH,
+ UNIT_MM = GTK_UNIT_MM
+ };
+
+ enum PageOrientation {
+ PAGE_ORIENTATION_PORTRAIT = GTK_PAGE_ORIENTATION_PORTRAIT,
+ PAGE_ORIENTATION_LANDSCAPE = GTK_PAGE_ORIENTATION_LANDSCAPE,
+ PAGE_ORIENTATION_REVERSE_PORTRAIT = GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT,
+ PAGE_ORIENTATION_REVERSE_LANDSCAPE = GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE
+ };
+
+ class PageSetup : public G::Object {
+ public:
+ PageSetup();
+ PageSetup( const PageSetup *pagesetup );
+ PageSetup( GtkPageSetup *ctx, bool owns_reference = true );
+
+ GtkPageSetup *gtk_pagesetup() const;
+
+ operator GtkPageSetup* () const;
+
+ PageOrientation get_orientation();
+ void set_orientation( PageOrientation orientation );
+ PaperSize* get_paper_size();
+ void set_paper_size( PaperSize *size);
+ gdouble get_top_margin( Unit unit);
+ void set_top_margin( gdouble margin, Unit unit);
+ gdouble get_bottom_margin( Unit unit);
+ void set_bottom_margin( gdouble margin, Unit unit );
+ gdouble get_left_margin( Unit unit );
+ void set_left_margin( gdouble margin, Unit unit );
+ gdouble get_right_margin( Unit unit );
+ void set_right_margin( gdouble margin, Unit unit );
+ void set_paper_size_and_default_margins( PaperSize *size );
+ gdouble get_paper_width( Unit unit);
+ gdouble get_paper_height( Unit unit );
+ gdouble get_page_width( Unit unit);
+ gdouble get_page_height( Unit unit );
+ };
+ }
+}
+
+#include <xfc/gtk/inline/printpagesetup.inl>
+
+#endif
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/printpapersize.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printpapersize.cc (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printpapersize.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1 @@
+#include <xfc/gtk/printpapersize.hh>
Added: xfc/trunk/libXFCui/xfc/gtk/printpapersize.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printpapersize.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printpapersize.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,53 @@
+/**
+ GtkPageSetup - Stores page setup information
+*/
+#ifndef XFC_GTK_PAPER_SIZE_HH
+#define XFC_GTK_PAPER_SIZE_HH 1
+
+#include <xfc/gtk/printpagesetup.hh>
+
+namespace Xfc {
+ namespace Gtk {
+ /**
+ A PageSetup object stores the page size, orientation and margins.
+ The idea is that you can get one of these from the page setup
+ dialog and then pass it to the PrintOperation when printing.
+ The benefit of splitting this out of the PrintSettings is that
+ these affect the actual layout of the page, and thus need to
+ be set long before user prints.
+
+ The margins specified in this object are the "print margins",
+ i.e. the parts of the page that the printer cannot print on.
+ These are different from the layout margins that a word processor
+ uses; they are typically used to determine the minimal size
+ for the layout margins.
+
+ To obtain a PageSetup use gtk_page_setup_new() to get the defaults,
+ or use run_page_setup_dialog() to show the page setup
+ dialog and receive the resulting page setup.
+ */
+ class PrintPaperSize : public G::Object {
+ public:
+ PageOrientation get_orientation();
+ void set_orientation( PageOrientation orientation);
+ PaperSize* get_paper_size();
+ void set_paper_size( GtkPaperSize *size );
+ gdouble get_top_margin( GtkUnit unit);
+ void set_top_margin( gdouble margin, GtkUnit unit);
+ gdouble get_bottom_margin( GtkUnit unit);
+ void set_bottom_margin( gdouble margin, GtkUnit unit);
+ gdouble get_left_margin( GtkUnit unit);
+ void set_left_margin( gdouble margin, GtkUnit unit);
+ gdouble get_right_margin( GtkUnit unit);
+ void set_right_margin( gdouble margin, GtkUnit unit);
+ void set_paper_size_and_default_margins( PaperSize *size);
+ gdouble get_paper_width( GtkUnit unit);
+ gdouble get_paper_height( GtkUnit unit);
+ gdouble get_page_width(GtkUnit unit);
+ gdouble get_page_height( GtkUnit unit);
+
+ };
+ }
+}
+
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/printsetting.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printsetting.cc (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printsetting.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,442 @@
+#include <xfc/gtk/printsetting.hh>
+#include <stdexcept>
+#include <cstring>
+
+using namespace Xfc;
+
+///////////////////
+// PageRanges
+
+Gtk::PageRanges::PageRanges( GtkPageRange *pr, int cnt, bool no_free )
+{
+ _no_free = no_free;
+ _cnt = cnt;
+ _pr = pr;
+}
+
+Gtk::PageRanges::PageRanges( const PageRanges &pr )
+{
+ if( pr._no_free ) {
+ _no_free = false;
+ _cnt = pr._cnt;
+ _pr = pr._pr;
+ } else {
+ _cnt = pr._cnt;
+ _pr = (GtkPageRange*)g_malloc( sizeof( GtkPageRange ) * _cnt );
+ memcpy(_pr, pr, sizeof( GtkPageRange ) * _cnt );
+ _no_free = false;
+ }
+}
+
+Gtk::PageRanges::~PageRanges()
+{
+ if( !_no_free && _pr )
+ g_free( _pr );
+}
+
+GtkPageRange& Gtk::PageRanges::operator[] (int n)
+{
+ if( n > _cnt )
+ throw std::invalid_argument( "index of PageRanges out of range" );
+
+ return _pr[ n ];
+}
+///////////////////////
+// PaperSize
+
+
+Gtk::PaperSize::PaperSize( const String &name )
+{
+ _papersize = gtk_paper_size_new( name.c_str());
+}
+
+Gtk::PaperSize::PaperSize( GtkPaperSize *papersize )
+{
+ _papersize = papersize;
+}
+
+Gtk::PaperSize::PaperSize( const PaperSize &ps )
+{
+ _papersize = gtk_paper_size_copy( ps._papersize );
+}
+
+Gtk::PaperSize::~PaperSize()
+{
+ if( _papersize )
+ gtk_paper_size_free( _papersize );
+}
+
+bool Gtk::PaperSize::is_equal( const PaperSize &size2)
+{
+ return gtk_paper_size_is_equal( _papersize, size2 );
+}
+
+const String Gtk::PaperSize::get_name()
+{
+ return gtk_paper_size_get_name( _papersize );
+}
+
+const String Gtk::PaperSize::get_display_name()
+{
+ return gtk_paper_size_get_display_name( _papersize );
+}
+
+const String Gtk::PaperSize::get_ppd_name()
+{
+ return gtk_paper_size_get_ppd_name( _papersize );
+}
+
+double Gtk::PaperSize::get_width(Unit unit)
+{
+ return gtk_paper_size_get_width( _papersize, (GtkUnit)unit );
+}
+
+double Gtk::PaperSize::get_height(Unit unit)
+{
+ return gtk_paper_size_get_height( _papersize, (GtkUnit)unit );
+}
+
+bool Gtk::PaperSize::is_custom()
+{
+ return gtk_paper_size_is_custom( _papersize );
+}
+
+void Gtk::PaperSize::set_size( double width, double height, Unit unit)
+{
+ gtk_paper_size_set_size( _papersize, width, height, (GtkUnit)unit );
+}
+
+double Gtk::PaperSize::get_default_top_margin(Unit unit)
+{
+ return gtk_paper_size_get_default_top_margin( _papersize, (GtkUnit)unit );
+}
+
+double Gtk::PaperSize::get_default_bottom_margin(Unit unit)
+{
+ return gtk_paper_size_get_default_bottom_margin( _papersize, (GtkUnit)unit );
+}
+
+double Gtk::PaperSize::get_default_left_margin(Unit unit)
+{
+ return gtk_paper_size_get_default_left_margin( _papersize, (GtkUnit)unit );
+}
+
+double Gtk::PaperSize::get_default_right_margin(Unit unit)
+{
+ return gtk_paper_size_get_default_right_margin( _papersize, (GtkUnit)unit );
+}
+
+const String Gtk::PaperSize::get_default(void)
+{
+ return gtk_paper_size_get_default();
+}
+
+///////////////////////
+// PrintSettings
+
+// We need no private class when no signals are emitted
+Gtk::PrintSettings::PrintSettings() : G::Object((GObject*)gtk_print_settings_new() ) {}
+
+Gtk::PrintSettings::PrintSettings(GtkPrintSettings *op, bool owns_reference)
+ : G::Object( (GObject*)op, owns_reference ) {}
+
+Gtk::PrintSettings::~PrintSettings() {}
+
+bool Gtk::PrintSettings::has_key( const String &key )
+{
+ return gtk_print_settings_has_key( gtk_print_settings(), key.c_str());
+}
+
+String Gtk::PrintSettings::get( const String &key )
+{
+ return gtk_print_settings_get( gtk_print_settings(), key.c_str());
+}
+
+void Gtk::PrintSettings::set( const String &key, const String &value )
+{
+ gtk_print_settings_set( gtk_print_settings(), key.c_str(), value.c_str());
+}
+
+void Gtk::PrintSettings::unset( const String &key )
+{
+ gtk_print_settings_unset( gtk_print_settings(), key.c_str());
+}
+
+bool Gtk::PrintSettings::get_bool( const String &key )
+{
+ return gtk_print_settings_get_bool( gtk_print_settings(), key.c_str());
+}
+
+void Gtk::PrintSettings::set_bool( const String &key, bool value)
+{
+ gtk_print_settings_set_bool( gtk_print_settings(), key.c_str(), value );
+}
+
+double Gtk::PrintSettings::get_double( const String &key )
+{
+ return gtk_print_settings_get_double( gtk_print_settings(), key.c_str());
+}
+
+double Gtk::PrintSettings::get_double( const String &key, double def )
+{
+ return gtk_print_settings_get_double_with_default( gtk_print_settings(), key.c_str(), def );
+}
+
+void Gtk::PrintSettings::set_double( const String &key, double value)
+{
+ gtk_print_settings_set_double( gtk_print_settings(), key.c_str(), value );
+}
+
+double Gtk::PrintSettings::get_length( const String &key, Unit unit)
+{
+ return gtk_print_settings_get_length( gtk_print_settings(), key.c_str(), (GtkUnit)unit );
+}
+
+void Gtk::PrintSettings::set_length( const String &key, double value, Unit unit)
+{
+ gtk_print_settings_set_length( gtk_print_settings(), key.c_str(), value, (GtkUnit)unit );
+}
+
+int Gtk::PrintSettings::get_int( const String &key)
+{
+ return gtk_print_settings_get_int( gtk_print_settings(), key.c_str());
+}
+
+int Gtk::PrintSettings::get_int( const String &key, int def)
+{
+ return gtk_print_settings_get_int_with_default( gtk_print_settings(), key.c_str(), def );
+}
+
+void Gtk::PrintSettings::set_int( const String &key, int value)
+{
+ gtk_print_settings_set_int( gtk_print_settings(), key.c_str(), value );
+}
+
+String Gtk::PrintSettings::get_printer()
+{
+ return gtk_print_settings_get_printer( gtk_print_settings() );
+}
+
+void Gtk::PrintSettings::set_printer( const String &printer )
+{
+ gtk_print_settings_set_printer( gtk_print_settings(), printer.c_str());
+}
+
+Gtk::PageOrientation Gtk::PrintSettings::get_orientation()
+{
+ return (PageOrientation)gtk_print_settings_get_orientation( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_orientation( PageOrientation orientation)
+{
+ gtk_print_settings_set_orientation( gtk_print_settings(), (GtkPageOrientation)orientation );
+}
+
+Gtk::PaperSize Gtk::PrintSettings::get_paper_size()
+{
+ return (Gtk::PaperSize)gtk_print_settings_get_paper_size( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_paper_size( Gtk::PaperSize *paper_size )
+{
+ GtkPaperSize *ps = *paper_size;
+
+ gtk_print_settings_set_paper_size( gtk_print_settings(), ps );
+}
+
+double Gtk::PrintSettings::get_paper_width( Unit unit )
+{
+ return gtk_print_settings_get_paper_width( gtk_print_settings(), (GtkUnit)unit );
+}
+
+void Gtk::PrintSettings::set_paper_width( double width, Unit unit )
+{
+ gtk_print_settings_set_paper_width( gtk_print_settings(), width, (GtkUnit)unit );
+}
+
+double Gtk::PrintSettings::get_paper_height( Unit unit )
+{
+ return gtk_print_settings_get_paper_height( gtk_print_settings(), (GtkUnit)unit );
+}
+
+void Gtk::PrintSettings::set_paper_height( double height, Unit unit )
+{
+ gtk_print_settings_set_paper_height( gtk_print_settings(), height, (GtkUnit)unit );
+}
+
+bool Gtk::PrintSettings::get_use_color()
+{
+ return gtk_print_settings_get_use_color( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_use_color( bool use_color )
+{
+ gtk_print_settings_set_use_color( gtk_print_settings(), use_color );
+}
+
+bool Gtk::PrintSettings::get_collate()
+{
+ return gtk_print_settings_get_collate( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_collate( bool collate )
+{
+ gtk_print_settings_set_collate( gtk_print_settings(), collate );
+}
+
+bool Gtk::PrintSettings::get_reverse()
+{
+ return gtk_print_settings_get_reverse( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_reverse( bool reverse)
+{
+ gtk_print_settings_set_reverse( gtk_print_settings(), reverse );
+}
+
+Gtk::PrintDuplex Gtk::PrintSettings::get_duplex()
+{
+ return (Gtk::PrintDuplex)gtk_print_settings_get_duplex( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_duplex( Gtk::PrintDuplex duplex)
+{
+ gtk_print_settings_set_duplex( gtk_print_settings(), (GtkPrintDuplex)duplex );
+}
+
+Gtk::PrintQuality Gtk::PrintSettings::get_quality()
+{
+ return (Gtk::PrintQuality)gtk_print_settings_get_quality( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_quality( Gtk::PrintQuality quality )
+{
+ gtk_print_settings_set_quality( gtk_print_settings(), (GtkPrintQuality)quality );
+}
+
+int Gtk::PrintSettings::get_n_copies()
+{
+ return gtk_print_settings_get_n_copies( gtk_print_settings() );
+}
+
+void Gtk::PrintSettings::set_n_copies( int num_copies )
+{
+ gtk_print_settings_set_n_copies( gtk_print_settings(), num_copies );
+}
+
+int Gtk::PrintSettings::get_number_up()
+{
+ return gtk_print_settings_get_number_up(gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_number_up( int number_up)
+{
+ gtk_print_settings_set_number_up( gtk_print_settings(), number_up );
+}
+
+int Gtk::PrintSettings::get_resolution()
+{
+ return gtk_print_settings_get_resolution( gtk_print_settings() );
+}
+
+void Gtk::PrintSettings::set_resolution( int resolution )
+{
+ gtk_print_settings_set_resolution( gtk_print_settings(), resolution );
+}
+
+double Gtk::PrintSettings::get_scale()
+{
+ return gtk_print_settings_get_scale( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_scale( double scale)
+{
+ gtk_print_settings_set_scale( gtk_print_settings(), scale );
+}
+
+Gtk::PrintPages Gtk::PrintSettings::get_print_pages()
+{
+ return (Gtk::PrintPages)gtk_print_settings_get_print_pages( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_print_pages( Gtk::PrintPages pages)
+{
+ gtk_print_settings_set_print_pages( gtk_print_settings(), (GtkPrintPages)pages );
+}
+
+Gtk::PageRanges Gtk::PrintSettings::get_page_ranges()
+{
+ int num;
+
+ GtkPageRange *ranges = gtk_print_settings_get_page_ranges( gtk_print_settings(), &num );
+
+ if( ranges )
+ return Gtk::PageRanges( ranges, num );
+ else
+ throw std::out_of_range( "No page ranges found" );
+}
+
+void Gtk::PrintSettings::set_page_ranges( Gtk::PageRanges &ranges )
+{
+ gtk_print_settings_set_page_ranges( gtk_print_settings(), ranges, ranges.size() );
+}
+
+Gtk::PageSet Gtk::PrintSettings::get_page_set()
+{
+ return (Gtk::PageSet)gtk_print_settings_get_page_set( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_page_set( Gtk::PageSet page_set )
+{
+ gtk_print_settings_set_page_set( gtk_print_settings(), (GtkPageSet)page_set );
+}
+
+String Gtk::PrintSettings::get_default_source()
+{
+ return gtk_print_settings_get_default_source( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_default_source( const String &default_source )
+{
+ gtk_print_settings_set_default_source( gtk_print_settings(), default_source.c_str());
+}
+
+String Gtk::PrintSettings::get_media_type()
+{
+ return gtk_print_settings_get_media_type( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_media_type( const String &media_type)
+{
+ gtk_print_settings_set_media_type( gtk_print_settings(), media_type.c_str() );
+}
+
+String Gtk::PrintSettings::get_dither()
+{
+ return gtk_print_settings_get_dither( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_dither( const String &dither)
+{
+ gtk_print_settings_set_dither( gtk_print_settings(), dither.c_str());
+}
+
+String Gtk::PrintSettings::get_finishings()
+{
+ return gtk_print_settings_get_finishings( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_finishings( const String &finishings )
+{
+ gtk_print_settings_set_finishings( gtk_print_settings(), finishings.c_str());
+}
+
+String Gtk::PrintSettings::get_output_bin()
+{
+ return gtk_print_settings_get_output_bin( gtk_print_settings());
+}
+
+void Gtk::PrintSettings::set_output_bin( const String &output_bin)
+{
+ gtk_print_settings_set_output_bin( gtk_print_settings(), output_bin.c_str());
+}
Added: xfc/trunk/libXFCui/xfc/gtk/printsetting.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/printsetting.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/printsetting.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,181 @@
+/**
+ GtkPrintSetting - Stores print settings
+*/
+#ifndef XFC_GTK_PRINT_SETTING_HH
+#define XFC_GTK_PRINT_SETTING_HH 1
+
+#include <gtk/gtkprintoperation.h>
+
+#include <xfc/gtk/printoperation.hh>
+
+namespace Xfc {
+ namespace Gtk {
+
+ // Holder class for page ranges array, in XFC
+ class PageRanges {
+ GtkPageRange *_pr;
+ int _cnt;
+ bool _no_free;
+ public:
+ // Take over the pointer an free it on destruction (no refcnt)
+ PageRanges( GtkPageRange *pr, int num, bool no_free = false );
+ PageRanges( const PageRanges &pr );
+ ~PageRanges();
+
+ operator GtkPageRange *() const { return _pr; }
+
+ GtkPageRange& operator[] (int n);
+ int size() const {return _cnt;}
+ };
+
+ enum PageSet {
+ ALL = GTK_PAGE_SET_ALL,
+ EVEN = GTK_PAGE_SET_EVEN,
+ ODD = GTK_PAGE_SET_ODD
+ };
+
+ enum PrintDuplex {
+ SIMPLEX = GTK_PRINT_DUPLEX_SIMPLEX,
+ HORIZONTAL = GTK_PRINT_DUPLEX_HORIZONTAL,
+ VERTICA = GTK_PRINT_DUPLEX_VERTICAL
+ };
+
+ enum PrintQuality {
+ LOW = GTK_PRINT_QUALITY_LOW,
+ NORMAL = GTK_PRINT_QUALITY_NORMAL,
+ HIGH = GTK_PRINT_QUALITY_HIGH,
+ DRAFT = GTK_PRINT_QUALITY_DRAFT
+ };
+
+ enum PrintPages {
+ PAGES_ALL = GTK_PRINT_PAGES_ALL,
+ PAGES_CURRENT = GTK_PRINT_PAGES_CURRENT,
+ PAGES_RANGES = GTK_PRINT_PAGES_RANGES
+ };
+
+ class PaperSize {
+ GtkPaperSize *_papersize;
+ public:
+ PaperSize( const String &name );
+ PaperSize( GtkPaperSize * );
+ PaperSize( const PaperSize & );
+
+ ~PaperSize();
+
+ operator GtkPaperSize *() const {return _papersize;}
+
+ bool is_equal( const PaperSize &size2);
+ const String get_name();
+ const String get_display_name();
+ const String get_ppd_name();
+ double get_width(Unit unit);
+ double get_height(Unit unit);
+ bool is_custom();
+ void set_size( double width, double height, Unit unit);
+ double get_default_top_margin(Unit unit);
+ double get_default_bottom_margin(Unit unit);
+ double get_default_left_margin(Unit unit);
+ double get_default_right_margin(Unit unit);
+ static const String get_default(void);
+ };
+
+ /**
+ A GtkPrintSettings object represents the settings of a print dialog
+ in a system-independent way. The main use for this object is that once
+ you've printed you can get a settings object that represents the
+ settings the user chose, and the next time you print you can pass
+ that object in so that the user doesn't have to re-set all his settings.
+
+ Its also possible to enumerate the settings so that you can easily
+ save the settings for the next time your app runs, or even store
+ them in a document. The predefined keys try to use shared values
+ as much as possible so that moving such a document between systems still works.
+ */
+ class PrintSettings : public G::Object {
+ public:
+ PrintSettings();
+
+ explicit PrintSettings(GtkPrintSettings *op, bool owns_reference = false);
+
+ virtual ~PrintSettings();
+
+ GtkPrintSettings *gtk_print_settings() const;
+
+ operator GtkPrintSettings *() const;
+
+ bool has_key( const String &key );
+ String get( const String &key);
+ void set( const String &key, const String &value );
+ void unset( const String &key);
+ // void foreach( PrintSettingsFunc func, gpointer user_data);
+ bool get_bool( const String &key);
+ void set_bool( const String &key, bool value);
+ double get_double( const String &key);
+ double get_double( const String &key, double def);
+ void set_double( const String &key, double value);
+ double get_length( const String &key, Unit unit);
+ void set_length( const String &key, double value, Unit unit);
+ int get_int( const String &key);
+ int get_int( const String &key, int def);
+ void set_int( const String &key, int value);
+ String get_printer();
+ void set_printer( const String &printer);
+ PageOrientation get_orientation();
+ void set_orientation( PageOrientation orientation);
+
+ PaperSize get_paper_size();
+ void set_paper_size( PaperSize *paper_size );
+ double get_paper_width( Unit unit );
+ void set_paper_width( double width, Unit unit );
+ double get_paper_height( Unit unit );
+ void set_paper_height( double height, Unit unit );
+ bool get_use_color();
+ void set_use_color( bool use_color );
+ bool get_collate();
+ void set_collate( bool collate );
+ bool get_reverse();
+ void set_reverse( bool reverse);
+ PrintDuplex get_duplex();
+ void set_duplex( PrintDuplex duplex);
+ PrintQuality get_quality();
+ void set_quality( PrintQuality quality );
+ int get_n_copies();
+ void set_n_copies( int num_copies);
+ int get_number_up();
+ void set_number_up( int number_up);
+ int get_resolution();
+ void set_resolution( int resolution );
+ double get_scale();
+ void set_scale( double scale);
+ PrintPages get_print_pages();
+ void set_print_pages( PrintPages pages);
+ PageRanges get_page_ranges();
+ void set_page_ranges( PageRanges &ranges );
+ PageSet get_page_set();
+ void set_page_set( PageSet page_set);
+ String get_default_source();
+ void set_default_source( const String &default_source );
+ String get_media_type();
+ void set_media_type( const String &media_type);
+ String get_dither();
+ void set_dither( const String &dither);
+ String get_finishings();
+ void set_finishings( const String &finishings );
+ String get_output_bin();
+ void set_output_bin( const String &output_bin);
+ };
+
+ inline GtkPrintSettings* PrintSettings::gtk_print_settings() const
+ {
+ return reinterpret_cast<GtkPrintSettings*>(instance_);
+ }
+
+ inline PrintSettings::operator GtkPrintSettings* () const
+ {
+ return this ? gtk_print_settings() : NULL;
+ }
+
+ }
+}
+
+#endif
Modified: xfc/trunk/libXFCui/xfc/gtk/private/Makefile.am
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/private/Makefile.am 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/gtk/private/Makefile.am 2009-05-22 08:41:32 UTC (rev 29970)
@@ -75,6 +75,9 @@
objectclass.hh \
panedclass.hh \
plugclass.hh \
+ printoperationpreviewiface.hh \
+ printoperationclass.hh \
+ printpagesetupclass.hh \
progressbarclass.hh \
radioactionclass.hh \
radiobuttonclass.hh \
Added: xfc/trunk/libXFCui/xfc/gtk/private/printoperationclass.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/private/printoperationclass.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/private/printoperationclass.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,45 @@
+#ifndef XFC_GTK_PRINT_OPERATION_CLASS_HH
+#define XFC_GTK_PRINT_OPERATION_CLASS_HH
+
+#include <xfc/gtk/private/objectclass.hh>
+
+namespace Xfc {
+namespace Gtk {
+
+class PrintOperationClass {
+public:
+ static void init(GtkPrintOperationClass *g_class);
+
+ static GtkPrintOperationClass* get_parent_class(void *instance);
+
+ static GType get_type();
+
+ static void* create();
+
+ static void begin_print_proxy( GtkPrintOperation *operation, GtkPrintContext *context );
+
+ static GtkWidget* create_custom_widget_proxy(GtkPrintOperation *operation);
+
+ static void custom_widget_apply_proxy(GtkPrintOperation *operation, GtkWidget *widget );
+
+ static void done_proxy(GtkPrintOperation *operation, GtkPrintOperationResult result );
+
+ static void draw_page_proxy(GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr );
+
+ static void end_print_proxy(GtkPrintOperation *operation, GtkPrintContext *context );
+
+ static gboolean paginate_proxy(GtkPrintOperation *operation, GtkPrintContext *context );
+
+ static gboolean preview_proxy(GtkPrintOperation *operation, GtkPrintOperationPreview *preview,
+ GtkPrintContext *context, GtkWindow *parent );
+
+ static void request_page_setup_proxy(GtkPrintOperation *operation, GtkPrintContext *context,
+ gint page_nr, GtkPageSetup *setup );
+
+ static void status_changed_proxy(GtkPrintOperation *operation );
+};
+
+} // namespace Gtk
+} // namespace Xfc
+
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/private/printoperationpreviewiface.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/private/printoperationpreviewiface.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/private/printoperationpreviewiface.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,29 @@
+#ifndef XFC_GTK_PRINT_OPERATION_PREVIEW_CLASS_HH
+#define XFC_GTK_PRINT_OPERATION_PREVIEW_CLASS_HH
+
+#ifndef __GTK_PRINT_OPERATION_PREVIEW_H__
+#include "gtk/gtkprintoperationpreview.h"
+#endif
+
+namespace Xfc {
+
+ namespace Gtk {
+
+ class PrintOperationPreviewIface
+ {
+ public:
+ static void init(GtkPrintOperationPreviewIface *g_iface);
+
+ static GtkPrintOperationPreviewIface* get_parent_iface(void *instance);
+
+ static void ready_proxy(GtkPrintOperationPreview *, GtkPrintContext *);
+
+ static void got_page_size_proxy(GtkPrintOperationPreview *,
+ GtkPrintContext *,
+ GtkPageSetup *);
+ };
+
+ }
+}
+
+#endif
Added: xfc/trunk/libXFCui/xfc/gtk/private/printpagesetupclass.hh
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/private/printpagesetupclass.hh (rev 0)
+++ xfc/trunk/libXFCui/xfc/gtk/private/printpagesetupclass.hh 2009-05-22 08:41:32 UTC (rev 29970)
@@ -0,0 +1,17 @@
+#ifndef XFC_GTK_PAGE_SETUP_CLASS_HH
+#define XFC_GTK_PAGE_SETUP_CLASS_HH
+
+#include <xfc/gtk/private/objectclass.hh>
+
+class PageSetupClass {
+public:
+ static void init(GtkWidgetClass *g_class);
+
+ static GtkWidgetClass* get_parent_class(void *instance);
+
+ static GType get_type();
+
+ static void* create();
+};
+
+#endif
Modified: xfc/trunk/libXFCui/xfc/gtk/stock.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/stock.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/gtk/stock.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -21,6 +21,7 @@
#include "stock.hh"
#include "accelgroup.hh"
#include <glib/gstrfuncs.h>
+#include <cstring>
using namespace Xfc;
Modified: xfc/trunk/libXFCui/xfc/gtk/textbuffer.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/gtk/textbuffer.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/gtk/textbuffer.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -25,6 +25,7 @@
#include "private/marshal.hh"
#include "private/textbufferclass.hh"
#include "../gdk-pixbuf/pixbuf.hh"
+#include <cstring>
using namespace Xfc;
Modified: xfc/trunk/libXFCui/xfc/pango/glyph.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/pango/glyph.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/pango/glyph.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -22,6 +22,7 @@
#include "font.hh"
#include "types.hh"
#include "item.hh"
+#include <cstring>
using namespace Xfc;
Modified: xfc/trunk/libXFCui/xfc/pango/layout.cc
===================================================================
--- xfc/trunk/libXFCui/xfc/pango/layout.cc 2009-05-17 09:54:11 UTC (rev 29969)
+++ xfc/trunk/libXFCui/xfc/pango/layout.cc 2009-05-22 08:41:32 UTC (rev 29970)
@@ -24,6 +24,7 @@
#include "types.hh"
#include "../gdk/region.hh"
#include <gdk/gdkpango.h>
+#include <cstring>
using namespace Xfc;
More information about the Xfce4-commits
mailing list