Re: Custom widget painting with GtkStyle

2009-12-21 Thread Sebastian Pająk
Hmm... I just found theme on my box, that caused problem too (Raleigh). Do you see any warnings/errors in console while running? (a.out:51454): Gtk-CRITICAL **: gtk_paint_box: assertion `GTK_IS_STYLE (style)' failed If yes, following may help... (works now with all themes i have + proper

Re: Custom widget painting with GtkStyle

2009-12-20 Thread Artur Galyamov
20.12.09, 01:53, Sebastian Pająk spcon...@gmail.com: Cairo drowing works fine. I saw in gtkstyle.c that gtk_paint_box just sets background and draws It is default style implementation -- static void gtk_default_draw_box(...), i think. shadow. Now, if I paint shadow directly instead of box

Re: Custom widget painting with GtkStyle

2009-12-20 Thread Artur Galyamov
#include gtk/gtk.h static GtkWidget *window = NULL; static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event) { static GtkStyle *style = NULL; int x = widget-allocation.x; int y = widget-allocation.y; int width = widget-allocation.width; int height =

Re: Custom widget painting with GtkStyle

2009-12-20 Thread Sebastian Pająk
Thanks. The code compiles, but the painted box doesn't appear also. But the fault is somewhere else. I found gtk_paint_box doesn't work with MS-Windows theme only. With any other theme no problem exists (yes, I use gtk+ on win xp). It's weird because GtkButton also calls this function and there is

Re: Custom widget painting with GtkStyle

2009-12-20 Thread Artur Galyamov
Hmm... I just found theme on my box, that caused problem too (Raleigh). Do you see any warnings/errors in console while running? (a.out:51454): Gtk-CRITICAL **: gtk_paint_box: assertion `GTK_IS_STYLE (style)' failed If yes, following may help... (works now with all themes i have + proper style

Custom widget painting with GtkStyle

2009-12-19 Thread Sebastian Pająk
Hi I'm trying to create a shape for my custom widget using GtkStyle (gtk_paint func. family). For a start I want a shape like a button has (shadow + relief). This is my code for expose event: static int clv_expose(GtkWidget *widget, GdkEventExpose *event) // clv is a subclass of GtkConainer {

Re: Custom widget painting with GtkStyle

2009-12-19 Thread Artur Galyamov
Hi, Sebastian! static gboolean expose_event(GtkWidget *widget, GdkEventExpose *event) { static GtkStyle *style = NULL; int x = widget-allocation.x; int y = widget-allocation.y; int width = widget-allocation.width; int height = widget-allocation.height; if (!style)

Re: Custom widget painting with GtkStyle

2009-12-19 Thread Sebastian Pająk
I'm attaching a GtkStyle to my widget's window inside realize callback (like I saw it in gtkbutton.c). So I think there is no need to do it inside expose callback. Essentially all I want now is to draw something I can see like relief/shadow/line, because now I can see no effect of my

Re: Custom widget painting with GtkStyle

2009-12-19 Thread Artur Galyamov
19.12.09, 16:45, Sebastian Pająk spcon...@gmail.com: I'm attaching a GtkStyle to my widget's window inside realize callback (like I saw it in gtkbutton.c). So I think there is no need to do it inside expose callback. Me too -- example was very flat and all-in-one. But if you still get empty

Re: Custom widget painting with GtkStyle

2009-12-19 Thread Sebastian Pająk
Cairo drowing works fine. I saw in gtkstyle.c that gtk_paint_box just sets background and draws shadow. Now, if I paint shadow directly instead of box (with gtk_paint_shadow) it works! Strange. I need to read more about these engines/themes and try gtk_rc_* func as you suggested. I can post