/* Copyright (C) 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/>.
 */
 
_CONFIGINCLUDE(gdkmmconfig.h)
_DEFS(gdkmm,gdk)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C"
{
struct _graphene_point_t;
using graphene_point_t = _graphene_point_t;
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gdk
{
namespace Graphene
{
//TODO: When we can break ABI, _CLASS_OPAQUE_COPYABLE -> _CLASS_GENERIC.
// graphene_point_t gobject_; //Not a pointer.
// https://gitlab.gnome.org/GNOME/gtkmm/-/issues/155

/** A point with 2 coordinates.
 *
 * %Gdk::Graphene::Point is a data structure capable of describing a point
 * with two coordinates.
 *
 * @newin{4,12}
 */
class GDKMM_API Point
{
  _CLASS_OPAQUE_COPYABLE(Point, graphene_point_t, NONE, gdkmm_graphene_point_copy, graphene_point_free, GDKMM_API)
  _IGNORE(graphene_point_init, graphene_point_init_from_point, graphene_point_free)
public:
  Point(float x, float y);

  /** Checks if this instance is valid.
   * It is valid if and only if it contains a value.
   * For instance,
   * @code
   * if (point)
   *   do_something()
   * @endcode
   */
  explicit operator bool() const;

  _MEMBER_GET(x, x, float, float)
  _MEMBER_SET(x, x, float, float)
  _MEMBER_GET(y, y, float, float)
  _MEMBER_SET(y, y, float, float)

  _WRAP_METHOD(bool equal(const Point& b) const, graphene_point_equal, newin "4,12")
  _WRAP_METHOD(bool near(const Point& b, float epsilon) const, graphene_point_near, newin "4,12")
};
} // namespace Graphene
} // namespace Gdk
