GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::Gdk::Rectangle Class Reference

A GdkRectangle C++ wrapper class. More...

#include <gfc/gdk/types.hh>

Inheritance diagram for GFC::Gdk::Rectangle:

GFC::Gtk::Allocation List of all members.

Public Member Functions

Constructors
Accessors
Methods
Methods returning a new Rectangle

Detailed Description

A GdkRectangle C++ wrapper class.

Rectangle is an object that holds the position and size of a rectangle. The intersection of two rectangles can be computed with intersect_with(). To find the union of two rectangles use union_with(). Rectangle uses default copy, assignment and destruction.


Constructor & Destructor Documentation

GFC::Gdk::Rectangle::Rectangle (   ) 
 

Construct a null rectangle.

A null rectangle has its x, y, width and height set to 0;

GFC::Gdk::Rectangle::Rectangle (  int  x,
int  y,
int  width,
int  height
) 
 

Construct a new rectangle.

Parameters:
x The X coordinate of the rectangle.
y The Y coordinate of the rectangle.
width The width of the rectangle.
height The height of the rectangle.

GFC::Gdk::Rectangle::Rectangle (  const Point &  point,
int  width,
int  height
) 
 

Construct a new rectangle.

Parameters:
point The x, y coordinates of the top-left corner of the rectangle.
width The width of the rectangle.
height The height of the rectangle.

GFC::Gdk::Rectangle::Rectangle (  const GdkRectangle &  rectangle  ) 
 

Construct a new rectangle from an existing GdkRectangle.

Parameters:
rectangle A GdkRectangle.


Member Function Documentation

void GFC::Gdk::Rectangle::capture (  Point &  point  )  const
 

Keeps point within the boundries of the rectangle.

Parameters:
point A reference to a Point.

This method is useful if you want to confine the cursor to a rectangle (e.g. a dialog) until the user makes a selection. Just use the captured point to set the cursor position in response to a motion_event signal.

bool GFC::Gdk::Rectangle::empty (   )  const
 

Returns true if the rectangle is empty.

A rectangle is empty if either the width or height is 0;

bool GFC::Gdk::Rectangle::equal (  const Rectangle &  other  )  const
 

Returns true if this rectangle compares equal to other.

Parameters:
other A Gdk::Rectangle.

Rectangle& GFC::Gdk::Rectangle::inflate (  int  dx,
int  dy
) 
 

Resize the rectangle.

Parameters:
dx The number of pixels to add/subtract the X coordinate of each corner.
dy The number of pixels to add/subtract the Y coordinate of each corner.
Returns:
A reference to the resized rectangle.

Positive values for dx and dy will enlarge the rectangle, and a negative values for dx and dy will shrink the rectangle.

Rectangle GFC::Gdk::Rectangle::inflate_by (  int  dx,
int  dy
)  const
 

Resize this rectangle and return the result as a new Rectangle.

Parameters:
dx The number of pixels to add/subtract the X coordinate of each corner.
dy The number of pixels to add/subtract the Y coordinate of each corner.
Returns:
A new rectangle (see inflate()).

Positive values for dx and dy will enlarge the rectangle, and a negative values for dx and dy will shrink the rectangle.

bool GFC::Gdk::Rectangle::intersect (  const Rectangle &  other  )  const
 

Returns true if this rectangle and other intersect.

Parameters:
other A Gdk::Rectangle.

bool GFC::Gdk::Rectangle::intersect_with (  const Rectangle &  other  ) 
 

Calculates the intersection of two rectangles.

Parameters:
other A Gdk::Rectangle.
Returns:
true if this rectangle and other intersect.

On returning, this rectangle contains the intersection the original rectangle and other. If the two rectangles don't intersect, the rectangle will be unchanged.

bool GFC::Gdk::Rectangle::null (   )  const
 

Returns true if the rectangle is null.

A null rectangle has its x, y, width and height set to 0;

Rectangle& GFC::Gdk::Rectangle::offset (  int  dx,
int  dy
) 
 

Move the rectangle.

Parameters:
dx The number of pixels to add/subtract the X coordinate of the top-left corner.
dy The number of pixels to add/subtract the Y coordinate of the top-left corner.
Returns:
A reference to the resized rectangle.

