equal
deleted
inserted
replaced
14 |
14 |
15 import org.eclipse.swt.SWT; |
15 import org.eclipse.swt.SWT; |
16 import org.eclipse.swt.internal.qt.GCData; |
16 import org.eclipse.swt.internal.qt.GCData; |
17 import org.eclipse.swt.internal.qt.OS; |
17 import org.eclipse.swt.internal.qt.OS; |
18 import org.eclipse.swt.internal.qt.graphics.GraphicsContext; |
18 import org.eclipse.swt.internal.qt.graphics.GraphicsContext; |
|
19 import org.eclipse.swt.internal.qt.graphics.WindowSurface; |
19 import org.eclipse.swt.widgets.Control; |
20 import org.eclipse.swt.widgets.Control; |
20 import org.eclipse.swt.widgets.Display; |
21 import org.eclipse.swt.widgets.Display; |
|
22 import org.eclipse.swt.widgets.Internal_PackageSupport; |
21 |
23 |
22 /** |
24 /** |
23 * Class <code>GC</code> is where all of the drawing capabilities that are |
25 * Class <code>GC</code> is where all of the drawing capabilities that are |
24 * supported by SWT are located. Instances are used to draw on either an |
26 * supported by SWT are located. Instances are used to draw on either an |
25 * <code>Image</code>, a <code>Control</code>, or directly on a |
27 * <code>Image</code>, a <code>Control</code>, or directly on a |
1033 0, |
1035 0, |
1034 (GraphicsContext.ALIGNMENT_HCENTER | GraphicsContext.ALIGNMENT_LEFT), |
1036 (GraphicsContext.ALIGNMENT_HCENTER | GraphicsContext.ALIGNMENT_LEFT), |
1035 translatedFlags, isTransparent); |
1037 translatedFlags, isTransparent); |
1036 } |
1038 } |
1037 |
1039 |
|
1040 /* |
|
1041 * Ends external rendering session. |
|
1042 */ |
|
1043 void endExternalRendering() { |
|
1044 if (drawable instanceof Control) { |
|
1045 Internal_PackageSupport.endWindowSurfaceSession((Control)drawable); |
|
1046 } |
|
1047 } |
|
1048 |
|
1049 |
1038 /** |
1050 /** |
1039 * Compares the argument to the receiver, and returns true if they represent the |
1051 * Compares the argument to the receiver, and returns true if they represent the |
1040 * <em>same</em> object using a class specific comparison. |
1052 * <em>same</em> object using a class specific comparison. |
1041 * |
1053 * |
1042 * @param object |
1054 * @param object |
1655 : GCData.XOR_MODE_OFF); |
1667 : GCData.XOR_MODE_OFF); |
1656 } |
1668 } |
1657 return (data.xorMode == GCData.XOR_MODE_ON); |
1669 return (data.xorMode == GCData.XOR_MODE_ON); |
1658 } |
1670 } |
1659 |
1671 |
|
1672 /* |
|
1673 * Getter for the window surface which is target of this |
|
1674 * GC instance. |
|
1675 * @return related WindowSurface instance if the target is widget, |
|
1676 * otherwise null, if e.g. the target is instance of Image. |
|
1677 */ |
|
1678 WindowSurface getWindowSurface() { |
|
1679 if (drawable instanceof Control) { |
|
1680 return Internal_PackageSupport.getWindowsurface(((Control)drawable).getShell()); |
|
1681 } else { |
|
1682 return null; |
|
1683 } |
|
1684 } |
|
1685 |
|
1686 |
1660 /** |
1687 /** |
1661 * Returns an integer hash code for the receiver. Any two objects that return |
1688 * Returns an integer hash code for the receiver. Any two objects that return |
1662 * <code>true</code> when passed to <code>equals</code> must return the same |
1689 * <code>true</code> when passed to <code>equals</code> must return the same |
1663 * value for this method. |
1690 * value for this method. |
1664 * |
1691 * |
2051 * </li> |
2078 * </li> |
2052 * </ul> |
2079 * </ul> |
2053 */ |
2080 */ |
2054 public Point stringExtent(String string) { |
2081 public Point stringExtent(String string) { |
2055 return textExtent(string, 0); |
2082 return textExtent(string, 0); |
|
2083 } |
|
2084 |
|
2085 /* |
|
2086 * Starts external rendering session. |
|
2087 * The sessions must be opened before starting to render to the target outside GC. |
|
2088 * This is needed in order to open the rendering session to Qt window surface. |
|
2089 * Once rendering has completed the session must be closed with |
|
2090 * endExternalRendering() -call, which closes the window surface session. |
|
2091 * |
|
2092 * If the target of this GC is not Control, this call has no effect. |
|
2093 * |
|
2094 * @return the clip area of the GC in window coordinates |
|
2095 */ |
|
2096 Rectangle startExternalRendering() { |
|
2097 if (drawable instanceof Control) { |
|
2098 return Internal_PackageSupport.startWindowSurfaceSession((Control)drawable, getClipping()); |
|
2099 } |
|
2100 return null; |
2056 } |
2101 } |
2057 |
2102 |
2058 /** |
2103 /** |
2059 * Returns the extent of the given string. Tab expansion and carriage return |
2104 * Returns the extent of the given string. Tab expansion and carriage return |
2060 * processing are performed. |
2105 * processing are performed. |