Re: GTK+ & images
- From: Stefan Kost <kost imn htwk-leipzig de>
- To: Alf C Stockton <alf stockton co za>
- Cc: Hubert Sokolowski <h sokolowski wsisiz edu pl>, gtk-app-devel-list gnome org
- Subject: Re: GTK+ & images
- Date: Mon, 10 Jan 2005 16:26:40 +0100
Hi Alf,
generally I recomment to use e.g.
GDK_WINDOW(window) instead of (GdkWindow *)window
The first version by default does run-time checking and you will get error in
the console when running such code. If you need maximum speed you can add
options to you configure.ac that define G_DISABLE_CAST_CHECKS (dont do this when
developing though). That would turn the first version into the second version.
Stefan
Alf C Stockton wrote:
On Tue, 4 Jan 2005, Hubert Sokolowski wrote:
I have not been able to find a way to add an image to the background
of a
window
created with glade.
I would like to have the base window to have a background image and each
button
on that window to also have an image as background. I have seen this
done
on VB
& want the same functionality in GTK+.
Can this be done?
yes,
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Windows.html#gdk-window-set-back-pixmap
I have tried that as follows:-
int main(int argc, char **argv)
{
GtkWindow *window;
GtkButton *button;
GtkImage *image;
GdkPixbuf *orig_pixbuf;
/* Initialize GTK+ */
gtk_init(&argc, &argv);
/* create window, set default height and width to 200 pixels */
window = g_object_new(GTK_TYPE_WINDOW,
"default-height", 640,
"default-width", 480,
"border-width", 12,
"title", "Kiosk",
NULL);
image = g_object_new(GTK_TYPE_IMAGE, "file", "Background.jpg", NULL);
g_object_get(image, "pixbuf", &orig_pixbuf, NULL);
g_object_set_data(G_OBJECT(image),"orig_pixbuf",(gpointer)orig_pixbuf);
gdk_window_set_back_pixmap((GdkWindow *)window, (GdkPixmap *)image,
FALSE);
but when I run the program I get:-
(Kiosk:2175): Gdk-CRITICAL **: file gdkwindow-x11.c: line 2508
(gdk_window_set_back_pixmap): assertion `GDK_IS_WINDOW (window)' failed
---
Regards,
Alf Stockton www.stockton.co.za
Real programmers don't write in BASIC. Actually, no programmers write
in BASIC after reaching puberty.
NOTE: Dear Outlook users: Please remove me from your address books.
Read this article and you know why:
http://newsforge.com/article.pl?sid=03/08/21/143258
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
\|/ Stefan Kost
<@ @> private business
+-oOO-(_)-OOo------------------------------------------------------ - - - - -
| __ Address Simildenstr. 5 HTWK Leipzig, Fb IMN, Postfach 301166
| /// 04277 Leipzig 04251 Leipzig
| __ /// Germany Germany
| \\\/// Phone +49341 2253538 +49341 30766101
| \__/ EMail st_kost_at_gmx.net kost_at_imn.htwk-leipzig.de
| WWW www.sonicpulse.de www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - - - -
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]