gfx/skia/trunk/include/views/android/AndroidKeyToSkKey.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/include/views/android/AndroidKeyToSkKey.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2011 Skia
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +
    1.13 +#ifndef _ANDROID_TO_SKIA_KEYCODES_H
    1.14 +#define _ANDROID_TO_SKIA_KEYCODES_H
    1.15 +
    1.16 +#include "android/keycodes.h"
    1.17 +#include "SkKey.h"
    1.18 +
    1.19 +// Convert an Android keycode to an SkKey.  This is an incomplete list, only
    1.20 +// including keys used by the sample app.
    1.21 +SkKey AndroidKeycodeToSkKey(int keycode) {
    1.22 +    switch (keycode) {
    1.23 +        case AKEYCODE_DPAD_LEFT:
    1.24 +            return kLeft_SkKey;
    1.25 +        case AKEYCODE_DPAD_RIGHT:
    1.26 +            return kRight_SkKey;
    1.27 +        case AKEYCODE_DPAD_UP:
    1.28 +            return kUp_SkKey;
    1.29 +        case AKEYCODE_DPAD_DOWN:
    1.30 +            return kDown_SkKey;
    1.31 +        case AKEYCODE_BACK:
    1.32 +            return kBack_SkKey;
    1.33 +        default:
    1.34 +            return kNONE_SkKey;
    1.35 +    }
    1.36 +}
    1.37 +
    1.38 +#endif

mercurial