lp#1296715: refresh invalidated menus

- so we need to be a StatusListener in framework after all
- we ware updating all menus for now, instead of just one
- this would have a hugh performance hit when there is much change to the menu
- thus we just invalidate the menu and update with all changes after 100ms once

Change-Id: I48cda968cf0ae1eae0421b3424bb3e5830817e84
This commit is contained in:
Bjoern Michaelsen
2014-05-18 14:28:39 +02:00
parent b24739c98f
commit eda624641b
5 changed files with 80 additions and 1 deletions

View File

@@ -67,6 +67,7 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <vcl/menu.hxx>
#include <vcl/settings.hxx>
#include <osl/mutex.hxx>
#include <osl/file.hxx>
@@ -429,6 +430,10 @@ throw ( RuntimeException, std::exception )
OUString aFeatureURL = Event.FeatureURL.Complete;
SolarMutexGuard aSolarGuard;
{
vcl::MenuInvalidator aInvalidator;
aInvalidator.Invalidated();
}
{
if ( m_bDisposed )
return;
@@ -914,9 +919,9 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
if ( !bPopupMenu )
{
// We need only an update to reflect the current state
xMenuItemDispatch->addStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
xMenuItemDispatch->removeStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
xMenuItemDispatch->addStatusListener( static_cast< XStatusListener* >( this ), aTargetURL );
}
}
else if ( !bPopupMenu )