Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6b6a95a

Browse files
author
zhourenjian
committed
Implement Display#map
1 parent85d652a commit6b6a95a

File tree

1 file changed

+14
-6
lines changed
  • sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets

1 file changed

+14
-6
lines changed

‎sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Display.java‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,15 +2547,19 @@ public Point map (Control from, Control to, int x, int y) {
25472547
checkDevice ();
25482548
if (from !=null &&from.isDisposed())error (SWT.ERROR_INVALID_ARGUMENT);
25492549
if (to !=null &&to.isDisposed())error (SWT.ERROR_INVALID_ARGUMENT);
2550-
//Element hwndFrom = from != null ? from.handle : null;
2551-
//Element hwndTo = to != null ? to.handle : null;
2550+
if (from ==to)returnnewPoint (x,y);
2551+
ElementhwndFrom =from !=null ?from.handle :document.body;
2552+
ElementhwndTo =to !=null ?to.handle :document.body;
25522553

25532554
//POINT point = new POINT ();
25542555
//point.x = x;
25552556
//point.y = y;
25562557
//OS.MapWindowPoints (hwndFrom, hwndTo, point, 1);
25572558
//return new Point (point.x, point.y);
2558-
returnnewPoint (0,0);
2559+
Pointp =OS.calcuateRelativePosition(hwndFrom,hwndTo);
2560+
p.x +=x;
2561+
p.y +=y;
2562+
returnp;
25592563
}
25602564

25612565
/**
@@ -2642,8 +2646,9 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei
26422646
checkDevice ();
26432647
if (from !=null &&from.isDisposed())error (SWT.ERROR_INVALID_ARGUMENT);
26442648
if (to !=null &&to.isDisposed())error (SWT.ERROR_INVALID_ARGUMENT);
2645-
//Element hwndFrom = from != null ? from.handle : null;
2646-
//Element hwndTo = to != null ? to.handle : null;
2649+
if (from ==to)returnnewRectangle (x,y,width,height);
2650+
ElementhwndFrom =from !=null ?from.handle :document.body;
2651+
ElementhwndTo =to !=null ?to.handle :document.body;
26472652

26482653
//RECT rect = new RECT ();
26492654
//rect.left = x;
@@ -2652,7 +2657,10 @@ public Rectangle map (Control from, Control to, int x, int y, int width, int hei
26522657
//rect.bottom = y + height;
26532658
//OS.MapWindowPoints (hwndFrom, hwndTo, rect, 2);
26542659
//return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
2655-
returnnewRectangle (0,0,0,0);
2660+
Pointp =OS.calcuateRelativePosition(hwndFrom,hwndTo);
2661+
p.x +=x;
2662+
p.y +=y;
2663+
returnnewRectangle (p.x +x,p.y +y,OS.getContainerWidth(hwndTo),OS.getContainerHeight(hwndTo));
26562664
}
26572665

26582666
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp