mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-02 11:10:12 +02:00
added TMenuItem.IsLine from Graeme
git-svn-id: trunk@8987 -
This commit is contained in:
parent
30f1bff9f2
commit
d13febced8
@ -37,8 +37,8 @@ procedure TMenuItem.AddSeparator;
|
||||
var
|
||||
Item: TMenuItem;
|
||||
begin
|
||||
Item:=TMenuItem.Create(Self);
|
||||
Item.Caption:='-';
|
||||
Item := TMenuItem.Create(Self);
|
||||
Item.Caption := cLineCaption;
|
||||
Add(Item);
|
||||
end;
|
||||
|
||||
@ -203,6 +203,19 @@ begin
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
|
||||
{ Find the menu item with a Caption of ACaption. Also for compatability with
|
||||
Delphi. }
|
||||
function TMenuItem.Find(const ACaption: string): TMenuItem;
|
||||
var
|
||||
Idx: Integer;
|
||||
begin
|
||||
Result := nil;
|
||||
Idx := IndexOfCaption(ACaption);
|
||||
if Idx <> -1 then
|
||||
Result := Items[Idx];
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TMenuItem.GetImageList: TCustomImageList;
|
||||
|
||||
@ -880,6 +893,15 @@ begin
|
||||
Result:=Checked or RadioItem or AutoCheck or ShowAlwaysCheckable;
|
||||
end;
|
||||
|
||||
|
||||
{ Returns true if the current menu item is a Line (menu seperator). Added for
|
||||
Delphi compatability as well. }
|
||||
function TMenuItem.IsLine: Boolean;
|
||||
begin
|
||||
Result := FCaption = cLineCaption;
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TMenuItem.SetCaption
|
||||
Params: Value:
|
||||
|
10
lcl/menus.pp
10
lcl/menus.pp
@ -185,6 +185,7 @@ type
|
||||
FCompStyle: LongInt;
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function Find(const ACaption: string): TMenuItem;
|
||||
function GetImageList: TCustomImageList; virtual;
|
||||
function GetParentComponent: TComponent; override;
|
||||
function GetParentMenu: TMenu; virtual;
|
||||
@ -196,6 +197,7 @@ type
|
||||
function IndexOfCaption(const ACaption: string): Integer; virtual;
|
||||
function VisibleIndexOf(Item: TMenuItem): Integer;
|
||||
function IsCheckItem: boolean; virtual;
|
||||
function IsLine: Boolean;
|
||||
procedure Add(Item: TMenuItem);
|
||||
procedure AddSeparator;
|
||||
procedure Click; virtual;
|
||||
@ -208,7 +210,6 @@ type
|
||||
procedure Clear;
|
||||
function HasBitmap: boolean;
|
||||
function GetIconSize: TPoint; virtual;
|
||||
public
|
||||
// Event lists
|
||||
procedure RemoveAllHandlersOfObject(AnObject: TObject); override;
|
||||
procedure AddHandlerOnDestroy(const OnDestroyEvent: TNotifyEvent;
|
||||
@ -373,6 +374,13 @@ function NewLine: TMenuItem;
|
||||
|
||||
procedure Register;
|
||||
|
||||
|
||||
const
|
||||
cHotkeyPrefix = '&';
|
||||
cLineCaption = '-';
|
||||
cDialogSuffix = '...';
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
|
Loading…
Reference in New Issue
Block a user