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