diff options
Diffstat (limited to 'adw/src/dialog.cpp')
| -rw-r--r-- | adw/src/dialog.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/adw/src/dialog.cpp b/adw/src/dialog.cpp new file mode 100644 index 0000000..3fe9752 --- /dev/null +++ b/adw/src/dialog.cpp @@ -0,0 +1,87 @@ +#include "turns/adw/dialog.hpp" + +#include <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/refptr.h> +#include <glibmm/ustring.h> +#include <glibmm/wrap.h> + +#include <gtkmm/init.h> +#include <gtkmm/private/widget_p.h> +#include <gtkmm/widget.h> + +#include <adwaita.h> +#include <glib-object.h> +#include <gtk/gtk.h> + +namespace turns::adw +{ + + namespace + { + auto constinit _class = Dialog::Class{}; + } // namespace + + auto Dialog::Class::init() -> Glib::Class const & + { + if (!gtype_) + { + class_init_func_ = &Dialog::Class::class_init_function; + register_derived_type(adw_dialog_get_type()); + } + return *this; + } + + auto Dialog::Class::class_init_function(void * gclass, void * data) -> void + { + auto const klass = static_cast<AdwDialogClass *>(gclass); + Gtk::Widget_Class::class_init_function(klass, data); + } + + auto Dialog::Class::wrap_new(GObject * object) -> Glib::ObjectBase * + { + return new Dialog(ADW_DIALOG(object)); + } + + auto Dialog::get_type() -> GType + { + return _class.init().get_type(); + } + + auto Dialog::get_base_type() -> GType + { + return adw_dialog_get_type(); + } + + Dialog::Dialog(Glib::ConstructParams const & params) + : Gtk::Widget{params} + { + } + + Dialog::Dialog(AdwDialog * gobj) + : Glib::ObjectBase{nullptr} + , Gtk::Widget(GTK_WIDGET(gobj)) + { + } + + Dialog::Dialog() + : Glib::ObjectBase{nullptr} + , Gtk::Widget{Glib::ConstructParams{_class.init()}} + { + } + + auto Dialog::present(Gtk::Widget * parent) -> void + { + adw_dialog_present(gobj(), Glib::unwrap(parent)); + } + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwDialog * object, bool copy) -> Glib::RefPtr<turns::adw::Dialog> + { + return Glib::make_refptr_for_instance<turns::adw::Dialog>(dynamic_cast<turns::adw::Dialog *>(Glib::wrap_auto(G_OBJECT(object), copy))); + } +} // namespace Glib
\ No newline at end of file |
