logo       


Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

class wxHtmlDCRenderer: msg#00024

Subject: class wxHtmlDCRenderer
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
Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
db.firebase.por...    text.xml.xalan....    qnx.openqnx.dev...    user-groups.zar...    internationaliz...    kde.devel.konve...    finance.e-gold....    emacs.latex.pre...    gis.therion/200...    web.webmin.gene...    yellowdog.gener...    vserver/2003-08...    redhat.release....    sysutils.tivoli...    xfree86.expert/...    mail.becky.user...    hardware.netapp...    netbsd.ports.xe...    python.distutil...    boot-loaders.gr...    culture.interne...    java.springfram...    activedir/2006-...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe