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