Mattia,
I wrapped wxHtmlDCRenderer for my own use.
A diff is attached, with a couple of simple additions to wxHtmlWindow
and WxHtmlEasyPrinting.
My C / XS skills are limited so its all copy and paste really.
The only thing I had difficulty with was
wxHtmlDCRenderer::Render
This takes an optional reference to an array. I'm not sure if I've
handled the 'optional' part correctly.
In connection with this, I also have extended perl versions of
HtmlPrintout and HtmlEasyPrinting.
Why bother? Well, I wanted to be able to override some methods and
control the appearance and controls on the preview frame but not lose
the 'Easy' aspects.
It will allow me to create simple reporting applications using html
templating systems for the output.
A 'minimal' sample of this is at
http://www.gigi.co.uk/wxperl/HtmlEasyPrinting.zip.
This uses wxHtmlDCRenderer.
Regards
Mark
Changes are:
For wxHtmlDCRenderer
1. Wrapped wxHtmlDCRenderer
2. Necessary include added to Html.xs
3. Necessary addition to typemap
A couple of unrelated chanages that appeared in diff
4. Added SetFonts to wxHtmlEasyPrinting
5. Added LoadFile to wxHtmlWindow (just because its in the docs - I know
LoadPage is equivalent)
diff -ruN Wx-0.55/ext/html/Html.xs Wx-0.55b/ext/html/Html.xs
--- Wx-0.55/ext/html/Html.xs
+++ Wx-0.55b/ext/html/Html.xs
@@ -27,6 +27,7 @@
#if wxPERL_USE_PRINTING_ARCHITECTURE
INCLUDE: XS/HtmlEasyPrinting.xs
+INCLUDE: XS/HtmlDCRenderer.xs
#endif
diff -ruN Wx-0.55/ext/html/typemap Wx-0.55b/ext/html/typemap
--- Wx-0.55/ext/html/typemap
+++ Wx-0.55b/ext/html/typemap
@@ -21,6 +21,7 @@
wxBestHelpController * O_WXOBJECT
wxHtmlEasyPrinting * O_NON_WXOBJECT
+wxHtmlDCRenderer * O_NON_WXOBJECT
wxPrintData * O_WXOBJECT
wxPageSetupDialogData * O_WXOBJECT
diff -ruN Wx-0.55/ext/html/XS/HtmlEasyPrinting.xs
Wx-0.55b/ext/html/XS/HtmlEasyPrinting.xs
--- Wx-0.55/ext/html/XS/HtmlEasyPrinting.xs
+++ Wx-0.55b/ext/html/XS/HtmlEasyPrinting.xs
@@ -67,6 +67,23 @@
int pg
void
+wxHtmlEasyPrinting::SetFonts( normal_face, fixed_face, sizes )
+ wxString normal_face
+ wxString fixed_face
+ SV* sizes
+ PREINIT:
+ int* array;
+ int n = wxPli_av_2_intarray( aTHX_ sizes, &array );
+ CODE:
+ if( n != 7 )
+ {
+ delete[] array;
+ croak( "Specified %d sizes, 7 wanted", n );
+ }
+ THIS->SetFonts( normal_face, fixed_face, array );
+ delete[] array;
+
+void
wxHtmlEasyPrinting::SetFooter( header, pg = wxPAGE_ALL )
wxString header
int pg
diff -ruN Wx-0.55/ext/html/XS/HtmlDCRenderer.xs
Wx-0.55b/ext/html/XS/HtmlDCRenderer.xs
--- Wx-0.55/ext/html/XS/HtmlDCRenderer.xs
+++ Wx-0.55b/ext/html/XS/HtmlDCRenderer.xs
@@ -0,0 +1,79 @@
+#############################################################################
+## Name: ext/html/XS/HtmlDCRenderer.xs
+## Purpose: XS for Wx::HtmlDCRenderer
+##
+#############################################################################
+
+
+#include <wx/html/htmprint.h>
+#include <wx/dc.h>
+
+MODULE=Wx PACKAGE=Wx::HtmlDCRenderer
+
+wxHtmlDCRenderer*
+wxHtmlDCRenderer::new()
+
+void
+wxHtmlDCRenderer::DESTROY()
+
+void
+wxHtmlDCRenderer::SetDC( dc, pixel_scale = 1.0 )
+ wxDC* dc
+ double pixel_scale
+
+void
+wxHtmlDCRenderer::SetSize(width, height)
+ int width
+ int height
+
+void
+wxHtmlDCRenderer::SetHtmlText( htmlText, basepath = wxEmptyString, isdir = 1 )
+ wxString htmlText
+ wxString basepath
+ bool isdir
+
+void
+wxHtmlDCRenderer::SetFonts( normal_face, fixed_face, sizes )
+ wxString normal_face
+ wxString fixed_face
+ SV* sizes
+ PREINIT:
+ int* array;
+ int n = wxPli_av_2_intarray( aTHX_ sizes, &array );
+ CODE:
+ if( n != 7 )
+ {
+ delete[] array;
+ croak( "Specified %d sizes, 7 wanted", n );
+ }
+ THIS->SetFonts( normal_face, fixed_face, array );
+ delete[] array;
+
+int
+wxHtmlDCRenderer::Render(x, y, from = 0, dont_render = 0, maxHeight = INT_MAX,
pagebreaks, number_of_pages = 0)
+ int x
+ int y
+ int from
+ int dont_render
+ int maxHeight
+ SV* pagebreaks
+ int number_of_pages
+ PREINIT:
+ int* array;
+ int n = wxPli_av_2_intarray( aTHX_ pagebreaks, &array );
+ CODE:
+ if( n == 0 )
+ {
+ RETVAL = THIS->Render( x, y, from, dont_render, maxHeight, NULL,
number_of_pages);
+ }
+ else
+ {
+ RETVAL = THIS->Render( x, y, from, dont_render, maxHeight, array,
number_of_pages);
+ }
+ delete[] array;
+ OUTPUT:
+ RETVAL
+
+
+int
+wxHtmlDCRenderer::GetTotalHeight()
diff -ruN Wx-0.55/ext/html/XS/HtmlWindow.xs Wx-0.55b/ext/html/XS/HtmlWindow.xs
--- Wx-0.55/ext/html/XS/HtmlWindow.xs
+++ Wx-0.55b/ext/html/XS/HtmlWindow.xs
@@ -86,6 +86,10 @@
wxHtmlWindow::HistoryForward()
bool
+wxHtmlWindow::LoadFile( filename )
+ wxString filename
+
+bool
wxHtmlWindow::LoadPage( location )
wxString location
End of Patch.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________
wxperl-users mailing list
wxperl-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/wxperl-users
|