Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5532: Add the module and command/menu bindings
- Loading branch information
1 parent
b8dbc7d
commit 59b1b75
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
#include "icommandsystem.h" | ||
|
||
namespace ui | ||
{ | ||
|
||
class MaterialEditor | ||
{ | ||
public: | ||
static void ShowDialog(const cmd::ArgumentList& args) | ||
{} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include "MaterialEditor.h" | ||
|
||
#include "imodule.h" | ||
#include "icommandsystem.h" | ||
#include "itextstream.h" | ||
#include "imenumanager.h" | ||
#include "module/StaticModule.h" | ||
|
||
namespace ui | ||
{ | ||
|
||
class MaterialEditorModule : | ||
public RegisterableModule | ||
{ | ||
public: | ||
// RegisterableModule | ||
const std::string& getName() const override | ||
{ | ||
static std::string _name("MaterialEditor"); | ||
return _name; | ||
} | ||
|
||
const StringSet& getDependencies() const override | ||
{ | ||
static StringSet _dependencies | ||
{ | ||
MODULE_COMMANDSYSTEM, | ||
MODULE_MENUMANAGER, | ||
}; | ||
|
||
return _dependencies; | ||
} | ||
|
||
void initialiseModule(const IApplicationContext& ctx) override | ||
{ | ||
rMessage() << getName() << "::initialiseModule called." << std::endl; | ||
|
||
GlobalCommandSystem().addCommand("MaterialEditor", MaterialEditor::ShowDialog); | ||
|
||
// Bind the command to the menu | ||
GlobalMenuManager().add("main/entity", // menu location path | ||
"MaterialEditor", // name | ||
ui::menu::ItemType::Item, // type | ||
_("Material Editor..."), // caption | ||
"icon_texture.png", // icon | ||
"MaterialEditor"); // event name | ||
} | ||
|
||
void shutdownModule() override | ||
{ | ||
} | ||
}; | ||
|
||
module::StaticModule<MaterialEditorModule> materialEditorModule; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters