From 05b4e992fa50dab4e0be8631d4dae8a3eeb49304 Mon Sep 17 00:00:00 2001 From: "saari%netscape.com" Date: Thu, 4 Feb 1999 05:12:22 +0000 Subject: [PATCH] added the fix I made for Mac --- widget/src/gtk/nsMenuBar.cpp | 32 +++++++++++++++++++++++++++++++- widget/src/motif/nsMenuBar.cpp | 32 +++++++++++++++++++++++++++++++- widget/src/windows/nsMenuBar.cpp | 31 ++++++++++++++++++++++++++++++- 3 files changed, 92 insertions(+), 3 deletions(-) diff --git a/widget/src/gtk/nsMenuBar.cpp b/widget/src/gtk/nsMenuBar.cpp index 7a495cf1fc4..2621f354619 100644 --- a/widget/src/gtk/nsMenuBar.cpp +++ b/widget/src/gtk/nsMenuBar.cpp @@ -26,7 +26,37 @@ #include "nsStringUtil.h" static NS_DEFINE_IID(kMenuBarIID, NS_IMENUBAR_IID); -NS_IMPL_ISUPPORTS(nsMenuBar, kMenuBarIID) +static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +//NS_IMPL_ISUPPORTS(nsMenuBar, kMenuBarIID) + +nsresult nsMenuBar::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + + *aInstancePtr = NULL; + + if (aIID.Equals(kIMenuBarIID)) { + *aInstancePtr = (void*) ((nsIMenuBar*) this); + NS_ADDREF_THIS(); + return NS_OK; + } + if (aIID.Equals(kISupportsIID)) { + *aInstancePtr = (void*) ((nsISupports*)(nsIMenuBar*) this); + NS_ADDREF_THIS(); + return NS_OK; + } + if (aIID.Equals(kIMenuListenerIID)) { + *aInstancePtr = (void*) ((nsIMenuListener*)this); + NS_ADDREF_THIS(); + return NS_OK; + } + return NS_NOINTERFACE; +} + +NS_IMPL_ADDREF(nsMenuBar) +NS_IMPL_RELEASE(nsMenuBar) //------------------------------------------------------------------------- // diff --git a/widget/src/motif/nsMenuBar.cpp b/widget/src/motif/nsMenuBar.cpp index e4a3c007f75..56aa814c542 100644 --- a/widget/src/motif/nsMenuBar.cpp +++ b/widget/src/motif/nsMenuBar.cpp @@ -26,7 +26,37 @@ #include static NS_DEFINE_IID(kMenuBarIID, NS_IMENUBAR_IID); -NS_IMPL_ISUPPORTS(nsMenuBar, kMenuBarIID) +static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +//NS_IMPL_ISUPPORTS(nsMenuBar, kMenuBarIID) + +nsresult nsMenuBar::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + + *aInstancePtr = NULL; + + if (aIID.Equals(kIMenuBarIID)) { + *aInstancePtr = (void*) ((nsIMenuBar*) this); + NS_ADDREF_THIS(); + return NS_OK; + } + if (aIID.Equals(kISupportsIID)) { + *aInstancePtr = (void*) ((nsISupports*)(nsIMenuBar*) this); + NS_ADDREF_THIS(); + return NS_OK; + } + if (aIID.Equals(kIMenuListenerIID)) { + *aInstancePtr = (void*) ((nsIMenuListener*)this); + NS_ADDREF_THIS(); + return NS_OK; + } + return NS_NOINTERFACE; +} + +NS_IMPL_ADDREF(nsMenuBar) +NS_IMPL_RELEASE(nsMenuBar) //------------------------------------------------------------------------- // diff --git a/widget/src/windows/nsMenuBar.cpp b/widget/src/windows/nsMenuBar.cpp index 1deb44debd1..5a83c4f906b 100644 --- a/widget/src/windows/nsMenuBar.cpp +++ b/widget/src/windows/nsMenuBar.cpp @@ -33,8 +33,37 @@ #include "nsGfxCIID.h" static NS_DEFINE_IID(kMenuBarIID, NS_IMENUBAR_IID); -NS_IMPL_ISUPPORTS(nsMenuBar, kMenuBarIID) +static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +//NS_IMPL_ISUPPORTS(nsMenuBar, kMenuBarIID) +nsresult nsMenuBar::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + + *aInstancePtr = NULL; + + if (aIID.Equals(kIMenuBarIID)) { + *aInstancePtr = (void*) ((nsIMenuBar*) this); + NS_ADDREF_THIS(); + return NS_OK; + } + if (aIID.Equals(kISupportsIID)) { + *aInstancePtr = (void*) ((nsISupports*)(nsIMenuBar*) this); + NS_ADDREF_THIS(); + return NS_OK; + } + if (aIID.Equals(kIMenuListenerIID)) { + *aInstancePtr = (void*) ((nsIMenuListener*)this); + NS_ADDREF_THIS(); + return NS_OK; + } + return NS_NOINTERFACE; +} + +NS_IMPL_ADDREF(nsMenuBar) +NS_IMPL_RELEASE(nsMenuBar) //------------------------------------------------------------------------- // // nsMenuListener interface