diff options
author | Steve Northover | 2003-07-14 18:35:24 +0000 |
---|---|---|
committer | Steve Northover | 2003-07-14 18:35:24 +0000 |
commit | 9e31c4848da674b924950acb4bf386a247c0b202 (patch) | |
tree | 8f92ef73155cb674e64bb4fbf29c301039281525 /bundles | |
parent | 4987194d8bce616de61408593d5536fbd929aa51 (diff) | |
download | eclipse.platform.swt-9e31c4848da674b924950acb4bf386a247c0b202.tar.gz eclipse.platform.swt-9e31c4848da674b924950acb4bf386a247c0b202.tar.xz eclipse.platform.swt-9e31c4848da674b924950acb4bf386a247c0b202.zip |
4608
Diffstat (limited to 'bundles')
6 files changed, 71 insertions, 32 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java index b5de070a98..c5341a815d 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java @@ -941,6 +941,7 @@ public String getToolTipText () { */ public boolean getVisible () { checkWidget (); + if (drawCount != 0) return (style & HIDDEN) == 0; int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); return (bits & OS.WS_VISIBLE) != 0; } @@ -2136,29 +2137,31 @@ boolean setRadioSelection (boolean value) { public void setRedraw (boolean redraw) { checkWidget (); /* - * This code is intentionally commented. - * * Feature in Windows. When WM_SETREDRAW is used to turn * off drawing in a widget, it clears the WS_VISIBLE bits * and then sets them when redraw is turned back on. This * means that WM_SETREDRAW will make a widget unexpectedly - * visible. - * - * There is no fix at this time. + * visible. The fix is to track the visibility state while + * drawing is turned off and restore it when drawing is + * turned back on. */ -// if (drawCount == 0) { -// int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); -// if ((bits & OS.WS_VISIBLE) == 0) return; -// } - + if (drawCount == 0) { + int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); + if ((bits & OS.WS_VISIBLE) == 0) state |= HIDDEN; + } if (redraw) { if (--drawCount == 0) { OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); - if (OS.IsWinCE) { - OS.InvalidateRect (handle, null, true); + if ((state & HIDDEN) != 0) { + state &= ~HIDDEN; + OS.ShowWindow (handle, OS.SW_HIDE); } else { - int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; - OS.RedrawWindow (handle, null, 0, flags); + if (OS.IsWinCE) { + OS.InvalidateRect (handle, null, true); + } else { + int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN; + OS.RedrawWindow (handle, null, 0, flags); + } } } } else { @@ -2263,8 +2266,12 @@ public void setToolTipText (String string) { */ public void setVisible (boolean visible) { checkWidget (); - int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); - if (((bits & OS.WS_VISIBLE) != 0) == visible) return; + if (drawCount != 0) { + if (((state & HIDDEN) == 0) == visible) return; + } else { + int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); + if (((bits & OS.WS_VISIBLE) != 0) == visible) return; + } if (visible) { /* * It is possible (but unlikely), that application @@ -2284,7 +2291,11 @@ public void setVisible (boolean visible) { */ boolean fixFocus = false; if (!visible) fixFocus = isFocusAncestor (); - OS.ShowWindow (handle, visible ? OS.SW_SHOW : OS.SW_HIDE); + if (drawCount != 0) { + state = visible ? state & ~HIDDEN : state | HIDDEN; + } else { + OS.ShowWindow (handle, visible ? OS.SW_SHOW : OS.SW_HIDE); + } if (!visible) { /* * It is possible (but unlikely), that application diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java index 06c9ffe0b1..cdbd6ac89b 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java @@ -1107,7 +1107,11 @@ public void setText (String string) { public void setVisible (boolean visible) { checkWidget (); - if (visible == OS.IsWindowVisible (handle)) return; + if (drawCount != 0) { + if (((state & HIDDEN) == 0) == visible) return; + } else { + if (visible == OS.IsWindowVisible (handle)) return; + } if (visible) { /* * It is possible (but unlikely), that application @@ -1122,16 +1126,20 @@ public void setVisible (boolean visible) { OS.CommandBar_DrawMenuBar (hwndCB, 0); } } - if (OS.IsWinCE) { - OS.ShowWindow (handle, OS.SW_SHOW); + if (drawCount != 0) { + state &= ~HIDDEN; } else { - if (menuBar != null) { - display.removeBar (menuBar); - OS.DrawMenuBar (handle); + if (OS.IsWinCE) { + OS.ShowWindow (handle, OS.SW_SHOW); + } else { + if (menuBar != null) { + display.removeBar (menuBar); + OS.DrawMenuBar (handle); + } + OS.ShowWindow (handle, swFlags); } - OS.ShowWindow (handle, swFlags); + OS.UpdateWindow (handle); } - OS.UpdateWindow (handle); } else { if (!OS.IsWinCE) { if (OS.IsIconic (handle)) { @@ -1148,7 +1156,11 @@ public void setVisible (boolean visible) { } } } - OS.ShowWindow (handle, OS.SW_HIDE); + if (drawCount != 0) { + state |= HIDDEN; + } else { + OS.ShowWindow (handle, OS.SW_HIDE); + } sendEvent (SWT.Hide); } } 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 545dc4b9f8..faf94a6090 100755 --- 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 @@ -945,8 +945,7 @@ public void setVisible (boolean visible) { * that runs during WM_SIZE that queries the visibility * of the scroll bar will get the correct value. */ - state &= ~HIDDEN; - if (!visible) state |= HIDDEN; + state = visible ? state & ~HIDDEN : state | HIDDEN; int hwnd = hwndScrollBar (), type = scrollBarType (); if (OS.ShowScrollBar (hwnd, type, visible)) { /* diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java index b043303999..693ebaaf53 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java @@ -1759,6 +1759,19 @@ public void setLinesVisible (boolean show) { public void setRedraw (boolean redraw) { checkWidget (); + /* + * Feature in Windows. When WM_SETREDRAW is used to turn + * off drawing in a widget, it clears the WS_VISIBLE bits + * and then sets them when redraw is turned back on. This + * means that WM_SETREDRAW will make a widget unexpectedly + * visible. The fix is to track the visibility state while + * drawing is turned off and restore it when drawing is turned + * back on. + */ + if (drawCount == 0) { + int bits = OS.GetWindowLong (handle, OS.GWL_STYLE); + if ((bits & OS.WS_VISIBLE) == 0) state |= HIDDEN; + } if (redraw) { if (--drawCount == 0) { /* @@ -1794,6 +1807,10 @@ public void setRedraw (boolean redraw) { */ ignoreResize = true; OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0); + if ((state & HIDDEN) != 0) { + state &= ~HIDDEN; + OS.ShowWindow (handle, OS.SW_HIDE); + } if (!ignoreResize) { setResizeChildren (false); sendEvent (SWT.Resize); 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 17d8753829..a9ded576a2 100755 --- 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 @@ -1328,10 +1328,10 @@ public void setRedraw (boolean redraw) { OS.SendMessage (handle, OS.EM_GETSEL, start, end); if (!redraw) { oldStart = start [0]; oldEnd = end [0]; - return; + } else { + if (oldStart == start [0] && oldEnd == end [0]) return; + OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0); } - if (oldStart == start [0] && oldEnd == end [0]) return; - OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java index 2fdb44e127..eaf1813be8 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java @@ -1006,7 +1006,7 @@ public void setRedraw (boolean redraw) { * the tree. */ int hItem = 0; - if (redraw) { + if (redraw && drawCount == 1) { int count = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0); if (count == 0) { TVINSERTSTRUCT tvInsert = new TVINSERTSTRUCT (); |