+2007-08-28 Jonathan Pobst <monkey@jpobst.com>
+
+ * Cursor.cs: Add HotSpot, hook into XPlatUI.GetCursorInfo.
+ * XPlatUIWin32.cs: Implement hotspot lookup in GetCursorInfo.
+
2007-08-28 Jonathan Pobst <monkey@jpobst.com>
* RadioButton.cs: Use 2.0 rendering. Use base implementation of TextAlign.
}
}
+#if NET_2_0
+ [MonoTODO ("Implemented for Win32, X11 always returns 0,0")]
+ public Point HotSpot {
+ get {
+ int cursor_w, cursor_h, hot_x, hot_y;
+ XplatUI.GetCursorInfo (Handle, out cursor_w, out cursor_h, out hot_x, out hot_y);
+
+ return new Point (hot_x, hot_y);
+ }
+ }
+#endif
public Size Size {
get {
return size;
internal short wParamH;
}
+ [StructLayout (LayoutKind.Sequential)]
+ internal struct ICONINFO {
+ internal bool fIcon;
+ internal Int32 xHotspot;
+ internal Int32 yHotspot;
+ internal IntPtr hbmMask;
+ internal IntPtr hbmColor;
+ }
+
[StructLayout(LayoutKind.Explicit)]
internal struct INPUT {
[FieldOffset(0)]
[MonoTODO]
internal override void GetCursorInfo(IntPtr cursor, out int width, out int height, out int hotspot_x, out int hotspot_y) {
+ ICONINFO ii = new ICONINFO ();
+
+ if (!Win32GetIconInfo (cursor, out ii))
+ throw new Win32Exception ();
+
width = 20;
height = 20;
- hotspot_x = 0;
- hotspot_y = 0;
+ hotspot_x = ii.xHotspot;
+ hotspot_y = ii.yHotspot;
}
internal override void SetCursorPos(IntPtr handle, int x, int y) {
[DllImport ("kernel32.dll", EntryPoint = "GetSystemPowerStatus", CallingConvention = CallingConvention.StdCall)]
internal static extern Boolean Win32GetSystemPowerStatus (SYSTEMPOWERSTATUS sps);
+
+ [DllImport ("user32.dll", EntryPoint = "GetIconInfo", CallingConvention = CallingConvention.StdCall)]
+ internal static extern bool Win32GetIconInfo (IntPtr hIcon, out ICONINFO piconinfo);
#endregion
}
}