| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsScriptEditorPrerequisites.h"
- #include "Utility/BsModule.h"
- namespace bs
- {
- /** @addtogroup EditorScript
- * @{
- */
- /** Tracks main menu items that are registered in managed code using the MenuItem attribute. */
- class BS_SCR_BED_EXPORT MenuItemManager : public Module<MenuItemManager>
- {
- public:
- MenuItemManager(ScriptAssemblyManager& scriptObjectManager);
- ~MenuItemManager();
- private:
- /** Removes all managed menu items from the main menu. */
- void clearMenuItems();
- /**
- * Reloads all assembly types and attempts to find uses of MenuItem. Old menu items are cleared and new are added.
- */
- void reloadAssemblyData();
- /**
- * Parse the provided method and detect whether it has a MenuItem attribute. If it has extract needed data from it.
- *
- * @param[in] method Managed method to parse.
- * @param[in] path Output path defined in the MenuItem attribute.
- * @param[in] shortcut Shortcut key defined in the MenuItem attribute.
- * @param[in] priority Menu item priority defined in the MenuItem attribute.
- * @param[in] separator Should the separator be inserted before the menu item.
- * @return True if the method has a MenuItem attribute. If false is returned output parameters
- * from this method are undefined.
- */
- bool parseMenuItemMethod(MonoMethod* method, String& path, ShortcutKey& shortcut, INT32& priority, bool& separator) const;
- /**
- * Triggered when one of the managed menu items is clicked.
- *
- * @param[in] method Managed method that the MenuItem is referencing.
- */
- static void menuItemCallback(MonoMethod* method);
- ScriptAssemblyManager& mScriptObjectManager;
- HEvent mDomainLoadedConn;
- MonoClass* mMenuItemAttribute;
- MonoField* mPathField;
- MonoField* mShortcutField;
- MonoField* mPriorityField;
- MonoField* mSeparatorField;
- Vector<GUIMenuItem*> mMenuItems;
- };
- /** @} */
- }
|