1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = GtkLockButton.html 27 * outPack = gtk 28 * outFile = LockButton 29 * strct = GtkLockButton 30 * realStrct= 31 * ctorStrct= 32 * clss = LockButton 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_switch_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gio.Permission 47 * structWrap: 48 * - GPermission* -> Permission 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module gtk.LockButton; 55 56 public import gtkc.gtktypes; 57 58 private import gtkc.gtk; 59 private import glib.ConstructionException; 60 private import gobject.ObjectG; 61 62 63 private import gio.Permission; 64 65 66 67 private import gtk.Button; 68 69 /** 70 * GtkLockButton is a widget that can be used in control panels or 71 * preference dialogs to allow users to obtain and revoke authorizations 72 * needed to operate the controls. The required authorization is represented 73 * by a GPermission object. Concrete implementations of GPermission may use 74 * PolicyKit or some other authorization framework. To obtain a PolicyKit-based 75 * GPermission, use polkit_permission_new(). 76 * 77 * If the user is not currently allowed to perform the action, but can obtain 78 * the permission, the widget looks like this 79 * 80 * $(DDOC_COMMENT example) 81 * 82 * and the user can click the button to request the permission. Depending 83 * on the platform, this may pop up an authentication dialog or ask the user 84 * to authenticate in some other way. Once the user has obtained the permission, 85 * the widget changes to this 86 * 87 * $(DDOC_COMMENT example) 88 * 89 * and the permission can be dropped again by clicking the button. If the user 90 * is not able to obtain the permission at all, the widget looks like this 91 * 92 * $(DDOC_COMMENT example) 93 * 94 * If the user has the permission and cannot drop it, the button is hidden. 95 * 96 * The text (and tooltips) that are shown in the various cases can be adjusted 97 * with the "text-lock", "text-unlock", 98 * "tooltip-lock", "tooltip-unlock" and 99 * "tooltip-not-authorized" properties. 100 */ 101 public class LockButton : Button 102 { 103 104 /** the main Gtk struct */ 105 protected GtkLockButton* gtkLockButton; 106 107 108 public GtkLockButton* getLockButtonStruct() 109 { 110 return gtkLockButton; 111 } 112 113 114 /** the main Gtk struct as a void* */ 115 protected override void* getStruct() 116 { 117 return cast(void*)gtkLockButton; 118 } 119 120 /** 121 * Sets our main struct and passes it to the parent class 122 */ 123 public this (GtkLockButton* gtkLockButton) 124 { 125 super(cast(GtkButton*)gtkLockButton); 126 this.gtkLockButton = gtkLockButton; 127 } 128 129 protected override void setStruct(GObject* obj) 130 { 131 super.setStruct(obj); 132 gtkLockButton = cast(GtkLockButton*)obj; 133 } 134 135 /** 136 */ 137 138 /** 139 * Creates a new lock button which reflects the permission. 140 * Params: 141 * permission = a GPermission. [allow-none] 142 * Returns: a new GtkLockButton Since 3.2 143 */ 144 public static GtkWidget* gtkLockButtonNew(Permission permission) 145 { 146 // GtkWidget * gtk_lock_button_new (GPermission *permission); 147 return gtk_lock_button_new((permission is null) ? null : permission.getPermissionStruct()); 148 } 149 150 /** 151 * Obtains the GPermission object that controls button. 152 * Returns: the GPermission of button. [transfer none] Since 3.2 153 */ 154 public Permission gtkLockButtonGetPermission() 155 { 156 // GPermission * gtk_lock_button_get_permission (GtkLockButton *button); 157 auto p = gtk_lock_button_get_permission(gtkLockButton); 158 159 if(p is null) 160 { 161 return null; 162 } 163 164 return ObjectG.getDObject!(Permission)(cast(GPermission*) p); 165 } 166 167 /** 168 * Sets the GPermission object that controls button. 169 * Params: 170 * permission = a GPermission object, or NULL. [allow-none] 171 * Since 3.2 172 */ 173 public void gtkLockButtonSetPermission(Permission permission) 174 { 175 // void gtk_lock_button_set_permission (GtkLockButton *button, GPermission *permission); 176 gtk_lock_button_set_permission(gtkLockButton, (permission is null) ? null : permission.getPermissionStruct()); 177 } 178 }