mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-24 03:09:21 +02:00
+ TAdvancedMenuBar.GetMenuItem(by command number)
This commit is contained in:
parent
c25711a2ef
commit
f3f8690b8a
@ -52,6 +52,7 @@ type
|
|||||||
function NewSubView(var Bounds: TRect; AMenu: PMenu;
|
function NewSubView(var Bounds: TRect; AMenu: PMenu;
|
||||||
AParentMenu: PMenuView): PMenuView; virtual;
|
AParentMenu: PMenuView): PMenuView; virtual;
|
||||||
procedure Update; virtual;
|
procedure Update; virtual;
|
||||||
|
function GetMenuItem(cm : word) : PMenuItem;
|
||||||
procedure HandleEvent(var Event: TEvent); virtual;
|
procedure HandleEvent(var Event: TEvent); virtual;
|
||||||
function Execute: Word; virtual;
|
function Execute: Word; virtual;
|
||||||
end;
|
end;
|
||||||
@ -760,6 +761,55 @@ begin
|
|||||||
DrawView;
|
DrawView;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TAdvancedMenuBar.GetMenuItem(cm : word) : PMenuItem;
|
||||||
|
type
|
||||||
|
PItemChain = ^TItemChain;
|
||||||
|
TItemChain = record
|
||||||
|
Next : PMenuItem;
|
||||||
|
Up : PItemChain;
|
||||||
|
end;
|
||||||
|
var Cur : PMenuItem;
|
||||||
|
Up,NUp : PItemChain;
|
||||||
|
begin
|
||||||
|
Cur:=Menu^.Items;
|
||||||
|
Up:=nil;
|
||||||
|
if cm=0 then
|
||||||
|
begin
|
||||||
|
GetMenuItem:=nil;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
while assigned(Cur) and (Cur^.Command<>cm) do
|
||||||
|
begin
|
||||||
|
if (Cur^.Command=0) and assigned(Cur^.SubMenu) and
|
||||||
|
assigned(Cur^.SubMenu^.Items) then
|
||||||
|
{subMenu}
|
||||||
|
begin
|
||||||
|
If assigned(Cur^.Next) then
|
||||||
|
begin
|
||||||
|
New(Nup);
|
||||||
|
Nup^.Up:=Up;
|
||||||
|
Nup^.next:=Cur^.Next;
|
||||||
|
Up:=Nup;
|
||||||
|
end;
|
||||||
|
Cur:=Cur^.SubMenu^.Items;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
{ normal item }
|
||||||
|
begin
|
||||||
|
if assigned(Cur^.Next) then
|
||||||
|
Cur:=Cur^.Next
|
||||||
|
else if assigned(Up) then
|
||||||
|
begin
|
||||||
|
Cur:=Up^.next;
|
||||||
|
Up:=Up^.Up;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Cur:=Nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
GetMenuItem:=Cur;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TAdvancedMenuBar.HandleEvent(var Event: TEvent);
|
procedure TAdvancedMenuBar.HandleEvent(var Event: TEvent);
|
||||||
begin
|
begin
|
||||||
case Event.What of
|
case Event.What of
|
||||||
@ -1464,7 +1514,9 @@ end;
|
|||||||
|
|
||||||
procedure NotImplemented;
|
procedure NotImplemented;
|
||||||
begin
|
begin
|
||||||
InformationBox('This function is not yet implemented...',nil);
|
InformationBox( #3'This function is not'#13+
|
||||||
|
#3+'yet implemented...'#13+
|
||||||
|
#3+'Sorry',nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure InsertButtons(ADialog: PDialog);
|
procedure InsertButtons(ADialog: PDialog);
|
||||||
@ -2008,7 +2060,10 @@ end;
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 1999-04-07 21:56:07 peter
|
Revision 1.7 1999-06-25 00:30:34 pierre
|
||||||
|
+ TAdvancedMenuBar.GetMenuItem(by command number)
|
||||||
|
|
||||||
|
Revision 1.6 1999/04/07 21:56:07 peter
|
||||||
+ object support for browser
|
+ object support for browser
|
||||||
* html help fixes
|
* html help fixes
|
||||||
* more desktop saving things
|
* more desktop saving things
|
||||||
|
Loading…
Reference in New Issue
Block a user