/* 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/>.
 */

#include <glibmm/interface.h>
#include <gdkmm/enums.h>
#include <gdkmm/popuplayout.h>
#include <gdkmm/surface.h>

_DEFS(gdkmm,gdk)
_PINCLUDE(glibmm/private/interface_p.h)
_PINCLUDE(gdk/gdk.h)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C"
{
typedef struct _GdkPopupInterface GdkPopupInterface;
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gdk
{

/** Interface for popup surfaces.
 *
 * A %Gdk::Popup is a surface that is attached to another surface,
 * called its property_parent(), and is positioned relative to it.
 *
 * %Gdk::Popups are typically used to implement menus and similar popups.
 * They can be modal, which is indicated by the property_autohide() property.
 *
 * @see Gdk::Toplevel, Gdk::Surface
 * @newin{3,98}
 */
class GDKMM_API Popup : public Glib::Interface
{
  _CLASS_INTERFACE(Popup, GdkPopup, GDK_POPUP, GdkPopupInterface, , , GDKMM_API)

public:
  _WRAP_METHOD(bool present(int width, int height, const Glib::RefPtr<PopupLayout>& layout),
    gdk_popup_present)
  _WRAP_METHOD(Gravity get_surface_anchor() const, gdk_popup_get_surface_anchor)
  _WRAP_METHOD(Gravity get_rect_anchor() const, gdk_popup_get_rect_anchor)
  _WRAP_METHOD(Glib::RefPtr<Surface> get_parent(), gdk_popup_get_parent, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Surface> get_parent() const,
    gdk_popup_get_parent, refreturn, constversion)
  _WRAP_METHOD(int get_position_x() const, gdk_popup_get_position_x)
  _WRAP_METHOD(int get_position_y() const, gdk_popup_get_position_y)
  _WRAP_METHOD(bool get_autohide() const, gdk_popup_get_autohide)

  _WRAP_PROPERTY("parent", Glib::RefPtr<Surface>)
  _WRAP_PROPERTY("autohide", bool)
};

} // namespace Gdk
