Re: RichText Printing Headers and Footers.

2010-05-06 Thread Mark Dootson

Hi,

Wx::RichTextPrintout is not yet wrapped because you cannot use it from 
Wx::RichTextPrinting. You would have to write your own equivalent of 
Wx::RichTextPrinting in Perl if you wanted to access 
Wx::RichTextPrintout directly.


If it were wrapped, you would need code something like:

my $printout = MyPrintout-new();

.

package MyPrintout;
use strict;
use warnings;
use Wx;
use Wx::RichText;
use base qw( Wx::RichTextPrintout );

sub new {
  my $class = shift;
  my $self = $class-SUPER::new( @_ );
  return $self;
}

sub OnPrintPage{
  my ($self, $page) = @_;
  .
}

a good place to get better info on this stuff would be
http://perldoc.perl.org/perlobj.html
http://perldoc.perl.org/perltoot.html


Regards

Mark



On 06/05/2010 02:40, Steve Cookson wrote:

OK, so I think I didn't get that quite right.  I've added a separate package
name and a 'use base', but it says the base is not found.

So now the code is:

package Wx::RichTextPrintout;   

use Wx qw(:everything);
use base qw(Wx);

sub OnPrintPage{
 my ($self, $page) = @_;
 my $dc = self-GetDC();
 if ($dc){
 if (HasPage($page)){

$dc-DrawBitmap(Wx::Bitmap-new('/home/steve/Documents/logo.png',1,1));
 Wx::RichTextPrintout::RenderPage($dc, $page);
return 1;
} else {
return 0;
}
}

But it's still not being called.

Regards

Steve



RE: RichText Printing Headers and Footers.

2010-05-06 Thread Steve Cookson
Hi Mark,

Thanks for this.

Well, maybe I'll rewrite it in Perl.

If I do, I'll let you know.

Regards

Steve

PS Thanks for the OO tip.



RichText Printing Headers and Footers.

2010-05-05 Thread Steve Cookson
Hi,

I'd like to include images in my RichText Printing Headers and Footers.  I
assume that I can over-ride the OnPrintPage function, so I've done this:

Wx::RichTextPrintout::OnPrintPage{
my ($self, $page) = @_;
my $dc = self-GetDC();
if ($dc){
if (HasPage($page))
 
$dc-DrawBitmap(Wx::Bitmap-new('/home/steve/Documents/logo.png',1,1));
RenderPage($dc, $page);
return 1;
}
else return 0;
}

However, nothing happens. I don't think my code has been executed. The print
preview works normally. Even if I put a 'print' statement in, it is ignored.
 
It has a 'use Wx' earlier, but does it need a 'use base'?  My OO is not yet
very developed and I'm not sure how the call should be implemented.

Thanks

Regards

Steve




RE: RichText Printing Headers and Footers.

2010-05-05 Thread Steve Cookson
OK, so I think I didn't get that quite right.  I've added a separate package
name and a 'use base', but it says the base is not found.

So now the code is:

package Wx::RichTextPrintout;   

use Wx qw(:everything);
use base qw(Wx);

sub OnPrintPage{
my ($self, $page) = @_;
my $dc = self-GetDC();
if ($dc){
if (HasPage($page)){
 
$dc-DrawBitmap(Wx::Bitmap-new('/home/steve/Documents/logo.png',1,1));
Wx::RichTextPrintout::RenderPage($dc, $page);
return 1;
} else {
return 0;
}
}

But it's still not being called.

Regards

Steve