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); |