DG Kernel Documentation


Skip Navigation Links.
Skip Navigation LinksHome Page > API Reference > General Computing > IMenu_KC Search Documentation


IMenu_KC Interface

Enable
GetItemCount
GetItemAt
InsertAt
RemoveAt
Add
InsertSubMenu
GetSubMenu

IMenu_KC interface gives access to context menu (right mouse click) of DG Kernel componet. IMenu_KC can be queried from IView interface of the component.

See also: Light SampleMenu topic


HRESULT Enable(int item, VARIANT_BOOL enable)

Parameters

item - [in] 0-based index of the item. The default menu indices are enumerated in EMenuCommand_KC

enable - [in] True to enable the item


HRESULT GetItemCount(int *count)

Parameters

count - [out, retval] Current number of items in the menu, including separators


HRESULT  GetItemAt(int index, IMenuItem_KC **item)

Parameters

index - [in] 0-based index of the item. Must be less than the current count of items.

item - [out, retval] IMenuItem_KC interface implemented by the item

Remarks:

Retrieves IMenuItem_KC interface implemented by the item. It is recommended to reacquire the interface after modifications of structure of the menu (items removed or added)


HRESULT InsertAt(int indexAt, IMenuItem_KC **item)

Parameters

indexAt - [in] 0-based index in the menu. Must be less than or equal to the current count of items.

item - [out, retval] - The returned IMenuItem_KC interface implemented by the newly inserted item

Remarks:

Inserts a new default item at the position and returns IMenuItem_KC interface implemented by the newly inserted item, which can be used to set its properties, including the displayed text.


HRESULT RemoveAt(int index)

Parameters

index - [in] 0-based index of the item. Must be less than the current count of items.

Remarks:

Removes the item at the position.


HRESULT Add(IMenuItem_KC **item)

Parameters

item - [out, retval] - The returned IMenuItem_KC interface implemented by the newly inserted item

Remarks:

Adds a new default item at the end of the menu and returns IMenuItem_KC interface implemented by the newly inserted item, which can be used to set its properties, including the displayed text.


HRESULT RemoveAll()

Remarks:

Empties the menu.


HRESULT FindItem(char* name, int *index)

Parameters

name - [in] Text of the item to be found

index - [out, retval] - Index of the found item or -1 if there is no item with the name


HRESULT InsertSubMenu(int indexAt, IMenu_KC** newSubMenu)

Parameters

indexAt - [in] New sub menu will be created at this position

newSubMenu - [out, retval] - The new sub menu

Remarks:

Creates a new submenu at position indexAt. The menu has a single item with all default attributes, which can be modified via GetSubMenu(indexAt, ...) > IMenu_KC > GetItemAt(0, ..) > IMenuItem_KC


HRESULT GetSubMenu(int i, IMenu_KC** subMenu)

Parameters

i -[in] Index (position) of the submenu in this menu

subMenu - [out, retval] - The returned sub menu

Remarks:

This method can be called for any non-negative i, which is less then count of all menu items including submenus as returned by GetItemCount. When item at the position is not a submenu the method returns a NULL reference.