IHYVCLMenuItem

Overview

IHYMenuItem is an interface that represents menu items for the Hydra framework. Inside the Hydra framework, this interface is used to provide support for menu merging between host and plugins.

You can read about menu and toolbar merging in this article.

Use Case

You may use this interface to manipulate menu items, as an example, the following code demonstrates how you can manually add menu items into your host application menu:

procedure TTextEditor.HYPluginControlsRepository1AfterMergeMenuItems(
  Sender: THYPluginControlsRepository; const aHost: IHYHost;
    const anUpdateID: TGUID);
var filemenu : IHYMenuItem;
begin
  // Here, we customize manually, since the Open and
  // Save items need to go under the File menu
  if (aHost.MenuController=NIL) then Exit;
  
  filemenu := aHost.MenuController.Items.MenuItemByCaption('File');
  filemenu.Insert(0, actOpen);
  filemenu.Insert(1, actSave);
  filemenu.InsertSeparator(2);
end;

Note: Take a look at the Actions sample shipped with Hydra to see menu and toolbar merging in action.

Location


 

Action    (declared in IHYVCLControl)

Gets or sets the reference to the action associated with the control.

property Action: TBasicAction read write

Add (TBasicAction): IHYVCLMenuItem  overload

function Add(anAction: TBasicAction): IHYVCLMenuItem

Parameters:

  • anAction:

Add (string): IHYVCLMenuItem  overload

function Add(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption:

AddMenu

function AddMenu(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption:

AddSeparator

function AddSeparator: IHYVCLMenuItem

Caption    (declared in IHYVCLControl)

Gets or sets the caption associated with the control.

property Caption: string read write

Count

Gets the number of subitems of the menu item.

property Count: Integer read write

Delete

Inserts a new item into the position specified by the anIndex parameter and fills it with information from the given action object.

procedure Delete(Index: Integer)

Parameters:

  • Index: Reference to an action object.

DestroyObject    (declared in IHYVCLObjectReference)

Destroys referenced object.

procedure DestroyObject

FindMenuItem

function FindMenuItem(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption:

GetAction    (declared in IHYVCLControl)

function GetAction: TBasicAction

GetCaption    (declared in IHYVCLControl)

function GetCaption: string

GetCount

function GetCount: Integer

GetIndex    (declared in IHYVCLControl)

function GetIndex: Integer

GetItems

function GetItems(Index: Integer): IHYVCLMenuItem

Parameters:

  • Index:

GetProperty    (declared in IHYVCLObjectReference)

function GetProperty(const aName: string): Variant

Parameters:

  • aName:

GetRefObject    (declared in IHYVCLObjectReference)

function GetRefObject: TObject

Index    (declared in IHYVCLControl)

Gets the index associated with the control.

property Index: Integer read write

Insert (Integer, TBasicAction): IHYVCLMenuItem  overload

function Insert(anIndex: Integer; anAction: TBasicAction): IHYVCLMenuItem

Parameters:

  • anIndex:
  • anAction:

Insert (Integer, string): IHYVCLMenuItem  overload

function Insert(anIndex: Integer; const aCaption: string): IHYVCLMenuItem

Parameters:

  • anIndex:
  • aCaption:

InsertMenu

function InsertMenu(anIndex: Integer; const aCaption: string): IHYVCLMenuItem

Parameters:

  • anIndex:
  • aCaption:

InsertSeparator

function InsertSeparator(anIndex: Integer): IHYVCLMenuItem

Parameters:

  • anIndex:

Items

property Items[Index: Integer]: IHYVCLMenuItem read write

MenuItemByCaption

function MenuItemByCaption(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption:

Properties    (declared in IHYVCLObjectReference)

Gets or sets the value of the published properties of the referenced object with specified name.

property Properties[aName: string]: Variant read write

RefObject    (declared in IHYVCLObjectReference)

Gets a pointer to the referenced object.

property RefObject: TObject read write

SetAction    (declared in IHYVCLControl)

procedure SetAction(Value: TBasicAction)

Parameters:

  • Value:

SetCaption    (declared in IHYVCLControl)

procedure SetCaption(const Value: string)

Parameters:

  • Value:

SetProperty    (declared in IHYVCLObjectReference)

procedure SetProperty(const aName: string; const aPropertyValue: Variant)

Parameters:

  • aName:
  • aPropertyValue:

 

Action    (declared in IHYVCLControl)

Gets or sets the reference to the action associated with the control.

property Action: TBasicAction read write

Caption    (declared in IHYVCLControl)

Gets or sets the caption associated with the control.

property Caption: string read write

Count

Gets the number of subitems of the menu item.

property Count: Integer read write

Index    (declared in IHYVCLControl)

Gets the index associated with the control.

property Index: Integer read write

Items

property Items[Index: Integer]: IHYVCLMenuItem read write

Properties    (declared in IHYVCLObjectReference)

Gets or sets the value of the published properties of the referenced object with specified name.

property Properties[aName: string]: Variant read write

RefObject    (declared in IHYVCLObjectReference)

Gets a pointer to the referenced object.

property RefObject: TObject read write

 

Add (TBasicAction): IHYVCLMenuItem  overload

function Add(anAction: TBasicAction): IHYVCLMenuItem

Parameters:

  • anAction:

Add (string): IHYVCLMenuItem  overload

function Add(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption:

AddMenu

function AddMenu(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption:

AddSeparator

function AddSeparator: IHYVCLMenuItem

Delete

Inserts a new item into the position specified by the anIndex parameter and fills it with information from the given action object.

procedure Delete(Index: Integer)

Parameters:

  • Index: Reference to an action object.

DestroyObject    (declared in IHYVCLObjectReference)

Destroys referenced object.

procedure DestroyObject

FindMenuItem

function FindMenuItem(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption:

GetAction    (declared in IHYVCLControl)

function GetAction: TBasicAction

GetCaption    (declared in IHYVCLControl)

function GetCaption: string

GetCount

function GetCount: Integer

GetIndex    (declared in IHYVCLControl)

function GetIndex: Integer

GetItems

function GetItems(Index: Integer): IHYVCLMenuItem

Parameters:

  • Index:

GetProperty    (declared in IHYVCLObjectReference)

function GetProperty(const aName: string): Variant

Parameters:

  • aName:

GetRefObject    (declared in IHYVCLObjectReference)

function GetRefObject: TObject

Insert (Integer, TBasicAction): IHYVCLMenuItem  overload

function Insert(anIndex: Integer; anAction: TBasicAction): IHYVCLMenuItem

Parameters:

  • anIndex:
  • anAction:

Insert (Integer, string): IHYVCLMenuItem  overload

function Insert(anIndex: Integer; const aCaption: string): IHYVCLMenuItem

Parameters:

  • anIndex:
  • aCaption:

InsertMenu

function InsertMenu(anIndex: Integer; const aCaption: string): IHYVCLMenuItem

Parameters:

  • anIndex:
  • aCaption:

InsertSeparator

function InsertSeparator(anIndex: Integer): IHYVCLMenuItem

Parameters:

  • anIndex:

MenuItemByCaption

function MenuItemByCaption(const aCaption: string): IHYVCLMenuItem

Parameters:

  • aCaption:

SetAction    (declared in IHYVCLControl)

procedure SetAction(Value: TBasicAction)

Parameters:

  • Value:

SetCaption    (declared in IHYVCLControl)

procedure SetCaption(const Value: string)

Parameters:

  • Value:

SetProperty    (declared in IHYVCLObjectReference)

procedure SetProperty(const aName: string; const aPropertyValue: Variant)

Parameters:

  • aName:
  • aPropertyValue: