/* Copyright (C) 2019 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 <gtkmm/widget.h>
#include <gtkmm/editable.h>
#include <giomm/menumodel.h>

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

namespace Gtk
{

/** An entry for secrets.
 *
 * %Gtk::PasswordEntry is an entry that has been tailored for
 * entering secrets. It does not show its contents in clear text,
 * does not allow to copy it to the clipboard, and it shows a
 * warning when Caps-Lock is engaged.
 *
 * Optionally, it can offer a way to reveal the contents in clear text.
 *
 * %Gtk::PasswordEntry provides only minimal API and should be used with the
 * Gtk::Editable API.
 *
 * @newin{3,96}
 * @ingroup Widgets
 */
class PasswordEntry : public Widget, public Editable
{
  _CLASS_GTKOBJECT(PasswordEntry, GtkPasswordEntry, GTK_PASSWORD_ENTRY, Gtk::Widget, GtkWidget)
  _IMPLEMENTS_INTERFACE(Editable)
public:
  _CTOR_DEFAULT

  _WRAP_METHOD(void set_show_peek_icon(bool show_peek_icon = true), gtk_password_entry_set_show_peek_icon)
  _WRAP_METHOD(bool get_show_peek_icon() const, gtk_password_entry_get_show_peek_icon)

  _WRAP_METHOD(void set_extra_menu(const Glib::RefPtr<Gio::MenuModel>& model), gtk_password_entry_set_extra_menu)
  _WRAP_METHOD(Glib::RefPtr<Gio::MenuModel> get_extra_menu(), gtk_password_entry_get_extra_menu, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Gio::MenuModel> get_extra_menu() const, gtk_password_entry_get_extra_menu, refreturn, constversion)

  _WRAP_PROPERTY("placeholder-text", Glib::ustring)
  _WRAP_PROPERTY("activates-default", bool)
  _WRAP_PROPERTY("show-peek-icon", bool)
  _WRAP_PROPERTY("extra-menu", Glib::RefPtr<Gio::MenuModel>)
};

} //namespace Gtk
