diff options
author | Sravan Kumar Lakkimsetti | 2016-03-04 11:28:44 +0000 |
---|---|---|
committer | Sravan Kumar Lakkimsetti | 2016-03-04 11:28:44 +0000 |
commit | 0b159f5c02b6e6116371806736bec58960816c57 (patch) | |
tree | d37294b0b0a0033e8396fdff6e7b27edc20cb261 | |
parent | 531ff1f43da04e2878ab6cce0bdfc8b6d47d0453 (diff) | |
parent | ee9880b8210608782cae7b1417926f44f8b2dd30 (diff) | |
download | eclipse.platform.swt-0b159f5c02b6e6116371806736bec58960816c57.tar.gz eclipse.platform.swt-0b159f5c02b6e6116371806736bec58960816c57.tar.xz eclipse.platform.swt-0b159f5c02b6e6116371806736bec58960816c57.zip |
Merge branch 'slakkimsetti/HighDPIChangesforNeon' of ssh://slakkimsetti@git.eclipse.org/gitroot/platform/eclipse.platform.swt.git into slakkimsetti/HighDPIChangesforNeon
48 files changed, 309 insertions, 487 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java index c857a590e8..35cc62c76b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java @@ -18,6 +18,7 @@ import java.lang.reflect.*; /* SWT Imports */ import org.eclipse.swt.*; +import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.win32.*; @@ -303,7 +304,7 @@ public static Frame new_Frame (final Composite parent) { @Override public void run () { if (parent.isDisposed()) return; - final Rectangle clientArea = parent.getClientAreaInPixels(); + final Rectangle clientArea = DPIUtil.autoScaleUp(parent.getClientArea()); // To Pixels EventQueue.invokeLater(new Runnable () { @Override public void run () { @@ -353,7 +354,7 @@ public static Shell new_Shell (final Display display, final Canvas parent) { public void run () { if (shell.isDisposed()) return; Dimension dim = parent.getSize (); - shell.setSizeInPixels (dim.width, dim.height); + shell.setSize(DPIUtil.autoScaleDown(new Point(dim.width, dim.height))); // To Points } }); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java index 3f3f2a70a7..ebb10714c5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Browser/win32/org/eclipse/swt/browser/IE.java @@ -423,7 +423,7 @@ public void create(Composite parent, int style) { break; } case SWT.Resize: { - frame.setBoundsInPixels(browser.getClientAreaInPixels()); + frame.setBounds(browser.getClientArea()); break; } case SWT.MouseWheel: { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java index 3ac1cf1b23..ce147f1d7a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragSourceEffect.java @@ -12,6 +12,7 @@ package org.eclipse.swt.dnd; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.widgets.*; @@ -163,9 +164,9 @@ public class TableDragSourceEffect extends DragSourceEffect { long /*int*/ tableImageList = OS.SendMessage (table.handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0); if (tableImageList != 0) { int count = Math.min(selection.length, 10); - Rectangle bounds = selection[0].getBoundsInPixels(0); + Rectangle bounds = DPIUtil.autoScaleUp(selection[0].getBounds(0)); for (int i = 1; i < count; i++) { - bounds = bounds.union(selection[i].getBoundsInPixels(0)); + bounds = bounds.union(DPIUtil.autoScaleUp(selection[i].getBounds(0))); } long /*int*/ hDC = OS.GetDC(0); long /*int*/ hDC1 = OS.CreateCompatibleDC(hDC); @@ -183,7 +184,7 @@ public class TableDragSourceEffect extends DragSourceEffect { OS.FillRect(hDC1, rect, hBrush); for (int i = 0; i < count; i++) { TableItem selected = selection[i]; - Rectangle cell = selected.getBoundsInPixels(0); + Rectangle cell = DPIUtil.autoScaleUp(selected.getBounds(0)); POINT pt = new POINT(); long /*int*/ imageList = OS.SendMessage (table.handle, OS.LVM_CREATEDRAGIMAGE, table.indexOf(selected), pt); OS.ImageList_Draw(imageList, 0, hDC1, cell.x - bounds.x, cell.y - bounds.y, OS.ILD_SELECTED); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java index 287ea129c9..e9291a2df0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDropTargetEffect.java @@ -11,6 +11,7 @@ package org.eclipse.swt.dnd; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.widgets.*; @@ -151,7 +152,7 @@ public class TableDropTargetEffect extends DropTargetEffect { int effect = checkEffect(event.feedback); long /*int*/ handle = table.handle; Point coordinates = new Point(event.x, event.y); - coordinates = table.toControlInPixels(coordinates); + coordinates = DPIUtil.autoScaleUp(table.toControl(coordinates)); // To Pixels LVHITTESTINFO pinfo = new LVHITTESTINFO(); pinfo.x = coordinates.x; pinfo.y = coordinates.y; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java index 55245f81d4..8ffd1f4f9d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragSourceEffect.java @@ -12,6 +12,7 @@ package org.eclipse.swt.dnd; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.widgets.*; @@ -163,9 +164,9 @@ public class TreeDragSourceEffect extends DragSourceEffect { long /*int*/ treeImageList = OS.SendMessage (tree.handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0); if (treeImageList != 0) { int count = Math.min(selection.length, 10); - Rectangle bounds = selection[0].getBoundsInPixels(0); + Rectangle bounds = DPIUtil.autoScaleUp(selection[0].getBounds(0)); for (int i = 1; i < count; i++) { - bounds = bounds.union(selection[i].getBoundsInPixels(0)); + bounds = bounds.union(DPIUtil.autoScaleUp(selection[i].getBounds(0))); } long /*int*/ hDC = OS.GetDC(tree.handle); long /*int*/ hDC1 = OS.CreateCompatibleDC(hDC); @@ -178,7 +179,7 @@ public class TreeDragSourceEffect extends DragSourceEffect { OS.FillRect(hDC1, rect, hBrush); for (int i = 0; i < count; i++) { TreeItem selected = selection[i]; - Rectangle cell = selected.getBoundsInPixels(0); + Rectangle cell = DPIUtil.autoScaleUp(selected.getBounds(0)); long /*int*/ imageList = OS.SendMessage(tree.handle, OS.TVM_CREATEDRAGIMAGE, 0, selected.handle); OS.ImageList_Draw(imageList, 0, hDC1, cell.x - bounds.x, cell.y - bounds.y, OS.ILD_SELECTED); OS.ImageList_Destroy(imageList); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java index 8c24c1ce8b..98d28437c7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDropTargetEffect.java @@ -12,6 +12,7 @@ package org.eclipse.swt.dnd; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.widgets.*; @@ -162,7 +163,7 @@ public class TreeDropTargetEffect extends DropTargetEffect { int effect = checkEffect(event.feedback); long /*int*/ handle = tree.handle; Point coordinates = new Point(event.x, event.y); - coordinates = tree.toControlInPixels(coordinates); + coordinates = DPIUtil.autoScaleUp(tree.toControl(coordinates)); // To Pixels TVHITTESTINFO lpht = new TVHITTESTINFO (); lpht.x = coordinates.x; lpht.y = coordinates.y; diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java index 0d2a71d187..cf4e1d1918 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleClientSite.java @@ -826,7 +826,7 @@ protected int GetWindow(long /*int*/ phwnd) { return COM.S_OK; } RECT getRect() { - Rectangle area = getClientAreaInPixels(); + Rectangle area = DPIUtil.autoScaleUp(getClientArea()); // To Pixels RECT rect = new RECT(); rect.left = area.x; rect.top = area.y; @@ -1003,14 +1003,14 @@ private int OnInPlaceDeactivate() { return COM.S_OK; } private int OnPosRectChange(long /*int*/ lprcPosRect) { - Point size = getSizeInPixels(); + Point size = DPIUtil.autoScaleUp(getSize()); // To Pixels setExtent(size.x, size.y); return COM.S_OK; } private void onPaint(Event e) { if (state == STATE_RUNNING || state == STATE_INPLACEACTIVE) { SIZE size = getExtent(); - Rectangle area = getClientAreaInPixels(); + Rectangle area = DPIUtil.autoScaleUp(getClientArea()); // To Pixels RECT rect = new RECT(); if (getProgramID().startsWith("Excel.Sheet")) { //$NON-NLS-1$ rect.left = area.x; rect.right = area.x + (area.height * size.cx / size.cy); @@ -1400,11 +1400,11 @@ void setBorderSpace(RECT newBorderwidth) { setBounds(); } void setBounds() { - Rectangle area = frame.getClientAreaInPixels(); - setBoundsInPixel(borderWidths.left, - borderWidths.top, - area.width - borderWidths.left - borderWidths.right, - area.height - borderWidths.top - borderWidths.bottom); + Rectangle area = DPIUtil.autoScaleUp(frame.getClientArea()); // To Pixels + setBounds(DPIUtil.autoScaleDown(borderWidths.left), + DPIUtil.autoScaleDown(borderWidths.top), + DPIUtil.autoScaleDown(area.width - borderWidths.left - borderWidths.right), + DPIUtil.autoScaleDown(area.height - borderWidths.top - borderWidths.bottom)); setObjectRects(); } private void setExtent(int width, int height){ diff --git a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java index aab234e862..ee3a67aa9d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Printing/win32/org/eclipse/swt/printing/Printer.java @@ -481,7 +481,7 @@ public Point getDPI() { * @see #computeTrim */ @Override -public Rectangle getBoundsInPixels() { +protected Rectangle getBoundsInPixels() { checkDevice(); int width = OS.GetDeviceCaps(handle, OS.PHYSICALWIDTH); int height = OS.GetDeviceCaps(handle, OS.PHYSICALHEIGHT); @@ -506,7 +506,7 @@ public Rectangle getBoundsInPixels() { * @see #computeTrim */ @Override -public Rectangle getClientAreaInPixels() { +protected Rectangle getClientAreaInPixels() { checkDevice(); int width = OS.GetDeviceCaps(handle, OS.HORZRES); int height = OS.GetDeviceCaps(handle, OS.VERTRES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java index 046c3d1510..587b92e3b7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebDownloadDelegate.java @@ -172,7 +172,7 @@ void openDownloadWindow (final IWebDownload download, String name) { GridData data = new GridData (); Monitor monitor = browser.getMonitor (); int maxWidth = monitor.getBounds ().width / 2; - int width = nameLabel.computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT).x; + int width = nameLabel.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; data.widthHint = Math.min (width, maxWidth); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebFrameLoadDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebFrameLoadDelegate.java index 29fe579bab..9ba6e2ee66 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebFrameLoadDelegate.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebFrameLoadDelegate.java @@ -580,7 +580,7 @@ boolean showCertificateDialog (long /*int*/ webView, final String failingUrlStri GridData data = new GridData (); Monitor monitor = browser.getMonitor (); int maxWidth = monitor.getBounds ().width * 2 / 3; - int width = label.computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT).x; + int width = label.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; data.widthHint = Math.min (width, maxWidth); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; @@ -621,11 +621,11 @@ boolean showCertificateDialog (long /*int*/ webView, final String failingUrlStri shell.setDefaultButton (buttons[0]); shell.pack (); - Rectangle parentSize = parent.getBoundsInPixels (); - Rectangle shellSize = shell.getBoundsInPixels (); - int x = parent.getLocationInPixels ().x + (parentSize.width - shellSize.width) / 2; - int y = parent.getLocationInPixels ().y + (parentSize.height - shellSize.height) / 2; - shell.setLocationInPixels (x, y); + Rectangle parentSize = parent.getBounds (); + Rectangle shellSize = shell.getBounds (); + int x = parent.getLocation ().x + (parentSize.width - shellSize.width) / 2; + int y = parent.getLocation ().y + (parentSize.height - shellSize.height) / 2; + shell.setLocation (x, y); shell.open (); Display display = browser.getDisplay (); while (!shell.isDisposed ()) { @@ -749,11 +749,11 @@ void showCertificate (Shell parent, long /*int*/ certificate) { dialog.setDefaultButton (ok); dialog.pack (); - Rectangle parentSize = parent.getBoundsInPixels (); - Rectangle dialogSize = dialog.getBoundsInPixels (); - int x = parent.getLocationInPixels ().x + (parentSize.width - dialogSize.width) / 2; - int y = parent.getLocationInPixels ().y + (parentSize.height - dialogSize.height) / 2; - dialog.setLocationInPixels (x, y); + Rectangle parentSize = parent.getBounds (); + Rectangle dialogSize = dialog.getBounds (); + int x = parent.getLocation ().x + (parentSize.width - dialogSize.width) / 2; + int y = parent.getLocation ().y + (parentSize.height - dialogSize.height) / 2; + dialog.setLocation (x, y); dialog.open (); Display display = browser.getDisplay (); while (!dialog.isDisposed ()) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java index f2e2cd4c07..afd8e5b0dc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebKit.java @@ -658,7 +658,7 @@ public void create (Composite parent, int style) { break; } case SWT.Resize: { - Rectangle bounds = browser.getClientAreaInPixels (); + Rectangle bounds = DPIUtil.autoScaleUp(browser.getClientArea ()); // To Pixels OS.SetWindowPos (webViewWindowHandle, 0, bounds.x, bounds.y, bounds.width, bounds.height, OS.SWP_DRAWFRAME); break; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebResourceLoadDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebResourceLoadDelegate.java index 7c8cca8a6f..b23a151d91 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebResourceLoadDelegate.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebResourceLoadDelegate.java @@ -280,7 +280,7 @@ boolean showAuthenticationDialog (final String[] user, final String[] password, GridData data = new GridData (); Monitor monitor = browser.getMonitor (); int maxWidth = monitor.getBounds ().width * 2 / 3; - int width = label.computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT).x; + int width = label.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; data.widthHint = Math.min (width, maxWidth); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; @@ -334,11 +334,11 @@ boolean showAuthenticationDialog (final String[] user, final String[] password, shell.setDefaultButton (buttons[1]); shell.pack (); - Rectangle parentSize = parent.getBoundsInPixels (); - Rectangle shellSize = shell.getBoundsInPixels (); - int x = parent.getLocationInPixels().x + (parentSize.width - shellSize.width) / 2; - int y = parent.getLocationInPixels().y + (parentSize.height - shellSize.height) / 2; - shell.setLocationInPixels (x, y); + Rectangle parentSize = parent.getBounds (); + Rectangle shellSize = shell.getBounds (); + int x = parent.getLocation().x + (parentSize.width - shellSize.width) / 2; + int y = parent.getLocation().y + (parentSize.height - shellSize.height) / 2; + shell.setLocation (x, y); shell.open (); Display display = browser.getDisplay (); while (!shell.isDisposed ()) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java index 059aff005e..0bcdfdc268 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java +++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/win32/org/eclipse/swt/browser/WebUIDelegate.java @@ -456,7 +456,7 @@ int setFrame (long /*int*/ sender, long /*int*/ frame) { RECT rect = new RECT (); COM.MoveMemory (rect, frame, RECT.sizeof); /* convert to SWT system coordinates */ - location = browser.getDisplay ().mapInPixels (browser, null, rect.left, rect.top); + location = DPIUtil.autoScaleUp(browser.getDisplay ().map (browser, null, DPIUtil.autoScaleDown(new Point(rect.left, rect.top)))); // To Pixels int x = rect.right - rect.left; int y = rect.bottom - rect.top; if (y < 0 || x < 0 || (x == 0 && y == 0)) return COM.S_OK; @@ -514,14 +514,14 @@ void showAlertMessage (String title, String message) { label.setText (message); Monitor monitor = parent.getMonitor (); int maxWidth = monitor.getBounds().width * 2 / 3; - int width = label.computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT).x; + int width = label.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; GridData data = new GridData (SWT.FILL, SWT.CENTER, true, false); data.widthHint = Math.min (width, maxWidth); label.setLayoutData (data); Button ok = new Button (dialog, SWT.PUSH); ok.setText (SWT.getMessage ("SWT_OK")); //$NON-NLS-1$ - width = ok.computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT).x; + width = ok.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; GridData layoutData = new GridData (); layoutData.horizontalAlignment = SWT.CENTER; layoutData.verticalAlignment = SWT.CENTER; @@ -538,11 +538,11 @@ void showAlertMessage (String title, String message) { dialog.setDefaultButton (ok); dialog.pack (); - Rectangle parentSize = parent.getBoundsInPixels (); - Rectangle dialogSize = dialog.getBoundsInPixels (); - int x = parent.getLocationInPixels ().x + (parentSize.width - dialogSize.width) / 2; - int y = parent.getLocationInPixels ().y + (parentSize.height - dialogSize.height) / 2; - dialog.setLocationInPixels (x, y); + Rectangle parentSize = parent.getBounds (); + Rectangle dialogSize = dialog.getBounds (); + int x = parent.getLocation ().x + (parentSize.width - dialogSize.width) / 2; + int y = parent.getLocation ().y + (parentSize.height - dialogSize.height) / 2; + dialog.setLocation (x, y); dialog.open (); Display display = browser.getDisplay (); while (!dialog.isDisposed ()) { @@ -569,7 +569,7 @@ int showConfirmPanel (String title, String message) { label.setText (message); Monitor monitor = parent.getMonitor (); int maxWidth = monitor.getBounds ().width * 2 / 3; - int width = label.computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT).x; + int width = label.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; GridData data = new GridData (SWT.FILL, SWT.CENTER, true, false); data.widthHint = Math.min (width, maxWidth); label.setLayoutData (data); @@ -589,7 +589,7 @@ int showConfirmPanel (String title, String message) { Button cancel = new Button (buttons, SWT.PUSH); cancel.setText (SWT.getMessage ("SWT_Cancel")); //$NON-NLS-1$ cancel.setLayoutData (layoutData); - width = cancel.computeSizeInPixels (SWT.DEFAULT, SWT.DEFAULT).x; + width = cancel.computeSize (SWT.DEFAULT, SWT.DEFAULT).x; layoutData.widthHint = Math.max (width, 75); final int[] result = new int[1]; @@ -610,11 +610,11 @@ int showConfirmPanel (String title, String message) { dialog.setDefaultButton (ok); dialog.pack (); - Rectangle parentSize = parent.getBoundsInPixels (); - Rectangle dialogSize = dialog.getBoundsInPixels (); - int x = parent.getLocationInPixels ().x + (parentSize.width - dialogSize.width) / 2; - int y = parent.getLocationInPixels ().y + (parentSize.height - dialogSize.height) / 2; - dialog.setLocationInPixels (x, y); + Rectangle parentSize = parent.getBounds (); + Rectangle dialogSize = dialog.getBounds (); + int x = parent.getLocation ().x + (parentSize.width - dialogSize.width) / 2; + int y = parent.getLocation ().y + (parentSize.height - dialogSize.height) / 2; + dialog.setLocation (x, y); dialog.open (); Display display = browser.getDisplay (); while (!dialog.isDisposed ()) { @@ -666,11 +666,11 @@ String showTextPrompter (String title, String message, String defaultText) { dialog.setDefaultButton (ok); dialog.pack (); - Rectangle parentSize = parent.getBoundsInPixels (); - Rectangle dialogSize = dialog.getBoundsInPixels (); - int x = parent.getLocationInPixels ().x + (parentSize.width - dialogSize.width) / 2; - int y = parent.getLocationInPixels ().y + (parentSize.height - dialogSize.height) / 2; - dialog.setLocationInPixels (x, y); + Rectangle parentSize = parent.getBounds (); + Rectangle dialogSize = dialog.getBounds (); + int x = parent.getLocation ().x + (parentSize.width - dialogSize.width) / 2; + int y = parent.getLocation ().y + (parentSize.height - dialogSize.height) / 2; + dialog.setLocation (x, y); dialog.open (); Display display = browser.getDisplay (); while (!dialog.isDisposed ()) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java index 62c4b18ba1..67cfdf671d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java @@ -367,13 +367,13 @@ long /*int*/ EnumFontFamProc (long /*int*/ lpelfe, long /*int*/ lpntme, long /*i * </ul> */ public Rectangle getBounds() { + checkDevice (); return DPIUtil.autoScaleDown(getBoundsInPixels()); } /** * @noreference This method is not intended to be referenced by clients. */ -public Rectangle getBoundsInPixels () { - checkDevice (); +protected Rectangle getBoundsInPixels () { long /*int*/ hDC = internal_new_GC (null); int width = OS.GetDeviceCaps (hDC, OS.HORZRES); int height = OS.GetDeviceCaps (hDC, OS.VERTRES); @@ -436,13 +436,14 @@ public DeviceData getDeviceData () { * @see #getBounds */ public Rectangle getClientArea () { + checkDevice (); return DPIUtil.autoScaleDown(getClientAreaInPixels()); } /** * @noreference This method is not intended to be referenced by clients. */ -public Rectangle getClientAreaInPixels () { +protected Rectangle getClientAreaInPixels () { return getBoundsInPixels (); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java index fa1333ce62..285d41eeef 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java @@ -397,8 +397,7 @@ int computeLeftMargin () { return margin; } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int width = 0, height = 0, border = getBorderWidthInPixels (); if ((style & SWT.ARROW) != 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java index 61a2c35827..ce5f4fd6a3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java @@ -622,8 +622,7 @@ public void clearSelection () { OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, -1); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int width = 0, height = 0; if (wHint == SWT.DEFAULT) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java index 86dd08790d..812e736440 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java @@ -227,9 +227,7 @@ Widget [] computeTabList () { return result; } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { - checkWidget (); +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { display.runSkin (); Point size; if (layout != null) { @@ -370,6 +368,7 @@ int applyThemeBackground () { * @since 3.6 */ public void drawBackground (GC gc, int x, int y, int width, int height, int offsetX, int offsetY) { + checkWidget (); x = DPIUtil.autoScaleUp(x); y = DPIUtil.autoScaleUp(y); width = DPIUtil.autoScaleUp(width); @@ -378,11 +377,8 @@ public void drawBackground (GC gc, int x, int y, int width, int height, int offs offsetY = DPIUtil.autoScaleUp(offsetY); drawBackgroundInPixels(gc, x, y, width, height, offsetX, offsetY); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void drawBackgroundInPixels(GC gc, int x, int y, int width, int height, int offsetX, int offsetY) { - checkWidget (); + +void drawBackgroundInPixels(GC gc, int x, int y, int width, int height, int offsetX, int offsetY) { if (gc == null) error (SWT.ERROR_NULL_ARGUMENT); if (gc.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); RECT rect = new RECT (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java index 5d27e0b05d..e81adf7b70 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java @@ -619,15 +619,13 @@ void checkMirrored () { * @see "computeTrim, getClientArea for controls that implement them" */ public Point computeSize (int wHint, int hHint) { + checkWidget (); wHint = (wHint != SWT.DEFAULT ? DPIUtil.autoScaleUp(wHint) : wHint); hHint = (hHint != SWT.DEFAULT ? DPIUtil.autoScaleUp(hHint) : hHint); return DPIUtil.autoScaleDown(computeSizeInPixels(wHint, hHint)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Point computeSizeInPixels (int wHint, int hHint) { +Point computeSizeInPixels (int wHint, int hHint) { return computeSizeInPixels (wHint, hHint, true); } @@ -666,16 +664,13 @@ public Point computeSizeInPixels (int wHint, int hHint) { * @see "computeTrim, getClientArea for controls that implement them" */ public Point computeSize (int wHint, int hHint, boolean changed){ + checkWidget (); wHint = (wHint != SWT.DEFAULT ? DPIUtil.autoScaleUp(wHint) : wHint); hHint = (hHint != SWT.DEFAULT ? DPIUtil.autoScaleUp(hHint) : hHint); return DPIUtil.autoScaleDown(computeSizeInPixels(wHint, hHint, changed)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { - checkWidget (); +Point computeSizeInPixels (int wHint, int hHint, boolean changed) { int width = DEFAULT_WIDTH; int height = DEFAULT_HEIGHT; if (wHint != SWT.DEFAULT) width = wHint; @@ -1239,14 +1234,11 @@ int getBackgroundPixel () { * </ul> */ public int getBorderWidth () { + checkWidget (); return DPIUtil.autoScaleDown(getBorderWidthInPixels ()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getBorderWidthInPixels () { - checkWidget (); +int getBorderWidthInPixels () { long /*int*/ borderHandle = borderHandle (); int bits1 = OS.GetWindowLong (borderHandle, OS.GWL_EXSTYLE); if ((bits1 & OS.WS_EX_CLIENTEDGE) != 0) return OS.GetSystemMetrics (OS.SM_CXEDGE); @@ -1270,13 +1262,11 @@ public int getBorderWidthInPixels () { * </ul> */ public Rectangle getBounds (){ + checkWidget (); return DPIUtil.autoScaleDown(getBoundsInPixels ()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getBoundsInPixels () { - checkWidget (); + +Rectangle getBoundsInPixels () { forceResize (); RECT rect = new RECT (); OS.GetWindowRect (topHandle (), rect); @@ -1450,14 +1440,11 @@ public Object getLayoutData () { * </ul> */ public Point getLocation () { + checkWidget (); return DPIUtil.autoScaleDown(getLocationInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Point getLocationInPixels () { - checkWidget (); +Point getLocationInPixels () { forceResize (); RECT rect = new RECT (); OS.GetWindowRect (topHandle (), rect); @@ -1623,14 +1610,11 @@ public Shell getShell () { * </ul> */ public Point getSize (){ + checkWidget (); return DPIUtil.autoScaleDown(getSizeInPixels ()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Point getSizeInPixels () { - checkWidget (); +Point getSizeInPixels () { forceResize (); RECT rect = new RECT (); OS.GetWindowRect (topHandle (), rect); @@ -2476,17 +2460,15 @@ void redraw (boolean all) { * @see SWT#DOUBLE_BUFFERED */ public void redraw (int x, int y, int width, int height, boolean all) { + checkWidget (); x = DPIUtil.autoScaleUp(x); y = DPIUtil.autoScaleUp(y); width = DPIUtil.autoScaleUp(width); height = DPIUtil.autoScaleUp(height); redrawInPixels(x, y, width, height, all); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void redrawInPixels (int x, int y, int width, int height, boolean all) { - checkWidget (); + +void redrawInPixels (int x, int y, int width, int height, boolean all) { if (width <= 0 || height <= 0) return; if (!OS.IsWindowVisible (handle)) return; RECT rect = new RECT (); @@ -3216,18 +3198,15 @@ void setBackgroundPixel (int pixel) { * </ul> */ public void setBounds(int x, int y, int width, int height) { + checkWidget (); x = DPIUtil.autoScaleUp(x); y = DPIUtil.autoScaleUp(y); width = DPIUtil.autoScaleUp(width); height = DPIUtil.autoScaleUp(height); - setBoundsInPixel(x, y, width, height); + setBoundsInPixels(x, y, width, height); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setBoundsInPixel (int x, int y, int width, int height) { - checkWidget (); +void setBoundsInPixels (int x, int y, int width, int height) { int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE; setBoundsInPixels (x, y, Math.max (0, width), Math.max (0, height), flags); } @@ -3294,15 +3273,13 @@ void setBoundsInPixels (int x, int y, int width, int height, int flags, boolean * </ul> */ public void setBounds (Rectangle rect) { - setBoundsInPixels(DPIUtil.autoScaleUp(rect)); -} -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setBoundsInPixels (Rectangle rect) { checkWidget (); if (rect == null) error (SWT.ERROR_NULL_ARGUMENT); - setBoundsInPixel (rect.x, rect.y, rect.width, rect.height); + setBoundsInPixels(DPIUtil.autoScaleUp(rect)); +} + +void setBoundsInPixels (Rectangle rect) { + setBoundsInPixels (rect.x, rect.y, rect.width, rect.height); } /** @@ -3551,16 +3528,13 @@ public void setLayoutData (Object layoutData) { * </ul> */ public void setLocation (int x, int y) { + checkWidget (); x = DPIUtil.autoScaleUp(x); y = DPIUtil.autoScaleUp(y); setLocationInPixels(x, y); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setLocationInPixels (int x, int y) { - checkWidget (); +void setLocationInPixels (int x, int y) { int flags = OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE; /* * Feature in WinCE. The SWP_DRAWFRAME flag for SetWindowPos() @@ -3587,15 +3561,12 @@ public void setLocationInPixels (int x, int y) { * </ul> */ public void setLocation (Point location) { + checkWidget (); + if (location == null) error (SWT.ERROR_NULL_ARGUMENT); setLocationInPixels(DPIUtil.autoScaleUp(location)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setLocationInPixels (Point location) { - checkWidget (); - if (location == null) error (SWT.ERROR_NULL_ARGUMENT); +void setLocationInPixels (Point location) { setLocationInPixels (location.x, location.y); } @@ -3790,16 +3761,13 @@ boolean setSavedFocus () { * </ul> */ public void setSize (int width, int height) { + checkWidget (); width = DPIUtil.autoScaleUp(width); height = DPIUtil.autoScaleUp(height); setSizeInPixels(width, height); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setSizeInPixels (int width, int height) { - checkWidget (); +void setSizeInPixels (int width, int height) { int flags = OS.SWP_NOMOVE | OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE; setBoundsInPixels (0, 0, Math.max (0, width), Math.max (0, height), flags); } @@ -3823,15 +3791,12 @@ public void setSizeInPixels (int width, int height) { * </ul> */ public void setSize (Point size) { + checkWidget (); + if (size == null) error (SWT.ERROR_NULL_ARGUMENT); setSizeInPixels(DPIUtil.autoScaleUp(size)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setSizeInPixels (Point size) { - checkWidget (); - if (size == null) error (SWT.ERROR_NULL_ARGUMENT); +void setSizeInPixels (Point size) { setSizeInPixels (size.x, size.y); } @@ -4037,13 +4002,11 @@ void subclass () { * @since 2.1 */ public Point toControl (int x, int y) { + checkWidget (); return DPIUtil.autoScaleDown(toControlInPixels(DPIUtil.autoScaleUp(x), DPIUtil.autoScaleUp(y))); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Point toControlInPixels (int x, int y) { - checkWidget (); + +Point toControlInPixels (int x, int y) { POINT pt = new POINT (); pt.x = x; pt.y = y; OS.ScreenToClient (handle, pt); @@ -4071,14 +4034,12 @@ public Point toControlInPixels (int x, int y) { * </ul> */ public Point toControl (Point point) { - return DPIUtil.autoScaleDown(toControlInPixels(DPIUtil.autoScaleUp(point))); -} -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Point toControlInPixels (Point point) { checkWidget (); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); + return DPIUtil.autoScaleDown(toControlInPixels(DPIUtil.autoScaleUp(point))); +} + +Point toControlInPixels (Point point) { return toControlInPixels (point.x, point.y); } @@ -4103,13 +4064,11 @@ public Point toControlInPixels (Point point) { * @since 2.1 */ public Point toDisplay (int x, int y) { + checkWidget (); return DPIUtil.autoScaleDown(toDisplayInPixels(DPIUtil.autoScaleUp(x), DPIUtil.autoScaleUp(y))); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Point toDisplayInPixels (int x, int y) { - checkWidget (); + +Point toDisplayInPixels (int x, int y) { POINT pt = new POINT (); pt.x = x; pt.y = y; OS.ClientToScreen (handle, pt); @@ -4137,14 +4096,12 @@ public Point toDisplayInPixels (int x, int y) { * </ul> */ public Point toDisplay (Point point) { - return DPIUtil.autoScaleDown(toDisplayInPixels(DPIUtil.autoScaleUp(point))); -} -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Point toDisplayInPixels (Point point) { checkWidget (); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); + return DPIUtil.autoScaleDown(toDisplayInPixels(DPIUtil.autoScaleUp(point))); +} + +Point toDisplayInPixels (Point point) { return toDisplayInPixels (point.x, point.y); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java index e2621bfe30..e6e5a71584 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java @@ -141,9 +141,7 @@ protected void checkSubclass () { if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { - checkWidget (); +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { int width = 0, height = 0; int border = getBorderWidthInPixels (); int newWidth = wHint == SWT.DEFAULT ? 0x3FFF : wHint + (border * 2); @@ -561,6 +559,7 @@ public CoolItem [] getItems () { * </ul> */ public Point [] getItemSizes () { + checkWidget (); Point [] sizes = getItemSizesInPixels(); if (sizes != null) { for (int i = 0; i < sizes.length; i++) { @@ -569,8 +568,8 @@ public Point [] getItemSizes () { } return sizes; } -public Point [] getItemSizesInPixels () { - checkWidget (); + +Point [] getItemSizesInPixels () { int count = (int)/*64*/OS.SendMessage (handle, OS.RB_GETBANDCOUNT, 0, 0); Point [] sizes = new Point [count]; REBARBANDINFO rbBand = new REBARBANDINFO (); @@ -829,6 +828,7 @@ void setItemColors (int foreColor, int backColor) { * </ul> */ public void setItemLayout (int [] itemOrder, int [] wrapIndices, Point [] sizes) { + checkWidget (); if (sizes != null) { for (int i = 0; i < sizes.length; i++) { sizes[i] = DPIUtil.autoScaleUp(sizes[i]); @@ -836,8 +836,8 @@ public void setItemLayout (int [] itemOrder, int [] wrapIndices, Point [] sizes) } setItemLayoutInPixels (itemOrder, wrapIndices, sizes); } -public void setItemLayoutInPixels (int [] itemOrder, int [] wrapIndices, Point [] sizes) { - checkWidget (); + +void setItemLayoutInPixels (int [] itemOrder, int [] wrapIndices, Point [] sizes) { setRedraw (false); setItemOrder (itemOrder); setWrapIndices (wrapIndices); @@ -1180,7 +1180,7 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { if (control != null) { int width = lprbcs.rcChild_right - lprbcs.rcChild_left; int height = lprbcs.rcChild_bottom - lprbcs.rcChild_top; - control.setBoundsInPixel (lprbcs.rcChild_left, lprbcs.rcChild_top, width, height); + control.setBoundsInPixels (lprbcs.rcChild_left, lprbcs.rcChild_top, width, height); } } break; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java index 251a721675..077c5092ce 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java @@ -185,12 +185,12 @@ protected void checkSubclass () { * @see Scrollable#getClientArea */ public Point computeSize (int wHint, int hHint) { + checkWidget (); wHint = (wHint != SWT.DEFAULT ? DPIUtil.autoScaleUp(wHint) : wHint); hHint = (hHint != SWT.DEFAULT ? DPIUtil.autoScaleUp(hHint) : hHint); return DPIUtil.autoScaleDown(computeSizeInPixels(wHint, hHint)); } Point computeSizeInPixels (int wHint, int hHint) { - checkWidget (); int index = parent.indexOf (this); if (index == -1) return new Point (0, 0); int width = wHint, height = hHint; @@ -222,11 +222,11 @@ void destroyWidget () { * </ul> */ public Rectangle getBounds () { + checkWidget (); return DPIUtil.autoScaleDown(getBoundsInPixels()); } -public Rectangle getBoundsInPixels () { - checkWidget (); +Rectangle getBoundsInPixels () { int index = parent.indexOf (this); if (index == -1) return new Rectangle (0, 0, 0, 0); long /*int*/ hwnd = parent.handle; @@ -384,11 +384,11 @@ public void setControl (Control control) { * </ul> */ public Point getPreferredSize () { + checkWidget (); return DPIUtil.autoScaleDown(getPreferredSizeInPixels()); } -public Point getPreferredSizeInPixels () { - checkWidget (); +Point getPreferredSizeInPixels () { int index = parent.indexOf (this); if (index == -1) return new Point (0, 0); long /*int*/ hwnd = parent.handle; @@ -415,11 +415,11 @@ public Point getPreferredSizeInPixels () { * </ul> */ public void setPreferredSize (int width, int height) { + checkWidget (); setPreferredSizeInPixels(DPIUtil.autoScaleUp(width), DPIUtil.autoScaleUp(height)); } -public void setPreferredSizeInPixels (int width, int height) { - checkWidget (); +void setPreferredSizeInPixels (int width, int height) { int index = parent.indexOf (this); if (index == -1) return; width = Math.max (0, width); @@ -463,12 +463,12 @@ public void setPreferredSizeInPixels (int width, int height) { * </ul> */ public void setPreferredSize (Point size) { + checkWidget (); + if (size == null) error(SWT.ERROR_NULL_ARGUMENT); setPreferredSizeInPixels(DPIUtil.autoScaleUp(size)); } -public void setPreferredSizeInPixels (Point size) { - checkWidget (); - if (size == null) error(SWT.ERROR_NULL_ARGUMENT); +void setPreferredSizeInPixels (Point size) { setPreferredSizeInPixels (size.x, size.y); } @@ -486,11 +486,11 @@ public void setPreferredSizeInPixels (Point size) { * </ul> */ public Point getSize () { + checkWidget (); return DPIUtil.autoScaleDown(getSizeInPixels()); } -public Point getSizeInPixels() { - checkWidget (); +Point getSizeInPixels() { int index = parent.indexOf (this); if (index == -1) new Point (0, 0); long /*int*/ hwnd = parent.handle; @@ -530,11 +530,11 @@ public Point getSizeInPixels() { * </ul> */ public void setSize (int width, int height) { + checkWidget (); setSizeInPixels(DPIUtil.autoScaleUp(width), DPIUtil.autoScaleUp(height)); } -public void setSizeInPixels (int width, int height) { - checkWidget (); +void setSizeInPixels (int width, int height) { int index = parent.indexOf (this); if (index == -1) return; width = Math.max (0, width); @@ -597,11 +597,12 @@ public void setSizeInPixels (int width, int height) { * </ul> */ public void setSize (Point size) { + checkWidget (); + if (size == null) error(SWT.ERROR_NULL_ARGUMENT); setSizeInPixels(DPIUtil.autoScaleUp(size)); } -public void setSizeInPixels (Point size) { - if (size == null) error(SWT.ERROR_NULL_ARGUMENT); +void setSizeInPixels (Point size) { setSizeInPixels (size.x, size.y); } @@ -619,11 +620,11 @@ public void setSizeInPixels (Point size) { * @since 2.0 */ public Point getMinimumSize () { + checkWidget (); return DPIUtil.autoScaleDown(getMinimumSizeInPixels()); } -public Point getMinimumSizeInPixels () { - checkWidget (); +Point getMinimumSizeInPixels () { int index = parent.indexOf (this); if (index == -1) return new Point (0, 0); long /*int*/ hwnd = parent.handle; @@ -652,11 +653,11 @@ public Point getMinimumSizeInPixels () { * @since 2.0 */ public void setMinimumSize (int width, int height) { + checkWidget (); setMinimumSizeInPixels(DPIUtil.autoScaleUp(width), DPIUtil.autoScaleUp(height)); } -public void setMinimumSizeInPixels (int width, int height) { - checkWidget (); +void setMinimumSizeInPixels (int width, int height) { int index = parent.indexOf (this); if (index == -1) return; width = Math.max (0, width); @@ -701,12 +702,12 @@ public void setMinimumSizeInPixels (int width, int height) { * @since 2.0 */ public void setMinimumSize (Point size) { + checkWidget (); + if (size == null) error (SWT.ERROR_NULL_ARGUMENT); setMinimumSizeInPixels(DPIUtil.autoScaleUp(size)); } -public void setMinimumSizeInPixels (Point size) { - checkWidget (); - if (size == null) error (SWT.ERROR_NULL_ARGUMENT); +void setMinimumSizeInPixels (Point size) { setMinimumSizeInPixels (size.x, size.y); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java index cfa2c164f0..e30d1a8e79 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java @@ -247,8 +247,7 @@ protected void checkSubclass () { if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int width = 0, height = 0; if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java index 685761a028..6f42df63d2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java @@ -348,8 +348,7 @@ Control computeTabRoot () { return this; } -@Override -public Rectangle computeTrimInPixels (int x, int y, int width, int height) { +@Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget (); /* Get the size of the trimmings */ @@ -491,8 +490,7 @@ void fixDecorations (Decorations newDecorations, Control control, Menu [] menus) } } -@Override -public Rectangle getBoundsInPixels () { +@Override Rectangle getBoundsInPixels () { checkWidget (); if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { @@ -512,8 +510,7 @@ public Rectangle getBoundsInPixels () { return super.getBoundsInPixels (); } -@Override -public Rectangle getClientAreaInPixels () { +@Override Rectangle getClientAreaInPixels () { checkWidget (); /* * Note: The CommandBar is part of the client area, @@ -646,8 +643,7 @@ public Image [] getImages () { return result; } -@Override -public Point getLocationInPixels () { +@Override Point getLocationInPixels () { checkWidget (); if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { @@ -726,8 +722,7 @@ String getNameText () { return getText (); } -@Override -public Point getSizeInPixels () { +@Override Point getSizeInPixels () { checkWidget (); if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java index 896d9330b9..cdfdc95798 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java @@ -1512,7 +1512,7 @@ public Menu getMenuBar () { * </ul> */ @Override -public Rectangle getBoundsInPixels () { +protected Rectangle getBoundsInPixels () { checkDevice (); if (OS.GetSystemMetrics (OS.SM_CMONITORS) < 2) { int width = OS.GetSystemMetrics (OS.SM_CXSCREEN); @@ -1580,7 +1580,7 @@ int getClickCount (int type, int button, long /*int*/ hwnd, long /*int*/ lParam) * @see #getBounds */ @Override -public Rectangle getClientAreaInPixels () { +protected Rectangle getClientAreaInPixels () { checkDevice (); if (OS.GetSystemMetrics (OS.SM_CMONITORS) < 2) { RECT rect = new RECT (); @@ -1660,6 +1660,7 @@ public Control getCursorControl () { * </ul> */ public Point getCursorLocation () { + checkDevice (); return DPIUtil.autoScaleDown(getCursorLocationInPixels()); } @@ -1667,7 +1668,6 @@ public Point getCursorLocation () { * @noreference This method is not intended to be referenced by clients. */ public Point getCursorLocationInPixels () { - checkDevice (); POINT pt = new POINT (); OS.GetCursorPos (pt); return new Point (pt.x, pt.y); @@ -2959,6 +2959,8 @@ boolean isValidThread () { * @since 2.1.2 */ public Point map (Control from, Control to, Point point) { + checkDevice (); + if (point == null) error (SWT.ERROR_NULL_ARGUMENT); point = DPIUtil.autoScaleUp(point); return DPIUtil.autoScaleDown(mapInPixels(from, to, point)); } @@ -2967,8 +2969,6 @@ public Point map (Control from, Control to, Point point) { * @noreference This method is not intended to be referenced by clients. */ public Point mapInPixels (Control from, Control to, Point point) { - checkDevice (); - if (point == null) error (SWT.ERROR_NULL_ARGUMENT); return mapInPixels (from, to, point.x, point.y); } @@ -3009,16 +3009,13 @@ public Point mapInPixels (Control from, Control to, Point point) { * @since 2.1.2 */ public Point map (Control from, Control to, int x, int y) { + checkDevice (); x = DPIUtil.autoScaleUp(x); y = DPIUtil.autoScaleUp(y); return DPIUtil.autoScaleDown(mapInPixels(from, to, x, y)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Point mapInPixels (Control from, Control to, int x, int y) { - checkDevice (); +Point mapInPixels (Control from, Control to, int x, int y) { if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (from == to) return new Point (x, y); @@ -3068,16 +3065,13 @@ public Point mapInPixels (Control from, Control to, int x, int y) { * @since 2.1.2 */ public Rectangle map (Control from, Control to, Rectangle rectangle) { + checkDevice (); + if (rectangle == null) error (SWT.ERROR_NULL_ARGUMENT); rectangle = DPIUtil.autoScaleUp(rectangle); return DPIUtil.autoScaleDown(mapInPixels(from, to, rectangle)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle mapInPixels (Control from, Control to, Rectangle rectangle) { - checkDevice (); - if (rectangle == null) error (SWT.ERROR_NULL_ARGUMENT); +Rectangle mapInPixels (Control from, Control to, Rectangle rectangle) { return mapInPixels (from, to, rectangle.x, rectangle.y, rectangle.width, rectangle.height); } @@ -3120,17 +3114,15 @@ public Rectangle mapInPixels (Control from, Control to, Rectangle rectangle) { * @since 2.1.2 */ public Rectangle map (Control from, Control to, int x, int y, int width, int height) { + checkDevice (); x = DPIUtil.autoScaleUp(x); y = DPIUtil.autoScaleUp(y); width = DPIUtil.autoScaleUp(width); height = DPIUtil.autoScaleUp(height); return DPIUtil.autoScaleDown(mapInPixels(from, to, x, y, width, height)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle mapInPixels (Control from, Control to, int x, int y, int width, int height) { - checkDevice (); + +Rectangle mapInPixels (Control from, Control to, int x, int y, int width, int height) { if (from != null && from.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (to != null && to.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (from == to) return new Rectangle (x, y, width, height); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java index de6695f217..e8c99bab60 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java @@ -128,9 +128,7 @@ static int checkStyle (int style) { return style | SWT.NO_BACKGROUND; } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { - checkWidget (); +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { int height = 0, width = 0; if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { if (itemCount > 0) { @@ -395,13 +393,11 @@ public ExpandItem [] getItems () { * </ul> */ public int getSpacing () { + checkWidget (); return DPIUtil.autoScaleDown(getSpacingInPixels ()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getSpacingInPixels () { - checkWidget (); + +int getSpacingInPixels () { return spacing; } @@ -573,13 +569,11 @@ void setScrollbar () { * </ul> */ public void setSpacing (int spacing) { + checkWidget (); setSpacingInPixels(DPIUtil.autoScaleUp(spacing)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setSpacingInPixels (int spacing) { - checkWidget (); + +void setSpacingInPixels (int spacing) { if (spacing < 0) return; if (spacing == this.spacing) return; this.spacing = spacing; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java index c475e9c03a..4b25b7a2a3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java @@ -297,14 +297,11 @@ public boolean getExpanded () { * </ul> */ public int getHeaderHeight () { + checkWidget (); return DPIUtil.autoScaleDown(getHeaderHeightInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getHeaderHeightInPixels () { - checkWidget (); +int getHeaderHeightInPixels () { return Math.max (parent.getBandHeight (), imageHeight); } @@ -319,13 +316,11 @@ public int getHeaderHeightInPixels () { * </ul> */ public int getHeight () { + checkWidget (); return DPIUtil.autoScaleDown(getHeightInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getHeightInPixels () { - checkWidget (); + +int getHeightInPixels () { return height; } @@ -418,7 +413,7 @@ void setBounds (int x, int y, int width, int height, boolean move, boolean size) width = Math.max (0, width - BORDER * 2); height = Math.max (0, height - BORDER); } - if (move && size) control.setBoundsInPixel (x, y + headerHeight, width, height); + if (move && size) control.setBoundsInPixels (x, y + headerHeight, width, height); if (move && !size) control.setLocationInPixels (x, y + headerHeight); if (!move && size) control.setSizeInPixels (width, height); } @@ -451,9 +446,9 @@ public void setControl (Control control) { if (!parent.isAppThemed ()) { int width = Math.max (0, this.width - BORDER * 2); int height = Math.max (0, this.height - BORDER); - control.setBoundsInPixel (x + BORDER, y + headerHeight, width, height); + control.setBoundsInPixels (x + BORDER, y + headerHeight, width, height); } else { - control.setBoundsInPixel (x, y + headerHeight, width, height); + control.setBoundsInPixels (x, y + headerHeight, width, height); } } } @@ -486,13 +481,11 @@ public void setExpanded (boolean expanded) { * </ul> */ public void setHeight (int height) { + checkWidget (); setHeightInPixels(DPIUtil.autoScaleUp(height)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setHeightInPixels (int height) { - checkWidget (); + +void setHeightInPixels (int height) { if (height < 0) return; setBounds (0, 0, width, height, false, true); if (expanded) parent.layoutItems (parent.indexOf (this) + 1, true); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java index 27a4866ce7..19fc56e3b8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java @@ -151,8 +151,7 @@ protected void checkSubclass () { if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); Point size = super.computeSizeInPixels (wHint, hHint, changed); int length = text.length (); @@ -179,8 +178,7 @@ public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { return size; } -@Override -public Rectangle computeTrimInPixels (int x, int y, int width, int height) { +@Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget (); Rectangle trim = super.computeTrimInPixels (x, y, width, height); long /*int*/ newFont, oldFont = 0; @@ -251,8 +249,7 @@ String fixText (boolean enabled) { return null; } -@Override -public Rectangle getClientAreaInPixels () { +@Override Rectangle getClientAreaInPixels () { checkWidget (); forceResize (); RECT rect = new RECT (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java index 9c97bcc465..39b1d7a2bc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java @@ -128,8 +128,7 @@ static int checkStyle (int style) { return checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int width = 0, height = 0, border = getBorderWidthInPixels (); if ((style & SWT.SEPARATOR) != 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java index dd5476ebac..68b7af17b5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java @@ -176,8 +176,7 @@ long /*int*/ callWindowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, lo return OS.DefWindowProc (hwnd, msg, wParam, lParam); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java index 2d91231977..f5bf603bc5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java @@ -215,8 +215,7 @@ static int checkStyle (int style) { return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int width = 0, height = 0; if (wHint == SWT.DEFAULT) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java index 1193d7b6af..e4935b6253 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java @@ -1445,13 +1445,13 @@ public void setEnabled (boolean enabled) { * </ul> */ public void setLocation (int x, int y) { + checkWidget (); setLocationInPixels(DPIUtil.autoScaleUp(x), DPIUtil.autoScaleUp(y)); } /** * @noreference This method is not intended to be referenced by clients. */ public void setLocationInPixels (int x, int y) { - checkWidget (); if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return; this.x = x; this.y = y; @@ -1483,16 +1483,10 @@ public void setLocationInPixels (int x, int y) { * @since 2.1 */ public void setLocation (Point location) { - setLocationInPixels(DPIUtil.autoScaleUp(location)); -} - -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setLocationInPixels (Point location) { checkWidget (); if (location == null) error (SWT.ERROR_NULL_ARGUMENT); - setLocationInPixels (location.x, location.y); + location = DPIUtil.autoScaleUp(location); + setLocationInPixels(location.x, location.y); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java index 12ff54c0dd..e3f76f49a0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java @@ -122,8 +122,7 @@ static int checkStyle (int style) { return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int border = getBorderWidthInPixels (); int width = border * 2, height = border * 2; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java index 6a3bcce92f..69983a6d5f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java @@ -126,8 +126,7 @@ static int checkStyle (int style) { return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int border = getBorderWidthInPixels (); int width = border * 2, height = border * 2; @@ -314,7 +313,7 @@ LRESULT WM_LBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) { } drawBand (bounds.x, bounds.y, width, height); if ((style & SWT.SMOOTH) != 0) { - setBoundsInPixel (bounds.x, bounds.y, width, height); + setBoundsInPixels (bounds.x, bounds.y, width, height); // widget could be disposed at this point } } @@ -346,7 +345,7 @@ LRESULT WM_LBUTTONUP (long /*int*/ wParam, long /*int*/ lParam) { Rectangle bounds = event.getBoundsInPixels(); if (event.doit) { if ((style & SWT.SMOOTH) != 0) { - setBoundsInPixel (bounds.x, bounds.y, width, height); + setBoundsInPixels (bounds.x, bounds.y, width, height); // widget could be disposed at this point } } @@ -404,7 +403,7 @@ LRESULT WM_MOUSEMOVE (long /*int*/ wParam, long /*int*/ lParam) { } drawBand (lastX, lastY, width, height); if ((style & SWT.SMOOTH) != 0) { - setBoundsInPixel (lastX, lastY, width, height); + setBoundsInPixels (lastX, lastY, width, height); // widget could be disposed at this point } return result; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java index 0351edae43..e2e716a2d0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java @@ -151,8 +151,7 @@ static int checkStyle (int style) { return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int border = getBorderWidthInPixels (); int width = border * 2, height = border * 2; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java index 2abf438c0c..239711b876 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java @@ -116,6 +116,7 @@ long /*int*/ callWindowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, lo * @see #getClientArea */ public Rectangle computeTrim (int x, int y, int width, int height) { + checkWidget (); x = DPIUtil.autoScaleUp(x); y = DPIUtil.autoScaleUp(y); width = DPIUtil.autoScaleUp(width); @@ -123,11 +124,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) { return DPIUtil.autoScaleDown(computeTrimInPixels(x, y, width, height)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle computeTrimInPixels (int x, int y, int width, int height) { - checkWidget (); +Rectangle computeTrimInPixels (int x, int y, int width, int height) { long /*int*/ scrolledHandle = scrolledHandle (); RECT rect = new RECT (); OS.SetRect (rect, x, y, x + width, y + height); @@ -205,14 +202,11 @@ void destroyScrollBar (int type) { * @see #computeTrim */ public Rectangle getClientArea () { + checkWidget (); return DPIUtil.autoScaleDown(getClientAreaInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getClientAreaInPixels () { - checkWidget (); +Rectangle getClientAreaInPixels () { forceResize (); RECT rect = new RECT (); long /*int*/ scrolledHandle = scrolledHandle (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java index a618680b8e..a7148c3783 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java @@ -931,9 +931,7 @@ public int getAlpha () { return 0xFF; } -@Override -public Rectangle getBoundsInPixels () { - checkWidget (); +@Override Rectangle getBoundsInPixels () { if (!OS.IsWinCE) { if (OS.IsIconic (handle)) return super.getBoundsInPixels (); } @@ -1031,9 +1029,7 @@ public int getImeInputMode () { return result | SWT.ALPHA; } -@Override -public Point getLocationInPixels () { - checkWidget (); +@Override Point getLocationInPixels () { if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { return super.getLocationInPixels (); @@ -1066,14 +1062,11 @@ public boolean getMaximized () { * @since 3.1 */ public Point getMinimumSize () { + checkWidget (); return DPIUtil.autoScaleDown(getMinimumSizeInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Point getMinimumSizeInPixels () { - checkWidget (); +Point getMinimumSizeInPixels () { int width = Math.max (0, minWidth); int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX; if ((style & SWT.NO_TRIM) == 0 && (style & trim) != 0) { @@ -1138,9 +1131,7 @@ public Shell getShell () { return this; } -@Override -public Point getSizeInPixels () { - checkWidget (); +@Override Point getSizeInPixels () { if (!OS.IsWinCE) { if (OS.IsIconic (handle)) return super.getSizeInPixels (); } @@ -1739,13 +1730,11 @@ public void setImeInputMode (int mode) { * @since 3.1 */ public void setMinimumSize (int width, int height) { + checkWidget (); setMinimumSizeInPixels(DPIUtil.autoScaleUp(width), DPIUtil.autoScaleUp(height)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setMinimumSizeInPixels (int width, int height) { - checkWidget (); + +void setMinimumSizeInPixels (int width, int height) { int widthLimit = 0, heightLimit = 0; int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX; if ((style & SWT.NO_TRIM) == 0 && (style & trim) != 0) { @@ -1788,14 +1777,12 @@ public void setMinimumSizeInPixels (int width, int height) { * @since 3.1 */ public void setMinimumSize (Point size) { - setMinimumSizeInPixels(DPIUtil.autoScaleUp(size)); -} -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setMinimumSizeInPixels (Point size) { checkWidget (); if (size == null) error (SWT.ERROR_NULL_ARGUMENT); + setMinimumSizeInPixels(DPIUtil.autoScaleUp(size)); +} + +void setMinimumSizeInPixels (Point size) { setMinimumSizeInPixels (size.x, size.y); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java index c3c6796c37..324fd8826b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java @@ -175,8 +175,7 @@ static int checkStyle (int style) { return checkBits (style, SWT.HORIZONTAL, SWT.VERTICAL, 0, 0, 0, 0); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int border = getBorderWidthInPixels (); int width = border * 2, height = border * 2; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java index 83c8a3fdd1..963fb7e51e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java @@ -289,8 +289,7 @@ long /*int*/ borderHandle () { return hwndText; } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int width = 0, height = 0; if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { @@ -338,8 +337,7 @@ public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { return new Point (trim.width, trim.height); } -@Override -public Rectangle computeTrimInPixels (int x, int y, int width, int height) { +@Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget (); /* Get the trim of the text control */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java index cf54077ea7..28e9358833 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java @@ -193,8 +193,7 @@ protected void checkSubclass () { if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); Point size = super.computeSizeInPixels (wHint, hHint, changed); RECT insetRect = new RECT (), itemRect = new RECT (); @@ -215,8 +214,7 @@ public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { return size; } -@Override -public Rectangle computeTrimInPixels (int x, int y, int width, int height) { +@Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget (); RECT rect = new RECT (); OS.SetRect (rect, x, y, x + width, y + height); @@ -329,8 +327,7 @@ Control findThemeControl () { return this; } -@Override -public Rectangle getClientAreaInPixels () { +@Override Rectangle getClientAreaInPixels () { checkWidget (); forceResize (); RECT rect = new RECT (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java index 594dd6f723..4e709d02aa 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java @@ -1463,9 +1463,7 @@ public void clearAll () { } } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { - checkWidget (); +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { if (fixScrollWidth) setScrollWidth (null, true); //This code is intentionally commented // if (itemHeight == -1 && hooks (SWT.MeasureItem)) { @@ -2460,13 +2458,11 @@ int getFocusIndex () { * </ul> */ public int getGridLineWidth () { + checkWidget (); return DPIUtil.autoScaleDown(getGridLineWidthInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getGridLineWidthInPixels () { - checkWidget (); + +int getGridLineWidthInPixels () { return GRID_WIDTH; } @@ -2483,14 +2479,11 @@ public int getGridLineWidthInPixels () { * @since 2.0 */ public int getHeaderHeight () { + checkWidget (); return DPIUtil.autoScaleDown(getHeaderHeightInPixels ()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getHeaderHeightInPixels () { - checkWidget (); +int getHeaderHeightInPixels () { long /*int*/ hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0); if (hwndHeader == 0) return 0; RECT rect = new RECT (); @@ -2567,14 +2560,12 @@ public TableItem getItem (int index) { * </ul> */ public TableItem getItem (Point point) { - return getItemInPixels (DPIUtil.autoScaleUp(point)); -} -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public TableItem getItemInPixels (Point point) { checkWidget (); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); + return getItemInPixels (DPIUtil.autoScaleUp(point)); +} + +TableItem getItemInPixels (Point point) { int count = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0); if (count == 0) return null; LVHITTESTINFO pinfo = new LVHITTESTINFO (); @@ -2671,14 +2662,11 @@ public int getItemCount () { * </ul> */ public int getItemHeight () { + checkWidget (); return DPIUtil.autoScaleDown(getItemHeightInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getItemHeightInPixels () { - checkWidget (); +int getItemHeightInPixels () { if (!painted && hooks (SWT.MeasureItem)) hitTestSelection (0, 0, 0); long /*int*/ empty = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 0, 0); long /*int*/ oneItem = OS.SendMessage (handle, OS.LVM_APPROXIMATEVIEWRECT, 1, 0); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java index 21486d0646..ebb755ae40 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java @@ -309,13 +309,11 @@ public String getToolTipText () { * </ul> */ public int getWidth () { + checkWidget (); return DPIUtil.autoScaleDown(getWidthInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getWidthInPixels () { - checkWidget (); + +int getWidthInPixels () { int index = parent.indexOf (this); if (index == -1) return 0; long /*int*/ hwnd = parent.handle; @@ -876,13 +874,11 @@ public void setToolTipText (String string) { * </ul> */ public void setWidth (int width) { + checkWidget (); setWidthInPixels(DPIUtil.autoScaleUp(width)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setWidthInPixels (int width) { - checkWidget (); + +void setWidthInPixels (int width) { if (width < 0) return; int index = parent.indexOf (this); if (index == -1) return; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java index 66f7690189..83a2c14c81 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java @@ -210,13 +210,11 @@ public Color getBackground (int index) { * @since 3.2 */ public Rectangle getBounds () { + checkWidget(); return DPIUtil.autoScaleDown(getBoundsInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getBoundsInPixels () { - checkWidget(); + +Rectangle getBoundsInPixels () { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); int itemIndex = parent.indexOf (this); if (itemIndex == -1) return new Rectangle (0, 0, 0, 0); @@ -238,13 +236,11 @@ public Rectangle getBoundsInPixels () { * </ul> */ public Rectangle getBounds (int index) { + checkWidget(); return DPIUtil.autoScaleDown(getBoundsInPixels(index)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getBoundsInPixels (int index) { - checkWidget(); + +Rectangle getBoundsInPixels (int index) { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); int itemIndex = parent.indexOf (this); if (itemIndex == -1) return new Rectangle (0, 0, 0, 0); @@ -586,13 +582,11 @@ public Image getImage (int index) { * </ul> */ public Rectangle getImageBounds (int index) { + checkWidget(); return DPIUtil.autoScaleDown(getImageBoundsInPixels(index)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getImageBoundsInPixels (int index) { - checkWidget(); + +Rectangle getImageBoundsInPixels (int index) { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); int itemIndex = parent.indexOf (this); if (itemIndex == -1) return new Rectangle (0, 0, 0, 0); @@ -689,13 +683,11 @@ public String getText (int index) { * @since 3.3 */ public Rectangle getTextBounds (int index) { + checkWidget(); return DPIUtil.autoScaleDown(getTextBoundsInPixels(index)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getTextBoundsInPixels (int index) { - checkWidget(); + +Rectangle getTextBoundsInPixels (int index) { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); int itemIndex = parent.indexOf (this); if (itemIndex == -1) return new Rectangle (0, 0, 0, 0); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java index 82f9cd545d..6b6d5ba8d5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java @@ -664,8 +664,7 @@ public void clearSelection () { } } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); int height = 0, width = 0; if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { @@ -713,8 +712,7 @@ public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { return new Point (trim.width, trim.height); } -@Override -public Rectangle computeTrimInPixels (int x, int y, int width, int height) { +@Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget (); Rectangle rect = super.computeTrimInPixels (x, y, width, height); /* @@ -895,8 +893,7 @@ void fixAlignment () { OS.SetWindowLong (handle, OS.GWL_STYLE, bits2); } -@Override -public int getBorderWidthInPixels () { +@Override int getBorderWidthInPixels () { checkWidget (); /* * Feature in Windows 2000 and XP. Despite the fact that WS_BORDER diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java index 1177c6053d..f124bd3399 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java @@ -188,9 +188,7 @@ protected void checkSubclass () { if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { - checkWidget (); +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { int width = 0, height = 0; if ((style & SWT.VERTICAL) != 0) { RECT rect = new RECT (); @@ -251,9 +249,7 @@ public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { return new Point (width, height); } -@Override -public Rectangle computeTrimInPixels (int x, int y, int width, int height) { - checkWidget (); +@Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { Rectangle trim = super.computeTrimInPixels (x, y, width, height); int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); if ((bits & OS.CCS_NODIVIDER) == 0) trim.height += 2; @@ -548,12 +544,12 @@ public ToolItem getItem (int index) { * </ul> */ public ToolItem getItem (Point point) { + checkWidget (); + if (point == null) error (SWT.ERROR_NULL_ARGUMENT); return getItemInPixels(DPIUtil.autoScaleUp(point)); } -public ToolItem getItemInPixels (Point point) { - checkWidget (); - if (point == null) error (SWT.ERROR_NULL_ARGUMENT); +ToolItem getItemInPixels (Point point) { ToolItem [] items = getItems (); for (int i=0; i<items.length; i++) { Rectangle rect = items [i].getBoundsInPixels (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java index c8232c3ba1..e1742c77c3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java @@ -234,13 +234,11 @@ void destroyWidget () { * </ul> */ public Rectangle getBounds () { + checkWidget(); return DPIUtil.autoScaleDown(getBoundsInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getBoundsInPixels () { - checkWidget(); + +Rectangle getBoundsInPixels () { long /*int*/ hwnd = parent.handle; int index = (int)/*64*/OS.SendMessage (hwnd, OS.TB_COMMANDTOINDEX, id, 0); RECT rect = new RECT (); @@ -395,13 +393,11 @@ public String getToolTipText () { * </ul> */ public int getWidth () { + checkWidget(); return DPIUtil.autoScaleDown(getWidthInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getWidthInPixels () { - checkWidget(); + +int getWidthInPixels () { long /*int*/ hwnd = parent.handle; int index = (int)/*64*/OS.SendMessage (hwnd, OS.TB_COMMANDTOINDEX, id, 0); RECT rect = new RECT (); @@ -932,13 +928,11 @@ public void setToolTipText (String string) { * </ul> */ public void setWidth (int width) { + checkWidget(); setWidthInPixels(DPIUtil.autoScaleUp(width)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setWidthInPixels (int width) { - checkWidget(); + +void setWidthInPixels (int width) { if ((style & SWT.SEPARATOR) == 0) return; if (width < 0) return; long /*int*/ hwnd = parent.handle; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java index e12492b129..d9043d99f5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java @@ -410,6 +410,7 @@ void drawRectangles (Rectangle [] rects, boolean stippled) { * </ul> */ public Rectangle [] getRectangles () { + checkWidget(); Rectangle [] result = getRectanglesInPixels(); for (int i = 0; i < result.length; i++) { result[i] = DPIUtil.autoScaleDown(result[i]); @@ -417,11 +418,7 @@ public Rectangle [] getRectangles () { return result; } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle [] getRectanglesInPixels () { - checkWidget(); +Rectangle [] getRectanglesInPixels () { Rectangle [] result = new Rectangle [rectangles.length]; for (int i = 0; i < rectangles.length; i++) { Rectangle current = rectangles [i]; @@ -859,17 +856,15 @@ public void setCursor(Cursor newCursor) { * </ul> */ public void setRectangles (Rectangle [] rectangles) { + checkWidget (); + if (rectangles == null) error (SWT.ERROR_NULL_ARGUMENT); for (int i = 0; i < rectangles.length; i++) { rectangles [i] = DPIUtil.autoScaleUp (rectangles [i]); } setRectanglesInPixels (rectangles); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setRectanglesInPixels (Rectangle [] rectangles) { - checkWidget (); - if (rectangles == null) error (SWT.ERROR_NULL_ARGUMENT); + +void setRectanglesInPixels (Rectangle [] rectangles) { this.rectangles = new Rectangle [rectangles.length]; for (int i = 0; i < rectangles.length; i++) { Rectangle current = rectangles [i]; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java index 224316de70..8b2f23188f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java @@ -1813,9 +1813,7 @@ long /*int*/ CompareFunc (long /*int*/ lParam1, long /*int*/ lParam2, long /*int return sortDirection == SWT.UP ? text1.compareTo (text2) : text2.compareTo (text1); } -@Override -public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { - checkWidget (); +@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { int width = 0, height = 0; if (hwndHeader != 0) { HDITEM hdItem = new HDITEM (); @@ -2932,14 +2930,11 @@ TreeItem getFocusItem () { * @since 3.1 */ public int getGridLineWidth () { + checkWidget (); return DPIUtil.autoScaleDown(getGridLineWidthInPixels ()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getGridLineWidthInPixels () { - checkWidget (); +int getGridLineWidthInPixels () { return GRID_WIDTH; } @@ -2956,13 +2951,11 @@ public int getGridLineWidthInPixels () { * @since 3.1 */ public int getHeaderHeight () { + checkWidget (); return DPIUtil.autoScaleDown(getHeaderHeightInPixels ()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getHeaderHeightInPixels () { - checkWidget (); + +int getHeaderHeightInPixels () { if (hwndHeader == 0) return 0; RECT rect = new RECT (); OS.GetWindowRect (hwndHeader, rect); @@ -3214,14 +3207,12 @@ TreeItem getItem (NMTVCUSTOMDRAW nmcd) { * </ul> */ public TreeItem getItem (Point point) { - return getItemInPixels(DPIUtil.autoScaleUp(point)); -} -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public TreeItem getItemInPixels (Point point) { checkWidget (); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); + return getItemInPixels(DPIUtil.autoScaleUp(point)); +} + +TreeItem getItemInPixels (Point point) { TVHITTESTINFO lpht = new TVHITTESTINFO (); lpht.x = point.x; lpht.y = point.y; @@ -3291,14 +3282,11 @@ int getItemCount (long /*int*/ hItem) { * </ul> */ public int getItemHeight () { + checkWidget (); return DPIUtil.autoScaleDown(getItemHeightInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getItemHeightInPixels () { - checkWidget (); +int getItemHeightInPixels () { return (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMHEIGHT, 0, 0); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java index 1fe61123d9..2c07d2d220 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java @@ -311,14 +311,11 @@ public String getToolTipText () { * </ul> */ public int getWidth () { + checkWidget (); return DPIUtil.autoScaleDown(getWidthInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public int getWidthInPixels () { - checkWidget (); +int getWidthInPixels () { int index = parent.indexOf (this); if (index == -1) return 0; long /*int*/ hwndHeader = parent.hwndHeader; @@ -734,13 +731,11 @@ public void setToolTipText (String string) { * </ul> */ public void setWidth (int width) { + checkWidget (); setWidthInPixels(DPIUtil.autoScaleUp(width)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public void setWidthInPixels (int width) { - checkWidget (); + +void setWidthInPixels (int width) { if (width < 0) return; int index = parent.indexOf (this); if (index == -1) return; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java index 096fd7ece9..9e98f80edb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java @@ -394,13 +394,11 @@ public Color getBackground (int index) { * </ul> */ public Rectangle getBounds () { + checkWidget (); return DPIUtil.autoScaleDown(getBoundsInPixels()); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getBoundsInPixels () { - checkWidget (); + +Rectangle getBoundsInPixels () { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); RECT rect = getBounds (0, true, false, false); int width = rect.right - rect.left, height = rect.bottom - rect.top; @@ -422,13 +420,11 @@ public Rectangle getBoundsInPixels () { * @since 3.1 */ public Rectangle getBounds (int index) { + checkWidget(); return DPIUtil.autoScaleDown(getBoundsInPixels(index)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getBoundsInPixels (int index) { - checkWidget(); + +Rectangle getBoundsInPixels (int index) { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); RECT rect = getBounds (index, true, true, true); int width = rect.right - rect.left, height = rect.bottom - rect.top; @@ -851,14 +847,11 @@ public Image getImage (int index) { * @since 3.1 */ public Rectangle getImageBounds (int index) { + checkWidget(); return DPIUtil.autoScaleDown(getImageBoundsInPixels(index)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getImageBoundsInPixels (int index) { - checkWidget(); +Rectangle getImageBoundsInPixels (int index) { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); RECT rect = getBounds (index, false, true, false); int width = rect.right - rect.left, height = rect.bottom - rect.top; @@ -949,14 +942,11 @@ public String getText (int index) { * @since 3.3 */ public Rectangle getTextBounds (int index) { + checkWidget(); return DPIUtil.autoScaleDown(getTextBoundsInPixels(index)); } -/** -* @noreference This method is not intended to be referenced by clients. -*/ -public Rectangle getTextBoundsInPixels (int index) { - checkWidget(); +Rectangle getTextBoundsInPixels (int index) { if (!parent.checkData (this, true)) error (SWT.ERROR_WIDGET_DISPOSED); RECT rect = getBounds (index, true, false, true); if (index == 0) rect.left += Tree.INSET - 1; |