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


#include <glibmm.h>

#include <gtkmm/filedialog.h>
#include <gtkmm/private/filedialog_p.h>


/* Copyright 2022 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 <gdkmm/slot_async.h>
#include <gtkmm/window.h>

namespace
{
template <typename CppType, typename CType = typename CppType::BaseObjectType>
std::vector<Glib::RefPtr<CppType>> listmodel_to_vector(GListModel* listmodel)
{
  if (!listmodel)
    return {};
  std::vector<Glib::RefPtr<CppType>> result;
  const guint n_items = g_list_model_get_n_items(listmodel);
  for (guint pos = 0; pos < n_items; ++pos)
    // g_list_model_get_object() gives us a reference.
    result.push_back(Glib::wrap((CType*)g_list_model_get_object(listmodel, pos)));
  // The caller had a reference that's no longer needed.
  g_object_unref(listmodel);
  return result;
}
} // anonymous namespace

namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gtk::FileDialog> wrap(GtkFileDialog* object, bool take_copy)
{
  return Glib::make_refptr_for_instance<Gtk::FileDialog>( dynamic_cast<Gtk::FileDialog*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Glib */


namespace Gtk
{


/* The *_Class implementation: */

const Glib::Class& FileDialog_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Do not derive a GType, or use a derived class:
    gtype_ = gtk_file_dialog_get_type();

  }

  return *this;
}


Glib::ObjectBase* FileDialog_Class::wrap_new(GObject* object)
{
  return new FileDialog((GtkFileDialog*)object);
}


/* The implementation: */

GtkFileDialog* FileDialog::gobj_copy()
{
  reference();
  return gobj();
}

FileDialog::FileDialog(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{

}

FileDialog::FileDialog(GtkFileDialog* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


FileDialog::FileDialog(FileDialog&& src) noexcept
: Glib::Object(std::move(src))
{}

FileDialog& FileDialog::operator=(FileDialog&& src) noexcept
{
  Glib::Object::operator=(std::move(src));
  return *this;
}


FileDialog::~FileDialog() noexcept
{}


FileDialog::CppClassType FileDialog::filedialog_class_; // initialize static member

GType FileDialog::get_type()
{
  return filedialog_class_.init().get_type();
}


GType FileDialog::get_base_type()
{
  return gtk_file_dialog_get_type();
}


FileDialog::FileDialog()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(nullptr),
  Glib::Object(Glib::ConstructParams(filedialog_class_.init()))
{
  

}

Glib::RefPtr<FileDialog> FileDialog::create()
{
  return Glib::make_refptr_for_instance<FileDialog>( new FileDialog() );
}

Glib::ustring FileDialog::get_title() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_file_dialog_get_title(const_cast<GtkFileDialog*>(gobj())));
}

void FileDialog::set_title(const Glib::ustring& title)
{
  gtk_file_dialog_set_title(gobj(), title.c_str());
}

bool FileDialog::get_modal() const
{
  return gtk_file_dialog_get_modal(const_cast<GtkFileDialog*>(gobj()));
}

void FileDialog::set_modal(bool modal)
{
  gtk_file_dialog_set_modal(gobj(), static_cast<int>(modal));
}

