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