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

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

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/Viewer.cpp ('k') | tools/viewer/sk_app/CommandSet.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/viewer/sk_app/CommandSet.h
diff --git a/tools/viewer/sk_app/CommandSet.h b/tools/viewer/sk_app/CommandSet.h
index 5e6373c9354b8dcda97edd5b8a7b8ded8b61ba74..4cbb367e01cf99269817f76c34ead05fc2672f56 100644
--- a/tools/viewer/sk_app/CommandSet.h
+++ b/tools/viewer/sk_app/CommandSet.h
@@ -12,6 +12,7 @@
#include "Window.h"
#include <functional>
+#include <vector>
class SkCanvas;
@@ -40,6 +41,7 @@ public:
void attach(Window* window);
bool onKey(sk_app::Window::Key key, sk_app::Window::InputState state, uint32_t modifiers);
bool onChar(SkUnichar, uint32_t modifiers);
+ bool onSoftkey(const SkString& softkey);
void addCommand(SkUnichar c, const char* group, const char* description,
std::function<void(void)> function);
@@ -48,6 +50,8 @@ public:
void drawHelp(SkCanvas* canvas);
+ std::vector<SkString> getCommandsAsSoftkeys() const;
+
private:
struct Command {
enum CommandType {
@@ -86,6 +90,10 @@ private:
SkString fGroup;
SkString fDescription;
std::function<void(void)> fFunction;
+
+ SkString getSoftkeyString() const {
+ return SkStringPrintf("%s (%s)", fKeyName.c_str(), fDescription.c_str());
+ }
};
static bool compareCommandKey(const Command& first, const Command& second);
« no previous file with comments | « tools/viewer/Viewer.cpp ('k') | tools/viewer/sk_app/CommandSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698