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 private import gio.Permission;
63 
64 
65 private import gtk.Button;
66 
67 /**
68  * GtkLockButton is a widget that can be used in control panels or
69  * preference dialogs to allow users to obtain and revoke authorizations
70  * needed to operate the controls. The required authorization is represented
71  * by a GPermission object. Concrete implementations of GPermission may use
72  * PolicyKit or some other authorization framework. To obtain a PolicyKit-based
73  * GPermission, use polkit_permission_new().
74  *
75  * If the user is not currently allowed to perform the action, but can obtain
76  * the permission, the widget looks like this
77  *
78  * $(DDOC_COMMENT example)
79  *
80  * and the user can click the button to request the permission. Depending
81  * on the platform, this may pop up an authentication dialog or ask the user
82  * to authenticate in some other way. Once the user has obtained the permission,
83  * the widget changes to this
84  *
85  * $(DDOC_COMMENT example)
86  *
87  * and the permission can be dropped again by clicking the button. If the user
88  * is not able to obtain the permission at all, the widget looks like this
89  *
90  * $(DDOC_COMMENT example)
91  *
92  * If the user has the permission and cannot drop it, the button is hidden.
93  *
94  * The text (and tooltips) that are shown in the various cases can be adjusted
95  * with the "text-lock", "text-unlock",
96  * "tooltip-lock", "tooltip-unlock" and
97  * "tooltip-not-authorized" properties.
98  */
99 public class LockButton : Button
100 {
101 	
102 	/** the main Gtk struct */
103 	protected GtkLockButton* gtkLockButton;
104 	
105 	
106 	/** Get the main Gtk struct */
107 	public GtkLockButton* getLockButtonStruct()
108 	{
109 		return gtkLockButton;
110 	}
111 	
112 	
113 	/** the main Gtk struct as a void* */
114 	protected override void* getStruct()
115 	{
116 		return cast(void*)gtkLockButton;
117 	}
118 	
119 	/**
120 	 * Sets our main struct and passes it to the parent class
121 	 */
122 	public this (GtkLockButton* gtkLockButton)
123 	{
124 		super(cast(GtkButton*)gtkLockButton);
125 		this.gtkLockButton = gtkLockButton;
126 	}
127 	
128 	protected override void setStruct(GObject* obj)
129 	{
130 		super.setStruct(obj);
131 		gtkLockButton = cast(GtkLockButton*)obj;
132 	}
133 	
134 	/**
135 	 */
136 	
137 	/**
138 	 * Creates a new lock button which reflects the permission.
139 	 * Params:
140 	 * permission = a GPermission. [allow-none]
141 	 * Returns: a new GtkLockButton Since 3.2
142 	 */
143 	public static GtkWidget* gtkLockButtonNew(Permission permission)
144 	{
145 		// GtkWidget * gtk_lock_button_new (GPermission *permission);
146 		return gtk_lock_button_new((permission is null) ? null : permission.getPermissionStruct());
147 	}
148 	
149 	/**
150 	 * Obtains the GPermission object that controls button.
151 	 * Returns: the GPermission of button. [transfer none] Since 3.2
152 	 */
153 	public Permission gtkLockButtonGetPermission()
154 	{
155 		// GPermission * gtk_lock_button_get_permission (GtkLockButton *button);
156 		auto p = gtk_lock_button_get_permission(gtkLockButton);
157 		
158 		if(p is null)
159 		{
160 			return null;
161 		}
162 		
163 		return ObjectG.getDObject!(Permission)(cast(GPermission*) p);
164 	}
165 	
166 	/**
167 	 * Sets the GPermission object that controls button.
168 	 * Params:
169 	 * permission = a GPermission object, or NULL. [allow-none]
170 	 * Since 3.2
171 	 */
172 	public void gtkLockButtonSetPermission(Permission permission)
173 	{
174 		// void gtk_lock_button_set_permission (GtkLockButton *button,  GPermission *permission);
175 		gtk_lock_button_set_permission(gtkLockButton, (permission is null) ? null : permission.getPermissionStruct());
176 	}
177 }