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.c.functions;
29 public  import gdk.c.types;
30 private import gio.AppLaunchContext : DGioAppLaunchContext = AppLaunchContext;
31 private import gio.IconIF;
32 private import glib.Str;
33 private import gobject.ObjectG;
34 
35 
36 /**
37  * `GdkAppLaunchContext` handles launching an application in a graphical context.
38  * 
39  * It is an implementation of `GAppLaunchContext` that provides startup
40  * notification and allows to launch applications on a specific screen
41  * or workspace.
42  * 
43  * ## Launching an application
44  * 
45  * ```c
46  * GdkAppLaunchContext *context;
47  * 
48  * context = gdk_display_get_app_launch_context (display);
49  * 
50  * gdk_app_launch_context_set_display (display);
51  * gdk_app_launch_context_set_timestamp (gdk_event_get_time (event));
52  * 
53  * if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error))
54  * g_warning ("Launching failed: %s\n", error->message);
55  * 
56  * g_object_unref (context);
57  * ```
58  */
59 public class AppLaunchContext : DGioAppLaunchContext
60 {
61 	/** the main Gtk struct */
62 	protected GdkAppLaunchContext* gdkAppLaunchContext;
63 
64 	/** Get the main Gtk struct */
65 	public GdkAppLaunchContext* getGdkAppLaunchContextStruct(bool transferOwnership = false)
66 	{
67 		if (transferOwnership)
68 			ownedRef = false;
69 		return gdkAppLaunchContext;
70 	}
71 
72 	/** the main Gtk struct as a void* */
73 	protected override void* getStruct()
74 	{
75 		return cast(void*)gdkAppLaunchContext;
76 	}
77 
78 	/**
79 	 * Sets our main struct and passes it to the parent class.
80 	 */
81 	public this (GdkAppLaunchContext* gdkAppLaunchContext, bool ownedRef = false)
82 	{
83 		this.gdkAppLaunchContext = gdkAppLaunchContext;
84 		super(cast(GAppLaunchContext*)gdkAppLaunchContext, ownedRef);
85 	}
86 
87 
88 	/** */
89 	public static GType getType()
90 	{
91 		return gdk_app_launch_context_get_type();
92 	}
93 
94 	/**
95 	 * Gets the `GdkDisplay` that @context is for.
96 	 *
97 	 * Returns: the display of @context
98 	 */
99 	public Display getDisplay()
100 	{
101 		auto __p = gdk_app_launch_context_get_display(gdkAppLaunchContext);
102 
103 		if(__p is null)
104 		{
105 			return null;
106 		}
107 
108 		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) __p);
109 	}
110 
111 	/**
112 	 * Sets the workspace on which applications will be launched.
113 	 *
114 	 * This only works when running under a window manager that
115 	 * supports multiple workspaces, as described in the
116 	 * [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec).
117 	 *
118 	 * When the workspace is not specified or @desktop is set to -1,
119 	 * it is up to the window manager to pick one, typically it will
120 	 * be the current workspace.
121 	 *
122 	 * Params:
123 	 *     desktop = the number of a workspace, or -1
124 	 */
125 	public void setDesktop(int desktop)
126 	{
127 		gdk_app_launch_context_set_desktop(gdkAppLaunchContext, desktop);
128 	}
129 
130 	/**
131 	 * Sets the icon for applications that are launched with this
132 	 * context.
133 	 *
134 	 * Window Managers can use this information when displaying startup
135 	 * notification.
136 	 *
137 	 * See also [method@Gdk.AppLaunchContext.set_icon_name].
138 	 *
139 	 * Params:
140 	 *     icon = a #GIcon, or %NULL
141 	 */
142 	public void setIcon(IconIF icon)
143 	{
144 		gdk_app_launch_context_set_icon(gdkAppLaunchContext, (icon is null) ? null : icon.getIconStruct());
145 	}
146 
147 	/**
148 	 * Sets the icon for applications that are launched with this context.
149 	 *
150 	 * The @icon_name will be interpreted in the same way as the Icon field
151 	 * in desktop files. See also [method@Gdk.AppLaunchContext.set_icon()].
152 	 *
153 	 * If both @icon and @icon_name are set, the @icon_name takes priority.
154 	 * If neither @icon or @icon_name is set, the icon is taken from either
155 	 * the file that is passed to launched application or from the `GAppInfo`
156 	 * for the launched application itself.
157 	 *
158 	 * Params:
159 	 *     iconName = an icon name, or %NULL
160 	 */
161 	public void setIconName(string iconName)
162 	{
163 		gdk_app_launch_context_set_icon_name(gdkAppLaunchContext, Str.toStringz(iconName));
164 	}
165 
166 	/**
167 	 * Sets the timestamp of @context.
168 	 *
169 	 * The timestamp should ideally be taken from the event that
170 	 * triggered the launch.
171 	 *
172 	 * Window managers can use this information to avoid moving the
173 	 * focus to the newly launched application when the user is busy
174 	 * typing in another window. This is also known as 'focus stealing
175 	 * prevention'.
176 	 *
177 	 * Params:
178 	 *     timestamp = a timestamp
179 	 */
180 	public void setTimestamp(uint timestamp)
181 	{
182 		gdk_app_launch_context_set_timestamp(gdkAppLaunchContext, timestamp);
183 	}
184 }