/* Copyright (C) 2020 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)

#include <gdk/gdk.h>

_DEFS(gdkmm,gdk)

namespace Gdk
{

/** Information for computing toplevel size.
 *
 * The %Gdk::ToplevelSize struct contains information that may be useful
 * for users of Gdk::Toplevel to compute a surface size. It also carries
 * information back with the computational result.
 *
 * @newin{3,98}
 */
class GDKMM_API ToplevelSize
{
  _CLASS_GENERIC(ToplevelSize, GdkToplevelSize)

public:
  explicit ToplevelSize(GdkToplevelSize* gobject);

  // Not copyable
  ToplevelSize(const ToplevelSize& other) = delete;
  ToplevelSize& operator=(const ToplevelSize& other) = delete;

  // Movable
  ToplevelSize(ToplevelSize&& other) noexcept;
  ToplevelSize& operator=(ToplevelSize&& other) noexcept;

  ~ToplevelSize() noexcept;

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

  /// Provides access to the underlying C object.
  GdkToplevelSize* gobj() { return gobject_; }
  /// Provides access to the underlying C object.
  const GdkToplevelSize* gobj() const { return gobject_; }

  _WRAP_METHOD(void get_bounds(int& bounds_width, int& bounds_height) const,
    gdk_toplevel_size_get_bounds)
  _WRAP_METHOD(void set_size(int width, int height), gdk_toplevel_size_set_size)
  _WRAP_METHOD(void set_min_size(int min_width, int min_height), gdk_toplevel_size_set_min_size)
  _WRAP_METHOD(void set_shadow_width(int left, int right, int top, int bottom), gdk_toplevel_size_set_shadow_width)

protected:
  // The Gdk::ToplevelSize instance does not own the wrapped GdkToplevelSize instance.
  // GdkToplevelSize is a private gtk struct with no public create,
  // copy or free functions.
  GdkToplevelSize* gobject_;
};

} // namespace Gdk
