/* Create an empty style suitable to this RC style */ static GtkStyle * clearlooks_rc_style_create_style (GtkRcStyle *rc_style) { (void) rc_style; return GTK_STYLE (g_object_new (CLEARLOOKS_TYPE_STYLE, NULL)); }
/* Create an empty style suitable to this RC style */ static GtkStyle * mist_rc_style_create_style (GtkRcStyle *rc_style) { void *ptr; ptr = GTK_STYLE (g_object_new (MIST_TYPE_STYLE, NULL)); return (GtkStyle *)ptr; }
static GtkStyle * mgicchikn_rc_style_create_style (GtkRcStyle * gtk_rc_style) { MgicChiknStyle *style = g_object_new (MGICCHIKN_TYPE_STYLE, NULL); return GTK_STYLE (style); }
/* Create an empty style suitable to this RC style */ static GtkStyle * thinice_rc_style_create_style (GtkRcStyle *rc_style) { void *ptr; ptr = GTK_STYLE (g_object_new (THINICE_TYPE_STYLE, NULL)); return (GtkStyle *)ptr; }
int setupwindow() { GdkPixmap *background; GdkPixbuf *pixbuf; GdkPixbuf *scaled; GdkScreen *screen; GdkColormap *colormap; GError *error=NULL; GtkStyle *style; window=gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(G_OBJECT(window), "expose_event", G_CALLBACK(expose_window),NULL); gtk_window_set_title(GTK_WINDOW(window), "clock"); gtk_window_stick(GTK_WINDOW(window)); gtk_window_set_resizable(GTK_WINDOW(window),TRUE); gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window),TRUE); gtk_window_set_keep_above(GTK_WINDOW(window),TRUE); gtk_container_set_border_width(GTK_CONTAINER(window), 3); gtk_window_set_decorated(GTK_WINDOW(window),TRUE); gtk_window_set_default_size(GTK_WINDOW(window),100,100); gtk_widget_set_app_paintable(window,TRUE); /* Get the screen to get the colormap */ screen=gtk_widget_get_screen(window); colormap = gdk_screen_get_rgba_colormap(screen); if(colormap != NULL){ alpha_channel_support=TRUE; } else { alpha_channel_support=FALSE; colormap=gdk_screen_get_rgb_colormap(screen); g_print("Sorry, no alpha!\n"); } /* Tell the window to use the colormap */ gtk_widget_set_colormap(window,colormap); /* Get a pixbuf from the image file */ pixbuf=gdk_pixbuf_new_from_file("clockface.png",&error); if(pixbuf==NULL){ g_print("Failed to open background image: %s\n", error->message); g_error_free(error); error=NULL; return 0; } /* Make it the same size as the window */ scaled=gdk_pixbuf_scale_simple(pixbuf,100,100, GDK_INTERP_BILINEAR); /* Render it using the colormap of the window */ gdk_pixbuf_render_pixmap_and_mask_for_colormap(scaled,colormap,&background,NULL,0); /* Make a new style, stick the background in it, tell window to use it. */ style = gtk_style_new(); style->bg_pixmap[0] = background; gtk_widget_set_style(GTK_WIDGET(window),GTK_STYLE(style)); /*gtk_window_set_opacity(GTK_WINDOW(window),0.3);*/ gtk_window_move(GTK_WINDOW(window), 0, 0); gtk_widget_show_all(window); return 1; }
static MT_PIXMAP *_mt_pixmap_new_from_image(MT_IMAGE *img) { GdkPixmap *pixmap; int width, height; width = gdk_pixbuf_get_width((GdkPixbuf *)img); height = gdk_pixbuf_get_height((GdkPixbuf *)img); pixmap = gdk_pixmap_new(gdk_get_default_root_window(), width, height, GTK_STYLE(mt_style)->depth); gdk_pixbuf_render_to_drawable((GdkPixbuf *)img, pixmap, NULL, 0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE, 0, 0); return (MT_PIXMAP *)pixmap; }
static void _mt_gc_set_foreground(MT_GC *gc, MT_COLOR *col) { GdkGCValues gc_values; GdkGCValuesMask gc_values_mask; GdkColor color; GdkGC *gdkgc; MT_GTK_GC *mtgc = (MT_GTK_GC *)gc; color.red = col->r * 256; color.green = col->g * 256; color.blue = col->b * 256; if (!gdk_colormap_alloc_color(GTK_STYLE(mt_style)->colormap, &color, FALSE, TRUE)) return; gc_values_mask = GDK_GC_FOREGROUND; gc_values.foreground = color; gdkgc = gtk_gc_get(GTK_STYLE(mt_style)->depth, GTK_STYLE(mt_style)->colormap, &gc_values, gc_values_mask); gtk_gc_release(mtgc->gc); mtgc->gc = gdkgc; }
void setWindow(GtkWidget *widget,gpointer data ) { GdkPixbuf *LoadImage = NULL; GtkStyle *StyleNew = NULL; GdkPixmap *LoadPixmap = NULL; LoadImage = load_pixbuf_from_file ((gchar*)data); gdk_pixbuf_render_pixmap_and_mask (LoadImage, &LoadPixmap, NULL, 0); StyleNew = gtk_style_new (); StyleNew->bg_pixmap [0] = LoadPixmap; gtk_widget_set_style (GTK_WIDGET(window), GTK_STYLE (StyleNew)); }
static MT_GC *_mt_gc_new_with_foreground(MT_COLOR *col) { GdkGCValues gc_values; GdkGCValuesMask gc_values_mask; GdkColor color; GdkGC *gc; MT_GTK_GC *mtgc; color.red = col->r * 256; color.green = col->g * 256; color.blue = col->b * 256; if (!gdk_colormap_alloc_color(GTK_STYLE(mt_style)->colormap, &color, FALSE, TRUE)) return NULL; gc_values_mask = GDK_GC_FOREGROUND; gc_values.foreground = color; gc = gtk_gc_get(GTK_STYLE(mt_style)->depth, GTK_STYLE(mt_style)->colormap, &gc_values, gc_values_mask); mtgc = (MT_GC *)malloc(sizeof(MT_GTK_GC)); mtgc->gc = gc; mtgc->clip.width = -1; mtgc->clip.height = -1; return mtgc; }
int main(int argc, char *argv[]) { GtkWidget *box, *button, *poz, *reg_b, *frame; GtkStyle *style; GdkPixmap *bg; char buffer[buffsize]; if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) { fprintf(stderr, "WSAStartup() failed"); exit(1); } if ((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) puts("socket() failed"); memset(&server, 0, sizeof(server)); /* Zero out structure */ server.sin_family = AF_INET; /* Internet address family */ server.sin_addr.s_addr = inet_addr("127.0.0.1"); /* Server IP address */ server.sin_port = htons(21); /* Server port */ if (connect(sock, (struct sockaddr *) &server, sizeof(server)) < 0) /* Establish the connection to the server */ puts("connect() failed"); gtk_init(&argc, &argv); //start GTK+ pixbuf = gdk_pixbuf_new_from_file_utf8("bgm.jpg", error); //read background gdk_pixbuf_render_pixmap_and_mask(pixbuf, &bg, NULL, 0); style = gtk_style_new(); style->bg_pixmap[0] = bg; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); //create window //gtk_window_set_default_size(GTK_WINDOW(window), 1280, 720); pixbuf = gdk_pixbuf_new_from_file_utf8("logo.gif", error); //read logo gtk_window_set_icon(GTK_WINDOW (window), pixbuf); //set logo gtk_container_set_border_width(GTK_CONTAINER (window), 10); //create close window event g_signal_connect(window, "delete-event", G_CALLBACK (delete_event), NULL); gtk_widget_set_style(GTK_WIDGET(window), GTK_STYLE(style)); //set background box = gtk_vbox_new(FALSE, 0); //the mess of positioning poz = gtk_hbox_new(FALSE, 0); logbox = gtk_vbox_new(FALSE, 0); gamebox = gtk_vbox_new(FALSE, 0); //positioning ends here //Setting up used Widgets -> buttons, input fields, ... //image = gtk_image_new_from_file_utf8("maemo.png"); pixbuf = gdk_pixbuf_new_from_file_at_scale_utf8("pic/0.jpg", 500, 500, TRUE, //read shown image error); image = gtk_image_new_from_pixbuf(pixbuf); //set image frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type((GtkFrame *) frame, GTK_SHADOW_ETCHED_IN); gtk_container_add(GTK_CONTAINER (frame), image); gtk_container_add(GTK_CONTAINER (poz), frame); gtk_widget_show(frame); gtk_box_pack_start(GTK_BOX (poz), box, FALSE, FALSE, 10); //a bit of positioning gtk_box_pack_start(GTK_BOX (box), logbox, FALSE, FALSE, 10); gtk_box_pack_start(GTK_BOX (box), gamebox, FALSE, FALSE, 10); //end logname = gtk_entry_new(); gtk_box_pack_start(GTK_BOX (logbox), logname, FALSE, FALSE, 10); gtk_widget_show(logname); pass = gtk_entry_new(); gtk_box_pack_start(GTK_BOX (logbox), pass, FALSE, FALSE, 10); gtk_widget_show(pass); button = gtk_button_new_with_label("login"); g_signal_connect(button, "clicked", G_CALLBACK (login), (gpointer) NULL); gtk_box_pack_start(GTK_BOX (logbox), button, FALSE, FALSE, 10); gtk_widget_show(button); reg_b = gtk_button_new_with_label("Register"); g_signal_connect(reg_b, "clicked", G_CALLBACK (reg), (gpointer) "NULL"); gtk_box_pack_start(GTK_BOX (logbox), reg_b, FALSE, FALSE, 10); gtk_widget_show(reg_b); cbutton = gtk_button_new_with_label(buffer); g_signal_connect(cbutton, "clicked", G_CALLBACK (lan), (gpointer) buffer); gtk_box_pack_start(GTK_BOX (gamebox), cbutton, FALSE, FALSE, 10); button = gtk_button_new_with_label("picture"); g_signal_connect(button, "clicked", G_CALLBACK (set_image), "pic"); gtk_box_pack_start(GTK_BOX (gamebox), button, FALSE, FALSE, 10); stats = make_stats(); gtk_box_pack_start(GTK_BOX (gamebox), stats, FALSE, FALSE, 10); status = gtk_toggle_button_new_with_label("connected"); gtk_toggle_button_set_active((GtkToggleButton *) status, TRUE); g_signal_connect(status, "toggled", G_CALLBACK (clcon), (gpointer) NULL); gtk_box_pack_start(GTK_BOX (box), status, FALSE, FALSE, 10); gtk_container_add(GTK_CONTAINER (window), poz); //showing the parts of the window gtk_widget_show(status); gtk_widget_show(image); gtk_widget_show(logbox); gtk_widget_show(poz); gtk_widget_show(box); gtk_widget_show(window); gtk_main(); return EXIT_SUCCESS; }
/* Create an empty style suitable to this RC style */ static GtkStyle * rsvg_rc_style_create_style (GtkRcStyle *rc_style) { return GTK_STYLE (g_object_new (RSVG_TYPE_STYLE, NULL)); }
static GtkStyle * dawati_rc_style_create_style (GtkRcStyle *rc_style) { return GTK_STYLE (g_object_new (DAWATI_TYPE_STYLE, NULL)); }
static GtkStyle * dwerg_rc_style_create_style(GtkRcStyle *rc_style) { return GTK_STYLE(g_object_new(DWERG_TYPE_STYLE,NULL)); }
//______________________________________________________________________ GtkStyle* RCStyle::createStyle( GtkRcStyle* rc_style ) { return GTK_STYLE( g_object_new( StyleWrapper::type(), 0L ) ); }
static GtkStyle * crux_rc_style_create_style (GtkRcStyle *rc_style) { return GTK_STYLE (g_object_new (CRUX_TYPE_STYLE, NULL)); }