#ifndef TastaturEreignis_H
#define TastaturEreignis_H

#include <functional>

#include "OperatingSystem.h"

namespace Framework
{
    //! A key was pressed
    const int TE_Press = 0;
    //! A key was released
    const int TE_Release = 1;
#ifdef WIN32
    const unsigned char T_Tab = VK_TAB;
    const unsigned char T_Enter = VK_RETURN;
    const unsigned char T_BackSpace = VK_BACK;
    const unsigned char T_Shift = VK_SHIFT;
    const unsigned char T_Strg = VK_CONTROL;
    const unsigned char T_Alt = VK_MENU;
    const unsigned char T_Pause = VK_PAUSE;
    const unsigned char T_Caps_Lock = VK_CAPITAL;
    const unsigned char T_Esc = VK_ESCAPE;
    const unsigned char T_Space = VK_SPACE;
    const unsigned char T_ImageO = VK_PRIOR;
    const unsigned char T_ImageU = VK_NEXT;
    const unsigned char T_Ende = VK_END;
    const unsigned char T_Pos1 = VK_HOME;
    const unsigned char T_Links = VK_LEFT;
    const unsigned char T_Oben = VK_UP;
    const unsigned char T_Rechts = VK_RIGHT;
    const unsigned char T_Unten = VK_DOWN;
    const unsigned char T_Druck = VK_PRINT;
    const unsigned char T_Einfg = VK_INSERT;
    const unsigned char T_Entf = VK_DELETE;
    const unsigned char T_F1 = VK_F1;
    const unsigned char T_F2 = VK_F2;
    const unsigned char T_F3 = VK_F3;
    const unsigned char T_F4 = VK_F4;
    const unsigned char T_F5 = VK_F5;
    const unsigned char T_F6 = VK_F6;
    const unsigned char T_F7 = VK_F7;
    const unsigned char T_F8 = VK_F8;
    const unsigned char T_F9 = VK_F9;
    const unsigned char T_F10 = VK_F10;
    const unsigned char T_F11 = VK_F11;
    const unsigned char T_F12 = VK_F12;
    const unsigned char T_Num = VK_NUMLOCK;
    const unsigned char T_Alt_Gr = VK_RMENU;
#else
    const unsigned char T_Tab = 0x09;
    const unsigned char T_Enter = 0x0D;
    const unsigned char T_BackSpace = 0x0B;
    const unsigned char T_Shift = 0x10;
    const unsigned char T_Strg = 0x11;
    const unsigned char T_Alt = 0x12;
    const unsigned char T_Pause = 0x13;
    const unsigned char T_Caps_Lock = 0x14;
    const unsigned char T_Esc = 0x1B;
    const unsigned char T_Space = 0x20;
    const unsigned char T_ImageO = 0x21;
    const unsigned char T_ImageU = 0x22;
    const unsigned char T_Ende = 0x23;
    const unsigned char T_Pos1 = 0x24;
    const unsigned char T_Links = 0x25;
    const unsigned char T_Oben = 0x26;
    const unsigned char T_Rechts = 0x27;
    const unsigned char T_Unten = 0x28;
    const unsigned char T_Druck = 0x2A;
    const unsigned char T_Einfg = 0x2D;
    const unsigned char T_Entf = 0x2E;
    const unsigned char T_F1 = 0x70;
    const unsigned char T_F2 = 0x71;
    const unsigned char T_F3 = 0x72;
    const unsigned char T_F4 = 0x73;
    const unsigned char T_F5 = 0x74;
    const unsigned char T_F6 = 0x75;
    const unsigned char T_F7 = 0x76;
    const unsigned char T_F8 = 0x77;
    const unsigned char T_F9 = 0x78;
    const unsigned char T_F10 = 0x79;
    const unsigned char T_F11 = 0x7A;
    const unsigned char T_F12 = 0x7B;
    const unsigned char T_Num = 0x90;
    const unsigned char T_Alt_Gr = 0xA5;
#endif

    //! Stores the keyboard input from a user
    struct KeyboardEvent
    {
        //! Type of input
        int id;
        //! Affected key
        char key[3];
        //! virtual key code
        int virtualKey;
        //! (true) if the input has already been processed. (false) otherwise
        bool processed;
    };

    typedef std::function<bool(void*, void*, KeyboardEvent)> KeyboardAction;

    //! Default keyboard event callback function
    //! \param param An arbitrary parameter
    //! \param obj The drawing that calls this function
    //! \param te The keyboard event to process
    //! \return (true) if the calling drawing should continue processing
    //! the event. (false) otherwise. Always returns (true)
    DLLEXPORT bool _ret1TE(void* param, void* obj, KeyboardEvent te);
    //! Default keyboard event callback function
    //! \param param An arbitrary parameter
    //! \param obj The drawing that calls this function
    //! \param te The keyboard event to process
    //! \return (true) if the calling drawing should continue processing
    //! the event. (false) otherwise. Only returns (true) if the key is between
    //! '0' and '9', or used for deleting or cursor movement
    DLLEXPORT bool _onlyNumbersTE(void* param, void* obj, KeyboardEvent te);
    //! Default keyboard event callback function
    //! \param param An arbitrary parameter
    //! \param obj The drawing that calls this function
    //! \param te The keyboard event to process
    //! \return (true) if the calling drawing should continue processing
    //! the event. (false) otherwise. Only returns (true) if the key is between
    //! '0' and '9' or 'A' and 'F', or used for deleting or cursor movement
    DLLEXPORT bool _onlyHexTE(void* param, void* obj, KeyboardEvent te);
} // namespace Framework

#endif