| 1 |
#include "MaterialEditor.h" |
| 2 |
|
| 3 |
#include "i18n.h" |
| 4 |
#include "imodule.h" |
| 5 |
#include "icommandsystem.h" |
| 6 |
#include "itextstream.h" |
| 7 |
#include "ui/imenumanager.h" |
| 8 |
#include "module/StaticModule.h" |
| 9 |
|
| 10 |
namespace ui |
| 11 |
{ |
| 12 |
|
| 13 |
class MaterialEditorModule : |
| 14 |
public RegisterableModule |
| 15 |
{ |
| 16 |
public: |
| 17 |
// RegisterableModule |
| 18 |
const std::string& getName() const override |
| 19 |
{ |
| 20 |
static std::string _name("MaterialEditor"); |
| 21 |
return _name; |
| 22 |
} |
| 23 |
|
| 24 |
const StringSet& getDependencies() const override |
| 25 |
{ |
| 26 |
static StringSet _dependencies |
| 27 |
{ |
| 28 |
MODULE_COMMANDSYSTEM, |
| 29 |
MODULE_MENUMANAGER, |
| 30 |
}; |
| 31 |
|
| 32 |
return _dependencies; |
| 33 |
} |
| 34 |
|
| 35 |
void initialiseModule(const IApplicationContext& ctx) override |
| 36 |
{ |
| 37 |
GlobalCommandSystem().addCommand("MaterialEditor", MaterialEditor::ShowDialog, { cmd::ARGTYPE_STRING | cmd::ARGTYPE_OPTIONAL }); |
| 38 |
|
| 39 |
// Bind the command to the menu |
| 40 |
GlobalMenuManager().add("main/map", // menu location path |
| 41 |
"MaterialEditor", // name |
| 42 |
ui::menu::ItemType::Item, // type |
| 43 |
_("Material Editor..."), // caption |
| 44 |
"icon_texture.png", // icon |
| 45 |
"MaterialEditor"); // event name |
| 46 |
} |
| 47 |
}; |
| 48 |
|
| 49 |
module::StaticModuleRegistration<MaterialEditorModule> materialEditorModule; |
| 50 |
|
| 51 |
} |