class MenuItemManager

Tracks main menu items that are registered in managed code using the MenuItem attribute.

Public

Constructors

MenuItemManager

MenuItemManager(ScriptAssemblyManager &scriptObjectManager)

Methods

~MenuItemManager

~MenuItemManager() noexcept

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Protected

Methods

~Module<T>

virtual ~Module<T>() = default

OnStartUp

virtual void OnStartUp()

Override if you want your module to be notified once it has been constructed and started.

OnShutDown

virtual void OnShutDown()

Override if you want your module to be notified just before it is deleted.

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Private

Methods

ClearMenuItems

void ClearMenuItems()

Removes all managed menu items from the main menu.

ReloadAssemblyData

void ReloadAssemblyData()

Reloads all assembly types and attempts to find uses of MenuItem.

Old menu items are cleared and new are added.

ParseMenuItemMethod

bool ParseMenuItemMethod(MonoMethod *method, String &path, ShortcutKey &shortcut, i32 &priority, bool &separator) const

Parse the provided method and detect whether it has a MenuItem attribute.

If it has extract needed data from it.

method
Managed method to parse.
path
Output path defined in the MenuItem attribute.
shortcut
Shortcut key defined in the MenuItem attribute.
priority
Menu item priority defined in the MenuItem attribute.
separator
Should the separator be inserted before the menu item.

Returns: True if the method has a MenuItem attribute. If false is returned output parameters from this method are undefined.

staticMenuItemCallback

static void MenuItemCallback(MonoMethod *method)

Triggered when one of the managed menu items is clicked.

method
Managed method that the MenuItem is referencing.

Fields

mScriptObjectManager

ScriptAssemblyManager & mScriptObjectManager

mOnAssemblyRefreshAssembliesLoadedConnection

HEvent mOnAssemblyRefreshAssembliesLoadedConnection

mMenuItemAttribute

MonoClass * mMenuItemAttribute

mPathField

MonoField * mPathField

mShortcutField

MonoField * mShortcutField

mPriorityField

MonoField * mPriorityField

mSeparatorField

MonoField * mSeparatorField

mMenuItems

Vector<GUIMenuItem *> mMenuItems