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


#include <glibmm.h>

#include <gdkmm/graphene_size.h>
#include <gdkmm/private/graphene_size_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_size_t* gdkmm_graphene_size_copy(const graphene_size_t* other)
{
  return graphene_size_init_from_size(graphene_size_alloc(), other);
}
} // anonymous namespace

namespace Gdk
{
namespace Graphene
{

Size::Size(float width, float height)
{
  gobject_ = graphene_size_init(graphene_size_alloc(), width, height);
}

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

} //namespace Graphene
} //namespace Gdk

namespace
{
} // anonymous namespace


namespace Glib
{

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

} // namespace Glib


namespace Gdk
{

namespace Graphene
{


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

Size::Size(const Size& src)
:
  gobject_ ((src.gobject_) ? gdkmm_graphene_size_copy(src.gobject_) : nullptr)
{}

Size::Size(graphene_size_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_size_copy(castitem);
    else
      gobject_ = nullptr;
  }
}


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

  if(gobject_)
    graphene_size_free(gobject_);

  gobject_ = new_gobject;

  return *this;
}

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

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

Size::~Size() noexcept
{
  if(gobject_)
    graphene_size_free(gobject_);
}

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

graphene_size_t* Size::gobj_copy() const
{
  return gdkmm_graphene_size_copy(gobject_);
}


float Size::get_width() const
{
  return gobj()->width;
}

void Size::set_width(const float& value)
{
  gobj()->width = value;
}

float Size::get_height() const
{
  return gobj()->height;
}

void Size::set_height(const float& value)
{
  gobj()->height = value;
}

bool Size::equal(const Size& b) const
{
  return graphene_size_equal(const_cast<graphene_size_t*>(gobj()), (b).gobj());
}


} // namespace Graphene

} // namespace Gdk


