Re: The proper way to integrate self-made widgets with themes
- From: centipede takhis net
- To: gtk-list gnome org
- Subject: Re: The proper way to integrate self-made widgets with themes
- Date: Sat, 26 Jan 2008 07:55:09 +0100 (CET)
> Hello all.
>
> In the process of making a bunch of widgets I have stumbled upon this
> issue: I need to paint various parts of my widget, but I would like to
> make the color of the parts controlled by the theme. I.e. the properties I
> want to deal with are extra, self-invented properties besides the usual
> style properties.
>
> (Note: I am using PyGTK 2.12, GTK 2.10 on Arch Linux)
>
> I have figured out how to manually load a theme-file accompanying my
> application (by setting the environment variable GTK2_RC_FILES to ./gtkrc
> before initializing gtk)
> However I cannot insert my own property-names in such a file. The
> following gives rise to a syntax error:
>
> # My Properties
> scalartrack_segment_handle_size = 5
>
> Besides I wouldn't know how to get those properties out again so I can use
> them in an expose event
>
> So...
> I am asking for the canonical way to implement new widgets and push the
> choice of color, size and pixmap-overlays to the theme-designer. The
> alternative is drawing with libcairo and using hardwired style properties.
>
> Regards, Rene Jensen
Possible solution: Use the pixmap engine. It seems to support the "detail"
parameter, so I can specify many additional sections, one for each detail.
Example:
style "track"
{
engine "pixmap"
{
image
{
function = BOX
recolorable = TRUE
detail = "segment"
file = "Extra/track-segment-type1.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
orientation = HORIZONTAL
}
}
}
.. This style will draw the image "Extra/track-segment-type1.png" when
invoked with this command (in PyGTK):
self.styleTrack.paint_box (self.window, gtk.STATE_NORMAL,
gtk.SHADOW_IN, None, None, "segment", X,Y,W,H)
But since the pixmap-engine really did turn out to be rather heavy, I will
have to settle for less:
HOW CAN I DRAW a theme'd box (using gtk_paint_box) in colors different
from what the theme has chosen for my GtkDrawingArea?
Do I have to modify_bg before each call to paint_box, and then reset it
again afterwards?
Regards,
Rene Jensen, Denmark
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]