void gmdb_form_add_icon(gchar *text) { GList *glist = NULL; GtkWidget *li; GtkWidget *label; GtkWidget *box; GtkWidget *pixmapwid; GdkPixmap *pixmap; GdkBitmap *mask; li = gtk_list_item_new (); box = gtk_hbox_new (FALSE,5); pixmap = gdk_pixmap_colormap_create_from_xpm( NULL, gtk_widget_get_colormap(app), &mask, NULL, "table.xpm"); /* a pixmap widget to contain the pixmap */ pixmapwid = gtk_pixmap_new( pixmap, mask ); gtk_widget_show( pixmapwid ); gtk_box_pack_start (GTK_BOX (box), pixmapwid, FALSE, TRUE, 0); label = gtk_label_new (text); gtk_box_pack_start (GTK_BOX (box), label, FALSE, TRUE, 0); gtk_container_add(GTK_CONTAINER(li), box); glist = g_list_append (glist, li); gtk_widget_show (label); gtk_widget_show_all (li); gtk_hlist_append_items(GTK_HLIST(form_hlist), glist); }
void message_dialog (gchar *message) { GtkWidget *dialog; GtkWidget *vbox; GtkWidget *hbox; GdkColormap *colormap; GtkStyle *style; GdkBitmap *mask; GdkPixmap *pixmap; GtkWidget *image; GtkWidget *label; GtkWidget *button; dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL); #if GTK_MAJOR_VERSION == 2 gtk_window_set_decorated (GTK_WINDOW(dialog), FALSE); #endif gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ALWAYS); gtk_container_set_border_width (GTK_CONTAINER(dialog), 12); vbox = gtk_vbox_new (FALSE, 10); gtk_container_add (GTK_CONTAINER(dialog), vbox); hbox = gtk_hbox_new (FALSE, 10); gtk_box_pack_start_defaults (GTK_BOX(vbox), hbox); style = gtk_widget_get_style (dialog); colormap = gtk_widget_get_colormap(dialog); pixmap = gdk_pixmap_colormap_create_from_xpm (dialog->window, colormap, &mask, NULL, "/etc/icons/error.xpm"); image = gtk_pixmap_new (pixmap, mask); gtk_box_pack_start_defaults (GTK_BOX(hbox), image); label = gtk_label_new (message); gtk_box_pack_start_defaults (GTK_BOX(hbox), label); button = gtk_button_new_with_label ("Fechar"); gtk_signal_connect (GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); gtk_box_pack_start_defaults (GTK_BOX(vbox), button); gtk_widget_show_all (dialog); gtk_widget_grab_focus (button); gtk_main (); gtk_widget_destroy (dialog); while (gtk_events_pending ()) gtk_main_iteration (); }
/* * Called once at the beginning of the program for setup */ void select_restore_setup() { const gchar *title[NUM_COLUMNS] = {_("Mark"), _("File"), _("Mode"), _("User"), _("Group"), _("Size"), _("Date")}; restore_file_selection = create_restore_file_selection(); if (!restore_file_selection) { Dmsg0(000, "Restore_files not setup.\n"); } restore_dir = lookup_widget(restore_file_selection, "restore_dir"); scrolled = lookup_widget(restore_file_selection, "scrolled"); if (!scrolled) { Dmsg0(000, "Scrolled not setup.\n"); } restore = new_window(); #ifdef needed check_pixmap = gdk_pixmap_colormap_create_from_xpm(NULL, gdk_colormap_get_system(), &check_trans, NULL, "check.xpm"); blank_pixmap = gdk_pixmap_colormap_create_from_xpm(NULL, gdk_colormap_get_system(), &blank_trans, NULL, "blank.xpm"); #endif /* XXX: Stupid gtk_clist_set_selection_mode() has incorrect declaration of the title argument */ /* XXX: Workaround by typecast... [email protected] */ restore->list = (GtkCList *)gtk_clist_new_with_titles(NUM_COLUMNS, (gchar **) title); gtk_clist_set_selection_mode(restore->list, GTK_SELECTION_EXTENDED); gtk_clist_set_sort_column(restore->list, FILE_COLUMN); gtk_clist_set_auto_sort(restore->list, true); gtk_signal_connect(GTK_OBJECT(restore->list), "click_column", G_CALLBACK(click_column_cb), restore); gtk_signal_connect(GTK_OBJECT(restore->list), "select_row", G_CALLBACK(select_row_cb), restore); gtk_container_add(GTK_CONTAINER(scrolled), GTK_WIDGET(restore->list)); restore->buf = get_pool_memory(PM_FNAME); restore->fname = get_pool_memory(PM_FNAME); restore->path = get_pool_memory(PM_NAME); restore->file = get_pool_memory(PM_NAME); }
/* This is an internally used function to create pixmaps. */ GtkWidget* create_pixmap (GtkWidget *widget, const gchar *filename) { gchar *found_filename = NULL; GdkColormap *colormap; GdkPixmap *gdkpixmap; GdkBitmap *mask; GtkWidget *pixmap; GList *elem; if (!filename || !filename[0]) return create_dummy_pixmap (widget); /* We first try any pixmaps directories set by the application. */ elem = pixmaps_directories; while (elem) { found_filename = check_file_exists ((gchar*)elem->data, filename); if (found_filename) break; elem = elem->next; } /* If we haven't found the pixmap, try the source directory. */ if (!found_filename) { found_filename = check_file_exists ("../pixmaps", filename); } if (!found_filename) { g_warning (_("Couldn't find pixmap file: %s"), filename); return create_dummy_pixmap (widget); } colormap = gtk_widget_get_colormap (widget); gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask, NULL, found_filename); if (gdkpixmap == NULL) { g_warning (_("Error loading pixmap file: %s"), found_filename); g_free (found_filename); return create_dummy_pixmap (widget); } g_free (found_filename); pixmap = gtk_pixmap_new (gdkpixmap, mask); gdk_pixmap_unref (gdkpixmap); gdk_bitmap_unref (mask); return pixmap; }
void build_example1(GtkWidget *active_plot) { GdkColormap *colormap; GdkPixmap *pixmap; GdkBitmap *mask; static gdouble px1[]={0., 0.2, 0.4, 0.6, 0.8, 1.0}; static gdouble py1[]={.2, .4, .5, .35, .30, .40}; static gdouble px2[]={0., 0.2, 0.4, 0.6, 0.8, 1.0}; static gdouble py2[]={.12, .22, .27, .12, .52, .62}; colormap = gdk_colormap_get_system(); pixmap = gdk_pixmap_colormap_create_from_xpm(NULL, colormap, &mask, NULL, "cloud.xpm"); dataset[0] = GTK_PLOT_DATA(gtk_plot_pixmap_new(pixmap, mask)); gtk_plot_add_data(GTK_PLOT(active_plot), dataset[0]); gtk_widget_show(GTK_WIDGET(dataset[0])); gtk_plot_data_set_points(dataset[0], px1, py1, px2, py2, 6); gtk_plot_data_set_legend(dataset[0], "Pixmap 1"); gdk_pixmap_unref(pixmap); gdk_bitmap_unref(mask); pixmap = gdk_pixmap_colormap_create_from_xpm(NULL, colormap, &mask, NULL, "suncloud.xpm"); dataset[1] = GTK_PLOT_DATA(gtk_plot_pixmap_new(pixmap, mask)); gtk_plot_add_data(GTK_PLOT(active_plot), dataset[1]); gtk_widget_show(GTK_WIDGET(dataset[1])); gtk_plot_data_set_points(dataset[1], px2, py2, NULL, NULL, 6); gtk_plot_data_set_legend(dataset[1], "Pixmap 2"); gdk_pixmap_unref(pixmap); gdk_bitmap_unref(mask); }
static VALUE gdkpmap_colormap_create_from_xpm(VALUE self, VALUE win, VALUE colormap, VALUE tcolor, VALUE fname) { GdkPixmap *result; GdkBitmap *mask; result = gdk_pixmap_colormap_create_from_xpm(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)), GDK_COLORMAP(RVAL2GOBJ(colormap)), &mask, RVAL2GDKCOLOR(tcolor), RVAL2CSTR(fname)); if (result == NULL) rb_raise(rb_eArgError, "Pixmap not created from %s", RVAL2CSTR(fname)); return rb_assoc_new(GOBJ2RVAL(result), GOBJ2RVAL(mask)); }
void build_example1(GtkWidget *active_plot) { GdkPixmap *pixmap; GdkBitmap *mask; GdkColormap *colormap; colormap = gdk_colormap_get_system(); pixmap = gdk_pixmap_colormap_create_from_xpm(NULL, colormap, &mask, NULL, "sat.xpm"); gtk_plot_set_background_pixmap(GTK_PLOT(active_plot), pixmap); gdk_pixmap_unref(pixmap); gdk_bitmap_unref(mask); }
GtkWidget * create_pixmap (GtkWidget * widget, const gchar * file) { GdkColormap *colormap; GdkPixmap *gdkpixmap; GdkBitmap *mask; GtkWidget *pixmap; GtkStyle *style; colormap = gtk_widget_get_colormap (app.main_window); style = gtk_widget_get_style (app.main_window); gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask, NULL, file); pixmap = gtk_pixmap_new (gdkpixmap, mask); gdk_pixmap_unref (gdkpixmap); gdk_bitmap_unref (mask); return pixmap; }
/* * This is an internally used function to create pixmaps. */ GtkWidget * create_pixmap (GtkWidget * widget, const gchar * filename, gboolean gnome_pixmap) { GtkWidget *pixmap; GdkColormap *colormap; GdkPixmap *gdkpixmap; GdkBitmap *mask; gchar *pathname; if (!filename || !filename[0]) return create_dummy_pixmap (widget, gnome_pixmap); pathname = gnome_pixmap_file (filename); if (!pathname) { g_warning (_("Couldn't find pixmap file: %s"), filename); return create_dummy_pixmap (widget, gnome_pixmap); } if (gnome_pixmap) { pixmap = gnome_pixmap_new_from_file (pathname); g_free (pathname); return pixmap; } colormap = gtk_widget_get_colormap (widget); gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask, NULL, pathname); if (gdkpixmap == NULL) { g_warning (_("Couldn't create pixmap from file: %s"), pathname); g_free (pathname); return create_dummy_pixmap (widget, gnome_pixmap); } g_free (pathname); pixmap = gtk_pixmap_new (gdkpixmap, mask); gdk_pixmap_unref (gdkpixmap); gdk_bitmap_unref (mask); return pixmap; }
CAMLprim value ml_gdk_pixmap_colormap_create_from_xpm (value window, value colormap, value transparent, char *filename) { CAMLparam0(); GdkPixmap *pixmap; GdkBitmap *mask = NULL; CAMLlocal2(vpixmap, vmask); value ret; pixmap = gdk_pixmap_colormap_create_from_xpm (Option_val(window,GdkWindow_val,NULL), Option_val(colormap,GdkColormap_val,NULL), &mask, Option_val(transparent,GdkColor_val,NULL), filename); if (!pixmap) ml_raise_gdk ("Gdk.Pixmap.create_from_xpm_file"); vpixmap = Val_GdkPixmap_no_ref(pixmap); vmask = Val_GdkBitmap_no_ref (mask); ret = alloc_small (2,0); Field(ret,0) = vpixmap; Field(ret,1) = vmask; CAMLreturn(ret); }
void input_dialog (gchar **user, gchar **pass) { GtkWidget *dialog; GdkColormap *colormap; GtkStyle *style; GdkBitmap *mask; GdkPixmap *pixmap; GtkWidget *image; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *label; GtkWidget *user_entry; GtkWidget *pass_entry; GtkWidget *connect_button; dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL); #if GTK_MAJOR_VERSION == 2 gtk_window_set_decorated (GTK_WINDOW(dialog), FALSE); #endif gtk_signal_connect (GTK_OBJECT(dialog), "delete-event", GTK_SIGNAL_FUNC(quit_prog), NULL); gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ALWAYS); gtk_container_set_border_width (GTK_CONTAINER(dialog), 12); vbox = gtk_vbox_new (FALSE, 26); gtk_container_add (GTK_CONTAINER(dialog), vbox); style = gtk_widget_get_style (dialog); colormap = gtk_widget_get_colormap(dialog); pixmap = gdk_pixmap_colormap_create_from_xpm (dialog->window, colormap, &mask, NULL, "/etc/icons/thinnx.xpm"); image = gtk_pixmap_new (pixmap, mask); gtk_box_pack_start_defaults (GTK_BOX(vbox), image); hbox = gtk_hbox_new (TRUE, 4); gtk_box_pack_start_defaults (GTK_BOX(vbox), hbox); label = gtk_label_new ("Login:"******"Senha:"); gtk_box_pack_start_defaults (GTK_BOX(hbox), label); pass_entry = gtk_entry_new (); gtk_signal_connect (GTK_OBJECT(pass_entry), "activate", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); gtk_entry_set_visibility (GTK_ENTRY(pass_entry), FALSE); gtk_box_pack_start_defaults (GTK_BOX(hbox), pass_entry); hbox = gtk_hbox_new (TRUE, 6); gtk_box_pack_start_defaults (GTK_BOX(vbox), hbox); connect_button = gtk_button_new_with_label ("Conectar!"); gtk_signal_connect (GTK_OBJECT(connect_button), "clicked", GTK_SIGNAL_FUNC(gtk_main_quit), NULL); gtk_box_pack_start_defaults (GTK_BOX(hbox), connect_button); gtk_widget_show_all (dialog); gtk_widget_grab_focus (user_entry); gtk_main (); *user = g_strdup (gtk_entry_get_text (GTK_ENTRY(user_entry))); *pass = g_strdup (gtk_entry_get_text (GTK_ENTRY(pass_entry))); gtk_widget_destroy (dialog); while (gtk_events_pending ()) gtk_main_iteration (); }