Custom widget painting with GtkStyle
- From: Sebastian PajÄk <spconv+m gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Custom widget painting with GtkStyle
- Date: Sat, 19 Dec 2009 14:09:45 +0100
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
{
int x = widget->allocation.x;
int y = widget->allocation.y;
int width = widget->allocation.width;
int height = widget->allocation.height;
gtk_paint_box(widget->style, widget->window,
GTK_STATE_NORMAL,
GTK_SHADOW_IN, &event->area,
widget, "button",
x+4, y+4, width-8, height-8);
std::printf("EXPOSE");
return FALSE;
}
clv_expose is connected and is called. Unfortunately it doesn't work.
Only empty, flat window is showing, no shadow like in a button. Do you
know what can be wrong? Is GtkConainer good for sublassing in this
situation?
I cannot find any info on gtk/gdk drawing using google (only cairo).
Gtk API reference is very poor abou it. Some hints, simple exmples or
howtos will be helpful for a GTK+ beginner like me :).
Thanks in advance
Sebastian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]