Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gdk::Rectangle Class Reference

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

#include <xfc/gdk/types.hh>

Inheritance diagram for Xfc::Gdk::Rectangle:

Xfc::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

Xfc::Gdk::Rectangle::Rectangle  ) 
 

Construct a null rectangle.

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

Xfc::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.

Xfc::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.

Xfc::Gdk::Rectangle::Rectangle const GdkRectangle &  rectangle  ) 
 

Construct a new rectangle from an existing GdkRectangle.

Parameters:
rectangle A GdkRectangle.


Member Function Documentation

void Xfc::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 Xfc::Gdk::Rectangle::empty  )  const
 

Returns true if the rectangle is empty.

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

bool Xfc::Gdk::Rectangle::equal const Rectangle other  )  const
 

Returns true if this rectangle compares equal to other.

Parameters:
other A Gdk::Rectangle.

Rectangle& Xfc::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 Xfc::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 Xfc::Gdk::Rectangle::intersect const Rectangle other  )  const
 

Returns true if this rectangle and other intersect.

Parameters:
other A Gdk::Rectangle.

bool Xfc::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 Xfc::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& Xfc::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 Xfc::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 Xfc::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 Xfc::Gdk::Rectangle::operator!= const Rectangle other  )  const
 

Returns true if this rectangle and other compare unequal.

Parameters:
other A Gdk::Rectangle.

Rectangle& Xfc::Gdk::Rectangle::operator++  ) 
 

Inflates the rectangle in all directions by one pixel.

Returns:
A reference to the resized rectangle.

Rectangle& Xfc::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& Xfc::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& Xfc::Gdk::Rectangle::operator--  ) 
 

Shrink the rectangle in all directions by one pixel.

Returns:
A reference to the resized rectangle.

Rectangle& Xfc::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& Xfc::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 Xfc::Gdk::Rectangle::operator== const Rectangle other  )  const
 

Returns true if this rectangle and other compare equal.

Parameters:
other A Gdk::Rectangle.

void Xfc::Gdk::Rectangle::operator|= const Rectangle other  ) 
 

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

Parameters:
other A Gdk::Rectangle.

void Xfc::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 Xfc::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 Xfc::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 Xfc::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 Xfc::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: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3