carbon: menu disabling counter is added for included modal calls. (modal window shows another modal window)

git-svn-id: trunk@23871 -
This commit is contained in:
dmitry 2010-03-07 23:22:00 +00:00
parent 96172c3bcd
commit 7c12e786fa
2 changed files with 11 additions and 2 deletions

View File

@ -68,6 +68,7 @@ type
FTimerMap: TMap; // the map contains all installed timers
FCurrentCursor: HCURSOR;
FMainMenu: HMENU; // Main menu attached to menu bar
FMenuDisableCount: Integer; // The modal menu counter
FCaptureWidget: HWND; // Captured widget (TCarbonWidget descendant)
FFocusedWidget: HWND; // Forced Focus widgetset (TCarbonWidget descendant)
FOpenEventHandlerUPP: AEEventHandlerUPP;

View File

@ -553,11 +553,19 @@ begin
{$IFDEF VerboseLCLIntf}
DebugLn('TCarbonWidgetSet.SetMainMenuEnabled AEnabled: ' + DbgS(AEnabled));
{$ENDIF}
if AEnabled then
dec(FMenuDisableCount)
else
inc(FMenuDisableCount);
if FMainMenu <> 0 then
begin
if csDesigning in TCarbonMenu(FMainMenu).LCLMenuItem.ComponentState then Exit;
TCarbonMenu(FMainMenu).SetEnable(AEnabled);
if (AEnabled and (FMenuDisableCount=0)) or
((not AEnabled) and (FMenuDisableCount<>0)) then
TCarbonMenu(FMainMenu).SetEnable(AEnabled);
end;
end;