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 module gdk.AppLaunchContext;
26 
27 private import gdk.Display;
28 private import gdk.Screen;
29 private import gio.AppLaunchContext : GioAppLaunchContext = AppLaunchContext;
30 private import gio.IconIF;
31 private import glib.ConstructionException;
32 private import glib.Str;
33 private import gobject.ObjectG;
34 private import gtkc.gdk;
35 public  import gtkc.gdktypes;
36 
37 
38 /**
39  * GdkAppLaunchContext is an implementation of #GAppLaunchContext that
40  * handles launching an application in a graphical context. It provides
41  * startup notification and allows to launch applications on a specific
42  * screen or workspace.
43  * 
44  * ## Launching an application
45  * 
46  * |[<!-- language="C" -->
47  * GdkAppLaunchContext *context;
48  * 
49  * context = gdk_display_get_app_launch_context (display);
50  * 
51  * gdk_app_launch_context_set_screen (screen);
52  * gdk_app_launch_context_set_timestamp (event->time);
53  * 
54  * if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error))
55  * g_warning ("Launching failed: %s\n", error->message);
56  * 
57  * g_object_unref (context);
58  * ]|
59  */
60 public class AppLaunchContext : GioAppLaunchContext
61 {
62 	/** the main Gtk struct */
63 	protected GdkAppLaunchContext* gdkAppLaunchContext;
64 
65 	/** Get the main Gtk struct */
66 	public GdkAppLaunchContext* getGdkAppLaunchContextStruct()
67 	{
68 		return gdkAppLaunchContext;
69 	}
70 
71 	/** the main Gtk struct as a void* */
72 	protected override void* getStruct()
73 	{
74 		return cast(void*)gdkAppLaunchContext;
75 	}
76 
77 	protected override void setStruct(GObject* obj)
78 	{
79 		gdkAppLaunchContext = cast(GdkAppLaunchContext*)obj;
80 		super.setStruct(obj);
81 	}
82 
83 	/**
84 	 * Sets our main struct and passes it to the parent class.
85 	 */
86 	public this (GdkAppLaunchContext* gdkAppLaunchContext, bool ownedRef = false)
87 	{
88 		this.gdkAppLaunchContext = gdkAppLaunchContext;
89 		super(cast(GAppLaunchContext*)gdkAppLaunchContext, ownedRef);
90 	}
91 
92 
93 	/** */
94 	public static GType getType()
95 	{
96 		return gdk_app_launch_context_get_type();
97 	}
98 
99 	/**
100 	 * Creates a new #GdkAppLaunchContext.
101 	 *
102 	 * Deprecated: Use gdk_display_get_app_launch_context() instead
103 	 *
104 	 * Return: a new #GdkAppLaunchContext
105 	 *
106 	 * Since: 2.14
107 	 *
108 	 * Throws: ConstructionException GTK+ fails to create the object.
109 	 */
110 	public this()
111 	{
112 		auto p = gdk_app_launch_context_new();
113 		
114 		if(p is null)
115 		{
116 			throw new ConstructionException("null returned by new");
117 		}
118 		
119 		this(cast(GdkAppLaunchContext*) p, true);
120 	}
121 
122 	/**
123 	 * Sets the workspace on which applications will be launched when
124 	 * using this context when running under a window manager that
125 	 * supports multiple workspaces, as described in the
126 	 * [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec).
127 	 *
128 	 * When the workspace is not specified or @desktop is set to -1,
129 	 * it is up to the window manager to pick one, typically it will
130 	 * be the current workspace.
131 	 *
132 	 * Params:
133 	 *     desktop = the number of a workspace, or -1
134 	 *
135 	 * Since: 2.14
136 	 */
137 	public void setDesktop(int desktop)
138 	{
139 		gdk_app_launch_context_set_desktop(gdkAppLaunchContext, desktop);
140 	}
141 
142 	/**
143 	 * Sets the display on which applications will be launched when
144 	 * using this context. See also gdk_app_launch_context_set_screen().
145 	 *
146 	 * Deprecated: Use gdk_display_get_app_launch_context() instead
147 	 *
148 	 * Params:
149 	 *     display = a #GdkDisplay
150 	 *
151 	 * Since: 2.14
152 	 */
153 	public void setDisplay(Display display)
154 	{
155 		gdk_app_launch_context_set_display(gdkAppLaunchContext, (display is null) ? null : display.getDisplayStruct());
156 	}
157 
158 	/**
159 	 * Sets the icon for applications that are launched with this
160 	 * context.
161 	 *
162 	 * Window Managers can use this information when displaying startup
163 	 * notification.
164 	 *
165 	 * See also gdk_app_launch_context_set_icon_name().
166 	 *
167 	 * Params:
168 	 *     icon = a #GIcon, or %NULL
169 	 *
170 	 * Since: 2.14
171 	 */
172 	public void setIcon(IconIF icon)
173 	{
174 		gdk_app_launch_context_set_icon(gdkAppLaunchContext, (icon is null) ? null : icon.getIconStruct());
175 	}
176 
177 	/**
178 	 * Sets the icon for applications that are launched with this context.
179 	 * The @icon_name will be interpreted in the same way as the Icon field
180 	 * in desktop files. See also gdk_app_launch_context_set_icon().
181 	 *
182 	 * If both @icon and @icon_name are set, the @icon_name takes priority.
183 	 * If neither @icon or @icon_name is set, the icon is taken from either
184 	 * the file that is passed to launched application or from the #GAppInfo
185 	 * for the launched application itself.
186 	 *
187 	 * Params:
188 	 *     iconName = an icon name, or %NULL
189 	 *
190 	 * Since: 2.14
191 	 */
192 	public void setIconName(string iconName)
193 	{
194 		gdk_app_launch_context_set_icon_name(gdkAppLaunchContext, Str.toStringz(iconName));
195 	}
196 
197 	/**
198 	 * Sets the screen on which applications will be launched when
199 	 * using this context. See also gdk_app_launch_context_set_display().
200 	 *
201 	 * If both @screen and @display are set, the @screen takes priority.
202 	 * If neither @screen or @display are set, the default screen and
203 	 * display are used.
204 	 *
205 	 * Params:
206 	 *     screen = a #GdkScreen
207 	 *
208 	 * Since: 2.14
209 	 */
210 	public void setScreen(Screen screen)
211 	{
212 		gdk_app_launch_context_set_screen(gdkAppLaunchContext, (screen is null) ? null : screen.getScreenStruct());
213 	}
214 
215 	/**
216 	 * Sets the timestamp of @context. The timestamp should ideally
217 	 * be taken from the event that triggered the launch.
218 	 *
219 	 * Window managers can use this information to avoid moving the
220 	 * focus to the newly launched application when the user is busy
221 	 * typing in another window. This is also known as 'focus stealing
222 	 * prevention'.
223 	 *
224 	 * Params:
225 	 *     timestamp = a timestamp
226 	 *
227 	 * Since: 2.14
228 	 */
229 	public void setTimestamp(uint timestamp)
230 	{
231 		gdk_app_launch_context_set_timestamp(gdkAppLaunchContext, timestamp);
232 	}
233 }