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


#include <glibmm.h>

#include <gtkmm/nativedialog.h>
#include <gtkmm/private/nativedialog_p.h>


/* 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 <gtk/gtk.h>
#include <gtkmm/window.h>

namespace Gtk
{

void NativeDialog::unset_transient_for()
{
  gtk_native_dialog_set_transient_for(gobj(), nullptr);
}

} // namespace Gtk


namespace
{


static void NativeDialog_signal_response_callback(GtkNativeDialog* self, gint p0,void* data)
{
  using namespace Gtk;
  using SlotType = sigc::slot< void,int >;

  auto obj = dynamic_cast<NativeDialog*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(p0
);
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
  }
}

static const Glib::SignalProxyInfo NativeDialog_signal_response_info =
{
  "response",
  (GCallback) &NativeDialog_signal_response_callback,
  (GCallback) &NativeDialog_signal_response_callback
};


} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gtk::NativeDialog> wrap(GtkNativeDialog* object, bool take_copy)
{
  return Glib::RefPtr<Gtk::NativeDialog>( dynamic_cast<Gtk::NativeDialog*> (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& NativeDialog_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &NativeDialog_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(gtk_native_dialog_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


void NativeDialog_Class::class_init_function(void* g_class, void* class_data)
{
  const auto klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);


  klass->response = &response_callback;
}


void NativeDialog_Class::response_callback(GtkNativeDialog* self, gint p0)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->on_response(p0
);
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  const auto base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->response)
    (*base->response)(self, p0);
}


Glib::ObjectBase* NativeDialog_Class::wrap_new(GObject* object)
{
  return new NativeDialog((GtkNativeDialog*)object);
}


/* The implementation: */

GtkNativeDialog* NativeDialog::gobj_copy()
{
  reference();
  return gobj();
}

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

}

NativeDialog::NativeDialog(GtkNativeDialog* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


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

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


NativeDialog::~NativeDialog() noexcept
{}


NativeDialog::CppClassType NativeDialog::nativedialog_class_; // initialize static member

GType NativeDialog::get_type()
{
  return nativedialog_class_.init().get_type();
}


GType NativeDialog::get_base_type()
{
  return gtk_native_dialog_get_type();
}


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

}

void NativeDialog::show()
{
  gtk_native_dialog_show(gobj());
}

void NativeDialog::hide()
{
  gtk_native_dialog_hide(gobj());
}

bool NativeDialog::get_visible() const
{
  return gtk_native_dialog_get_visible(const_cast<GtkNativeDialog*>(gobj()));
}

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

bool NativeDialog::get_modal() const
{
  return gtk_native_dialog_get_modal(const_cast<GtkNativeDialog*>(gobj()));
}

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

Glib::ustring NativeDialog::get_title() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gtk_native_dialog_get_title(const_cast<GtkNativeDialog*>(gobj())));
}

void NativeDialog::set_transient_for(Window& parent)
{
  gtk_native_dialog_set_transient_for(gobj(), (parent).gobj());
}

Window* NativeDialog::get_transient_for()
{
  return Glib::wrap(gtk_native_dialog_get_transient_for(gobj()));
}

const Window* NativeDialog::get_transient_for() const
{
  return const_cast<NativeDialog*>(this)->get_transient_for();
}

int NativeDialog::run()
{
  return gtk_native_dialog_run(gobj());
}


Glib::SignalProxy< void,int > NativeDialog::signal_response()
{
  return Glib::SignalProxy< void,int >(this, &NativeDialog_signal_response_info);
}


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

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

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

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

Glib::PropertyProxy< bool > NativeDialog::property_visible() 
{
  return Glib::PropertyProxy< bool >(this, "visible");
}

Glib::PropertyProxy_ReadOnly< bool > NativeDialog::property_visible() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "visible");
}

Glib::PropertyProxy< Window* > NativeDialog::property_transient_for() 
{
  return Glib::PropertyProxy< Window* >(this, "transient-for");
}

Glib::PropertyProxy_ReadOnly< Window* > NativeDialog::property_transient_for() const
{
  return Glib::PropertyProxy_ReadOnly< Window* >(this, "transient-for");
}


void Gtk::NativeDialog::on_response(int response_id)
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->response)
    (*base->response)(gobj(),response_id);
}


} // namespace Gtk


