/* Copyright (C) 2017 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/object.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gtk
{
class Window;

/** Integrate with native dialogs.
 *
 * Native dialogs are platform dialogs that don't use Gtk::Dialog or
 * Gtk::Window. They are used in order to integrate better with a
 * platform, by looking the same as other native applications and
 * supporting platform specific features.
 *
 * The Gtk::Dialog functions cannot be used on such objects, but we
 * need a similar API in order to drive them. The %NativeDialog
 * object is an API that allows you to do this. It allows you to set
 * various common properties on the dialog, as well as show and hide
 * it and get a response signal when the user finished with the dialog.
 *
 * There is also a run() helper that makes it easy
 * to run any native dialog in a modal way with a recursive mainloop,
 * similar to Dialog::run().
 *
 * @see Gtk::FileChooserNative, Gtk::Dialog
 * @newin{3,92}
 */
class NativeDialog : public Glib::Object
{
  _CLASS_GOBJECT(NativeDialog, GtkNativeDialog, GTK_NATIVE_DIALOG, Glib::Object, GObject)
  _IGNORE(gtk_native_dialog_destroy)

protected:
  /** There is no create() method that corresponds to this constructor,
   * because only derived classes shall be created.
   */
  _CTOR_DEFAULT

public:
  // No create() because only derived classes shall be instantiated.

  _WRAP_METHOD(void show(), gtk_native_dialog_show, newin "3,92")
  _WRAP_METHOD(void hide(), gtk_native_dialog_hide, newin "3,92")
  _WRAP_METHOD(bool get_visible() const, gtk_native_dialog_get_visible, newin "3,92")
  _WRAP_METHOD(void set_modal(bool modal = true), gtk_native_dialog_set_modal, newin "3,92")
  _WRAP_METHOD(bool get_modal() const, gtk_native_dialog_get_modal, newin "3,92")
  _WRAP_METHOD(void set_title(const Glib::ustring& title), gtk_native_dialog_set_title, newin "3,92")
  _WRAP_METHOD(Glib::ustring get_title() const, gtk_native_dialog_get_title, newin "3,92")

  _WRAP_METHOD(void set_transient_for(Window& parent), gtk_native_dialog_set_transient_for, newin "3,92")

  /** Unsets the current transient window.
   * @see set_transient_for().
   * @newin{3,92}
   */
  void unset_transient_for();

  _WRAP_METHOD(Window* get_transient_for(), gtk_native_dialog_get_transient_for, newin "3,92")
  _WRAP_METHOD(const Window* get_transient_for() const, gtk_native_dialog_get_transient_for, constversion, newin "3,92")

  _WRAP_METHOD(int run(), gtk_native_dialog_run, newin "3,92")

  _WRAP_PROPERTY("title", Glib::ustring, newin "3,92")
  _WRAP_PROPERTY("modal", bool, newin "3,92")
  _WRAP_PROPERTY("visible", bool, newin "3,92")
  _WRAP_PROPERTY("transient_for", Window*, newin "3,92")

  _WRAP_SIGNAL(void response(int response_id), "response", newin "3,92")
};

} // namespace Gtk
