Re: GdkColor?
| From: | Steph | Date: | Tue, 05 Mar 2002 21:53:05 +0000 |
| Subject: | Re: GdkColor? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1447@lists.php.net to get a copy of this message | ||
You really can't at present, and unless someone knows of a good GTK tutorial for it you'll
still be at sea.
The huge numbers in GdkColor are (256*256) - 1 , if that helps any. I'm told you can use the
normal rgb stuff same as in HTML too, but I've not had much chance to experiment with that, so
I can't vouch for it. (broken keyboard, it thinks it's living abroad somewhere so I
can't find my hash sign at present ;)
The 'base' business is just where the 'base' property of a widget's style
is being given a particular colour. If you look at the GtkStyle skeleton docs, you'll see
there are a lot of different style properties. Each widget has a property named 'style'
that is really a GtkStyle, and each GtkStyle is made up of those different style properties.
It's not always obvious which property is being used for what part of a widget .... anyway the
'base' property is one of many.
Each property is an array of 5 possible states, these are the GtkStateTypes, which actually *are*
covered in the docs.
We use -> to get to the properties.
e.g.
$button = &new GtkButton('try this');
$butstyle_a = $button->style->bg[GTK_STATE_NORMAL];
/*mouse pointer's nowhere near it*/
$butstyle_b = $button->style->bg[GTK_STATE_ACTIVE];
/*doesn't last long .. it's doing whatever it does when you click on it*/
$butstyle_c = $button->style->bg[GTK_STATE_PRELIGHT];
/*means you're hovering over it*/
$butstyle_d = $button->style->bg[GTK_STATE_SELECTED];
/*currently selected*/
$butstyle_e = $button->style->bg[GTK_STATE_INSENSITIVE];
/*non-reactive state*/
All five states already have a default style defined where applicable, so we can either alter or
copy that. If you were to colour all these black ($black = &new GdkColor(0, 0, 0);) you would
see no reaction in the base of that button widget, regardless of anything you did to it. The button
would still work, it just wouldn't look as if it were. Probably. (I'm assuming that
GtkButton uses 'base' and not 'bg' here ....)
You can also define your styles in an rc file - there are two of these in the PHP-GTK test
directory. The principle's the same.
Hope some of that makes sense -
----- Original Message -----
From: "Adrian Immler" <a.immler@12mm.de>
To: <php-gtk-general@lists.php.net>
Sent: Tuesday, March 05, 2002 9:20 PM
Subject: [PHP-GTK] GdkColor?
> does someone has a good and easy tutorial for GdkColor for colorizing
> widgets ?
>
> i don't understand statements like these:
>
> $color1 = &new GdkColor(60000,40000,6000);
>
> $loginwindow->style->base[GTK_STATE_NORMAL] = $color1;
>
> that colorizes the whole application ... where can i find a document where
> that is explained in detail ?
>
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>