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

#undef GTK_DISABLE_DEPRECATED
#define GDK_DISABLE_DEPRECATION_WARNINGS 1
 

#ifndef GTKMM_DISABLE_DEPRECATED


#include <glibmm.h>

#include <gtkmm/filechooser.h>
#include <gtkmm/private/filechooser_p.h>


/* Copyright 2003 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <glibmm/vectorutils.h>
#include <gtk/gtk.h>

using Action = Gtk::FileChooser::Action;

namespace
{
template <typename CppType, typename CType = typename CppType::BaseObjectType>
std::vector<Glib::RefPtr<CppType>> listmodel_to_vector(GListModel* listmodel)
{
  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 Gtk
{

void FileChooser::add_choice(const Glib::ustring& id, const Glib::ustring& label)
{
  gtk_file_chooser_add_choice(gobj(), id.c_str(), label.c_str(), nullptr, nullptr);
}

} // namespace Gtk

namespace
{
} // anonymous namespace


Gtk::FileChooserError::FileChooserError(Gtk::FileChooserError::Code error_code, const Glib::ustring& error_message)
:
  Glib::Error (GTK_FILE_CHOOSER_ERROR, error_code, error_message)
{}

Gtk::FileChooserError::FileChooserError(GError* gobject)
:
  Glib::Error (gobject)
{}

Gtk::FileChooserError::Code Gtk::FileChooserError::code() const
{
  return static_cast<Code>(Glib::Error::code());
}

void Gtk::FileChooserError::throw_func(GError* gobject)
{
  throw Gtk::FileChooserError(gobject);
}

// static
GType Glib::Value<Gtk::FileChooserError::Code>::value_type()
{
  return gtk_file_chooser_error_get_type();
}

// static
GType Glib::Value<Gtk::FileChooser::Action>::value_type()
{
  return gtk_file_chooser_action_get_type();
}


namespace Glib
{

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

} // namespace Glib


namespace Gtk
{


/* The *_Class implementation: */

const Glib::Interface_Class& FileChooser_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Interface_Class has to know the interface init function
    // in order to add interfaces to implementing types.
    class_init_func_ = &FileChooser_Class::iface_init_function;

    // We can not derive from another interface, and it is not necessary anyway.
    gtype_ = gtk_file_chooser_get_type();
  }

  return *this;
}

void FileChooser_Class::iface_init_function(void* g_iface, void*)
{
  const auto klass = static_cast<BaseClassType*>(g_iface);

  //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
  //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
  g_assert(klass != nullptr);


}


Glib::ObjectBase* FileChooser_Class::wrap_new(GObject* object)
{
  return new FileChooser((GtkFileChooser*)(object));
}


/* The implementation: */

FileChooser::FileChooser()
:
  Glib::Interface(filechooser_class_.init())
{}

