Gtk, Trying to set bg to GtkEventBox but it fails.

Posted by PP on Stack Overflow See other posts from Stack Overflow or by PP
Published on 2010-03-26T06:28:45Z Indexed on 2010/03/26 6:33 UTC
Read the original article Hit count: 267

Filed under:
|

I am trying to set bg image to an event box but i am getting error as window GDK_IS_WINDOW (window)' failed what am i doing wrong in it?

int main()
{
    GtkWidget *g_winMain;
    GError *error = NULL;

    gtk_init(&argc, &argv);

    g_winMain   = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_size_request(g_winMain, 300, 300);
    g_signal_connect(G_OBJECT(g_winMain), "destroy",
              G_CALLBACK(gtk_main_quit), NULL);

    GtkWidget *event_box;
    event_box = gtk_event_box_new();
    gtk_event_box_set_visible_window( GTK_EVENT_BOX(event_box), TRUE );

    GtkWidget *image;
    GdkPixmap *pixmap;
    GdkPixbuf *pixbuf;
    GdkBitmap *bitmap;

    pixbuf = gdk_pixbuf_new_from_file("test.jpg", &error);
    gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, &bitmap, 0);
    gdk_window_set_back_pixmap( event_box->window, pixmap, true); //Error On this Line********

    gtk_container_add( GTK_CONTAINER(g_winMain), event_box);

    gtk_widget_show(g_winMain);
    gtk_main();
}

© Stack Overflow or respective owner

Related posts about gtk

Related posts about gtk+