diff -r 01cf3e701ff6 lib/irrlicht/include/IGUIContextMenu.h --- a/lib/irrlicht/include/IGUIContextMenu.h Tue Sep 02 15:08:18 2008 +0200 +++ b/lib/irrlicht/include/IGUIContextMenu.h Tue Sep 02 15:32:12 2008 +0200 @@ -140,7 +140,9 @@ //! does the element change the checked status on clicking virtual bool getItemAutoChecking(u32 idx) const = 0; - + + //! When an eventparent is set it receives events instead of the usual parent element + void setEventParent(IGUIElement *parent); }; } // end namespace gui diff -r 01cf3e701ff6 lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp --- a/lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp Tue Sep 02 15:08:18 2008 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp Tue Sep 02 15:32:12 2008 +0200 @@ -313,7 +313,7 @@ if (event.GUIEvent.Caller == this && !isMyChild(event.GUIEvent.Element) && AllowFocus) { // set event parent of submenus - setEventParent(Parent); + setEventParent(EventParent ? EventParent : Parent); if ( CloseHandling & ECMC_HIDE ) { @@ -427,11 +427,10 @@ event.GUIEvent.Caller = this; event.GUIEvent.Element = 0; event.GUIEvent.EventType = EGET_MENU_ITEM_SELECTED; - if (Parent) + if (EventParent) + EventParent->OnEvent(event); + else if (Parent) Parent->OnEvent(event); - else - if (EventParent) - EventParent->OnEvent(event); return 1; } diff -r 01cf3e701ff6 lib/irrlicht/source/Irrlicht/CGUIContextMenu.h --- a/lib/irrlicht/source/Irrlicht/CGUIContextMenu.h Tue Sep 02 15:08:18 2008 +0200 +++ b/lib/irrlicht/source/Irrlicht/CGUIContextMenu.h Tue Sep 02 15:32:12 2008 +0200 @@ -123,6 +123,9 @@ //! Reads attributes of the element virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options); + + //! When an eventparent is set it receives events instead of the usual parent element + void setEventParent(IGUIElement *parent); protected: @@ -160,8 +163,6 @@ //! Gets drawing rect of Item virtual core::rect getRect(const SItem& i, const core::rect& absolute) const; - void setEventParent(IGUIElement *parent); - s32 HighLighted; core::array Items; core::position2d Pos;