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.MonitorG; 26 27 private import gdk.Display; 28 private import gdk.c.functions; 29 public import gdk.c.types; 30 private import glib.Str; 31 private import gobject.ObjectG; 32 private import gobject.Signals; 33 public import gtkc.gdktypes; 34 private import std.algorithm; 35 36 37 /** 38 * GdkMonitor objects represent the individual outputs that are 39 * associated with a #GdkDisplay. GdkDisplay has APIs to enumerate 40 * monitors with gdk_display_get_n_monitors() and gdk_display_get_monitor(), and 41 * to find particular monitors with gdk_display_get_primary_monitor() or 42 * gdk_display_get_monitor_at_window(). 43 * 44 * GdkMonitor was introduced in GTK+ 3.22 and supersedes earlier 45 * APIs in GdkScreen to obtain monitor-related information. 46 */ 47 public class MonitorG : ObjectG 48 { 49 /** the main Gtk struct */ 50 protected GdkMonitor* gdkMonitor; 51 52 /** Get the main Gtk struct */ 53 public GdkMonitor* getMonitorGStruct(bool transferOwnership = false) 54 { 55 if (transferOwnership) 56 ownedRef = false; 57 return gdkMonitor; 58 } 59 60 /** the main Gtk struct as a void* */ 61 protected override void* getStruct() 62 { 63 return cast(void*)gdkMonitor; 64 } 65 66 /** 67 * Sets our main struct and passes it to the parent class. 68 */ 69 public this (GdkMonitor* gdkMonitor, bool ownedRef = false) 70 { 71 this.gdkMonitor = gdkMonitor; 72 super(cast(GObject*)gdkMonitor, ownedRef); 73 } 74 75 76 /** */ 77 public static GType getType() 78 { 79 return gdk_monitor_get_type(); 80 } 81 82 /** 83 * Gets the display that this monitor belongs to. 84 * 85 * Returns: the display 86 * 87 * Since: 3.22 88 */ 89 public Display getDisplay() 90 { 91 auto p = gdk_monitor_get_display(gdkMonitor); 92 93 if(p is null) 94 { 95 return null; 96 } 97 98 return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p); 99 } 100 101 /** 102 * Retrieves the size and position of an individual monitor within the 103 * display coordinate space. The returned geometry is in ”application pixels”, 104 * not in ”device pixels” (see gdk_monitor_get_scale_factor()). 105 * 106 * Params: 107 * geometry = a #GdkRectangle to be filled with the monitor geometry 108 * 109 * Since: 3.22 110 */ 111 public void getGeometry(out GdkRectangle geometry) 112 { 113 gdk_monitor_get_geometry(gdkMonitor, &geometry); 114 } 115 116 /** 117 * Gets the height in millimeters of the monitor. 118 * 119 * Returns: the physical height of the monitor 120 * 121 * Since: 3.22 122 */ 123 public int getHeightMm() 124 { 125 return gdk_monitor_get_height_mm(gdkMonitor); 126 } 127 128 /** 129 * Gets the name of the monitor's manufacturer, if available. 130 * 131 * Returns: the name of the manufacturer, or %NULL 132 */ 133 public string getManufacturer() 134 { 135 return Str.toString(gdk_monitor_get_manufacturer(gdkMonitor)); 136 } 137 138 /** 139 * Gets the a string identifying the monitor model, if available. 140 * 141 * Returns: the monitor model, or %NULL 142 */ 143 public string getModel() 144 { 145 return Str.toString(gdk_monitor_get_model(gdkMonitor)); 146 } 147 148 /** 149 * Gets the refresh rate of the monitor, if available. 150 * 151 * The value is in milli-Hertz, so a refresh rate of 60Hz 152 * is returned as 60000. 153 * 154 * Returns: the refresh rate in milli-Hertz, or 0 155 * 156 * Since: 3.22 157 */ 158 public int getRefreshRate() 159 { 160 return gdk_monitor_get_refresh_rate(gdkMonitor); 161 } 162 163 /** 164 * Gets the internal scale factor that maps from monitor coordinates 165 * to the actual device pixels. On traditional systems this is 1, but 166 * on very high density outputs this can be a higher value (often 2). 167 * 168 * This can be used if you want to create pixel based data for a 169 * particular monitor, but most of the time you’re drawing to a window 170 * where it is better to use gdk_window_get_scale_factor() instead. 171 * 172 * Returns: the scale factor 173 * 174 * Since: 3.22 175 */ 176 public int getScaleFactor() 177 { 178 return gdk_monitor_get_scale_factor(gdkMonitor); 179 } 180 181 /** 182 * Gets information about the layout of red, green and blue 183 * primaries for each pixel in this monitor, if available. 184 * 185 * Returns: the subpixel layout 186 * 187 * Since: 3.22 188 */ 189 public GdkSubpixelLayout getSubpixelLayout() 190 { 191 return gdk_monitor_get_subpixel_layout(gdkMonitor); 192 } 193 194 /** 195 * Gets the width in millimeters of the monitor. 196 * 197 * Returns: the physical width of the monitor 198 * 199 * Since: 3.22 200 */ 201 public int getWidthMm() 202 { 203 return gdk_monitor_get_width_mm(gdkMonitor); 204 } 205 206 /** 207 * Retrieves the size and position of the “work area” on a monitor 208 * within the display coordinate space. The returned geometry is in 209 * ”application pixels”, not in ”device pixels” (see 210 * gdk_monitor_get_scale_factor()). 211 * 212 * The work area should be considered when positioning menus and 213 * similar popups, to avoid placing them below panels, docks or other 214 * desktop components. 215 * 216 * Note that not all backends may have a concept of workarea. This 217 * function will return the monitor geometry if a workarea is not 218 * available, or does not apply. 219 * 220 * Params: 221 * workarea = a #GdkRectangle to be filled with 222 * the monitor workarea 223 * 224 * Since: 3.22 225 */ 226 public void getWorkarea(out GdkRectangle workarea) 227 { 228 gdk_monitor_get_workarea(gdkMonitor, &workarea); 229 } 230 231 /** 232 * Gets whether this monitor should be considered primary 233 * (see gdk_display_get_primary_monitor()). 234 * 235 * Returns: %TRUE if @monitor is primary 236 * 237 * Since: 3.22 238 */ 239 public bool isPrimary() 240 { 241 return gdk_monitor_is_primary(gdkMonitor) != 0; 242 } 243 244 /** */ 245 gulong addOnInvalidate(void delegate(MonitorG) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 246 { 247 return Signals.connect(this, "invalidate", dlg, connectFlags ^ ConnectFlags.SWAPPED); 248 } 249 }