Re: modify style in gtkperl
- From: dermot glade perl connectfree co uk
- To: Mark Stratman <mark sporkstorms org>
- Cc: Max Moser <mmo remote-exploit org>, gtk-perl-list gnome org
- Subject: Re: modify style in gtkperl
- Date: Fri, 25 Jan 2002 23:00:59 +0000
Hi all,
Mark Stratman wrote:
H. Pennington wrote a nice little primer, available at
http://www106.pair.com/rhp/gtk-colors.html.
[... perl code snipped ...]
Hi there
I just want to know how to change a style of a widget. in the gtk
references i saw modify style function.
I want to change the color of the progressbar depending on his value.
The important idea is that each widget is assigned a default style - if
you modify it (eg using get_style) you will change the style of every
widget that also uses the default style which is probably not what you
want - although you can change the font of all widgets in one go like this.
A simple way that I use to change the style of a widget that has a window
my $cm = $widget->window->get_colormap;
my $red = $cm->color_alloc({red=>65000, green=>0, blue=>0});
my $style_red = new Gtk::Style;
$style_red->font(Gtk::Gdk::Font->load(
'-*-helvetica-bold-r-normal-*-*-100-*-*-p-*-iso8859-1'));
$style_red->fg('normal', $red);
$style_red->text('normal', $red);
AND THEN:
$widget->set_style($style_red);
I can't remember now what the main progressbar color is but it will be one
of ('fg', 'bg', 'text', 'base') and the state that can be set is one of
("normal", "active", "prelight", "selected", "insensitive").
IIRC you can also set the background pixmap using:
$style_red->bg_pixmap('normal', $gdk_pixmap);
although I have never done this.
HTH, Dermot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]