
Adding a New Menu Item to PS/Workshop
| <<< The PS/Workshop Interfaces | Chapters | Registering Handlers for Different Filetypes >>> |
You can add a new menu item to PS/Workshop using IPSWApp::AddMenuItem or IPSWApp::AddMenuItem2. Typically this is done in CAddonMain::StartModule, which is called when the module is first loaded.
In order to add a new menu item you need to do the following:
The easiest way of doing this is to add a new ID via the Resources Symbol dialog in Visual Studio ( View > Resource Symbols).
For example, suppose that you wish to add a function called OnBlend with the ID ID_COMMAND_ON_BLEND to the CAddonDoc class. In this case, the CAddonDoc::OnCmdMsg would be as follows:
For example, the following code above adds an Operations menu containing a Blend command to the document level of PS/Workshop (i.e. the menu is only available when a document has been opened) . The ID ID_COMMAND_ON_BLEND is also associated with the menu item.
CComBSTR bstrMenuItem( OLESTR("&Operations\nBlend") ); HRESULT hr = m_pAppInterface->AddMenuItem(pApp, bstrMenuItem, ID_COMMAND_ON_BLEND, PSW_Menu_Doc); |
IPSWApp::AddMenuItem2 provides additional functionality to AddMenuItem, so that you can specify the precise position of any menu or menu item in the PS/Workshop menu bar.
| <<< The PS/Workshop Interfaces | Chapters | Registering Handlers for Different Filetypes >>> |