Re: Canvas change in gnome 1.2 (helix)



I'm sending a sample file. I don't understand why there is lots of space between
the text and the right border of the rectangle, while the other borbers seem OK.

	Jean-Marc

-- 
Jean-Marc Valin
Universite de Sherbrooke - Genie Electrique
valj01@gel.usherb.ca
#include <gnome.h>

int 
main(int argc, char* argv[])
{
   GtkWidget* window;
   GtkWidget* canvas;
   GnomeCanvasPoints* points;
   GnomeCanvasGroup* group;
   GnomeCanvasItem* item;
   double x1,x2,y1,y2;

   gnome_init("canvas-example", "0.0", argc, argv);  

   gdk_rgb_init();

   window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

   gtk_window_set_title(GTK_WINDOW(window), "Canvas Example");

   gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE);

   gtk_widget_push_visual(gdk_rgb_get_visual());
   gtk_widget_push_colormap(gdk_rgb_get_cmap());
   canvas = gnome_canvas_new_aa();
   gtk_widget_pop_colormap();
   gtk_widget_pop_visual();

   gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas), -20, -20, 20, 20);

   group = GNOME_CANVAS_GROUP (gnome_canvas_item_new (gnome_canvas_root(GNOME_CANVAS(canvas)),
                                                      gnome_canvas_group_get_type(),
                                                      "x", 0,
                                                      "y", 0,
                                                      NULL));

   item = gnome_canvas_item_new(group,
				gnome_canvas_text_get_type(),
				"x", 0.0,
				"y", 0.0,
				"text", "tatata",
				"anchor", GTK_ANCHOR_CENTER,
				"fill_color", "black",
				"font", "fixed",
				NULL);
   gnome_canvas_item_get_bounds(item, &x1,&y1, &x2, &y2);

   gnome_canvas_item_new (group,
			  gnome_canvas_rect_get_type(),
			  "x1", x1,
			  "y1", y1,
			  "x2", x2,
			  "y2", y2,
			  "fill_color_rgba", 0x3cb37180,
			  "outline_color", "black",
			  "width_units", 1.0,
			  NULL);


   gtk_container_add(GTK_CONTAINER(window), canvas);

   gtk_window_set_default_size(GTK_WINDOW(window), 300, 300);

   gtk_widget_show_all(window);

   gtk_main();

   return 0;
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]