2005-05-13 16:47:18 -04:00
|
|
|
// Generated by gtkmmproc -- DO NOT MODIFY!
|
|
|
|
|
2007-11-12 18:44:49 -05:00
|
|
|
|
2005-05-13 16:47:18 -04:00
|
|
|
#include <gdkmm/rectangle.h>
|
|
|
|
#include <gdkmm/private/rectangle_p.h>
|
|
|
|
|
|
|
|
// -*- c++ -*-
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright 1998-2002 The gtkmm Development Team
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free
|
|
|
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Gdk
|
|
|
|
{
|
|
|
|
|
|
|
|
Rectangle::Rectangle(int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
gobject_.x = x;
|
|
|
|
gobject_.y = y;
|
|
|
|
gobject_.width = width;
|
|
|
|
gobject_.height = height;
|
|
|
|
}
|
|
|
|
|
|
|
|
// gdk_rectangle_union() and gdk_rectangle_intersect() work fine even if
|
|
|
|
// the destination points to one of the input rectangles. The join() and
|
|
|
|
// intersect() implementations rely on this ability.
|
|
|
|
|
|
|
|
Rectangle& Rectangle::join(const Rectangle& src2)
|
|
|
|
{
|
|
|
|
gdk_rectangle_union(
|
|
|
|
&gobject_, const_cast<GdkRectangle*>(&src2.gobject_), &gobject_);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle& Rectangle::intersect(const Rectangle& src2)
|
|
|
|
{
|
|
|
|
gdk_rectangle_intersect(
|
|
|
|
&gobject_, const_cast<GdkRectangle*>(&src2.gobject_), &gobject_);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle& Rectangle::intersect(const Rectangle& src2, bool& rectangles_intersect)
|
|
|
|
{
|
|
|
|
rectangles_intersect = gdk_rectangle_intersect(
|
|
|
|
&gobject_, const_cast<GdkRectangle*>(&src2.gobject_), &gobject_);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Rectangle::has_zero_area() const
|
|
|
|
{
|
|
|
|
return (gobject_.width == 0 || gobject_.height == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Gdk
|
|
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
|
|
|
|
namespace Glib
|
|
|
|
{
|
|
|
|
|
|
|
|
Gdk::Rectangle& wrap(GdkRectangle* object)
|
|
|
|
{
|
|
|
|
return *reinterpret_cast<Gdk::Rectangle*>(object);
|
|
|
|
}
|
|
|
|
|
|
|
|
const Gdk::Rectangle& wrap(const GdkRectangle* object)
|
|
|
|
{
|
|
|
|
return *reinterpret_cast<const Gdk::Rectangle*>(object);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Glib
|
|
|
|
|
|
|
|
|
|
|
|
namespace Gdk
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
GType Rectangle::get_type()
|
|
|
|
{
|
|
|
|
return gdk_rectangle_get_type();
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle::Rectangle()
|
|
|
|
{
|
|
|
|
GLIBMM_INITIALIZE_STRUCT(gobject_, GdkRectangle);
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle::Rectangle(const GdkRectangle* gobject)
|
|
|
|
{
|
|
|
|
if(gobject)
|
|
|
|
gobject_ = *gobject;
|
|
|
|
else
|
|
|
|
GLIBMM_INITIALIZE_STRUCT(gobject_, GdkRectangle);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-12 18:44:49 -05:00
|
|
|
int Rectangle::get_x() const
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
return gobj()->x;
|
|
|
|
}
|
2007-11-12 18:44:49 -05:00
|
|
|
|
|
|
|
void Rectangle::set_x(const int& value)
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
gobj()->x = value;
|
|
|
|
}
|
2007-11-12 18:44:49 -05:00
|
|
|
|
|
|
|
int Rectangle::get_y() const
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
return gobj()->y;
|
|
|
|
}
|
2007-11-12 18:44:49 -05:00
|
|
|
|
|
|
|
void Rectangle::set_y(const int& value)
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
gobj()->y = value;
|
|
|
|
}
|
2007-11-12 18:44:49 -05:00
|
|
|
|
|
|
|
int Rectangle::get_width() const
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
return gobj()->width;
|
|
|
|
}
|
2007-11-12 18:44:49 -05:00
|
|
|
|
|
|
|
void Rectangle::set_width(const int& value)
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
gobj()->width = value;
|
|
|
|
}
|
2007-11-12 18:44:49 -05:00
|
|
|
|
|
|
|
int Rectangle::get_height() const
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
return gobj()->height;
|
|
|
|
}
|
2007-11-12 18:44:49 -05:00
|
|
|
|
|
|
|
void Rectangle::set_height(const int& value)
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
gobj()->height = value;
|
|
|
|
}
|
2007-11-12 18:44:49 -05:00
|
|
|
|
2005-05-13 16:47:18 -04:00
|
|
|
|
|
|
|
} // namespace Gdk
|
|
|
|
|
|
|
|
|