using System;
using System.Runtime.InteropServices;

namespace JuliusSweetland.OptiKey.Enums
{
    /// <summary>
    /// Specifies key codes and modifiers. An exact duplicate of Windows.Forms.Keys, except this class does not decorate 
    /// the enum with the KeysConverter attribute, which can cause problems when a value of this type is serialised/deserialised
    /// to/from the user's settings. This implementation also allows me to localise the string representation of the values manually.
    /// </summary>
    /// <filterpriority>2</filterpriority>
    [Flags]
    [ComVisible(true)]
    public enum Keys
    {
        KeyCode = 65535,
        Modifiers = -65536,
        None = 0,
        LButton = 1,
        RButton = 2,
        Cancel = RButton | LButton,
        MButton = 4,
        XButton1 = MButton | LButton,
        XButton2 = MButton | RButton,
        Back = 8,
        Tab = Back | LButton,
        LineFeed = Back | RButton,
        Clear = Back | MButton,
        Return = Clear | LButton,
        Enter = Return,
        ShiftKey = 16,
        ControlKey = ShiftKey | LButton,
        Menu = ShiftKey | RButton,
        Pause = Menu | LButton,
        Capital = ShiftKey | MButton,
        CapsLock = Capital,
        KanaMode = CapsLock | LButton,
        HanguelMode = KanaMode,
        HangulMode = HanguelMode,
        JunjaMode = HangulMode | RButton,
        FinalMode = ShiftKey | Back,
        HanjaMode = FinalMode | LButton,
        KanjiMode = HanjaMode,
        Escape = KanjiMode | RButton,
        IMEConvert = FinalMode | MButton,
        IMENonconvert = IMEConvert | LButton,
        IMEAccept = IMEConvert | RButton,
        IMEAceept = IMEAccept,
        IMEModeChange = IMEAceept | LButton,
        Space = 32,
        Prior = Space | LButton,
        PageUp = Prior,
        Next = Space | RButton,
        PageDown = Next,
        End = PageDown | LButton,
        Home = Space | MButton,
        Left = Home | LButton,
        Up = Home | RButton,
        Right = Up | LButton,
        Down = Space | Back,
        Select = Down | LButton,
        Print = Down | RButton,
        Execute = Print | LButton,
        Snapshot = Down | MButton,
        PrintScreen = Snapshot,
        Insert = PrintScreen | LButton,
        Delete = PrintScreen | RButton,
        Help = Delete | LButton,
        D0 = Space | ShiftKey,
        D1 = D0 | LButton,
        D2 = D0 | RButton,
        D3 = D2 | LButton,
        D4 = D0 | MButton,
        D5 = D4 | LButton,
        D6 = D4 | RButton,
        D7 = D6 | LButton,
        D8 = D0 | Back,
        D9 = D8 | LButton,
        A = 65,
        B = 66,
        C = B | LButton,
        D = 68,
        E = D | LButton,
        F = D | RButton,
        G = F | LButton,
        H = 72,
        I = H | LButton,
        J = H | RButton,
        K = J | LButton,
        L = H | MButton,
        M = L | LButton,
        N = L | RButton,
        O = N | LButton,
        P = 80,
        Q = P | LButton,
        R = P | RButton,
        S = R | LButton,
        T = P | MButton,
        U = T | LButton,
        V = T | RButton,
        W = V | LButton,
        X = P | Back,
        Y = X | LButton,
        Z = X | RButton,
        LWin = Z | LButton,
        RWin = X | MButton,
        Apps = RWin | LButton,
        Sleep = Apps | RButton,
        NumPad0 = 96,
        NumPad1 = NumPad0 | LButton,
        NumPad2 = NumPad0 | RButton,
        NumPad3 = NumPad2 | LButton,
        NumPad4 = NumPad0 | MButton,
        NumPad5 = NumPad4 | LButton,
        NumPad6 = NumPad4 | RButton,
        NumPad7 = NumPad6 | LButton,
        NumPad8 = NumPad0 | Back,
        NumPad9 = NumPad8 | LButton,
        Multiply = NumPad8 | RButton,
        Add = Multiply | LButton,
        Separator = NumPad8 | MButton,
        Subtract = Separator | LButton,
        Decimal = Separator | RButton,
        Divide = Decimal | LButton,
        F1 = NumPad0 | ShiftKey,
        F2 = F1 | LButton,
        F3 = F1 | RButton,
        F4 = F3 | LButton,
        F5 = F1 | MButton,
        F6 = F5 | LButton,
        F7 = F5 | RButton,
        F8 = F7 | LButton,
        F9 = F1 | Back,
        F10 = F9 | LButton,
        F11 = F9 | RButton,
        F12 = F11 | LButton,
        F13 = F9 | MButton,
        F14 = F13 | LButton,
        F15 = F13 | RButton,
        F16 = F15 | LButton,
        F17 = 128,
        F18 = F17 | LButton,
        F19 = F17 | RButton,
        F20 = F19 | LButton,
        F21 = F17 | MButton,
        F22 = F21 | LButton,
        F23 = F21 | RButton,
        F24 = F23 | LButton,
        NumLock = F17 | ShiftKey,
        Scroll = NumLock | LButton,
        LShiftKey = F17 | Space,
        RShiftKey = LShiftKey | LButton,
        LControlKey = LShiftKey | RButton,
        RControlKey = LControlKey | LButton,
        LMenu = LShiftKey | MButton,
        RMenu = LMenu | LButton,
        BrowserBack = LMenu | RButton,
        BrowserForward = BrowserBack | LButton,
        BrowserRefresh = LShiftKey | Back,
        BrowserStop = BrowserRefresh | LButton,
        BrowserSearch = BrowserRefresh | RButton,
        BrowserFavorites = BrowserSearch | LButton,
        BrowserHome = BrowserRefresh | MButton,
        VolumeMute = BrowserHome | LButton,
        VolumeDown = BrowserHome | RButton,
        VolumeUp = VolumeDown | LButton,
        MediaNextTrack = LShiftKey | ShiftKey,
        MediaPreviousTrack = MediaNextTrack | LButton,
        MediaStop = MediaNextTrack | RButton,
        MediaPlayPause = MediaStop | LButton,
        LaunchMail = MediaNextTrack | MButton,
        SelectMedia = LaunchMail | LButton,
        LaunchApplication1 = LaunchMail | RButton,
        LaunchApplication2 = LaunchApplication1 | LButton,
        OemSemicolon = MediaStop | Back,
        Oem1 = OemSemicolon,
        Oemplus = Oem1 | LButton,
        Oemcomma = LaunchMail | Back,
        OemMinus = Oemcomma | LButton,
        OemPeriod = Oemcomma | RButton,
        OemQuestion = OemPeriod | LButton,
        Oem2 = OemQuestion,
        Oemtilde = 192,
        Oem3 = Oemtilde,
        OemOpenBrackets = Oem3 | Escape,
        Oem4 = OemOpenBrackets,
        OemPipe = Oem3 | IMEConvert,
        Oem5 = OemPipe,
        OemCloseBrackets = Oem5 | LButton,
        Oem6 = OemCloseBrackets,
        OemQuotes = Oem5 | RButton,
        Oem7 = OemQuotes,
        Oem8 = Oem7 | LButton,
        OemBackslash = Oem3 | PageDown,
        Oem102 = OemBackslash,
        ProcessKey = Oem3 | Left,
        Packet = ProcessKey | RButton,
        Attn = Oem102 | CapsLock,
        Crsel = Attn | LButton,
        Exsel = Oem3 | D8,
        EraseEof = Exsel | LButton,
        Play = Exsel | RButton,
        Zoom = Play | LButton,
        NoName = Exsel | MButton,
        Pa1 = NoName | LButton,
        OemClear = NoName | RButton,
        Shift = 65536,
        Control = 131072,
        Alt = 262144,
    }
}
