/* 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_size_t;
using graphene_size_t = _graphene_size_t;
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

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

/** %Size representation.
 *
 * %Gdk::Graphene::Size represents a size composed of a @a width by a @a height.
 *
 * @newin{4,12}
 */
class GDKMM_API Size
{
  _CLASS_OPAQUE_COPYABLE(Size, graphene_size_t, NONE, gdkmm_graphene_size_copy, graphene_size_free, GDKMM_API)
  _IGNORE(graphene_size_init, graphene_size_init_from_size, graphene_size_free)
public:
  Size(float width, float height);

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

  _MEMBER_GET(width, width, float, float)
  _MEMBER_SET(width, width, float, float)
  _MEMBER_GET(height, height, float, float)
  _MEMBER_SET(height, height, float, float)

  _WRAP_METHOD(bool equal(const Size& b) const, graphene_size_equal, newin "4,12")
};
} // namespace Graphene
} // namespace Gdk