Glib::RefPtr<Gio::ListModel> FileDialog::get_filters()
{
  auto retvalue = Glib::wrap(gtk_file_dialog_get_filters(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Gio::ListModel> FileDialog::get_filters() const
{
  return const_cast<FileDialog*>(this)->get_filters();
}

void FileDialog::set_filters(const Glib::RefPtr<Gio::ListModel>& filters)
{
  gtk_file_dialog_set_filters(gobj(), Glib::unwrap(filters));
}

Glib::RefPtr<FileFilter> FileDialog::get_default_filter()
{
  auto retvalue = Glib::wrap(gtk_file_dialog_get_default_filter(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const FileFilter> FileDialog::get_default_filter() const
{
  return const_cast<FileDialog*>(this)->get_default_filter();
}

void FileDialog::set_default_filter(const Glib::RefPtr<FileFilter>& filter)
{
  gtk_file_dialog_set_default_filter(gobj(), const_cast<GtkFileFilter*>(Glib::unwrap(filter)));
}

Glib::RefPtr<Gio::File> FileDialog::get_initial_folder()
{
  auto retvalue = Glib::wrap(gtk_file_dialog_get_initial_folder(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Gio::File> FileDialog::get_initial_folder() const
{
  return const_cast<FileDialog*>(this)->get_initial_folder();
}

void FileDialog::set_initial_folder(const Glib::RefPtr<Gio::File>& folder)
{
  gtk_file_dialog_set_initial_folder(gobj(), const_cast<GFile*>(Glib::unwrap<Gio::File>(folder)));
}

std::string FileDialog::get_initial_name() const
{
  return Glib::convert_const_gchar_ptr_to_stdstring(gtk_file_dialog_get_initial_name(const_cast<GtkFileDialog*>(gobj())));
}

void FileDialog::set_initial_name(const std::string& name)
{
  gtk_file_dialog_set_initial_name(gobj(), name.c_str());
}

Glib::RefPtr<Gio::File> FileDialog::get_initial_file()
{
  auto retvalue = Glib::wrap(gtk_file_dialog_get_initial_file(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Gio::File> FileDialog::get_initial_file() const
{
  return const_cast<FileDialog*>(this)->get_initial_file();
}

void FileDialog::set_initial_file(const Glib::RefPtr<Gio::File>& file)
{
  gtk_file_dialog_set_initial_file(gobj(), const_cast<GFile*>(Glib::unwrap<Gio::File>(file)));
}

Glib::ustring FileDialog::get_accept_label() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_file_dialog_get_accept_label(const_cast<GtkFileDialog*>(gobj())));
}

void FileDialog::set_accept_label(const Glib::ustring& accept_label)
{
  gtk_file_dialog_set_accept_label(gobj(), accept_label.c_str());
}

void FileDialog::open(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_file_dialog_open(gobj(), (parent).gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

void FileDialog::open(const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_file_dialog_open(gobj(), nullptr, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

Glib::RefPtr<Gio::File> FileDialog::open_finish(const Glib::RefPtr<Gio::AsyncResult>& result)
{
  GError* gerror = nullptr;
  auto retvalue = Glib::wrap(gtk_file_dialog_open_finish(gobj(), Glib::unwrap(result), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

void FileDialog::select_folder(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_file_dialog_select_folder(gobj(), (parent).gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

void FileDialog::select_folder(const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_file_dialog_select_folder(gobj(), nullptr, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

Glib::RefPtr<Gio::File> FileDialog::select_folder_finish(const Glib::RefPtr<Gio::AsyncResult>& result)
{
  GError* gerror = nullptr;
  auto retvalue = Glib::wrap(gtk_file_dialog_select_folder_finish(gobj(), Glib::unwrap(result), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

void FileDialog::save(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_file_dialog_save(gobj(), (parent).gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

void FileDialog::save(const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_file_dialog_save(gobj(), nullptr, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

Glib::RefPtr<Gio::File> FileDialog::save_finish(const Glib::RefPtr<Gio::AsyncResult>& result)
{
  GError* gerror = nullptr;
  auto retvalue = Glib::wrap(gtk_file_dialog_save_finish(gobj(), Glib::unwrap(result), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

void FileDialog::open_multiple(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_file_dialog_open_multiple(gobj(), (parent).gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

void FileDialog::open_multiple(const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_file_dialog_open_multiple(gobj(), nullptr, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

std::vector<Glib::RefPtr<Gio::File>> FileDialog::open_multiple_finish(const Glib::RefPtr<Gio::AsyncResult>& result)
{
  GError* gerror = nullptr;
  auto retvalue = listmodel_to_vector<Gio::File>(gtk_file_dialog_open_multiple_finish(gobj(), Glib::unwrap(result), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

void FileDialog::select_multiple_folders(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_file_dialog_select_multiple_folders(gobj(), (parent).gobj(), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

void FileDialog::select_multiple_folders(const Gio::SlotAsyncReady& slot, const Glib::RefPtr<Gio::Cancellable>& cancellable)
{
  // Create a copy of the slot.
  auto slot_copy = new Gio::SlotAsyncReady(slot); 

  gtk_file_dialog_select_multiple_folders(gobj(), nullptr, const_cast<GCancellable*>(Glib::unwrap(cancellable)), &Gdk::gdkmm_SignalProxy_async_callback, slot_copy);
}

std::vector<Glib::RefPtr<Gio::File>> FileDialog::select_multiple_folders_finish(const Glib::RefPtr<Gio::AsyncResult>& result)
{
  GError* gerror = nullptr;
  auto retvalue = listmodel_to_vector<Gio::File>(gtk_file_dialog_select_multiple_folders_finish(gobj(), Glib::unwrap(result), &(gerror)));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}


Glib::PropertyProxy< Glib::ustring > FileDialog::property_title() 
{
  return Glib::PropertyProxy< Glib::ustring >(this, "title");
}

Glib::PropertyProxy_ReadOnly< Glib::ustring > FileDialog::property_title() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "title");
}

Glib::PropertyProxy< bool > FileDialog::property_modal() 
{
  return Glib::PropertyProxy< bool >(this, "modal");
}

Glib::PropertyProxy_ReadOnly< bool > FileDialog::property_modal() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "modal");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<Glib::RefPtr<Gio::ListModel>>::value,
  "Type Glib::RefPtr<Gio::ListModel> cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< Glib::RefPtr<Gio::ListModel> > FileDialog::property_filters() 
{
  return Glib::PropertyProxy< Glib::RefPtr<Gio::ListModel> >(this, "filters");
}

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::ListModel> > FileDialog::property_filters() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::ListModel> >(this, "filters");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<Glib::RefPtr<FileFilter>>::value,
  "Type Glib::RefPtr<FileFilter> cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< Glib::RefPtr<FileFilter> > FileDialog::property_default_filter() 
{
  return Glib::PropertyProxy< Glib::RefPtr<FileFilter> >(this, "default-filter");
}

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<FileFilter> > FileDialog::property_default_filter() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<FileFilter> >(this, "default-filter");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<Glib::RefPtr<Gio::File>>::value,
  "Type Glib::RefPtr<Gio::File> cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< Glib::RefPtr<Gio::File> > FileDialog::property_initial_file() 
{
  return Glib::PropertyProxy< Glib::RefPtr<Gio::File> >(this, "initial-file");
}

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::File> > FileDialog::property_initial_file() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::File> >(this, "initial-file");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<Glib::RefPtr<Gio::File>>::value,
  "Type Glib::RefPtr<Gio::File> cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< Glib::RefPtr<Gio::File> > FileDialog::property_initial_folder() 
{
  return Glib::PropertyProxy< Glib::RefPtr<Gio::File> >(this, "initial-folder");
}

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::File> > FileDialog::property_initial_folder() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::File> >(this, "initial-folder");
}

Glib::PropertyProxy< std::string > FileDialog::property_initial_name() 
{
  return Glib::PropertyProxy< std::string >(this, "initial-name");
}

Glib::PropertyProxy_ReadOnly< std::string > FileDialog::property_initial_name() const
{
  return Glib::PropertyProxy_ReadOnly< std::string >(this, "initial-name");
}

Glib::PropertyProxy< Glib::ustring > FileDialog::property_accept_label() 
{
  return Glib::PropertyProxy< Glib::ustring >(this, "accept-label");
}

Glib::PropertyProxy_ReadOnly< Glib::ustring > FileDialog::property_accept_label() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "accept-label");
}


} // namespace Gtk


