Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: tools/viewer/sk_app/CommandSet.cpp

Issue 2035923002: Add Softkey UIState to Viewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/viewer/sk_app/CommandSet.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « tools/viewer/sk_app/CommandSet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698