RE: [PHP-GTK] RE: Changing color/style on ascrollbarinaGtkScrolledWindow
| From: | Steph | Date: | Mon, 02 Aug 2004 20:47:37 +0000 |
| Subject: | RE: [PHP-GTK] RE: Changing color/style on ascrollbarinaGtkScrolledWindow | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-4920@lists.php.net to get a copy of this message | ||
Column headers and scrollbars are themselves sub-widgets of larger GTK
classes, so the 'propagation effect' has further to go.
Again: look into rc files. It's easier to have all your style information
in one place anyway, and it only needs one line of php-gtk code to apply
this 'stylesheet'. (that line being gtk::rc_parse(path-to-file); )
-----Original Message-----
From: dpgirago@mdanderson.org [mailto:dpgirago@mdanderson.org]
Sent: 02 August 2004 21:15
To: mmdrake@bctonline.com; php-gtk-general@lists.php.net; steph@zend.com
Subject: RE: [PHP-GTK] RE: Changing color/style on
ascrollbarinaGtkScrolledWindow
Madeleine, Steph,
It's true that Steph's basic, stand-alone example worked just as she said
on my Win2k box. However, I did comment out all usages of GtkStyle,
style->bg, and set_style in my 4k plus line app, and the color changes to
scrollbars and column headers using the same code snippet were never
realized. It is similar to what Madeleine is saying; nothing blew up, no
errors thrown, but no changes either. It goes without saying that I'm no
expert with php-gtk, but something seems amiss. For example, changing
color/style on GtkLabel and GtkButton widgets went exactly as expected, even
towards the end of my long-ish script. Now if this is compared with our
ambiguous results for GtkScrolledWindow (and, in my case GtkClist column
headers, too), then there is an inconsistency that is perplexing. But,
again, I was able to propagate color changes from GtkWindow on down with:
$window = &new GtkWindow();
$appStyle = gtk::widget_get_default_style();
$basicBackGroundColor = &new GdkColor('#E0EEE0');
$mouseOverColor = &new GdkColor('#CFDEF1');
$appStyle->bg[GTK_STATE_NORMAL] = $basicBackGroundColor;
$appStyle->bg[GTK_STATE_PRELIGHT] = $mouseOverColor;
$window->set_style($appStyle);
then re-style buttons and text as before. There certainly seems to be some
selective masking, or selective disconnection style-wise, going on.
Just my 2 cents.
dave
> Sorry, Dave and I went off-list there. I gave him a simple
> gtkscrolledwindow script with the code below, and it worked fine on his
box
> too; ergo, we don't have a platform issue.
>
> I think that when you create larger and more complex applications you're
> most likely seeing a drop-through effect that means the style property
> you're retrieving from the widget actually contains the style properties
of
> the outermost parent widget. In that case 'style->bg' wouldn't
necessarily
> mean a thing to GTK, because the child widget's natural-born style
element
> isn't the one being accessed.
>
> They call it propagation.. and I could be spelling that wrong :)
>
> It's never affected me because I've never actually tried to apply styles
> across a big application. However, I suspect that a far better way to
deal
> with style when you have something complex to deal with would be by
taking
> the rc file route. See Andrei's ancient but trusty test/gtk.php and
friends
> for details.