writting custom widget



Hello.

I'm having a lot of trouble trying to write a custom widget.
Basicaly, it's a button with two labels and drawing on the background (see
attached file).

In the gtk tutorial, there are two examples of custon widget.
The first (ttt) is a composite (inheriting of vbox) and does no drawing.
The second one does drawing (inheriting of widget) but has no child and uses no
color.

For now, i use the second example and draws my strings by hand
(gdk_draw_string). It's bad cause i need to compute the placement by hand.

Can i draw on the background of box, and how ?

I also need a bunch of colors (the square and circle can be red, green, blue,
yellow etc...). Do i need a GdkGC per color and per widget ?
I tried to allocate the GC in the _init method, but gtk keeps telling me
widget->window is NULL. Where do i do that ?

Thanx for your help.
-- 
Antoine
WYGIWYD - What You Get Is What You Deserve

sysbas.jpg



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