FileChooser::FileChooser(GtkFileChooser* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

FileChooser::FileChooser(const Glib::Interface_Class& interface_class)
: Glib::Interface(interface_class)
{
}

FileChooser::FileChooser(FileChooser&& src) noexcept
: Glib::Interface(std::move(src))
{}

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

FileChooser::~FileChooser() noexcept
{}

// static
void FileChooser::add_interface(GType gtype_implementer)
{
  filechooser_class_.init().add_interface(gtype_implementer);
}

FileChooser::CppClassType FileChooser::filechooser_class_; // initialize static member

GType FileChooser::get_type()
{
  return filechooser_class_.init().get_type();
}


GType FileChooser::get_base_type()
{
  return gtk_file_chooser_get_type();
}


void FileChooser::set_action(Action action)
{
  gtk_file_chooser_set_action(gobj(), static_cast<GtkFileChooserAction>(action));
}

Action FileChooser::get_action() const
{
  return static_cast<Action>(gtk_file_chooser_get_action(const_cast<GtkFileChooser*>(gobj())));
}

void FileChooser::set_select_multiple(bool select_multiple)
{
  gtk_file_chooser_set_select_multiple(gobj(), static_cast<int>(select_multiple));
}

bool FileChooser::get_select_multiple() const
{
  return gtk_file_chooser_get_select_multiple(const_cast<GtkFileChooser*>(gobj()));
}

void FileChooser::set_create_folders(bool create_folders)
{
  gtk_file_chooser_set_create_folders(gobj(), static_cast<int>(create_folders));
}

bool FileChooser::get_create_folders() const
{
  return gtk_file_chooser_get_create_folders(const_cast<GtkFileChooser*>(gobj()));
}

void FileChooser::set_current_name(const Glib::ustring& name)
{
  gtk_file_chooser_set_current_name(gobj(), name.c_str());
}

Glib::ustring FileChooser::get_current_name() const
{
  return Glib::convert_return_gchar_ptr_to_ustring(gtk_file_chooser_get_current_name(const_cast<GtkFileChooser*>(gobj())));
}

bool FileChooser::set_file(const Glib::RefPtr<const Gio::File>& file)
{
  GError* gerror = nullptr;
  auto retvalue = gtk_file_chooser_set_file(gobj(), const_cast<GFile*>(Glib::unwrap<Gio::File>(file)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

#ifndef GTKMM_DISABLE_DEPRECATED
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
Glib::RefPtr<Gio::ListModel> FileChooser::get_files()
{
  return Glib::wrap(gtk_file_chooser_get_files(gobj()));
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GTKMM_DISABLE_DEPRECATED

#ifndef GTKMM_DISABLE_DEPRECATED
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
Glib::RefPtr<const Gio::ListModel> FileChooser::get_files() const
{
  return Glib::wrap(gtk_file_chooser_get_files(const_cast<GtkFileChooser*>(gobj())));
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GTKMM_DISABLE_DEPRECATED

std::vector<Glib::RefPtr<Gio::File>> FileChooser::get_files2()
{
  return listmodel_to_vector<Gio::File>(gtk_file_chooser_get_files(gobj()));
}

std::vector<Glib::RefPtr<const Gio::File>> FileChooser::get_files2() const
{
  return listmodel_to_vector<const Gio::File>(gtk_file_chooser_get_files(const_cast<GtkFileChooser*>(gobj())));
}

bool FileChooser::set_current_folder(const Glib::RefPtr<const Gio::File>& file)
{
  GError* gerror = nullptr;
  auto retvalue = gtk_file_chooser_set_current_folder(gobj(), const_cast<GFile*>(Glib::unwrap<Gio::File>(file)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

Glib::RefPtr<Gio::File> FileChooser::get_current_folder()
{
  return Glib::wrap(gtk_file_chooser_get_current_folder(gobj()));
}

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

Glib::RefPtr<Gio::File> FileChooser::get_file()
{
  return Glib::wrap(gtk_file_chooser_get_file(gobj()));
}

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

void FileChooser::add_filter(const Glib::RefPtr<FileFilter>& filter)
{
  gtk_file_chooser_add_filter(gobj(), const_cast<GtkFileFilter*>(Glib::unwrap(filter)));
}

void FileChooser::remove_filter(const Glib::RefPtr<FileFilter>& filter)
{
  gtk_file_chooser_remove_filter(gobj(), const_cast<GtkFileFilter*>(Glib::unwrap(filter)));
}

Glib::RefPtr<const Gio::ListModel> FileChooser::get_filters() const
{
  return Glib::wrap(gtk_file_chooser_get_filters(const_cast<GtkFileChooser*>(gobj())));
}

void FileChooser::set_filter(const Glib::RefPtr<FileFilter>& filter)
{
  gtk_file_chooser_set_filter(gobj(), const_cast<GtkFileFilter*>(Glib::unwrap(filter)));
}

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

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

bool FileChooser::add_shortcut_folder(const Glib::RefPtr<Gio::File>& folder)
{
  GError* gerror = nullptr;
  auto retvalue = gtk_file_chooser_add_shortcut_folder(gobj(), const_cast<GFile*>(Glib::unwrap<Gio::File>(folder)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

bool FileChooser::remove_shortcut_folder(const Glib::RefPtr<Gio::File>& folder)
{
  GError* gerror = nullptr;
  auto retvalue = gtk_file_chooser_remove_shortcut_folder(gobj(), const_cast<GFile*>(Glib::unwrap<Gio::File>(folder)), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
  return retvalue;
}

#ifndef GTKMM_DISABLE_DEPRECATED
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
Glib::RefPtr<const Gio::ListModel> FileChooser::get_shortcut_folders() const
{
  return Glib::wrap(gtk_file_chooser_get_shortcut_folders(const_cast<GtkFileChooser*>(gobj())));
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GTKMM_DISABLE_DEPRECATED

std::vector<Glib::RefPtr<Gio::File>> FileChooser::get_shortcut_folders2()
{
  return listmodel_to_vector<Gio::File>(gtk_file_chooser_get_shortcut_folders(gobj()));
}

void FileChooser::add_choice(const Glib::ustring& id, const Glib::ustring& label, const std::vector<Glib::ustring>& options, const std::vector<Glib::ustring>& option_labels)
{
  gtk_file_chooser_add_choice(gobj(), id.c_str(), label.c_str(), Glib::ArrayHandler<Glib::ustring>::vector_to_array(options).data (), Glib::ArrayHandler<Glib::ustring>::vector_to_array(option_labels).data ());
}

void FileChooser::remove_choice(const Glib::ustring& id)
{
  gtk_file_chooser_remove_choice(gobj(), id.c_str());
}

void FileChooser::set_choice(const Glib::ustring& id, const Glib::ustring& option)
{
  gtk_file_chooser_set_choice(gobj(), id.c_str(), option.c_str());
}

Glib::ustring FileChooser::get_choice(const Glib::ustring& id) const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_file_chooser_get_choice(const_cast<GtkFileChooser*>(gobj()), id.c_str()));
}


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

Glib::PropertyProxy< Action > FileChooser::property_action() 
{
  return Glib::PropertyProxy< Action >(this, "action");
}

Glib::PropertyProxy_ReadOnly< Action > FileChooser::property_action() const
{
  return Glib::PropertyProxy_ReadOnly< Action >(this, "action");
}

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> > FileChooser::property_filter() 
{
  return Glib::PropertyProxy< Glib::RefPtr<FileFilter> >(this, "filter");
}

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<FileFilter> > FileChooser::property_filter() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<FileFilter> >(this, "filter");
}

Glib::PropertyProxy< bool > FileChooser::property_select_multiple() 
{
  return Glib::PropertyProxy< bool >(this, "select-multiple");
}

Glib::PropertyProxy_ReadOnly< bool > FileChooser::property_select_multiple() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "select-multiple");
}

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_ReadOnly< Glib::RefPtr<Gio::ListModel> > FileChooser::property_filters() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::ListModel> >(this, "filters");
}

#ifndef GTKMM_DISABLE_DEPRECATED

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_ReadOnly< Glib::RefPtr<Gio::ListModel> > FileChooser::property_shortcut_folders() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::ListModel> >(this, "shortcut-folders");
}
#endif // GTKMM_DISABLE_DEPRECATED


Glib::PropertyProxy< bool > FileChooser::property_create_folders() 
{
  return Glib::PropertyProxy< bool >(this, "create-folders");
}

Glib::PropertyProxy_ReadOnly< bool > FileChooser::property_create_folders() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "create-folders");
}


} // namespace Gtk

#endif // GTKMM_DISABLE_DEPRECATED


