Re: [gtk-list] Re: Gtk-Perl problem



Hi Steve,

CountZero wrote:
> 
Questions snipped (that I can't answer)

> This is causing me no end of frustration.   I am using Gtk::Perl .6123 if 
> this helps... I have seen mention of a CVS Gtk::Perl in the mailing list
> archives, but cannot seem to find this beast, 
Have a look at http://www.uk.gnome.org/devel/whatiscvs.shtml for advice
on how to use the Gnome CVS. You may have a nearer mirror than mine (UK).
You will need to checkout module 'gnome-perl'.

> also am wondering why www.gtk.org has only an older version of Gtk::Perl 
> wheras CPAN has .6123... very odd... 
This _is_ strange since they have the CVS version and 0.6123 is a month old.

snip
> >
> > Could anyone tell me how to set styles on the CList column titles?
Please correct me if I am talking rubbish but AFAIK the CList column titles
are constructed something like:
  #
  # Construct a GtkCList 'clist4'
  $widgets->{'clist4'} = new Gtk::CList('2' );
  $widgets->{'clist4'}->set_selection_mode('single' );
  $widgets->{'clist4'}->set_border('in' );
  $widgets->{'clist4'}->column_titles_show;
  $widgets->{'frame167'}->add($widgets->{'clist4'} );
  $widgets->{'clist4'}->show( );
  $widgets->{'clist4'}->can_focus('1' );
    #
    # Construct a GtkLabel 'label60'
    $widgets->{'label60'} = new Gtk::Label('label34' );
    $widgets->{'label60'}->set_justify('center' );
    $widgets->{'label60'}->set_line_wrap('0' );
    $widgets->{'clist4'}->set_column_widget(0, $widgets->{'label60'} );
    $widgets->{'label60'}->show( );
    $widgets->{'label60'}->set_alignment('0.5', '0.5' );
    #
    # Construct a GtkLabel 'label61'
    $widgets->{'label61'} = new Gtk::Label('label35' );
    $widgets->{'label61'}->set_justify('center' );
    $widgets->{'label61'}->set_line_wrap('0' );
    $widgets->{'clist4'}->set_column_widget(1, $widgets->{'label61'} );
    $widgets->{'label61'}->show( );
    $widgets->{'label61'}->set_alignment('0.5', '0.5' );

So you have refs to the labels and you can set the styles of those by doing:

    # Set font for
    $style->{'label60'} = new Gtk::Style;
    $style->{'label60'}->font(  Gtk::Gdk::Font->load(
        '-adobe-helvetica-bold-o-normal-*-*-120-*-*-p-*-iso8859-1'));   

    $style->{'label60-fg-normal'} = $style->{'label60'}->fg('normal');
    $style->{'label60-fg-normal'}->red(61680);
    $style->{'label60-fg-normal'}->green(5140);
    $style->{'label60-fg-normal'}->blue(8738);
    $style->{'label60-style'}->fg('normal' $style->{'label60-fg-normal'});

    ...
    set font and colours for (bg, text etc) and (active, prelight etc etc)
    set bg-pixmaps for active, prelight etc
    ....

    $widgets->{'label60'}->set_style($style->{'label60'});

You can work out from the gtk docs what the other style elements are but
they are all set in a similar way. Beware if you have colours in range 0-255
you will have to multiply by decimal 257 - yes 257 helps to spread the 
colours in range hex 00-ff to 0000 to ffff so you use the whole spectrum.

I haven't actually run the above code, it is pasted/edited from an old bit
of code I had lying around so please excuse me if there are typos.

HTH, Dermot



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]