diff options
author | Silenio Quarti <silenio> | 2009-03-03 21:28:51 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2009-03-03 21:28:51 +0000 |
commit | cdfe3af8ffec9d092524bba6cb209b9751b9010b (patch) | |
tree | af108b014cdf4a4949dd795504fa1cbcda53b940 | |
parent | 4628154548002d323ef227c9ddc45dc6839b6bba (diff) | |
download | eclipse.platform.swt-cdfe3af8ffec9d092524bba6cb209b9751b9010b.tar.gz eclipse.platform.swt-cdfe3af8ffec9d092524bba6cb209b9751b9010b.tar.xz eclipse.platform.swt-cdfe3af8ffec9d092524bba6cb209b9751b9010b.zip |
getDrawing()/isDrawing()
14 files changed, 44 insertions, 45 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Canvas.java index 3f19be54de..1b5c9f9aba 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Canvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Canvas.java @@ -307,7 +307,8 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b if (width <= 0 || height <= 0) return; int deltaX = destX - x, deltaY = destY - y; if (deltaX == 0 && deltaY == 0) return; - if (!isDrawing (handle)) return; + if (!isDrawing ()) return; + if (!OS.IsControlVisible (handle)) return; boolean isFocus = caret != null && caret.isFocusCaret (); if (isFocus) caret.killFocus (); Rectangle clientRect = getClientArea (); 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 0e381f2ac0..e3c15114a7 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 @@ -101,7 +101,8 @@ boolean drawCaret () { if (parent == null) return false; if (parent.isDisposed ()) return false; int parentHandle = parent.handle; - if (!parent.isDrawing (parentHandle)) return false; + if (!parent.isDrawing ()) return false; + if (!OS.IsControlVisible (parentHandle)) return false; int nWidth = width, nHeight = height; if (nWidth <= 0) nWidth = DEFAULT_WIDTH; if (OS.VERSION >= 0x1040) { 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 3910b13389..a5d897b723 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 @@ -1128,9 +1128,8 @@ public boolean getDragDetect () { return (state & DRAG_DETECT) != 0; } -int getDrawCount (int control) { - if (!isTrimHandle (control) && drawCount > 0) return drawCount; - return parent.getDrawCount (control); +boolean getDrawing () { + return drawCount <= 0; } /** @@ -1599,10 +1598,10 @@ public int internal_new_GC (GCData data) { if (data != null && data.paintEvent != 0) { visibleRgn = data.visibleRgn; } else { - if (getDrawCount (handle) > 0) { - visibleRgn = OS.NewRgn (); - } else { + if (isDrawing()) { visibleRgn = getVisibleRegion (handle, true); + } else { + visibleRgn = OS.NewRgn (); } } Rect rect = new Rect (); @@ -1731,6 +1730,10 @@ boolean isDescribedByLabel () { return true; } +boolean isDrawing () { + return getDrawing() && parent.isDrawing(); +} + /** * Returns <code>true</code> if the receiver is enabled and all * ancestors up to and including the receiver's nearest ancestor diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Group.java index cf128c9097..977ad25742 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Group.java @@ -115,7 +115,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) { height += (int) bounds.height - (client.bottom - client.top); if (oldBounds.width < MIN_SIZE || oldBounds.height < MIN_SIZE) { OS.HIViewSetFrame (handle, oldBounds); - OS.HIViewSetDrawingEnabled (handle, drawCount == 0); + OS.HIViewSetDrawingEnabled (handle, getDrawing ()); } return new Rectangle (-client.left, -client.top, width, height); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ScrollBar.java index aef1546a43..b68ff92f82 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ScrollBar.java @@ -225,8 +225,8 @@ void deregister () { display.removeWidget (handle); } -int getDrawCount (int control) { - return parent.getDrawCount (control); +boolean getDrawing () { + return parent.getDrawing (); } /** @@ -437,17 +437,8 @@ void invalWindowRgn (int window, int rgn) { parent.invalWindowRgn (window, rgn); } -boolean isDrawing (int control) { - /* - * Feature in the Macintosh. The scroll bars in a DataBrowser are - * always invisible according to IsControlVisible(), despite the fact - * that they are drawn. The fix is to check our visibility flag - * instead of calling IsControlVisible(). - * - * Note: During resize IsControlVisible() returns true allowing the - * clipping to be properly calculated. - */ - return isVisible () && getDrawCount (control) == 0; +boolean isDrawing () { + return getDrawing() && parent.isDrawing(); } /** 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 c455250d00..14244fc3e5 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 @@ -722,11 +722,6 @@ public Rectangle getBounds () { return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); } -int getDrawCount (int control) { - if (!isTrimHandle (control)) return drawCount; - return 0; -} - /** * Returns <code>true</code> if the receiver is currently * in fullscreen state, and false otherwise. @@ -966,6 +961,10 @@ void invalWindowRgn (int window, int rgn) { OS.UnionRgn (rgn, invalRgn, invalRgn); } +boolean isDrawing () { + return getDrawing (); +} + public boolean isEnabled () { checkWidget(); return getEnabled (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TabFolder.java index c1bf9b493a..4d61186697 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TabFolder.java @@ -182,7 +182,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) { OS.GetTabContentRect (handle, client); if (oldBounds.width < MIN_SIZE || oldBounds.height < MIN_SIZE) { OS.HIViewSetFrame (handle, oldBounds); - OS.HIViewSetDrawingEnabled (handle, drawCount == 0); + OS.HIViewSetDrawingEnabled (handle, getDrawing ()); } x -= client.left; y -= client.top; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java index 44776df513..c0c0b45bc7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Table.java @@ -329,7 +329,7 @@ public void clear (int index) { TableItem item = items [index]; if (item != null) { if (currentItem != item) item.clear (); - if (currentItem == null && drawCount == 0) { + if (currentItem == null && getDrawing ()) { int [] id = new int [] {getId (index)}; OS.UpdateDataBrowserItems (handle, 0, id.length, id, OS.kDataBrowserItemNoProperty, OS.kDataBrowserNoItem); } @@ -433,7 +433,7 @@ public void clearAll () { TableItem item = items [i]; if (item != null) item.clear (); } - if (currentItem == null && drawCount == 0) { + if (currentItem == null && getDrawing ()) { OS.UpdateDataBrowserItems (handle, 0, 0, null, OS.kDataBrowserItemNoProperty, OS.kDataBrowserNoItem); } setScrollWidth (items, true); @@ -660,7 +660,7 @@ void createItem (TableItem item, int index) { savedAnchor = getId (Math.min (itemCount - 1, savedIndex + 1)); } } - boolean add = drawCount == 0 || index != itemCount; + boolean add = getDrawing () || index != itemCount; if (add) { checkItems (false); int [] id = new int [] {itemCount + 1}; @@ -671,7 +671,7 @@ void createItem (TableItem item, int index) { } if (itemCount == items.length) { /* Grow the array faster when redraw is off */ - int length = drawCount == 0 ? items.length + 4 : Math.max (4, items.length * 3 / 2); + int length = getDrawing () ? items.length + 4 : Math.max (4, items.length * 3 / 2); TableItem [] newItems = new TableItem [length]; System.arraycopy (items, 0, newItems, 0, items.length); items = newItems; @@ -3080,7 +3080,7 @@ boolean setScrollWidth (TableItem item) { if (currentItem != item) fixScrollWidth = true; return false; } - if (drawCount != 0) return false; + if (!getDrawing ()) return false; GC gc = new GC (this); int newWidth = item.calculateWidth (0, gc); gc.dispose (); @@ -3100,7 +3100,7 @@ boolean setScrollWidth (TableItem [] items, boolean set) { fixScrollWidth = true; return false; } - if (drawCount != 0) return false; + if (!getDrawing ()) return false; GC gc = new GC (this); int newWidth = 0; for (int i = 0; i < items.length; i++) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableItem.java index 2547f81d3a..88f521861a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TableItem.java @@ -631,7 +631,7 @@ public Rectangle getTextBounds (int index) { void redraw (int propertyID) { if (parent.currentItem == this) return; - if (parent.drawCount != 0 && propertyID != Table.CHECK_COLUMN_ID) return; + if (!getDrawing () && propertyID != Table.CHECK_COLUMN_ID) return; int itemIndex = parent.indexOf (this); if (itemIndex == -1) return; int [] id = new int [] {parent.getId (itemIndex)}; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java index 35ae581e64..7d29e0bb4d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolBar.java @@ -441,7 +441,7 @@ int [] layout (int nWidth, int nHeight, boolean resize) { } void relayout () { - if (drawCount > 0) return; + if (!getDrawing ()) return; Rectangle rect = getClientArea (); layout (rect.width, rect.height, true); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolItem.java index 87ea3c9bc4..a4fc847dd4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ToolItem.java @@ -553,8 +553,8 @@ public boolean getEnabled () { return (state & DISABLED) == 0; } -int getDrawCount (int control) { - return parent.getDrawCount (control); +boolean getDrawing () { + return parent.getDrawing (); } /** @@ -749,6 +749,10 @@ void invalWindowRgn (int window, int rgn) { parent.invalWindowRgn (window, rgn); } +boolean isDrawing () { + return getDrawing() && parent.isDrawing(); +} + /** * Returns <code>true</code> if the receiver is enabled and all * of the receiver's ancestors are enabled, and <code>false</code> diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java index 990d39b240..8a1dff6923 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Tree.java @@ -3267,7 +3267,7 @@ public void setRedraw (boolean redraw) { } boolean setScrollWidth (TreeItem item) { - if (ignoreRedraw || drawCount != 0) return false; + if (ignoreRedraw || !getDrawing ()) return false; if (columnCount != 0) return false; TreeItem parentItem = item.parentItem; if (parentItem != null && !parentItem._getExpanded ()) return false; @@ -3316,7 +3316,7 @@ boolean setScrollWidth (boolean set) { } boolean setScrollWidth (boolean set, int[] childIds, boolean recurse) { - if (ignoreRedraw || drawCount != 0) return false; + if (ignoreRedraw || !getDrawing ()) return false; if (columnCount != 0 || childIds == null) return false; GC gc = new GC (this); int newWidth = calculateWidth (childIds, gc, recurse, 0, 0); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java index 6924371f61..0d5bc466b1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/TreeItem.java @@ -887,7 +887,7 @@ public int indexOf (TreeItem item) { void redraw (int propertyID) { if (parent.ignoreRedraw) return; - if (parent.drawCount != 0 && propertyID != Tree.CHECK_COLUMN_ID) return; + if (!getDrawing () && propertyID != Tree.CHECK_COLUMN_ID) return; int parentHandle = parent.handle; int parentID = parentItem == null ? OS.kDataBrowserNoItem : parentItem.id; /* 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 4ad04c3564..49ab0fd2c8 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 @@ -836,8 +836,8 @@ public Display getDisplay () { return display; } -int getDrawCount (int control) { - return 0; +boolean getDrawing () { + return true; } Rect getInset () { @@ -952,8 +952,8 @@ public boolean isDisposed () { return (state & DISPOSED) != 0; } -boolean isDrawing (int control) { - return OS.IsControlVisible (control) && getDrawCount (control) == 0; +boolean isDrawing () { + return true; } boolean isEnabled () { |