### Eclipse Workspace Patch 1.0
#P org.eclipse.swt
Index: Eclipse SWT PI/win32/library/os_structs.c
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.c,v
retrieving revision 1.65
diff -u -r1.65 os_structs.c
--- Eclipse SWT PI/win32/library/os_structs.c 26 Nov 2007 21:22:05 -0000 1.65
+++ Eclipse SWT PI/win32/library/os_structs.c 25 Feb 2008 01:13:43 -0000
@@ -7386,6 +7386,49 @@
}
#endif
+#ifndef NO_TPMPARAMS
+typedef struct TPMPARAMS_FID_CACHE {
+ int cached;
+ jclass clazz;
+ jfieldID cbSize, left, top, right, bottom;
+} TPMPARAMS_FID_CACHE;
+
+TPMPARAMS_FID_CACHE TPMPARAMSFc;
+
+void cacheTPMPARAMSFields(JNIEnv *env, jobject lpObject)
+{
+ if (TPMPARAMSFc.cached) return;
+ TPMPARAMSFc.clazz = (*env)->GetObjectClass(env, lpObject);
+ TPMPARAMSFc.cbSize = (*env)->GetFieldID(env, TPMPARAMSFc.clazz, "cbSize", "I");
+ TPMPARAMSFc.left = (*env)->GetFieldID(env, TPMPARAMSFc.clazz, "left", "I");
+ TPMPARAMSFc.top = (*env)->GetFieldID(env, TPMPARAMSFc.clazz, "top", "I");
+ TPMPARAMSFc.right = (*env)->GetFieldID(env, TPMPARAMSFc.clazz, "right", "I");
+ TPMPARAMSFc.bottom = (*env)->GetFieldID(env, TPMPARAMSFc.clazz, "bottom", "I");
+ TPMPARAMSFc.cached = 1;
+}
+
+TPMPARAMS *getTPMPARAMSFields(JNIEnv *env, jobject lpObject, TPMPARAMS *lpStruct)
+{
+ if (!TPMPARAMSFc.cached) cacheTPMPARAMSFields(env, lpObject);
+ lpStruct->cbSize = (*env)->GetIntField(env, lpObject, TPMPARAMSFc.cbSize);
+ lpStruct->rcExclude.left = (*env)->GetIntField(env, lpObject, TPMPARAMSFc.left);
+ lpStruct->rcExclude.top = (*env)->GetIntField(env, lpObject, TPMPARAMSFc.top);
+ lpStruct->rcExclude.right = (*env)->GetIntField(env, lpObject, TPMPARAMSFc.right);
+ lpStruct->rcExclude.bottom = (*env)->GetIntField(env, lpObject, TPMPARAMSFc.bottom);
+ return lpStruct;
+}
+
+void setTPMPARAMSFields(JNIEnv *env, jobject lpObject, TPMPARAMS *lpStruct)
+{
+ if (!TPMPARAMSFc.cached) cacheTPMPARAMSFields(env, lpObject);
+ (*env)->SetIntField(env, lpObject, TPMPARAMSFc.cbSize, (jint)lpStruct->cbSize);
+ (*env)->SetIntField(env, lpObject, TPMPARAMSFc.left, (jint)lpStruct->rcExclude.left);
+ (*env)->SetIntField(env, lpObject, TPMPARAMSFc.top, (jint)lpStruct->rcExclude.top);
+ (*env)->SetIntField(env, lpObject, TPMPARAMSFc.right, (jint)lpStruct->rcExclude.right);
+ (*env)->SetIntField(env, lpObject, TPMPARAMSFc.bottom, (jint)lpStruct->rcExclude.bottom);
+}
+#endif
+
#ifndef NO_TRACKMOUSEEVENT
typedef struct TRACKMOUSEEVENT_FID_CACHE {
int cached;
Index: Eclipse SWT PI/win32/library/os_stats.c
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.c,v
retrieving revision 1.109
diff -u -r1.109 os_stats.c
--- Eclipse SWT PI/win32/library/os_stats.c 25 Jan 2008 17:04:04 -0000 1.109
+++ Eclipse SWT PI/win32/library/os_stats.c 25 Feb 2008 01:13:37 -0000
@@ -14,8 +14,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 930;
-int OS_nativeFunctionCallCount[930];
+int OS_nativeFunctionCount = 932;
+int OS_nativeFunctionCallCount[932];
char * OS_nativeFunctionNames[] = {
"ACCEL_1sizeof",
"ACTCTX_1sizeof",
@@ -896,6 +896,7 @@
"TF_1DA_1COLOR_1sizeof",
"TF_1DISPLAYATTRIBUTE_1sizeof",
"TOOLINFO_1sizeof",
+ "TPMPARAMS_1sizeof",
"TRACKMOUSEEVENT_1sizeof",
"TRIVERTEX_1sizeof",
"TVHITTESTINFO_1sizeof",
@@ -907,6 +908,7 @@
"ToUnicode",
"TrackMouseEvent",
"TrackPopupMenu",
+ "TrackPopupMenuEx",
"TranslateAcceleratorA",
"TranslateAcceleratorW",
"TranslateCharsetInfo",
Index: Eclipse SWT PI/win32/library/os_structs.h
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/win32/library/os_structs.h,v
retrieving revision 1.54
diff -u -r1.54 os_structs.h
--- Eclipse SWT PI/win32/library/os_structs.h 26 Nov 2007 21:22:05 -0000 1.54
+++ Eclipse SWT PI/win32/library/os_structs.h 25 Feb 2008 01:13:44 -0000
@@ -1559,6 +1559,18 @@
#define TOOLINFO_sizeof() 0
#endif
+#ifndef NO_TPMPARAMS
+void cacheTPMPARAMSFields(JNIEnv *env, jobject lpObject);
+TPMPARAMS *getTPMPARAMSFields(JNIEnv *env, jobject lpObject, TPMPARAMS *lpStruct);
+void setTPMPARAMSFields(JNIEnv *env, jobject lpObject, TPMPARAMS *lpStruct);
+#define TPMPARAMS_sizeof() sizeof(TPMPARAMS)
+#else
+#define cacheTPMPARAMSFields(a,b)
+#define getTPMPARAMSFields(a,b,c) NULL
+#define setTPMPARAMSFields(a,b,c)
+#define TPMPARAMS_sizeof() 0
+#endif
+
#ifndef NO_TRACKMOUSEEVENT
void cacheTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject);
TRACKMOUSEEVENT *getTRACKMOUSEEVENTFields(JNIEnv *env, jobject lpObject, TRACKMOUSEEVENT *lpStruct);
Index: Eclipse SWT PI/win32/library/os_stats.h
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/win32/library/os_stats.h,v
retrieving revision 1.109
diff -u -r1.109 os_stats.h
--- Eclipse SWT PI/win32/library/os_stats.h 25 Jan 2008 17:04:04 -0000 1.109
+++ Eclipse SWT PI/win32/library/os_stats.h 25 Feb 2008 01:13:38 -0000
@@ -904,6 +904,7 @@
TF_1DA_1COLOR_1sizeof_FUNC,
TF_1DISPLAYATTRIBUTE_1sizeof_FUNC,
TOOLINFO_1sizeof_FUNC,
+ TPMPARAMS_1sizeof_FUNC,
TRACKMOUSEEVENT_1sizeof_FUNC,
TRIVERTEX_1sizeof_FUNC,
TVHITTESTINFO_1sizeof_FUNC,
@@ -915,6 +916,7 @@
ToUnicode_FUNC,
TrackMouseEvent_FUNC,
TrackPopupMenu_FUNC,
+ TrackPopupMenuEx_FUNC,
TranslateAcceleratorA_FUNC,
TranslateAcceleratorW_FUNC,
TranslateCharsetInfo_FUNC,
Index: Eclipse SWT PI/win32/library/os.c
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT PI/win32/library/os.c,v
retrieving revision 1.154
diff -u -r1.154 os.c
--- Eclipse SWT PI/win32/library/os.c 25 Jan 2008 17:04:04 -0000 1.154
+++ Eclipse SWT PI/win32/library/os.c 25 Feb 2008 01:13:37 -0000
@@ -14133,6 +14133,18 @@
}
#endif
+#ifndef NO_TPMPARAMS_1sizeof
+JNIEXPORT jint JNICALL OS_NATIVE(TPMPARAMS_1sizeof)
+ (JNIEnv *env, jclass that)
+{
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, TPMPARAMS_1sizeof_FUNC);
+ rc = (jint)TPMPARAMS_sizeof();
+ OS_NATIVE_EXIT(env, that, TPMPARAMS_1sizeof_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_TRACKMOUSEEVENT_1sizeof
JNIEXPORT jint JNICALL OS_NATIVE(TRACKMOUSEEVENT_1sizeof)
(JNIEnv *env, jclass that)
@@ -14287,6 +14299,22 @@
}
#endif
+#ifndef NO_TrackPopupMenuEx
+JNIEXPORT jboolean JNICALL OS_NATIVE(TrackPopupMenuEx)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jint arg3, jint arg4, jobject arg5)
+{
+ TPMPARAMS _arg5, *lparg5=NULL;
+ jboolean rc = 0;
+ OS_NATIVE_ENTER(env, that, TrackPopupMenuEx_FUNC);
+ if (arg5) if ((lparg5 = getTPMPARAMSFields(env, arg5, &_arg5)) == NULL) goto fail;
+ rc = (jboolean)TrackPopupMenuEx((HMENU)arg0, arg1, arg2, arg3, (HWND)arg4, lparg5);
+fail:
+ if (arg5 && lparg5) setTPMPARAMSFields(env, arg5, lparg5);
+ OS_NATIVE_EXIT(env, that, TrackPopupMenuEx_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_TranslateAcceleratorA
JNIEXPORT jint JNICALL OS_NATIVE(TranslateAcceleratorA)
(JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2)
Index: Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java,v
retrieving revision 1.118
diff -u -r1.118 ToolBar.java
--- Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java 10 Jul 2007 15:46:19 -0000 1.118
+++ Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java 25 Feb 2008 01:13:48 -0000
@@ -44,6 +44,7 @@
ToolItem [] items;
boolean ignoreResize, ignoreMouse;
ImageList imageList, disabledImageList, hotImageList;
+ boolean showingPushItemMenu;
static final int /*long*/ ToolBarProc;
static final TCHAR ToolBarClass = new TCHAR (0, OS.TOOLBARCLASSNAME, true);
static {
@@ -1017,7 +1018,10 @@
return ToolBarProc;
}
-LRESULT WM_CAPTURECHANGED (int /*long*/ wParam, int /*long*/ lParam) {
+LRESULT WM_CAPTURECHANGED (int wParam, int lParam) {
+ // Do not unpress the selected item while its menu is showing
+ // (if we call the super method, the ToolBar window procedure will unpress the item too).
+ if (showingPushItemMenu) return LRESULT.ZERO;
LRESULT result = super.WM_CAPTURECHANGED (wParam, lParam);
if (result != null) return result;
/*
@@ -1119,6 +1123,22 @@
* application the opportunity to cancel the operation.
*/
return LRESULT.ZERO;
+ case OS.VK_DOWN:
+ case OS.VK_UP:
+ /*
+ * Menus of SWT.DROPDOWN items are automatically triggered by Windows on the
+ * UP and DOWN keys. Here we mirror this behavior for PUSH items.
+ */
+ int itemIndex = (int)/*64*/OS.SendMessage (handle, OS.TB_GETHOTITEM, 0, 0);
+ ToolItem child = getEnabledPushItem (itemIndex);
+ if (child != null) {
+ RECT rect = new RECT ();
+ OS.SendMessage (handle, OS.TB_GETITEMRECT, itemIndex, rect);
+ if (sendItemMenuDetectEvent (child, rect, 0)) {
+ showPushItemMenu (child, rect);
+ return LRESULT.ZERO;
+ }
+ }
}
return result;
}
@@ -1131,7 +1151,42 @@
return super.WM_KILLFOCUS (wParam, lParam);
}
+LRESULT WM_LBUTTONDBLCLK (int /*long*/ wParam, int /*long*/ lParam) {
+ // Handle menu display for push items
+ POINT point = new POINT ();
+ point.x = OS.GET_X_LPARAM (lParam);
+ point.y = OS.GET_Y_LPARAM (lParam);
+ int itemIndex = (int)/*64*/OS.SendMessage (handle, OS.TB_HITTEST, 0, point);
+ ToolItem child = getEnabledPushItem (itemIndex);
+ if (child != null) {
+ RECT rect = new RECT ();
+ OS.SendMessage (handle, OS.TB_GETITEMRECT, itemIndex, rect);
+ if (sendItemMenuDetectEvent (child, rect, 0)) {
+ super.WM_LBUTTONDBLCLK (wParam, lParam);
+ showPushItemMenu (child, rect);
+ return LRESULT.ZERO;
+ }
+ }
+ return super.WM_LBUTTONDBLCLK (wParam, lParam);
+}
+
LRESULT WM_LBUTTONDOWN (int /*long*/ wParam, int /*long*/ lParam) {
+ // Handle menu display for push items
+ POINT point = new POINT ();
+ point.x = OS.GET_X_LPARAM (lParam);
+ point.y = OS.GET_Y_LPARAM (lParam);
+ int itemIndex = (int)/*64*/OS.SendMessage (handle, OS.TB_HITTEST, 0, point);
+ ToolItem child = getEnabledPushItem (itemIndex);
+ if (child != null) {
+ RECT rect = new RECT ();
+ OS.SendMessage (handle, OS.TB_GETITEMRECT, itemIndex, rect);
+ if (sendItemMenuDetectEvent (child, rect, 0)) {
+ super.WM_LBUTTONDOWN (wParam, lParam);
+ showPushItemMenu (child, rect);
+ return LRESULT.ZERO;
+ }
+ }
+
if (ignoreMouse) return null;
return super.WM_LBUTTONDOWN (wParam, lParam);
}
@@ -1299,14 +1354,18 @@
OS.MoveMemory (lpnmtb, lParam, NMTOOLBAR.sizeof);
ToolItem child = items [lpnmtb.iItem];
if (child != null) {
- Event event = new Event ();
- event.detail = SWT.ARROW;
int index = (int)/*64*/OS.SendMessage (handle, OS.TB_COMMANDTOINDEX, lpnmtb.iItem, 0);
RECT rect = new RECT ();
OS.SendMessage (handle, OS.TB_GETITEMRECT, index, rect);
- event.x = rect.left;
- event.y = rect.bottom;
- child.postEvent (SWT.Selection, event);
+ if (sendItemMenuDetectEvent (child, rect, SWT.ARROW)) {
+ showItemMenu (child, rect);
+ } else {
+ Event event = new Event ();
+ event.detail = SWT.ARROW;
+ event.x = rect.left;
+ event.y = rect.bottom;
+ child.postEvent (SWT.Selection, event);
+ }
}
break;
case OS.NM_CUSTOMDRAW:
@@ -1363,4 +1422,69 @@
return super.wmNotifyChild (hdr, wParam, lParam);
}
+private ToolItem getEnabledPushItem (int itemIndex) {
+ // Inspect non-separator item under the cursor
+ if (itemIndex >= 0) {
+ // Get item instance
+ TBBUTTON button = new TBBUTTON ();
+ OS.SendMessage (handle, OS.TB_GETBUTTON, itemIndex, button);
+ int buttonId = button.idCommand;
+ ToolItem child = items[buttonId];
+ // Only allow menu display for PUSH items
+ final int toolItemStyleMask = SWT.PUSH | SWT.CHECK | SWT.RADIO
+ | SWT.SEPARATOR | SWT.DROP_DOWN;
+ if ((child.style & toolItemStyleMask) == SWT.PUSH) {
+ // Get item state
+ int itemState = (int)/*64*/OS.SendMessage (handle, OS.TB_GETSTATE, buttonId, 0);
+ // Only attempt to show a menu if the item is enabled
+ if ((itemState & OS.TBSTATE_ENABLED) != 0) {
+ return child;
+ }
+ }
+ }
+ return null;
+}
+
+private void showPushItemMenu (ToolItem child, RECT rect) {
+ // Press item
+ int itemState = (int)/*64*/OS.SendMessage (handle, OS.TB_GETSTATE, child.id, 0);
+ itemState |= OS.TBSTATE_PRESSED;
+ OS.SendMessage (handle, OS.TB_SETSTATE, child.id, itemState);
+ // Show menu
+ showingPushItemMenu = true;
+ showItemMenu (child, rect);
+ showingPushItemMenu = false;
+ // Unpress item - reload item state since it may have changed
+ itemState = (int)/*64*/OS.SendMessage (handle, OS.TB_GETSTATE, child.id, 0);
+ itemState &= ~OS.TBSTATE_PRESSED;
+ OS.SendMessage (handle, OS.TB_SETSTATE, child.id, itemState);
+ // If the menu was cancelled by an LBUTTONDOWN event on the control, discard that event.
+ // This allows the menu to be closed on a second click.
+ OS.PeekMessage (new MSG (), handle, OS.WM_LBUTTONDOWN, OS.WM_LBUTTONDOWN, OS.PM_REMOVE);
+ // Force a redraw of the item. Otherwise, if the user cancels the menu by clicking and holding
+ // the left mouse button over the (non-client) title bar of a window
+ // that belongs to this application, the item will only get unpressed after a short delay.
+ OS.RedrawWindow (handle, rect, 0, OS.RDW_UPDATENOW);
+}
+
+private boolean sendItemMenuDetectEvent (ToolItem child, RECT rect, int detail) {
+ Event event = new Event ();
+ event.detail = detail;
+ event.x = rect.left;
+ event.y = rect.bottom;
+ child.sendEvent (SWT.MenuDetect, event);
+ Menu menu = child.menu;
+ return event.doit && menu != null && !menu.isDisposed ();
+}
+
+private void showItemMenu (ToolItem child, RECT rect) {
+ Menu menu = child.menu;
+ // Without this call, an lbuttondown event that triggers the menu
+ // will not be delivered to EventListeners until after the menu has been closed.
+ display.runDeferredEvents ();
+ OS.MapWindowPoints (handle, 0, rect, 2);
+ menu.setLocation (rect.left, rect.bottom);
+ menu._setVisible (true, rect, OS.TPM_VERTICAL);
+}
+
}
Index: Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java,v
retrieving revision 1.103
diff -u -r1.103 CoolBar.java
--- Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java 10 Jul 2007 15:46:18 -0000 1.103
+++ Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java 25 Feb 2008 01:13:47 -0000
@@ -1156,7 +1156,23 @@
event.x = lpnm.left;
event.y = lpnm.bottom;
}
- item.postEvent (SWT.Selection, event);
+
+ if (sendItemMenuDetectEvent (item, event.x, event.y, SWT.ARROW)) {
+ // Without this call, an lbuttondown event that triggers the menu
+ // will not be delivered to EventListeners until after the menu has been closed.
+ display.runDeferredEvents ();
+ RECT rect = new RECT ();
+ rect.top = lpnm.top;
+ rect.bottom = lpnm.bottom;
+ rect.left = lpnm.left;
+ rect.right = lpnm.right;
+ showItemMenu (item, rect);
+ // If the menu was cancelled by an LBUTTONDOWN event on the control, discard that event.
+ // This allows the menu to be closed on a second click.
+ OS.PeekMessage (new MSG (), handle, OS.WM_LBUTTONDOWN, OS.WM_LBUTTONDOWN, OS.PM_REMOVE);
+ } else {
+ item.postEvent (SWT.Selection, event);
+ }
}
break;
}
@@ -1184,4 +1200,33 @@
}
return super.wmNotifyChild (hdr, wParam, lParam);
}
+
+private void showItemMenu (CoolItem child, RECT rect) {
+ Menu menu = child.menu;
+ OS.MapWindowPoints (handle, 0, rect, 2);
+ int x, y;
+ int menuPosition;
+ if ((style & SWT.VERTICAL) != 0) {
+ x = rect.right;
+ y = rect.top;
+ menuPosition = OS.TPM_HORIZONTAL;
+ } else {
+ x = rect.left;
+ y = rect.bottom;
+ menuPosition = OS.TPM_VERTICAL;
+ }
+ menu.setLocation (x, y);
+ menu._setVisible (true, rect, menuPosition);
+}
+
+private boolean sendItemMenuDetectEvent (CoolItem child, int x, int y, int detail) {
+ Event event = new Event ();
+ event.detail = detail;
+ event.x = x;
+ event.y = y;
+ child.sendEvent (SWT.MenuDetect, event);
+ Menu menu = child.menu;
+ return event.doit && menu != null && !menu.isDisposed ();
+}
+
}
Index: Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java,v
retrieving revision 1.54
diff -u -r1.54 CoolItem.java
--- Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java 10 Jul 2007 15:46:18 -0000 1.54
+++ Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java 25 Feb 2008 01:13:47 -0000
@@ -34,6 +34,7 @@
public class CoolItem extends Item {
CoolBar parent;
Control control;
+ Menu menu;
int id;
boolean ideal, minimum;
@@ -112,6 +113,34 @@
}
/**
+ * Adds the listener to the collection of listeners who will
+ * be notified when the platform-specific chevron menu trigger
+ * has occurred, by sending it one of the messages defined in
+ * the MenuDetectListener
interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException
SelectionListener
@@ -279,6 +308,21 @@
}
/**
+ * Returns the receiver's chevron menu if it has one, or null
+ * if it does not.
+ *
+ * @return the receiver's drop-down menu
+ * @exception SWTException CoolBar
.
*
* @return the receiver's parent
@@ -293,6 +337,14 @@
return parent;
}
+void releaseWidget () {
+ super.releaseWidget ();
+ if (menu != null && !menu.isDisposed ()) {
+ menu.dispose ();
+ }
+ menu = null;
+}
+
void releaseHandle () {
super.releaseHandle ();
parent = null;
@@ -357,6 +409,33 @@
}
/**
+ * Sets the receiver's chevron menu to the argument, which may be
+ * null indicating that no drop-down menu should be displayed.
+ * + * If this property is null a drop-down menu can still be displayed manually by adding a + * {@link SelectionListener} to the receiver and handling{@link SWT#ARROW} events. + * + * @param menu the drop-down menu to be displayed when the receiver's arrow is pressed + * @exception SWTException
MenuDetectListener
interface.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException SelectionListener
* interface.
@@ -298,6 +327,24 @@
}
/**
+ * Returns the receiver's drop-down menu if it has one, or null
+ * if it does not.
+ * + * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled receiver is pressed. + *
+ * + * @return the receiver's drop-down menu + * @exception SWTExceptionToolBar
.
*
* @return the receiver's parent
@@ -394,6 +441,10 @@
void releaseWidget () {
super.releaseWidget ();
releaseImages ();
+ if (menu != null && !menu.isDisposed ()) {
+ menu.dispose ();
+ }
+ menu = null;
control = null;
toolTipText = null;
disabledImage = hotImage = null;
@@ -435,6 +486,33 @@
/**
* Removes the listener from the collection of listeners who will
+ * be notified when the platform-specific drop-down menu trigger has
+ * occurred.
+ *
+ * @param listener the listener which should no longer be notified
+ *
+ * @exception IllegalArgumentException + * If this property is null a drop-down menu can still be displayed manually by adding a + * {@link SelectionListener} to the receiver and handling{@link SWT#ARROW} events. + *
+ * The drop-down menu is activated when the arrow of an {@link SWT#DROP_DOWN}-styled + * receiver or any portion of an {@link SWT#PUSH}-styled receiver is pressed. + *
+ * + * @param menu the drop-down menu to be displayed when the receiver's arrow is pressed + * @exception SWTException