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  * Conversion parameters:
26  * inFile  = GdkDisplayManager.html
27  * outPack = gdk
28  * outFile = DisplayManager
29  * strct   = GdkDisplayManager
30  * realStrct=
31  * ctorStrct=
32  * clss    = DisplayManager
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gdk_display_manager_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- gdk.Display
47  * 	- glib.ListSG
48  * 	- gdk.Device
49  * structWrap:
50  * 	- GSList* -> ListSG
51  * 	- GdkDevice* -> Device
52  * 	- GdkDisplay* -> Display
53  * 	- GdkDisplayManager* -> DisplayManager
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gdk.DisplayManager;
60 
61 public  import gtkc.gdktypes;
62 
63 private import gtkc.gdk;
64 private import glib.ConstructionException;
65 private import gobject.ObjectG;
66 
67 private import gobject.Signals;
68 public  import gtkc.gdktypes;
69 
70 private import gdk.Display;
71 private import glib.ListSG;
72 private import gdk.Device;
73 
74 
75 
76 private import gobject.ObjectG;
77 
78 /**
79  * Description
80  * The purpose of the GdkDisplayManager singleton object is to offer
81  * notification when displays appear or disappear or the default display
82  * changes.
83  */
84 public class DisplayManager : ObjectG
85 {
86 	
87 	/** the main Gtk struct */
88 	protected GdkDisplayManager* gdkDisplayManager;
89 	
90 	
91 	public GdkDisplayManager* getDisplayManagerStruct()
92 	{
93 		return gdkDisplayManager;
94 	}
95 	
96 	
97 	/** the main Gtk struct as a void* */
98 	protected override void* getStruct()
99 	{
100 		return cast(void*)gdkDisplayManager;
101 	}
102 	
103 	/**
104 	 * Sets our main struct and passes it to the parent class
105 	 */
106 	public this (GdkDisplayManager* gdkDisplayManager)
107 	{
108 		super(cast(GObject*)gdkDisplayManager);
109 		this.gdkDisplayManager = gdkDisplayManager;
110 	}
111 	
112 	protected override void setStruct(GObject* obj)
113 	{
114 		super.setStruct(obj);
115 		gdkDisplayManager = cast(GdkDisplayManager*)obj;
116 	}
117 	
118 	/**
119 	 */
120 	int[string] connectedSignals;
121 	
122 	void delegate(Display, DisplayManager)[] onDisplayOpenedListeners;
123 	/**
124 	 * The ::display_opened signal is emitted when a display is opened.
125 	 * Since 2.2
126 	 */
127 	void addOnDisplayOpened(void delegate(Display, DisplayManager) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
128 	{
129 		if ( !("display-opened" in connectedSignals) )
130 		{
131 			Signals.connectData(
132 			getStruct(),
133 			"display-opened",
134 			cast(GCallback)&callBackDisplayOpened,
135 			cast(void*)this,
136 			null,
137 			connectFlags);
138 			connectedSignals["display-opened"] = 1;
139 		}
140 		onDisplayOpenedListeners ~= dlg;
141 	}
142 	extern(C) static void callBackDisplayOpened(GdkDisplayManager* displayManagerStruct, GdkDisplay* display, DisplayManager _displayManager)
143 	{
144 		foreach ( void delegate(Display, DisplayManager) dlg ; _displayManager.onDisplayOpenedListeners )
145 		{
146 			dlg(ObjectG.getDObject!(Display)(display), _displayManager);
147 		}
148 	}
149 	
150 	
151 	/**
152 	 * Gets the singleton GdkDisplayManager object.
153 	 * Since 2.2
154 	 * Returns: The global GdkDisplayManager singleton; gdk_parse_pargs(), gdk_init(), or gdk_init_check() must have been called first. [transfer none]
155 	 */
156 	public static DisplayManager get()
157 	{
158 		// GdkDisplayManager * gdk_display_manager_get (void);
159 		auto p = gdk_display_manager_get();
160 		
161 		if(p is null)
162 		{
163 			return null;
164 		}
165 		
166 		return ObjectG.getDObject!(DisplayManager)(cast(GdkDisplayManager*) p);
167 	}
168 	
169 	/**
170 	 * Gets the default GdkDisplay.
171 	 * Since 2.2
172 	 * Returns: a GdkDisplay, or NULL if there is no default display. [transfer none]
173 	 */
174 	public Display getDefaultDisplay()
175 	{
176 		// GdkDisplay * gdk_display_manager_get_default_display  (GdkDisplayManager *display_manager);
177 		auto p = gdk_display_manager_get_default_display(gdkDisplayManager);
178 		
179 		if(p is null)
180 		{
181 			return null;
182 		}
183 		
184 		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p);
185 	}
186 	
187 	/**
188 	 * Sets display as the default display.
189 	 * Since 2.2
190 	 * Params:
191 	 * display = a GdkDisplay
192 	 */
193 	public void setDefaultDisplay(Display display)
194 	{
195 		// void gdk_display_manager_set_default_display  (GdkDisplayManager *display_manager,  GdkDisplay *display);
196 		gdk_display_manager_set_default_display(gdkDisplayManager, (display is null) ? null : display.getDisplayStruct());
197 	}
198 	
199 	/**
200 	 * List all currently open displays.
201 	 * Since 2.2
202 	 * Returns: a newly allocated GSList of GdkDisplay objects. Free this list with g_slist_free() when you are done with it. [transfer container][element-type GdkDisplay]
203 	 */
204 	public ListSG listDisplays()
205 	{
206 		// GSList * gdk_display_manager_list_displays (GdkDisplayManager *display_manager);
207 		auto p = gdk_display_manager_list_displays(gdkDisplayManager);
208 		
209 		if(p is null)
210 		{
211 			return null;
212 		}
213 		
214 		return ObjectG.getDObject!(ListSG)(cast(GSList*) p);
215 	}
216 	
217 	/**
218 	 * Returns the core pointer device for the given display
219 	 * Since 2.2
220 	 * Params:
221 	 * display = a GdkDisplay
222 	 * Returns: the core pointer device; this is owned by the display and should not be freed.
223 	 */
224 	public static Device gdkDisplayGetCorePointer(Display display)
225 	{
226 		// GdkDevice * gdk_display_get_core_pointer (GdkDisplay *display);
227 		auto p = gdk_display_get_core_pointer((display is null) ? null : display.getDisplayStruct());
228 		
229 		if(p is null)
230 		{
231 			return null;
232 		}
233 		
234 		return ObjectG.getDObject!(Device)(cast(GdkDevice*) p);
235 	}
236 }