Contents


On-line Guides
All Guides
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
Book Store

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

 

 

Gtk+/Gnome Application Development
Prev Home Next

Bounds

The bounds method computes the approximate bounding box of a canvas item. In Gnome 1.0, this method is only used in gnome_canvas_item_get_bounds(), a user-visible function to return the bounds of a canvas item. The canvas does not use it at all internally, and most likely you could get away without implementing it, though all the stock items do.

The function should return an item's bounding box in item coordinates; here is the GnomeCanvasRE version:


static void
gnome_canvas_re_bounds (GnomeCanvasItem *item, 
                        double *x1, double *y1, 
                        double *x2, double *y2)
{
  GnomeCanvasRE *re;
  double hwidth;

  re = GNOME_CANVAS_RE (item);

  if (re->width_pixels)
    hwidth = (re->width / item->canvas->pixels_per_unit) / 2.0;
  else
    hwidth = re->width / 2.0;

  *x1 = re->x1 - hwidth;
  *y1 = re->y1 - hwidth;
  *x2 = re->x2 + hwidth;
  *y2 = re->y2 + hwidth;
}
      
Gtk+/Gnome Application Development
Prev Home Next

 
 
  Published under free license. Design by Interspire