aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2013-12-05 04:10:21 (EST)
committerLakshmi Shanmugam2013-12-05 04:15:21 (EST)
commitb7715ad10316718a00201f82cd9951c93fd257c0 (patch)
tree0bda132ef06f2a3716df5a8ffa892be9d3e8346f
parent4988c419200119bf4e94d9fb8baac88aa0de1c5d (diff)
downloadeclipse.platform.swt-b7715ad10316718a00201f82cd9951c93fd257c0.zip
eclipse.platform.swt-b7715ad10316718a00201f82cd9951c93fd257c0.tar.gz
eclipse.platform.swt-b7715ad10316718a00201f82cd9951c93fd257c0.tar.bz2
Bug 422090 - Adding/Removing SWT.MeasureEvent listener will show tree
without horizontal scrollbar Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java8
2 files changed, 25 insertions, 2 deletions
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 4538de6..b95c301 100644
--- 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
@@ -255,6 +255,25 @@ TreeItem _getItem (long /*int*/ hItem, int id) {
return id != -1 ? items [id] : new TreeItem (this, SWT.NONE, -1, -1, hItem);
}
+void _removeListener (int eventType, Listener listener) {
+ super._removeListener (eventType, listener);
+ switch (eventType) {
+ case SWT.MeasureItem: {
+ /**
+ * If H_SCROLL is set, reverting the TVS_NOHSCROLL settings which
+ * was applied while adding SWT.MeasureItem event Listener.
+ */
+ if ((style & SWT.H_SCROLL) != 0) {
+ int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
+ bits &= ~OS.TVS_NOHSCROLL;
+ OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
+ OS.InvalidateRect (handle, null, true);
+ }
+ break;
+ }
+ }
+}
+
void _setBackgroundPixel (int newPixel) {
int oldPixel = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETBKCOLOR, 0, 0);
if (oldPixel != newPixel) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
index 025c8b5..66c8b46 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
@@ -160,6 +160,11 @@ void _addListener (int eventType, Listener listener) {
eventTable.hook (eventType, listener);
}
+void _removeListener (int eventType, Listener listener) {
+ if (eventTable == null) return;
+ eventTable.unhook (eventType, listener);
+}
+
/**
* Adds the listener to the collection of listeners who will
* be notified when an event of the given type occurs. When the
@@ -923,8 +928,7 @@ void releaseWidget () {
public void removeListener (int eventType, Listener listener) {
checkWidget();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable == null) return;
- eventTable.unhook (eventType, listener);
+ _removeListener (eventType, listener);
}
/**