// Generated by gmmproc 2.80.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gdkmm/graphene_point.h>
#include <gdkmm/private/graphene_point_p.h>


/* Copyright 2023 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

#include <graphene.h>

namespace
{
graphene_point_t* gdkmm_graphene_point_copy(const graphene_point_t* other)
{
  return graphene_point_init_from_point(graphene_point_alloc(), other);
}
} // anonymous namespace

namespace Gdk
{
namespace Graphene
{

Point::Point(float x, float y)
{
  gobject_ = graphene_point_init(graphene_point_alloc(), x, y);
}

Point::operator bool() const
{
  return gobj();
}

} //namespace Graphene
} //namespace Gdk

namespace
{
} // anonymous namespace


namespace Glib
{

Gdk::Graphene::Point wrap(graphene_point_t* object, bool take_copy /* = false */)
{
  return Gdk::Graphene::Point(object, take_copy);
}

} // namespace Glib


namespace Gdk
{

namespace Graphene
{


Point::Point()
:
  gobject_ (nullptr) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
{}

Point::Point(const Point& src)
:
  gobject_ ((src.gobject_) ? gdkmm_graphene_point_copy(src.gobject_) : nullptr)
{}

Point::Point(graphene_point_t* castitem, bool make_a_copy /* = false */)
{
  if(!make_a_copy)
  {
    // It was given to us by a function which has already made a copy for us to keep.
    gobject_ = castitem;
  }
  else
  {
    // We are probably getting it via direct access to a struct,
    // so we can not just take it - we have to take a copy of it.
    if(castitem)
      gobject_ = gdkmm_graphene_point_copy(castitem);
    else
      gobject_ = nullptr;
  }
}


Point& Point::operator=(const Point& src)
{
  const auto new_gobject = (src.gobject_) ? gdkmm_graphene_point_copy(src.gobject_) : nullptr;

  if(gobject_)
    graphene_point_free(gobject_);

  gobject_ = new_gobject;

  return *this;
}

Point::Point(Point&& other) noexcept
:
  gobject_(other.gobject_)
{
  other.gobject_ = nullptr;
}

Point& Point::operator=(Point&& other) noexcept
{
  Point temp (std::move(other));
  swap(temp);
  return *this;
}

Point::~Point() noexcept
{
  if(gobject_)
    graphene_point_free(gobject_);
}

void Point::swap(Point& other) noexcept
{
  std::swap(gobject_, other.gobject_);
}

graphene_point_t* Point::gobj_copy() const
{
  return gdkmm_graphene_point_copy(gobject_);
}


float Point::get_x() const
{
  return gobj()->x;
}

void Point::set_x(const float& value)
{
  gobj()->x = value;
}

float Point::get_y() const
{
  return gobj()->y;
}

void Point::set_y(const float& value)
{
  gobj()->y = value;
}

bool Point::equal(const Point& b) const
{
  return graphene_point_equal(const_cast<graphene_point_t*>(gobj()), (b).gobj());
}

bool Point::near(const Point& b, float epsilon) const
{
  return graphene_point_near(const_cast<graphene_point_t*>(gobj()), (b).gobj(), epsilon);
}


} // namespace Graphene

} // namespace Gdk


