diff options
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse')
8 files changed, 104 insertions, 14 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java index 8346d2b5c3..86e796a938 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java @@ -1609,6 +1609,7 @@ public int getAscent () { /** * @noreference This method is not intended to be referenced by clients. */ + public int getAscentInPixels () { checkLayout(); return ascent; @@ -1626,7 +1627,7 @@ public int getAscentInPixels () { * </ul> * * @see #setWidth(int) - * @see #getLineBoundsInPixels(int) + * @see #getLineBounds(int) */ public Rectangle getBounds () { return DPIUtil.autoScaleDown(getBoundsInPixels()); @@ -3382,6 +3383,13 @@ public void setTextDirection (int textDirection) { * @see #setAlignment(int) */ public void setWidth (int width) { + setWidthInPixels(width != SWT.DEFAULT ? DPIUtil.autoScaleUp(width) : width); +} + +/** +* @noreference This method is not intended to be referenced by clients. +*/ +public void setWidthInPixels (int width) { checkLayout(); if (width < -1 || width == 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); if (this.wrapWidth == width) return; @@ -3404,6 +3412,13 @@ public void setWidth (int width) { * @since 3.6 */ public void setWrapIndent (int wrapIndent) { + setWrapIndentInPixels(DPIUtil.autoScaleUp(wrapIndent)); +} + +/** +* @noreference This method is not intended to be referenced by clients. +*/ +public void setWrapIndentInPixels (int wrapIndent) { checkLayout(); if (wrapIndent < 0) return; if (this.wrapIndent == wrapIndent) return; 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 50d2300eb7..dd5476ebac 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 @@ -209,17 +209,17 @@ public Point computeSizeInPixels (int wHint, int hHint, boolean changed) { int layoutWidth = layout.getWidthInPixels (); //TEMPORARY CODE if (wHint == 0) { - layout.setWidth (1); + layout.setWidthInPixels (1); Rectangle rect = layout.getBoundsInPixels (); width = 0; height = rect.height; } else { - layout.setWidth (wHint); + layout.setWidthInPixels (wHint); Rectangle rect = layout.getBoundsInPixels (); width = rect.width; height = rect.height; } - layout.setWidth (layoutWidth); + layout.setWidthInPixels (layoutWidth); } if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; @@ -1093,7 +1093,7 @@ LRESULT WM_SIZE (long /*int*/ wParam, long /*int*/ lParam) { if (OS.COMCTL32_MAJOR < 6) { RECT rect = new RECT (); OS.GetClientRect (handle, rect); - layout.setWidth (rect.right > 0 ? rect.right : -1); + layout.setWidthInPixels (rect.right > 0 ? rect.right : -1); redraw (); } return result; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java index dbbe6e85b3..676847f5ee 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java @@ -1226,7 +1226,7 @@ public void setToolTipText (String toolTip) { void showTooltip (int x, int y) { if (itemToolTip == null) return; - itemToolTip.setLocation (x, y); + itemToolTip.setLocationInPixels (x, y); itemToolTip.setVisible (true); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java index ab68be0aef..1882531a83 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java @@ -11,10 +11,10 @@ package org.eclipse.swt.widgets; -import org.eclipse.swt.internal.win32.*; import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; import org.eclipse.swt.events.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.win32.*; /** * Instances of this class are selectable user interface @@ -365,6 +365,12 @@ public int getSelection () { * </ul> */ public Point getSize () { + return DPIUtil.autoScaleDown(getSizeInPixels()); +} +/** +* @noreference This method is not intended to be referenced by clients. +*/ +public Point getSizeInPixels () { checkWidget(); parent.forceResize (); RECT rect = new RECT (); @@ -418,6 +424,12 @@ public int getThumb () { * @since 3.6 */ public Rectangle getThumbBounds () { + return DPIUtil.autoScaleDown(getThumbBoundsInPixels()); +} +/** +* @noreference This method is not intended to be referenced by clients. +*/ +public Rectangle getThumbBoundsInPixels () { checkWidget(); parent.forceResize (); SCROLLBARINFO info = new SCROLLBARINFO(); @@ -460,6 +472,12 @@ public Rectangle getThumbBounds () { * @since 3.6 */ public Rectangle getThumbTrackBounds () { + return DPIUtil.autoScaleDown(getThumbTrackBoundsInPixels()); +} +/** +* @noreference This method is not intended to be referenced by clients. +*/ +public Rectangle getThumbTrackBoundsInPixels () { checkWidget(); parent.forceResize (); SCROLLBARINFO info = new SCROLLBARINFO(); 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 8b7f1c8847..297b3e63d8 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 @@ -1065,6 +1065,13 @@ public boolean getMaximized () { * @since 3.1 */ public Point getMinimumSize () { + return DPIUtil.autoScaleDown(getMinimumSizeInPixels()); +} + +/** +* @noreference This method is not intended to be referenced by clients. +*/ +public Point getMinimumSizeInPixels () { checkWidget (); int width = Math.max (0, minWidth); int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX; @@ -1731,6 +1738,12 @@ public void setImeInputMode (int mode) { * @since 3.1 */ public void setMinimumSize (int width, int height) { + 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 (); int widthLimit = 0, heightLimit = 0; int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX; @@ -1774,9 +1787,15 @@ public void setMinimumSize (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); - setMinimumSize (size.x, size.y); + setMinimumSizeInPixels (size.x, size.y); } /** 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 582f39e972..82f9cd545d 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 @@ -940,6 +940,12 @@ public int getCaretLineNumber () { * </ul> */ public Point getCaretLocation () { + return DPIUtil.autoScaleDown(getCaretLocationInPixels()); +} +/** +* @noreference This method is not intended to be referenced by clients. +*/ +public Point getCaretLocationInPixels () { checkWidget (); /* * Bug in Windows. For some reason, Windows is unable @@ -2499,7 +2505,7 @@ int untranslateOffset (int offset) { @Override void updateMenuLocation (Event event) { - Point point = display.mapInPixels (this, null, getCaretLocation ()); + Point point = display.mapInPixels (this, null, getCaretLocationInPixels ()); event.x = point.x; event.y = point.y + getLineHeightInPixels (); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java index e1f449040b..20f8448ad3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java @@ -366,6 +366,12 @@ public void setAutoHide (boolean autoHide) { * </ul> */ public void setLocation (int x, int y) { + 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 (); this.x = x; this.y = y; @@ -396,9 +402,15 @@ public void setLocation (int x, int y) { * </ul> */ 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); - setLocation (location.x, location.y); + setLocationInPixels (location.x, location.y); } /** 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 d491e60749..e12492b129 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 @@ -11,11 +11,11 @@ package org.eclipse.swt.widgets; -import org.eclipse.swt.internal.*; -import org.eclipse.swt.internal.win32.*; -import org.eclipse.swt.graphics.*; import org.eclipse.swt.*; import org.eclipse.swt.events.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.win32.*; /** * Instances of this class implement rubber banding rectangles that are @@ -410,6 +410,17 @@ void drawRectangles (Rectangle [] rects, boolean stippled) { * </ul> */ public Rectangle [] getRectangles () { + Rectangle [] result = getRectanglesInPixels(); + for (int i = 0; i < result.length; i++) { + result[i] = DPIUtil.autoScaleDown(result[i]); + } + return result; +} + +/** +* @noreference This method is not intended to be referenced by clients. +*/ +public Rectangle [] getRectanglesInPixels () { checkWidget(); Rectangle [] result = new Rectangle [rectangles.length]; for (int i = 0; i < rectangles.length; i++) { @@ -848,6 +859,15 @@ public void setCursor(Cursor newCursor) { * </ul> */ public void setRectangles (Rectangle [] rectangles) { + 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); this.rectangles = new Rectangle [rectangles.length]; |