/* Copyright (C) 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/>.
 */

_CONFIGINCLUDE(gtkmmconfig.h)

#include <gtkmm/fontdialog.h>
#include <gtkmm/widget.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/widget_p.h)

namespace Gtk
{
_WRAP_ENUM(FontLevel, GtkFontLevel, decl_prefix GTKMM_API)

/** A wrapper around a Gtk::FontDialog.
 *
 * Allows to open a font dialog to change the font.
 *
 * It is a suitable widget for selecting a font in a preference dialog.
 *
 * @ingroup Widgets
 * @newin{4,10}
 */
class GTKMM_API FontDialogButton : public Widget
{
  _CLASS_GTKOBJECT(FontDialogButton, GtkFontDialogButton, GTK_FONT_DIALOG_BUTTON, Gtk::Widget, GtkWidget, , , GTKMM_API)
  _DO_NOT_DERIVE_GTYPE dnl// GtkFontDialogButton is a final type
  _STRUCT_NOT_HIDDEN

public:
  _WRAP_METHOD_DOCS_ONLY(gtk_font_dialog_button_new, voidreturn)
  _WRAP_CTOR(FontDialogButton(const Glib::RefPtr<FontDialog>& dialog = {}), gtk_font_dialog_button_new)

  _WRAP_METHOD(Glib::RefPtr<FontDialog> get_dialog(), gtk_font_dialog_button_get_dialog, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const FontDialog> get_dialog() const, gtk_font_dialog_button_get_dialog, refreturn, constversion)
  _WRAP_METHOD(void set_dialog(const Glib::RefPtr<FontDialog>& dialog), gtk_font_dialog_button_set_dialog)

  _WRAP_METHOD(FontLevel get_level() const, gtk_font_dialog_button_get_level)
  _WRAP_METHOD(void set_level(FontLevel level), gtk_font_dialog_button_set_level)
#m4 _CONVERSION(`PangoFontDescription*',`Pango::FontDescription',`Glib::wrap($3, true)')
  _WRAP_METHOD(Pango::FontDescription get_font_desc() const, gtk_font_dialog_button_get_font_desc)
  _WRAP_METHOD(void set_font_desc(const Pango::FontDescription& font_desc), gtk_font_dialog_button_set_font_desc)
  _WRAP_METHOD(Glib::ustring get_font_features() const, gtk_font_dialog_button_get_font_features)
  _WRAP_METHOD(void set_font_features(const Glib::ustring& font_features), gtk_font_dialog_button_set_font_features)
  _WRAP_METHOD(Pango::Language get_language() const, gtk_font_dialog_button_get_language)
#m4 _CONVERSION(`const Pango::Language&',`PangoLanguage*',`const_cast<PangoLanguage*>(`($3).gobj()')')
  _WRAP_METHOD(void set_language(const Pango::Language& language), gtk_font_dialog_button_set_language)
  _WRAP_METHOD(bool get_use_font() const, gtk_font_dialog_button_get_use_font)
  _WRAP_METHOD(void set_use_font(bool use_font = true), gtk_font_dialog_button_set_use_font)
  _WRAP_METHOD(bool get_use_size() const, gtk_font_dialog_button_get_use_size)
  _WRAP_METHOD(void set_use_size(bool use_size = true), gtk_font_dialog_button_set_use_size)

  _WRAP_PROPERTY("dialog", Glib::RefPtr<FontDialog>)
  _WRAP_PROPERTY("level", FontLevel)
  _WRAP_PROPERTY("font-desc", Pango::FontDescription)
  _WRAP_PROPERTY("font-features", Glib::ustring)
  _WRAP_PROPERTY("language", Pango::Language)
  _WRAP_PROPERTY("use-font", bool)
  _WRAP_PROPERTY("use-size", bool)

  // no_default_handler because the wrapped C signal has no default handler.
  _WRAP_SIGNAL(void activate(), "activate", no_default_handler, newin "4,18")
};

} // namespace Gtk