Rectangle GFC::Gdk::Rectangle::offset_by (  int  dx,
int  dy
)  const
 

Move the rectangle and return the result as a new rectangle.

Parameters:
dx The number of pixels to add/subtract the X coordinate of the top-left corner.
dy The number of pixels to add/subtract the Y coordinate of the top-left corner.
Returns:
A new rectangle (see offset()).

bool GFC::Gdk::Rectangle::operator &= (  const Rectangle &  other  ) 
 

Calculates the intersection of two rectangles (same as intersect_with()).

Parameters:
other A Gdk::Rectangle.
Returns:
true if this rectangle and other intersect.

bool GFC::Gdk::Rectangle::operator!= (  const Rectangle &  other  )  const
 

Returns true if this rectangle and other compare unequal.

Parameters:
other A Gdk::Rectangle.

Rectangle& GFC::Gdk::Rectangle::operator++ (   ) 
 

Inflates the rectangle in all directions by one pixel.

Returns:
A reference to the resized rectangle.

Rectangle& GFC::Gdk::Rectangle::operator+= (  const Point &  point  ) 
 

Offsets the rectangle by point.x and point.y.

Parameters:
point A Point specifying the dx and dy values to offset the top-left corner by.
Returns:
A reference to the moved rectangle.

Rectangle& GFC::Gdk::Rectangle::operator+= (  int  increment  ) 
 

Inflates the rectangle by increment in all directions.

Parameters:
increment The number of pixels to inflate the rectangle by.
Returns:
A reference to the resized rectangle.

Rectangle& GFC::Gdk::Rectangle::operator-- (   ) 
 

Shrink the rectangle in all directions by one pixel.

Returns:
A reference to the resized rectangle.

Rectangle& GFC::Gdk::Rectangle::operator-= (  const Point &  point  ) 
 

Offsets the rectangle by -point.x and -point.y.

Parameters:
point A Point specifying the dx and dy values to offset the top-left corner by.
Returns:
A reference to the moved rectangle.

Rectangle& GFC::Gdk::Rectangle::operator-= (  int  increment  ) 
 

Shrinks the rectangle by increment in all directions.

Parameters:
increment The number of pixels to shrink the rectangle by.
Returns:
A reference to the resized rectangle.

bool GFC::Gdk::Rectangle::operator== (  const Rectangle &  other  )  const
 

Returns true if this rectangle and other compare equal.

Parameters:
other A Gdk::Rectangle.

void GFC::Gdk::Rectangle::operator|= (  const Rectangle &  other  ) 
 

Calculates the union of this rectangle and other (same as union_with()).

Parameters:
other A Gdk::Rectangle.

void GFC::Gdk::Rectangle::set (  int  x,
int  y,
int  width,
int  height
) 
 

Sets the position and size of the rectangle.

Parameters:
x The new X coordinate of the rectangle.
y The new Y coordinate of the rectangle.
width The new width of the rectangle.
height The new height of the rectangle.

void GFC::Gdk::Rectangle::set_position (  const Point &  point  ) 
 

Sets the position of the rectangle.

Parameters:
point The new x, y coordinates of the top-left corner of the rectangle.

void GFC::Gdk::Rectangle::set_position (  int  x,
int  y
) 
 

Sets the position of the rectangle.

Parameters:
x The new X coordinate of the rectangle.
y The new Y coordinate of the rectangle.

void GFC::Gdk::Rectangle::set_size (  int  width,
int  height
) 
 

Sets the size of the rectangle.

Parameters:
width The new width of the rectangle.
height The new height of the rectangle.

void GFC::Gdk::Rectangle::union_with (  const Rectangle &  other  ) 
 

Calculates the union of this rectangle and other.

Parameters:
other A Gdk::Rectangle.

The union of two rectangles is the smallest rectangle which includes both rectangles within it. On returning, this rectangle contains the union the original rectangle and other.


The documentation for this class was generated from the following file:
Generated on Tue Aug 24 00:34:36 2004 for GFC-UI by doxygen 1.3.8