summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2002-12-11 16:17:23 +0000
committerSilenio Quarti <silenio>2002-12-11 16:17:23 +0000
commitb0d5f5c4347e1764793ac482cd1be0cd225992d1 (patch)
treee3f1e0f3bf596829d79ea68cda7cd0d4a93517c3
parent6bf3a2c28840deaa9f6b0f99b3a80ac6da450424 (diff)
downloadeclipse.platform.swt-b0d5f5c4347e1764793ac482cd1be0cd225992d1.tar.gz
eclipse.platform.swt-b0d5f5c4347e1764793ac482cd1be0cd225992d1.tar.xz
eclipse.platform.swt-b0d5f5c4347e1764793ac482cd1be0cd225992d1.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Caret.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java9
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java71
5 files changed, 47 insertions, 45 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java
index fa9fb8d935..0489d2f174 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/GC.java
@@ -331,7 +331,7 @@ public void drawArc(int x, int y, int width, int height, int startAngle, int end
public void drawFocus(int x, int y, int width, int height) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
//NOT DONE
- drawRectangle (x, y, width, height);
+// drawRectangle (x, y, width - 1, height - 1);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Caret.java
index 849e745ee0..7f13cb1678 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Caret.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Caret.java
@@ -61,9 +61,9 @@ boolean drawCaret () {
OS.GetPort (currentPort);
OS.SetPort (port);
int oldClip = OS.NewRgn ();
- int clipRgn = getClipping (parentHandle);
+ int visibleRgn = getVisibleRegion (parentHandle);
OS.GetClip (oldClip);
- OS.SetClip (clipRgn);
+ OS.SetClip (visibleRgn);
Rect rect = new Rect ();
OS.GetControlBounds (parentHandle, rect);
int left = rect.left + x;
@@ -76,7 +76,7 @@ boolean drawCaret () {
OS.RGBBackColor (color);
OS.InvertRect (rect);
OS.SetClip (oldClip);
- OS.DisposeRgn (clipRgn);
+ OS.DisposeRgn (visibleRgn);
OS.DisposeRgn (oldClip);
OS.SetPort (currentPort [0]);
return true;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
index 338af581fc..52ba622ff8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Control.java
@@ -360,7 +360,7 @@ int helpProc (int inControl, int inGlobalMouse, int inRequest, int outContentPro
* such that the help text will stay in the same position.
*/
int cursorHeight = 16;
- helpContent.tagSide = OS.kHMAbsoluteCenterAligned;
+ helpContent.tagSide = (short) OS.kHMAbsoluteCenterAligned;
int x = (short) (inGlobalMouse & 0xFFFF);
int y = (short) (inGlobalMouse >> 16);
if (display.helpControl != this) {
@@ -441,13 +441,12 @@ public int internal_new_GC (GCData data) {
OS.GetControlBounds (handle, rect);
Rect portRect = new Rect ();
OS.GetPortBounds (port, portRect);
- int clipRgn = getClipping (handle);
- if (paintRgn != 0) OS.SectRgn (paintRgn, clipRgn, clipRgn);
- OS.ClipCGContextToRegion (context, portRect, clipRgn);
+ visibleRgn = getVisibleRegion (handle);
+ if (paintRgn != 0) OS.SectRgn (paintRgn, visibleRgn, visibleRgn);
+ OS.ClipCGContextToRegion (context, portRect, visibleRgn);
int portHeight = portRect.bottom - portRect.top;
OS.CGContextScaleCTM (context, 1, -1);
OS.CGContextTranslateCTM (context, rect.left, -portHeight + rect.top);
- visibleRgn = clipRgn;
}
}
if (context == 0) SWT.error (SWT.ERROR_NO_HANDLES);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java
index dcac4e9175..2db10cf070 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java
@@ -511,6 +511,8 @@ void setActiveControl (Control control) {
public void setBounds (int x, int y, int width, int height) {
checkWidget ();
+ width = Math.max (0, width);
+ height = Math.max (0, height);
Rect rect = new Rect ();
OS.SetRect (rect, (short) x, (short) y, (short) (x + width), (short) (y + height));
OS.SetWindowBounds (shellHandle, (short) OS.kWindowStructureRgn, rect);
@@ -547,6 +549,8 @@ public void setMinimized (boolean minimized) {
public void setSize (int width, int height) {
checkWidget();
+ width = Math.max (0, width);
+ height = Math.max (0, height);
Rect rect = new Rect ();
OS.GetWindowBounds (shellHandle, (short) OS.kWindowStructureRgn, rect);
OS.SetRect (rect, rect.left, rect.top, (short)(rect.left + width), (short)(rect.top + height));
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
index f091003188..35dc90af4b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Widget.java
@@ -288,37 +288,6 @@ boolean filters (int eventType) {
return display.filters (eventType);
}
-int getClipping (int control) {
- int visibleRgn = OS.NewRgn (), childRgn = OS.NewRgn (), tempRgn = OS.NewRgn ();
- int window = OS.GetControlOwner (control);
- int port = OS.GetWindowPort (window);
- OS.GetPortVisibleRegion (port, visibleRgn);
- short [] count = new short [1];
- int [] outControl = new int [1];
- int tempControl = control, lastControl = 0;
- while (tempControl != 0) {
- OS.GetControlRegion (tempControl, (short) OS.kControlStructureMetaPart, tempRgn);
- OS.SectRgn (tempRgn, visibleRgn, visibleRgn);
- if (OS.EmptyRgn (visibleRgn)) break;
- OS.CountSubControls (tempControl, count);
- for (int i = 0; i < count [0]; i++) {
- OS.GetIndexedSubControl (tempControl, (short)(i + 1), outControl);
- int child = outControl [0];
- if (child == lastControl) break;
- if (!OS.IsControlVisible (child)) continue;
- OS.GetControlRegion (child, (short) OS.kControlStructureMetaPart, tempRgn);
- OS.UnionRgn (tempRgn, childRgn, childRgn);
- }
- lastControl = tempControl;
- OS.GetSuperControl (tempControl, outControl);
- tempControl = outControl [0];
- }
- OS.DiffRgn (visibleRgn, childRgn, visibleRgn);
- OS.DisposeRgn (childRgn);
- OS.DisposeRgn (tempRgn);
- return visibleRgn;
-}
-
Rect getControlBounds (int control) {
Rect rect = new Rect();
OS.GetControlBounds (control, rect);
@@ -384,6 +353,37 @@ public int getStyle () {
return style;
}
+int getVisibleRegion (int control) {
+ int visibleRgn = OS.NewRgn (), childRgn = OS.NewRgn (), tempRgn = OS.NewRgn ();
+ int window = OS.GetControlOwner (control);
+ int port = OS.GetWindowPort (window);
+ OS.GetPortVisibleRegion (port, visibleRgn);
+ short [] count = new short [1];
+ int [] outControl = new int [1];
+ int tempControl = control, lastControl = 0;
+ while (tempControl != 0) {
+ OS.GetControlRegion (tempControl, (short) OS.kControlStructureMetaPart, tempRgn);
+ OS.SectRgn (tempRgn, visibleRgn, visibleRgn);
+ if (OS.EmptyRgn (visibleRgn)) break;
+ OS.CountSubControls (tempControl, count);
+ for (int i = 0; i < count [0]; i++) {
+ OS.GetIndexedSubControl (tempControl, (short)(i + 1), outControl);
+ int child = outControl [0];
+ if (child == lastControl) break;
+ if (!OS.IsControlVisible (child)) continue;
+ OS.GetControlRegion (child, (short) OS.kControlStructureMetaPart, tempRgn);
+ OS.UnionRgn (tempRgn, childRgn, childRgn);
+ }
+ lastControl = tempControl;
+ OS.GetSuperControl (tempControl, outControl);
+ tempControl = outControl [0];
+ }
+ OS.DiffRgn (visibleRgn, childRgn, visibleRgn);
+ OS.DisposeRgn (childRgn);
+ OS.DisposeRgn (tempRgn);
+ return visibleRgn;
+}
+
int helpProc (int inControl, int inGlobalMouse, int inRequest, int outContentProvided, int ioHelpContent) {
return OS.eventNotHandledErr;
}
@@ -459,16 +459,15 @@ int kEventControlDraw (int nextHandler, int theEvent, int userData) {
OS.GetEventParameter (theEvent, OS.kEventParamDirectObject, OS.typeControlRef, null, 4, null, theControl);
int [] region = new int [1];
OS.GetEventParameter (theEvent, OS.kEventParamRgnHandle, OS.typeQDRgnHandle, null, 4, null, region);
- int clipRgn = getClipping (theControl [0]);
+ int visibleRgn = getVisibleRegion (theControl [0]);
int oldClip = OS.NewRgn ();
OS.GetClip (oldClip);
-// OS.SectRgn(oldRgn, clipRgn, clipRgn);
- OS.SectRgn(region [0], clipRgn, clipRgn);
- OS.SetClip (clipRgn);
+ OS.SectRgn(region [0], visibleRgn, visibleRgn);
+ OS.SetClip (visibleRgn);
drawWidget (theControl [0]);
int result = OS.CallNextEventHandler (nextHandler, theEvent);
OS.SetClip (oldClip);
- OS.DisposeRgn (clipRgn);
+ OS.DisposeRgn (visibleRgn);
OS.DisposeRgn (oldClip);
return result;
}