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