Gdk::Rectangle Class Reference

Gdk::Rectangle is a structure holding the position and size of a rectangle. More...

## Public Member Functions

| Rectangle (const Rectangle& other) noexcept
Rectangle& | operator= (const Rectangle& other) noexcept
| Rectangle (Rectangle&& other) noexcept
Rectangle& | operator= (Rectangle&& other) noexcept
| Rectangle ()
| Rectangle (const GdkRectangle* gobject)
GdkRectangle* | gobj ()
| Provides access to the underlying C instance. More...
const GdkRectangle* | gobj () const
| Provides access to the underlying C instance. More...
| Rectangle (int x, int y, int width, int height)
| Creates a new rectangle instance with these dimensions. More...
Rectangle& | join (const Rectangle& src2)
| Calculates the union of two rectangles. More...
Rectangle& | intersect (const Rectangle& src2)
| Calculates the intersection of two rectangles, changing this rectangle. More...
Rectangle& | intersect (const Rectangle& src2, bool& rectangles_intersect)
| Calculates the intersection of two rectangles, changing this rectangle. More...
bool | has_zero_area () const
| Checks whether either the width or height are 0. More...
int | get_x () const
void | set_x (const int& value)
int | get_y () const
void | set_y (const int& value)
int | get_width () const
void | set_width (const int& value)
int | get_height () const
void | set_height (const int& value)

## Static Public Member Functions

static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Protected Attributes

GdkRectangle | gobject_

## Related Functions

(Note that these are not member functions.)
Gdk::Rectangle& | wrap (GdkRectangle* object)
const Gdk::Rectangle& | wrap (const GdkRectangle* object)

## Detailed Description

Gdk::Rectangle is a structure holding the position and size of a rectangle.

The intersection of two rectangles can be computed with intersect(). To find the union of two rectangles use union().

## Constructor & Destructor Documentation

Gdk::Rectangle::Rectangle | ( | const Rectangle& | other | ) |

noexcept

Gdk::Rectangle::Rectangle | ( | Rectangle&& | other | ) |

noexcept

Gdk::Rectangle::Rectangle | ( |  | ) |

Gdk::Rectangle::Rectangle | ( | const GdkRectangle * | gobject | ) |

explicit

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

Creates a new rectangle instance with these dimensions.

## Member Function Documentation

int Gdk::Rectangle::get_height | ( |  | ) | const

static GType Gdk::Rectangle::get_type | ( |  | ) |

static

Get the GType for this class, for use with the underlying GObject type system.

int Gdk::Rectangle::get_width | ( |  | ) | const

int Gdk::Rectangle::get_x | ( |  | ) | const

int Gdk::Rectangle::get_y | ( |  | ) | const

GdkRectangle* Gdk::Rectangle::gobj | ( |  | ) |

inline

Provides access to the underlying C instance.

const GdkRectangle* Gdk::Rectangle::gobj | ( |  | ) | const

inline

Provides access to the underlying C instance.

bool Gdk::Rectangle::has_zero_area | ( |  | ) | const

Checks whether either the width or height are 0.

Returns
  Whether this rectangle has any non-0 area.

Rectangle& Gdk::Rectangle::intersect | ( | const Rectangle& | src2 | ) |

Calculates the intersection of two rectangles, changing this rectangle.

If the rectangles do not intersect, this rectangle's width and height is set to 0 and its x and y values are undefined.

This method returns a reference to this instance, allowing you to then call another method easily. For instance: rect.intersect(src2).join(src3);

Parameters

  src2 | The rectangle with which to calculate the intersection with this rectangle.

Returns
  A reference to this rectangle.

Rectangle& Gdk::Rectangle::intersect | ( | const Rectangle& | src2,
|  | bool & | rectangles_intersect
| ) |  |

Calculates the intersection of two rectangles, changing this rectangle.

If the rectangles do not intersect, this rectangle's width and height is set to 0 and its x and y values are undefined.

This method returns a reference to this instance, allowing you to then call another method easily. For instance: rect.intersect(src2).join(src3);

Parameters

  src2 | The rectangle with which to calculate the intersection with this rectangle.
  rectangles_interesect | This will be set to true if the rectangles intersect.

Returns
  A reference to this rectangle.

Rectangle& Gdk::Rectangle::join | ( | const Rectangle& | src2 | ) |

Calculates the union of two rectangles.

The union of this rectangle and src2 is the smallest rectangle which includes both this rectangle and src2 within it.

This method returns a reference to this instance, allowing you to then call another method easily. For instance: rect.join(src2).intersect(src3);

Parameters

  src2 | The rectangle with which to calculate the union with this rectangle.

Returns
  A reference to this rectangle.

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

noexcept

Rectangle& Gdk::Rectangle::operator= | ( | Rectangle&& | other | ) |

noexcept

void Gdk::Rectangle::set_height | ( | const int & | value | ) |

void Gdk::Rectangle::set_width | ( | const int & | value | ) |

void Gdk::Rectangle::set_x | ( | const int & | value | ) |

void Gdk::Rectangle::set_y | ( | const int & | value | ) |

## Friends And Related Function Documentation

Gdk::Rectangle& wrap | ( | GdkRectangle * | object | ) |

related

Parameters

  object | The C instance

Returns
  A C++ instance that wraps this C instance.

const Gdk::Rectangle& wrap | ( | const GdkRectangle * | object | ) |

related

Parameters

  object | The C instance

Returns
  A C++ instance that wraps this C instance.

## Member Data Documentation

GdkRectangle Gdk::Rectangle::gobject_

protected

The documentation for this class was generated from the following file:

- gdkmm/rectangle.h