180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2011 Skia
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef _ANDROID_TO_SKIA_KEYCODES_H
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define _ANDROID_TO_SKIA_KEYCODES_H
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "android/keycodes.h"
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkKey.h"
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// Convert an Android keycode to an SkKey.  This is an incomplete list, only
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru// including keys used by the sample app.
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste QueruSkKey AndroidKeycodeToSkKey(int keycode) {
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    switch (keycode) {
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        case AKEYCODE_DPAD_LEFT:
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            return kLeft_SkKey;
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        case AKEYCODE_DPAD_RIGHT:
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            return kRight_SkKey;
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        case AKEYCODE_DPAD_UP:
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            return kUp_SkKey;
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        case AKEYCODE_DPAD_DOWN:
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            return kDown_SkKey;
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        case AKEYCODE_BACK:
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            return kBack_SkKey;
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        default:
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru            return kNONE_SkKey;
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    }
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif
36