aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/views
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-08 16:17:50 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-08 16:17:50 +0000
commit4d5c26de0a24f86c37c1da8b0e30d11a550ea67b (patch)
treeae6412d266668e9f7ca91e9ef56d65ddb3b6e9ac /include/views
parent9aaf36de60c2a2e7a6b441bb7db9521a4fd59e08 (diff)
pass modifier keys to click events (e.g. control | shift etc.)
Review URL: https://codereview.appspot.com/7062054 git-svn-id: http://skia.googlecode.com/svn/trunk@7082 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/views')
-rw-r--r--include/views/SkKey.h7
-rw-r--r--include/views/SkOSWindow_Mac.h2
-rwxr-xr-xinclude/views/SkOSWindow_iOS.h2
-rw-r--r--include/views/SkView.h13
-rw-r--r--include/views/SkWindow.h4
5 files changed, 18 insertions, 10 deletions
diff --git a/include/views/SkKey.h b/include/views/SkKey.h
index a019c28115..65fac71c80 100644
--- a/include/views/SkKey.h
+++ b/include/views/SkKey.h
@@ -52,5 +52,12 @@ enum SkKey {
kSkKeyCount
};
+enum SkModifierKeys {
+ kShift_SkModifierKey = 1 << 0,
+ kControl_SkModifierKey = 1 << 1,
+ kOption_SkModifierKey = 1 << 2, // same as ALT
+ kCommand_SkModifierKey = 1 << 3,
+};
+
#endif
diff --git a/include/views/SkOSWindow_Mac.h b/include/views/SkOSWindow_Mac.h
index d195cf1b65..aa52021607 100644
--- a/include/views/SkOSWindow_Mac.h
+++ b/include/views/SkOSWindow_Mac.h
@@ -18,7 +18,7 @@ public:
void* getHWND() const { return fHWND; }
virtual bool onDispatchClick(int x, int y, Click::State state,
- void* owner);
+ void* owner, unsigned modi);
enum SkBackEndTypes {
kNone_BackEndType,
#if SK_SUPPORT_GPU
diff --git a/include/views/SkOSWindow_iOS.h b/include/views/SkOSWindow_iOS.h
index eda7c5f137..4422d28648 100755
--- a/include/views/SkOSWindow_iOS.h
+++ b/include/views/SkOSWindow_iOS.h
@@ -17,7 +17,7 @@ public:
void* getHWND() const { return fHWND; }
virtual bool onDispatchClick(int x, int y, Click::State state,
- void* owner);
+ void* owner, unsigned modi);
enum SkBackEndTypes {
kNone_BackEndType,
diff --git a/include/views/SkView.h b/include/views/SkView.h
index 00c135690b..698c8c79f3 100644
--- a/include/views/SkView.h
+++ b/include/views/SkView.h
@@ -156,6 +156,7 @@ public:
SkIPoint fIOrig, fIPrev, fICurr;
State fState;
void* fOwner;
+ unsigned fModifierKeys;
SkMetaData fMeta;
private:
@@ -167,11 +168,11 @@ public:
friend class SkView;
};
- Click* findClickHandler(SkScalar x, SkScalar y);
+ Click* findClickHandler(SkScalar x, SkScalar y, unsigned modifierKeys);
- static void DoClickDown(Click*, int x, int y);
- static void DoClickMoved(Click*, int x, int y);
- static void DoClickUp(Click*, int x, int y);
+ static void DoClickDown(Click*, int x, int y, unsigned modi);
+ static void DoClickMoved(Click*, int x, int y, unsigned modi);
+ static void DoClickUp(Click*, int x, int y, unsigned modi);
/** Send the event to the view's parent, and its parent etc. until one of them
returns true from its onEvent call. This view is returned. If no parent handles
@@ -345,13 +346,13 @@ protected:
/** Override this if you might handle the click
*/
- virtual Click* onFindClickHandler(SkScalar x, SkScalar y);
+ virtual Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi);
/** Override this to decide if your children are targets for a click.
The default returns true, in which case your children views will be
candidates for onFindClickHandler. Returning false wil skip the children
and just call your onFindClickHandler.
*/
- virtual bool onSendClickToChildren(SkScalar x, SkScalar y);
+ virtual bool onSendClickToChildren(SkScalar x, SkScalar y, unsigned modi);
/** Override this to track clicks, returning true as long as you want to track
the pen/mouse.
*/
diff --git a/include/views/SkWindow.h b/include/views/SkWindow.h
index ca48e27114..ca68e75760 100644
--- a/include/views/SkWindow.h
+++ b/include/views/SkWindow.h
@@ -45,7 +45,7 @@ public:
// return the bounds of the dirty/inval rgn, or [0,0,0,0] if none
const SkIRect& getDirtyBounds() const { return fDirtyRgn.getBounds(); }
- bool handleClick(int x, int y, Click::State, void* owner = NULL);
+ bool handleClick(int x, int y, Click::State, void* owner, unsigned modi = 0);
bool handleChar(SkUnichar);
bool handleKey(SkKey);
bool handleKeyUp(SkKey);
@@ -67,7 +67,7 @@ public:
const char path[]) {}
protected:
virtual bool onEvent(const SkEvent&);
- virtual bool onDispatchClick(int x, int y, Click::State, void* owner);
+ virtual bool onDispatchClick(int x, int y, Click::State, void* owner, unsigned modi);
// called if part of our bitmap is invalidated
virtual void onHandleInval(const SkIRect&);
virtual bool onHandleChar(SkUnichar);