File: MonitorG.d

package info (click to toggle)
gtk-d 3.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 20,152 kB
  • sloc: javascript: 565; sh: 71; makefile: 25
file content (249 lines) | stat: -rw-r--r-- 6,467 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module gdk.MonitorG;

private import gdk.Display;
private import gdk.c.functions;
public  import gdk.c.types;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
public  import gtkc.gdktypes;
private import std.algorithm;


/**
 * GdkMonitor objects represent the individual outputs that are
 * associated with a #GdkDisplay. GdkDisplay has APIs to enumerate
 * monitors with gdk_display_get_n_monitors() and gdk_display_get_monitor(), and
 * to find particular monitors with gdk_display_get_primary_monitor() or
 * gdk_display_get_monitor_at_window().
 * 
 * GdkMonitor was introduced in GTK+ 3.22 and supersedes earlier
 * APIs in GdkScreen to obtain monitor-related information.
 */
public class MonitorG : ObjectG
{
	/** the main Gtk struct */
	protected GdkMonitor* gdkMonitor;

	/** Get the main Gtk struct */
	public GdkMonitor* getMonitorGStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gdkMonitor;
	}

	/** the main Gtk struct as a void* */
	protected override void* getStruct()
	{
		return cast(void*)gdkMonitor;
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GdkMonitor* gdkMonitor, bool ownedRef = false)
	{
		this.gdkMonitor = gdkMonitor;
		super(cast(GObject*)gdkMonitor, ownedRef);
	}


	/** */
	public static GType getType()
	{
		return gdk_monitor_get_type();
	}

	/**
	 * Gets the display that this monitor belongs to.
	 *
	 * Returns: the display
	 *
	 * Since: 3.22
	 */
	public Display getDisplay()
	{
		auto p = gdk_monitor_get_display(gdkMonitor);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p);
	}

	/**
	 * Retrieves the size and position of an individual monitor within the
	 * display coordinate space. The returned geometry is in  ”application pixels”,
	 * not in ”device pixels” (see gdk_monitor_get_scale_factor()).
	 *
	 * Params:
	 *     geometry = a #GdkRectangle to be filled with the monitor geometry
	 *
	 * Since: 3.22
	 */
	public void getGeometry(out GdkRectangle geometry)
	{
		gdk_monitor_get_geometry(gdkMonitor, &geometry);
	}

	/**
	 * Gets the height in millimeters of the monitor.
	 *
	 * Returns: the physical height of the monitor
	 *
	 * Since: 3.22
	 */
	public int getHeightMm()
	{
		return gdk_monitor_get_height_mm(gdkMonitor);
	}

	/**
	 * Gets the name of the monitor's manufacturer, if available.
	 *
	 * Returns: the name of the manufacturer, or %NULL
	 */
	public string getManufacturer()
	{
		return Str.toString(gdk_monitor_get_manufacturer(gdkMonitor));
	}

	/**
	 * Gets the a string identifying the monitor model, if available.
	 *
	 * Returns: the monitor model, or %NULL
	 */
	public string getModel()
	{
		return Str.toString(gdk_monitor_get_model(gdkMonitor));
	}

	/**
	 * Gets the refresh rate of the monitor, if available.
	 *
	 * The value is in milli-Hertz, so a refresh rate of 60Hz
	 * is returned as 60000.
	 *
	 * Returns: the refresh rate in milli-Hertz, or 0
	 *
	 * Since: 3.22
	 */
	public int getRefreshRate()
	{
		return gdk_monitor_get_refresh_rate(gdkMonitor);
	}

	/**
	 * Gets the internal scale factor that maps from monitor coordinates
	 * to the actual device pixels. On traditional systems this is 1, but
	 * on very high density outputs this can be a higher value (often 2).
	 *
	 * This can be used if you want to create pixel based data for a
	 * particular monitor, but most of the time you’re drawing to a window
	 * where it is better to use gdk_window_get_scale_factor() instead.
	 *
	 * Returns: the scale factor
	 *
	 * Since: 3.22
	 */
	public int getScaleFactor()
	{
		return gdk_monitor_get_scale_factor(gdkMonitor);
	}

	/**
	 * Gets information about the layout of red, green and blue
	 * primaries for each pixel in this monitor, if available.
	 *
	 * Returns: the subpixel layout
	 *
	 * Since: 3.22
	 */
	public GdkSubpixelLayout getSubpixelLayout()
	{
		return gdk_monitor_get_subpixel_layout(gdkMonitor);
	}

	/**
	 * Gets the width in millimeters of the monitor.
	 *
	 * Returns: the physical width of the monitor
	 *
	 * Since: 3.22
	 */
	public int getWidthMm()
	{
		return gdk_monitor_get_width_mm(gdkMonitor);
	}

	/**
	 * Retrieves the size and position of the “work area” on a monitor
	 * within the display coordinate space. The returned geometry is in
	 * ”application pixels”, not in ”device pixels” (see
	 * gdk_monitor_get_scale_factor()).
	 *
	 * The work area should be considered when positioning menus and
	 * similar popups, to avoid placing them below panels, docks or other
	 * desktop components.
	 *
	 * Note that not all backends may have a concept of workarea. This
	 * function will return the monitor geometry if a workarea is not
	 * available, or does not apply.
	 *
	 * Params:
	 *     workarea = a #GdkRectangle to be filled with
	 *         the monitor workarea
	 *
	 * Since: 3.22
	 */
	public void getWorkarea(out GdkRectangle workarea)
	{
		gdk_monitor_get_workarea(gdkMonitor, &workarea);
	}

	/**
	 * Gets whether this monitor should be considered primary
	 * (see gdk_display_get_primary_monitor()).
	 *
	 * Returns: %TRUE if @monitor is primary
	 *
	 * Since: 3.22
	 */
	public bool isPrimary()
	{
		return gdk_monitor_is_primary(gdkMonitor) != 0;
	}

	/** */
	gulong addOnInvalidate(void delegate(MonitorG) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		return Signals.connect(this, "invalidate", dlg, connectFlags ^ ConnectFlags.SWAPPED);
	}
}