carbon: trial to fix compilation after menu changes

git-svn-id: trunk@21849 -
This commit is contained in:
paul 2009-09-24 14:22:07 +00:00
parent 53265d9507
commit 60af66268f
4 changed files with 18 additions and 21 deletions

View File

@ -67,7 +67,7 @@ type
FMainEventQueue: EventQueueRef;
FTimerMap: TMap; // the map contains all installed timers
FCurrentCursor: HCURSOR;
FMainMenu: TCarbonMenu; // Main menu attached to menu bar
FMainMenu: HMENU; // Main menu attached to menu bar
FCaptureWidget: HWND; // Captured widget (TCarbonWidget descendant)
FFocusedWidget: HWND; // Forced Focus widgetset (TCarbonWidget descendant)
FOpenEventHandlerUPP: AEEventHandlerUPP;
@ -134,8 +134,8 @@ type
public
procedure SetMainMenuEnabled(AEnabled: Boolean);
procedure SetRootMenu(const AMenu: TCarbonMenu);
property MainMenu: TCarbonMenu read FMainMenu;
procedure SetRootMenu(const AMenu: HMENU);
property MainMenu: HMENU read FMainMenu;
public
procedure SetCaptureWidget(const AWidget: HWND);
procedure SetTextFractional(ACanvas: TCanvas; AEnabled: Boolean);

View File

@ -612,13 +612,10 @@ begin
DebugLn('TCarbonWidgetSet.SetMainMenuEnabled AEnabled: ' + DbgS(AEnabled));
{$ENDIF}
if FMainMenu <> nil then
if FMainMenu <> 0 then
begin
if csDesigning in FMainMenu.ComponentState then Exit;
if FMainMenu.Items.HandleAllocated then
begin
TCarbonMenu(FMainMenu.Items.Handle).SetEnable(AEnabled);
end;
if csDesigning in TCarbonMenu(FMainMenu).LCLMenuItem.ComponentState then Exit;
TCarbonMenu(FMainMenu).SetEnable(AEnabled);
end;
end;
@ -628,15 +625,16 @@ end;
Sets the menu to menu bar
------------------------------------------------------------------------------}
procedure TCarbonWidgetSet.SetRootMenu(const AMenu: TCarbonMenu);
procedure TCarbonWidgetSet.SetRootMenu(const AMenu: HMENU);
begin
{$IFDEF VerboseLCLIntf}
DebugLn('TCarbonWidgetSet.SetRootMenu AMenu: ' + DbgS(AMenu));
{$ENDIF}
if (AMenu <> nil) and not (csDesigning in AMenu.LCLMenuItem.ComponentState) then
if (AMenu <> 0) and CheckMenu(AMenu, 'SetRootMenu') and
not (csDesigning in TCarbonMenu(AMenu).LCLMenuItem.ComponentState) then
begin
AMenu.AttachToMenuBar;
TCarbonMenu(AMenu).AttachToMenuBar;
FMainMenu := AMenu;
end;
end;

View File

@ -528,7 +528,7 @@ begin
FTimerMap := TMap.Create(its4, SizeOf(TFNTimerProc));
FCurrentCursor := 0;
FMainMenu := nil;
FMainMenu := 0;
FCaptureWidget := 0;
RegisterEvents;
@ -1091,10 +1091,7 @@ begin
DebugLn('TCarbonWidgetSet.AttachMenuToWindow ' + AMenuObject.Name);
{$ENDIF}
if (AMenuHandle = 0) or not CheckMenu(AMenuHandle, 'AttachMenuToWindow') then
SetRootMenu(nil)
else
SetRootMenu(TCarbonMenu(AMenuHandle));
SetRootMenu(AMenuHandle)
end;
{------------------------------------------------------------------------------

View File

@ -917,9 +917,9 @@ begin
begin
if (TCustomForm(AWidget.LCLObject).Menu <> nil) and
(TCustomForm(AWidget.LCLObject).Menu.HandleAllocated) then
CarbonWidgetSet.SetRootMenu(TCarbonMenu(TCustomForm(AWidget.LCLObject).Menu.Handle))
CarbonWidgetSet.SetRootMenu(TCustomForm(AWidget.LCLObject).Menu.Handle)
else
CarbonWidgetSet.SetRootMenu(nil);
CarbonWidgetSet.SetRootMenu(0);
end;
end;
kEventWindowDeactivated: DoActivate:=false;
@ -1687,7 +1687,8 @@ procedure TCarbonWindow.CloseModal;
begin
if not Assigned(fWindowRef) then Exit; // not possible to show modal if not Window mode
if CarbonWidgetSet.MainMenu <> (LCLObject as TCustomForm).Menu then
if ((LCLObject as TCustomForm).Menu <> nil) and ((LCLObject as TCustomForm).Menu.HandleAllocated) and
(CarbonWidgetSet.MainMenu <> (LCLObject as TCustomForm).Menu.Handle) then
CarbonWidgetSet.SetMainMenuEnabled(True);
OSError(
@ -1709,7 +1710,8 @@ begin
Self, 'ShowModal', SSetModality);
SelectWindow(fWindowRef);
if CarbonWidgetSet.MainMenu <> (LCLObject as TCustomForm).Menu then
if ((LCLObject as TCustomForm).Menu <> nil) and ((LCLObject as TCustomForm).Menu.HandleAllocated) and
(CarbonWidgetSet.MainMenu <> (LCLObject as TCustomForm).Menu.Handle) then
CarbonWidgetSet.SetMainMenuEnabled(False);
end;