diff options
author | Steve Northover <steve> | 2007-10-26 22:40:09 +0000 |
---|---|---|
committer | Steve Northover <steve> | 2007-10-26 22:40:09 +0000 |
commit | 1f0268d817d4d6da6a35f97f46ada77b8aa2e671 (patch) | |
tree | 27f843aa6d40666c5a0ce9b68b487d92c0de66c7 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java | |
parent | 0354f2fcd681774fe492f4e3d5f23f1a78e0b89a (diff) | |
download | eclipse.platform.swt-1f0268d817d4d6da6a35f97f46ada77b8aa2e671.tar.gz eclipse.platform.swt-1f0268d817d4d6da6a35f97f46ada77b8aa2e671.tar.xz eclipse.platform.swt-1f0268d817d4d6da6a35f97f46ada77b8aa2e671.zip |
206095 - DCR - possibility to print the contents of SWT widgets, 168979 - transparent shell, alpha in shell, Control.setRegion()
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java index efe87cb856..162123d9d6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java @@ -89,7 +89,12 @@ Composite () { * @see Widget#getStyle */ public Composite (Composite parent, int style) { - super (parent, style); + super (parent, checkStyle (style)); +} + +static int checkStyle (int style) { + style &= ~SWT.TRANSPARENT; + return style; } Control [] _getChildren () { @@ -1117,16 +1122,32 @@ int /*long*/ parentingHandle () { return fixedHandle != 0 ? fixedHandle : handle; } -void printWidget (int gc, int drawable, int depth, int x, int y) { +void printWidget (GC gc, int /*long*/ drawable, int depth, int x, int y) { + Region oldClip = new Region (gc.getDevice ()); + Region newClip = new Region (gc.getDevice ()); + gc.getClipping (oldClip); + Rectangle rect = getBounds (); + newClip.add (oldClip); + newClip.intersect (x, y, rect.width, rect.height); + gc.setClipping (newClip); super.printWidget (gc, drawable, depth, x, y); + Rectangle clientRect = getClientArea (); + Point pt = display.map (this, parent, clientRect.x, clientRect.y); + clientRect.x = x + pt.x - rect.x; + clientRect.y = y + pt.y - rect.y; + newClip.intersect (clientRect); + gc.setClipping (newClip); Control [] children = _getChildren (); - for (int i=children.length-1; i>= 0; --i) { + for (int i=children.length-1; i>=0; --i) { Control child = children [i]; if (child.getVisible ()) { Point location = child.getLocation (); child.printWidget (gc, drawable, depth, x + location.x, y + location.y); } } + gc.setClipping (oldClip); + oldClip.dispose (); + newClip.dispose (); } void redrawChildren () { |