mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 09:39:13 +02:00
carbon: added tracking dismiss property for menus. make menu Parent property public
git-svn-id: trunk@27205 -
This commit is contained in:
parent
595a43bd40
commit
6175b6e31e
@ -48,6 +48,7 @@ type
|
||||
FParentMenu: TCarbonMenu;
|
||||
FRoot: Boolean;
|
||||
FItems: TObjectList; // of TCarbonMenu
|
||||
fDismissed: Integer;
|
||||
procedure MenuNeeded(UpdateWithParent: Boolean=True);
|
||||
function GetIndex: Integer;
|
||||
protected
|
||||
@ -76,6 +77,9 @@ type
|
||||
|
||||
function GetShortCutKey: AnsiChar;
|
||||
procedure Update;
|
||||
|
||||
property Parent: TCarbonMenu read FParentMenu;
|
||||
property Dismissed: Integer read fDismissed write fDismissed;
|
||||
end;
|
||||
|
||||
function CheckMenu(const Menu: HMENU; const AMethodName: String; AParamName: String = ''): Boolean;
|
||||
@ -145,6 +149,31 @@ begin
|
||||
Result := CallNextEventHandler(ANextHandler, AEvent);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Name: CarbonMenu_EndTracking
|
||||
Handles menu end tracking
|
||||
------------------------------------------------------------------------------}
|
||||
function CarbonMenu_EndTracking(ANextHandler: EventHandlerCallRef;
|
||||
AEvent: EventRef;
|
||||
AWidget: TObject): OSStatus; {$IFDEF darwin}mwpascal;{$ENDIF}
|
||||
var
|
||||
dis : Integer;
|
||||
begin
|
||||
{$IFDEF VerboseMenu}
|
||||
DebugLn('CarbonMenu_EndTracking');
|
||||
{$ENDIF}
|
||||
|
||||
if AWidget is TCarbonMenu then
|
||||
begin
|
||||
if GetEventParameter(AEvent, kEventParamMenuDismissed, typeUInt32, nil, sizeof(dis), nil, @dis)<>noErr then
|
||||
dis:=0;
|
||||
(AWidget as TCarbonMenu).Dismissed:=dis;
|
||||
end;
|
||||
|
||||
Result := CallNextEventHandler(ANextHandler, AEvent);
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCarbonMenu.MenuNeeded
|
||||
|
||||
@ -235,6 +264,10 @@ begin
|
||||
TmpSpec := MakeEventSpec(kEventClassMenu, kEventMenuClosed);
|
||||
InstallMenuEventHandler(Menu, RegisterObjectEventHandler(@CarbonMenu_Closed),
|
||||
1, @TmpSpec, Pointer(Self), nil);
|
||||
|
||||
TmpSpec := MakeEventSpec(kEventClassMenu, kEventMenuEndTracking);
|
||||
InstallMenuEventHandler(Menu, RegisterObjectEventHandler(@CarbonMenu_EndTracking),
|
||||
1, @TmpSpec, Pointer(Self), nil);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user