/* 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 .
*/
#include
#include
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/button_p.h)
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}
*/
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& permission), gtk_lock_button_new)
_WRAP_METHOD(Glib::RefPtr get_permission(), gtk_lock_button_get_permission, refreturn)
_WRAP_METHOD(Glib::RefPtr get_permission() const, gtk_lock_button_get_permission, refreturn, constversion)
_WRAP_METHOD(void set_permission(const Glib::RefPtr& permission), gtk_lock_button_set_permission)
/** Unset permission.
* See set_permission().
*/
void unset_permission();
_WRAP_PROPERTY("permission", Glib::RefPtr)
_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