| Index: tools/viewer/sk_app/CommandSet.cpp
|
| diff --git a/tools/viewer/sk_app/CommandSet.cpp b/tools/viewer/sk_app/CommandSet.cpp
|
| index e426eaab210dca55e838c2368352bb305bcb36f2..4805e6aafeb61b4c640b5b13c48916237e4cd512 100644
|
| --- a/tools/viewer/sk_app/CommandSet.cpp
|
| +++ b/tools/viewer/sk_app/CommandSet.cpp
|
| @@ -71,6 +71,16 @@ bool CommandSet::onChar(SkUnichar c, uint32_t modifiers) {
|
| return false;
|
| }
|
|
|
| +bool CommandSet::onSoftkey(const SkString& softkey) {
|
| + for (const Command& cmd : fCommands) {
|
| + if (cmd.getSoftkeyString().equals(softkey)) {
|
| + cmd.fFunction();
|
| + return true;
|
| + }
|
| + }
|
| + return false;
|
| +}
|
| +
|
| void CommandSet::addCommand(SkUnichar c, const char* group, const char* description,
|
| std::function<void(void)> function) {
|
| fCommands.push_back(Command(c, group, description, function));
|
| @@ -154,4 +164,12 @@ void CommandSet::drawHelp(SkCanvas* canvas) {
|
| }
|
| }
|
|
|
| +std::vector<SkString> CommandSet::getCommandsAsSoftkeys() const {
|
| + std::vector<SkString> result;
|
| + for(const Command& command : fCommands) {
|
| + result.push_back(command.getSoftkeyString());
|
| + }
|
| + return result;
|
| +}
|
| +
|
| } // namespace sk_app
|
|
|