/* Copyright (C) 2014 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 <https://www.gnu.org/licenses/>.
 */

_DEFS(gtkmm,gtk)
_CONFIGINCLUDE(gtkmmconfig.h)
_IS_DEPRECATED // The entire file is deprecated.

#include <giomm/permission.h>
#include <gtkmm/button.h>

_PINCLUDE(gtkmm/private/button_p.h)

#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
#undef GTK_DISABLE_DEPRECATED
#define GDK_DISABLE_DEPRECATION_WARNINGS 1
#m4 _POP()

namespace Gtk
{

/** A widget to unlock or lock privileged operations.
 *
 * LockButton is a widget that can be used in control panels or
 * preference dialogs to allow users to obtain and revoke authorizations
 * needed to operate the controls. The required authorization is represented
 * by a Gio::Permission object. Concrete implementations of Gio::Permission may use
 * PolicyKit or some other authorization framework. To obtain a PolicyKit-based
 * Gio::Permission, use polkit_permission_new().
 *
 * If the user is not currently allowed to perform the action, but can obtain
 * the permission, the widget looks like this:
 *
 * @image html lockbutton1.png
 *
 * and the user can click the button to request the permission. Depending
 * on the platform, this may pop up an authentication dialog or ask the user
 * to authenticate in some other way. Once the user has obtained the permission,
 * the widget changes to this:
 *
 * @image html lockbutton2.png
 *
 * and the permission can be dropped again by clicking the button. If the user
 * is not able to obtain the permission at all, the widget looks like this:
 *
 * @image html lockbutton3.png
 *
 * If the user has the permission and cannot drop it, the button is hidden.
 *
 * The text (and tooltips) that are shown in the various cases can be adjusted
 * with the LockButton::property_text_lock(), LockButton::property_text_unlock(),
 * LockButton::property_tooltip_lock(), LockButton::property_tooltip_unlock() and
 * LockButton::property_tooltip_not_authorized() properties.
 *
 * @ingroup Widgets
 * @newin{3,14}
 * @deprecated 4.10: This is a very specialized widget, and should really just
 *                   live with the applications where it is used.
 */
class GTKMM_API LockButton : public Button
{
  _CLASS_GTKOBJECT(LockButton, GtkLockButton, GTK_LOCK_BUTTON, Gtk::Button, GtkButton, , , GTKMM_API)
public:

  /** Create a new lock button.
   */
  _CTOR_DEFAULT

  _WRAP_CTOR(LockButton(const Glib::RefPtr<const Gio::Permission>& permission), gtk_lock_button_new)


  _WRAP_METHOD(Glib::RefPtr<Gio::Permission> get_permission(), gtk_lock_button_get_permission, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Gio::Permission> get_permission() const, gtk_lock_button_get_permission, refreturn, constversion)
  _WRAP_METHOD(void set_permission(const Glib::RefPtr<const Gio::Permission>& permission), gtk_lock_button_set_permission)
  /** Unset permission.
   * See set_permission().
   */
  void unset_permission();


  _WRAP_PROPERTY("permission", Glib::RefPtr<Gio::Permission>)
  _WRAP_PROPERTY("text-lock", Glib::ustring)
  _WRAP_PROPERTY("text-unlock", Glib::ustring)
  _WRAP_PROPERTY("tooltip-lock", Glib::ustring)
  _WRAP_PROPERTY("tooltip-unlock", Glib::ustring)
  _WRAP_PROPERTY("tooltip-not-authorized", Glib::ustring)

  // Gtk::LockButton has no signals as of 3.2.
};

} // namespace Gtk
