| 1 |
#include "imodule.h" |
| 2 |
|
| 3 |
#include "i18n.h" |
| 4 |
#include "itextstream.h" |
| 5 |
#include "icommandsystem.h" |
| 6 |
#include "ui/imenumanager.h" |
| 7 |
#include "generic/callback.h" |
| 8 |
#include "debugging/debugging.h" |
| 9 |
|
| 10 |
#include "ConversationDialog.h" |
| 11 |
|
| 12 |
/** |
| 13 |
* Module to register the menu commands for the Conversation Editor class. |
| 14 |
*/ |
| 15 |
class ConversationEditorModule : |
| 16 |
public RegisterableModule |
| 17 |
{ |
| 18 |
public: |
| 19 |
// RegisterableModule implementation |
| 20 |
virtual const std::string& getName() const { |
| 21 |
static std::string _name("ConversationEditor"); |
| 22 |
return _name; |
| 23 |
} |
| 24 |
|
| 25 |
virtual const StringSet& getDependencies() const |
| 26 |
{ |
| 27 |
static StringSet _dependencies |
| 28 |
{ |
| 29 |
MODULE_MENUMANAGER, |
| 30 |
MODULE_COMMANDSYSTEM |
| 31 |
}; |
| 32 |
|
| 33 |
return _dependencies; |
| 34 |
} |
| 35 |
|
| 36 |
virtual void initialiseModule(const IApplicationContext& ctx) { |
| 37 |
|
| 38 |
// Add the callback event |
| 39 |
GlobalCommandSystem().addCommand("ConversationEditor", ui::ConversationDialog::ShowDialog); |
| 40 |
|
| 41 |
// Add the menu item |
| 42 |
GlobalMenuManager().add("main/map", // menu location path |
| 43 |
"ConversationEditor", // name |
| 44 |
ui::menu::ItemType::Item, // type |
| 45 |
_("Conversations..."), // caption |
| 46 |
"stimresponse.png", // icon |
| 47 |
"ConversationEditor"); // event name |
| 48 |
} |
| 49 |
}; |
| 50 |
typedef std::shared_ptr<ConversationEditorModule> ConversationEditorModulePtr; |
| 51 |
|
| 52 |
extern "C" void DARKRADIANT_DLLEXPORT RegisterModule(IModuleRegistry& registry) |
| 53 |
{ |
| 54 |
module::performDefaultInitialisation(registry); |
| 55 |
|
| 56 |
registry.registerModule(ConversationEditorModulePtr(new ConversationEditorModule)); |
| 57 |
} |