] |
] == Skinnable GTK1.2 Applikation == test.png ist in diesem Fall ein Transparentes PNG File erstellt mit Gimp main.c [[Code] #include <gtk/gtk.h> #include <stdio.h> #include <gdk/gdk.h> #include <gdk_imlib.h> int main(int argc, char *argv[]){ GtkWidget? *mainwindow; GdkImlibImage? *im; GdkPixmap? *pixmap; gint nheight,nwidth; GdkBitmap? *mask; GdkWindow? *win; gtk_init(&argc,&argv); gdk_imlib_init(); gtk_widget_push_visual(gdk_imlib_get_visual()); gtk_widget_push_colormap(gdk_imlib_get_colormap()); im=gdk_imlib_load_image("test.png"); if(!im){ fprintf(stderr,"Couldn't load image"); throw; } nwidth=im->rgb_width; nheight=im->rgb_height; fprintf(stderr,"width: %d height: %d\n", nwidth,nheight); gdk_imlib_render(im,nwidth,nheight); //nwidth,nheight); mask = gdk_imlib_move_mask(im); pixmap = gdk_imlib_move_image(im); mainwindow = gtk_window_new({GTK WINDOW TOPLEVEL}?); gtk_widget_set_app_paintable(mainwindow,TRUE); gtk_window_set_title({GTK WINDOW}?(mainwindow),"mainwindow"); gtk_window_set_policy({GTK WINDOW}?(mainwindow),FALSE,FALSE,FALSE); gtk_widget_realize(mainwindow); gdk_window_set_back_pixmap(mainwindow->window,pixmap,0); gdk_window_shape_combine_mask(mainwindow->window,mask,0,0); gdk_window_set_decorations(mainwindow->window,(GdkWMDecoration?)0); gtk_widget_set_usize(mainwindow,nwidth,nheight); //500,500); gtk_widget_show(mainwindow); gtk_main(); return 0; } ] Makefile [[Code] GCC=gcc LIBS=`pkg-config --cflags --libs gtk+` `pkg-config --cflags --libs imlibgdk` DEBUG=-g all: $(GCC) main.c $(LIBS) $(DEBUG) -o main clean: rm main ] |
GTK Programming |
Eines meiner ersten Beispiele.. mittlerweile würde ich eher auf Glade zurückgreifen da die Entwicklung um einiges schneller vorangeht..
|
compilen mit:
|
Skinnable GTK1.2 Applikation |
test.png ist in diesem Fall ein Transparentes PNG File erstellt mit Gimp
main.c
|
Makefile
|