[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp Widget.cs,1.6,1.7
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp Widget.cs,1.6,1.7 |
Date: |
Tue, 24 Jun 2003 07:10:06 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv4790/Xsharp
Modified Files:
Widget.cs
Log Message:
Add some support code for converting between screen and client co-ordinates.
Index: Widget.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Widget.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Widget.cs 24 Jun 2003 07:52:49 -0000 1.6
--- Widget.cs 24 Jun 2003 11:10:02 -0000 1.7
***************
*** 1455,1458 ****
--- 1455,1514 ----
}
+ /// <summary>
+ /// <para>Convert a set of widget co-ordinates into screen
+ /// co-ordinates.</para>
+ /// </summary>
+ ///
+ /// <param name="x">
+ /// <para>The X co-ordinate of the point to convert.</para>
+ /// </param>
+ ///
+ /// <param name="y">
+ /// <para>The Y co-ordinate of the point to convert.</para>
+ /// </param>
+ ///
+ /// <returns>
+ /// <para>The screen point.</para>
+ /// </returns>
+ public Point WidgetToScreen(int x, int y)
+ {
+ Widget current = this;
+ while(current.parent != null)
+ {
+ x += current.x;
+ y += current.y;
+ current = current.parent;
+ }
+ return new Point(x, y);
+ }
+
+ /// <summary>
+ /// <para>Convert a set of screen co-ordinates into widget
+ /// co-ordinates.</para>
+ /// </summary>
+ ///
+ /// <param name="x">
+ /// <para>The X co-ordinate of the point to convert.</para>
+ /// </param>
+ ///
+ /// <param name="y">
+ /// <para>The Y co-ordinate of the point to convert.</para>
+ /// </param>
+ ///
+ /// <returns>
+ /// <para>The widget point.</para>
+ /// </returns>
+ public Point ScreenToWidget(int x, int y)
+ {
+ Widget current = this;
+ while(current.parent != null)
+ {
+ x -= current.x;
+ y -= current.y;
+ current = current.parent;
+ }
+ return new Point(x, y);
+ }
+
} // class Widget
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/Xsharp Widget.cs,1.6,1.7,
Rhys Weatherley <address@hidden> <=