/* Copyright (C) 1998-2002 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 <https://www.gnu.org/licenses/>.
 */

#include <gtk/gtk.h>

namespace Gtk
{

Dialog::Dialog(const Glib::ustring& title, Gtk::Window& parent, bool modal)
:
  _CONSTRUCT("title", title.c_str())
{
  set_modal(modal);
  set_transient_for(parent);
}

Dialog::Dialog(const Glib::ustring& title, bool modal)
:
  _CONSTRUCT("title", title.c_str())
{
  set_modal(modal);
}

Dialog::Dialog(const Glib::ustring& title, DialogFlags flags)
:
  _CONSTRUCT("title", title.c_str(), "use-header-bar", (flags & DIALOG_USE_HEADER_BAR) != 0)
{
  set_modal((flags & DIALOG_MODAL) != 0);
  property_destroy_with_parent() = (flags & DIALOG_DESTROY_WITH_PARENT) != 0;
}

Dialog::Dialog(const Glib::ustring& title, Gtk::Window& parent, DialogFlags flags)
:
  _CONSTRUCT("title", title.c_str(), "use-header-bar", (flags & DIALOG_USE_HEADER_BAR) != 0)
{
  set_transient_for(parent);
  set_modal((flags & DIALOG_MODAL) != 0);
  property_destroy_with_parent() = (flags & DIALOG_DESTROY_WITH_PARENT) != 0;
}

_DEPRECATE_IFDEF_START
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void Dialog::set_alternative_button_order_from_array(const std::vector<int>& new_order)
{
  gtk_dialog_set_alternative_button_order_from_array(gobj(), new_order.size(), const_cast<int*>(Glib::ArrayHandler<int>::vector_to_array(new_order).data()));
}
G_GNUC_END_IGNORE_DEPRECATIONS
_DEPRECATE_IFDEF_END

} // namespace Gtk
