List Info

Thread: background-stipple on TextBuffer




background-stipple on TextBuffer
user name
2006-01-10 18:19:04
Hi, Is it possible to set a background-stipple as a
background on a text widget?
I can set this stipple up with no warnings, but it dosn't
seem to have any visible effect. The red tag seems to
work OK, but the background-stipple dosn't work.

Does it have something to do with the $colormap setup?

#!/usr/bin/perl
use warnings;
use strict;
use Gtk2 -init;

# Copy the entire file into a string (str)
my $str;
my $file = shift || $0;
open( TEST, "< $file" ) or die "Cannot
open test.txtn";
while (<TEST>) { $str .= $_;}
close TEST;
 
my $window = Gtk2::Window->new;

# a simple xpm for stipple
my z_xpm = (
'20 3 2 1',
'  	c None',
'+	c #1A1A1A',
'+ + + + + + + + + + ',
'+ + + + + + + + + + ',
'+ + + + + + + + + + ',);

#my $colormap = Gtk2::Gdk::Colormap->get_system;
my $colormap = $window->get_default_colormap;

my $pixmap = 
Gtk2::Gdk::Pixmap->colormap_create_from_xpm_d 
                    (undef, $colormap, undef, z_xpm );

# Create a textbuffer to contain that string
my $textbuffer = Gtk2::TextBuffer->new();
$textbuffer->set_text($str);

my $zmap = $textbuffer->create_tag('zmap',
'background-stipple' => $pixmap  );
my $rmap = $textbuffer->create_tag('rmap', 'background'
=> 'red'  );

$textbuffer->insert_with_tags_by_name 
     ($textbuffer->get_start_iter,"nYADDA
YADDAn",'rmap');
$textbuffer->insert_with_tags_by_name 
    ($textbuffer->get_start_iter,"No stipple
herenYADDAnYADDAn",'zmap');

# Create a textview using that textbuffer
my $textview =
Gtk2::TextView->new_with_buffer($textbuffer);

# Add the textview to a scrolledwindow
my $scrolledwindow = Gtk2::ScrolledWindow->new( undef,
undef );
$scrolledwindow->add($textview);

$window->signal_connect( destroy => sub {
Gtk2->main_quit; } );
$window->add($scrolledwindow);
$window->set_default_size( 500, 400 );
$window->show_all;
Gtk2->main;
__END__
############################################################
############

Thanks


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.
html
_______________________________________________
gtk-perl-list mailing list
gtk-perl-listgnome.org

http://mail.gnome.org/mailman/listinfo/gtk-perl-list
background-stipple on TextBuffer
user name
2006-01-11 23:04:35
On Tue, 10 Jan 2006 13:19:04 -0500
zentara <zentarazentara.net> wrote:

>Hi, Is it possible to set a background-stipple as a
>background on a text widget?
>I can set this stipple up with no warnings, but it
dosn't
>seem to have any visible effect. The red tag seems to
>work OK, but the background-stipple dosn't work.
>
>Does it have something to do with the $colormap setup?

Doh! Ignore my previous post. I got a pixmap and bitmap
confused. A stipple needs to be a Gtk2::Gdk::Bitmap and
be used in conjunction with a solid color tag.

I was "hoping" I could use a pixmap as a
background, like
a watermark on a TextView. Nope!.



-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.
html
_______________________________________________
gtk-perl-list mailing list
gtk-perl-listgnome.org

http://mail.gnome.org/mailman/listinfo/gtk-perl-list
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )