from glass.utils import di
from enum import Flag, IntEnum

import glm

class Manipulator:

    class MouseButton(Flag):
        LeftButton = 1
        RightButton = 2      
        MiddleButton = 4     
        XButton1 = 8
        XButton2 = 16        
        TaskButton = 32      
        ExtraButton4 = 64    
        ExtraButton5 = 128   
        ExtraButton6 = 256   
        ExtraButton7 = 512   
        ExtraButton8 = 1024  
        ExtraButton9 = 2048  
        ExtraButton10 = 4096 
        ExtraButton11 = 8192 
        ExtraButton12 = 16384
        ExtraButton13 = 32768
        ExtraButton14 = 65536
        ExtraButton15 = 131072
        ExtraButton16 = 262144
        ExtraButton17 = 524288
        ExtraButton18 = 1048576
        ExtraButton19 = 2097152
        ExtraButton20 = 4194304
        ExtraButton21 = 8388608
        ExtraButton22 = 16777216
        ExtraButton23 = 33554432
        ExtraButton24 = 67108864

    class Key(IntEnum):
        Key_Escape = 16777216   
        Key_Tab = 16777217      
        Key_Backtab = 16777218  
        Key_Backspace = 16777219
        Key_Return = 16777220   
        Key_Enter = 16777221    
        Key_Insert = 16777222   
        Key_Delete = 16777223   
        Key_Pause = 16777224    
        Key_Print = 16777225    
        Key_SysReq = 16777226   
        Key_Clear = 16777227    
        Key_Home = 16777232     
        Key_End = 16777233      
        Key_Left = 16777234
        Key_Up = 16777235
        Key_Right = 16777236
        Key_Down = 16777237
        Key_PageUp = 16777238
        Key_PageDown = 16777239
        Key_Shift = 16777248
        Key_Control = 16777249
        Key_Meta = 16777250
        Key_Alt = 16777251
        Key_CapsLock = 16777252
        Key_NumLock = 16777253
        Key_ScrollLock = 16777254
        Key_F1 = 16777264
        Key_F2 = 16777265
        Key_F3 = 16777266
        Key_F4 = 16777267
        Key_F5 = 16777268
        Key_F6 = 16777269
        Key_F7 = 16777270
        Key_F8 = 16777271
        Key_F9 = 16777272
        Key_F10 = 16777273
        Key_F11 = 16777274
        Key_F12 = 16777275
        Key_F13 = 16777276
        Key_F14 = 16777277
        Key_F15 = 16777278
        Key_F16 = 16777279
        Key_F17 = 16777280
        Key_F18 = 16777281
        Key_F19 = 16777282
        Key_F20 = 16777283
        Key_F21 = 16777284
        Key_F22 = 16777285
        Key_F23 = 16777286
        Key_F24 = 16777287
        Key_F25 = 16777288
        Key_F26 = 16777289
        Key_F27 = 16777290
        Key_F28 = 16777291
        Key_F29 = 16777292
        Key_F30 = 16777293
        Key_F31 = 16777294
        Key_F32 = 16777295
        Key_F33 = 16777296
        Key_F34 = 16777297
        Key_F35 = 16777298
        Key_Super_L = 16777299
        Key_Super_R = 16777300
        Key_Menu = 16777301
        Key_Hyper_L = 16777302
        Key_Hyper_R = 16777303
        Key_Help = 16777304
        Key_Direction_L = 16777305
        Key_Direction_R = 16777312
        Key_Space = 32
        Key_Exclam = 33
        Key_QuoteDbl = 34
        Key_NumberSign = 35
        Key_Dollar = 36
        Key_Percent = 37
        Key_Ampersand = 38
        Key_Apostrophe = 39
        Key_ParenLeft = 40
        Key_ParenRight = 41
        Key_Asterisk = 42
        Key_Plus = 43
        Key_Comma = 44
        Key_Minus = 45
        Key_Period = 46
        Key_Slash = 47
        Key_0 = 48
        Key_1 = 49
        Key_2 = 50
        Key_3 = 51
        Key_4 = 52
        Key_5 = 53
        Key_6 = 54
        Key_7 = 55
        Key_8 = 56
        Key_9 = 57
        Key_Colon = 58
        Key_Semicolon = 59
        Key_Less = 60
        Key_Equal = 61
        Key_Greater = 62
        Key_Question = 63
        Key_At = 64
        Key_A = 65
        Key_B = 66
        Key_C = 67
        Key_D = 68
        Key_E = 69
        Key_F = 70
        Key_G = 71
        Key_H = 72
        Key_I = 73
        Key_J = 74
        Key_K = 75
        Key_L = 76
        Key_M = 77
        Key_N = 78
        Key_O = 79
        Key_P = 80
        Key_Q = 81
        Key_R = 82
        Key_S = 83
        Key_T = 84
        Key_U = 85
        Key_V = 86
        Key_W = 87
        Key_X = 88
        Key_Y = 89
        Key_Z = 90
        Key_BracketLeft = 91
        Key_Backslash = 92
        Key_BracketRight = 93
        Key_AsciiCircum = 94
        Key_Underscore = 95
        Key_QuoteLeft = 96
        Key_BraceLeft = 123
        Key_Bar = 124
        Key_BraceRight = 125
        Key_AsciiTilde = 126
        Key_nobreakspace = 160
        Key_exclamdown = 161
        Key_cent = 162
        Key_sterling = 163
        Key_currency = 164
        Key_yen = 165
        Key_brokenbar = 166
        Key_section = 167
        Key_diaeresis = 168
        Key_copyright = 169
        Key_ordfeminine = 170
        Key_guillemotleft = 171
        Key_notsign = 172
        Key_hyphen = 173
        Key_registered = 174
        Key_macron = 175
        Key_degree = 176
        Key_plusminus = 177
        Key_twosuperior = 178
        Key_threesuperior = 179
        Key_acute = 180
        Key_mu = 181
        Key_paragraph = 182
        Key_periodcentered = 183
        Key_cedilla = 184
        Key_onesuperior = 185
        Key_masculine = 186
        Key_guillemotright = 187
        Key_onequarter = 188
        Key_onehalf = 189
        Key_threequarters = 190
        Key_questiondown = 191
        Key_Agrave = 192
        Key_Aacute = 193
        Key_Acircumflex = 194
        Key_Atilde = 195
        Key_Adiaeresis = 196
        Key_Aring = 197
        Key_AE = 198
        Key_Ccedilla = 199
        Key_Egrave = 200
        Key_Eacute = 201
        Key_Ecircumflex = 202
        Key_Ediaeresis = 203
        Key_Igrave = 204
        Key_Iacute = 205
        Key_Icircumflex = 206
        Key_Idiaeresis = 207
        Key_ETH = 208
        Key_Ntilde = 209
        Key_Ograve = 210
        Key_Oacute = 211
        Key_Ocircumflex = 212
        Key_Otilde = 213
        Key_Odiaeresis = 214
        Key_multiply = 215
        Key_Ooblique = 216
        Key_Ugrave = 217
        Key_Uacute = 218
        Key_Ucircumflex = 219
        Key_Udiaeresis = 220
        Key_Yacute = 221
        Key_THORN = 222
        Key_ssharp = 223
        Key_division = 247
        Key_ydiaeresis = 255
        Key_AltGr = 16781571
        Key_Multi_key = 16781600
        Key_Codeinput = 16781623
        Key_SingleCandidate = 16781628
        Key_MultipleCandidate = 16781629
        Key_PreviousCandidate = 16781630
        Key_Mode_switch = 16781694
        Key_Kanji = 16781601
        Key_Muhenkan = 16781602
        Key_Henkan = 16781603
        Key_Romaji = 16781604
        Key_Hiragana = 16781605
        Key_Katakana = 16781606
        Key_Hiragana_Katakana = 16781607
        Key_Zenkaku = 16781608
        Key_Hankaku = 16781609
        Key_Zenkaku_Hankaku = 16781610
        Key_Touroku = 16781611
        Key_Massyo = 16781612
        Key_Kana_Lock = 16781613
        Key_Kana_Shift = 16781614
        Key_Eisu_Shift = 16781615
        Key_Eisu_toggle = 16781616
        Key_Hangul = 16781617
        Key_Hangul_Start = 16781618
        Key_Hangul_End = 16781619
        Key_Hangul_Hanja = 16781620
        Key_Hangul_Jamo = 16781621
        Key_Hangul_Romaja = 16781622
        Key_Hangul_Jeonja = 16781624
        Key_Hangul_Banja = 16781625
        Key_Hangul_PreHanja = 16781626
        Key_Hangul_PostHanja = 16781627
        Key_Hangul_Special = 16781631
        Key_Dead_Grave = 16781904
        Key_Dead_Acute = 16781905
        Key_Dead_Circumflex = 16781906
        Key_Dead_Tilde = 16781907
        Key_Dead_Macron = 16781908
        Key_Dead_Breve = 16781909
        Key_Dead_Abovedot = 16781910
        Key_Dead_Diaeresis = 16781911
        Key_Dead_Abovering = 16781912
        Key_Dead_Doubleacute = 16781913
        Key_Dead_Caron = 16781914
        Key_Dead_Cedilla = 16781915
        Key_Dead_Ogonek = 16781916
        Key_Dead_Iota = 16781917
        Key_Dead_Voiced_Sound = 16781918
        Key_Dead_Semivoiced_Sound = 16781919
        Key_Dead_Belowdot = 16781920
        Key_Dead_Hook = 16781921
        Key_Dead_Horn = 16781922
        Key_Back = 16777313
        Key_Forward = 16777314
        Key_Stop = 16777315
        Key_Refresh = 16777316
        Key_VolumeDown = 16777328
        Key_VolumeMute = 16777329
        Key_VolumeUp = 16777330
        Key_BassBoost = 16777331
        Key_BassUp = 16777332
        Key_BassDown = 16777333
        Key_TrebleUp = 16777334
        Key_TrebleDown = 16777335
        Key_MediaPlay = 16777344
        Key_MediaStop = 16777345
        Key_MediaPrevious = 16777346
        Key_MediaNext = 16777347
        Key_MediaRecord = 16777348
        Key_HomePage = 16777360
        Key_Favorites = 16777361
        Key_Search = 16777362
        Key_Standby = 16777363
        Key_OpenUrl = 16777364
        Key_LaunchMail = 16777376
        Key_LaunchMedia = 16777377
        Key_Launch0 = 16777378
        Key_Launch1 = 16777379
        Key_Launch2 = 16777380
        Key_Launch3 = 16777381
        Key_Launch4 = 16777382
        Key_Launch5 = 16777383
        Key_Launch6 = 16777384
        Key_Launch7 = 16777385
        Key_Launch8 = 16777386
        Key_Launch9 = 16777387
        Key_LaunchA = 16777388
        Key_LaunchB = 16777389
        Key_LaunchC = 16777390
        Key_LaunchD = 16777391
        Key_LaunchE = 16777392
        Key_LaunchF = 16777393
        Key_MediaLast = 16842751
        Key_Select = 16842752
        Key_Yes = 16842753
        Key_No = 16842754
        Key_Context1 = 17825792
        Key_Context2 = 17825793
        Key_Context3 = 17825794
        Key_Context4 = 17825795
        Key_Call = 17825796
        Key_Hangup = 17825797
        Key_Flip = 17825798
        Key_unknown = 33554431
        Key_Execute = 16908291
        Key_Printer = 16908290
        Key_Play = 16908293
        Key_Sleep = 16908292
        Key_Zoom = 16908294
        Key_Cancel = 16908289
        Key_MonBrightnessUp = 16777394
        Key_MonBrightnessDown = 16777395
        Key_KeyboardLightOnOff = 16777396
        Key_KeyboardBrightnessUp = 16777397
        Key_KeyboardBrightnessDown = 16777398
        Key_PowerOff = 16777399
        Key_WakeUp = 16777400
        Key_Eject = 16777401
        Key_ScreenSaver = 16777402
        Key_WWW = 16777403
        Key_Memo = 16777404
        Key_LightBulb = 16777405
        Key_Shop = 16777406
        Key_History = 16777407
        Key_AddFavorite = 16777408
        Key_HotLinks = 16777409
        Key_BrightnessAdjust = 16777410
        Key_Finance = 16777411
        Key_Community = 16777412
        Key_AudioRewind = 16777413
        Key_BackForward = 16777414
        Key_ApplicationLeft = 16777415
        Key_ApplicationRight = 16777416
        Key_Book = 16777417
        Key_CD = 16777418
        Key_Calculator = 16777419
        Key_ToDoList = 16777420
        Key_ClearGrab = 16777421
        Key_Close = 16777422
        Key_Copy = 16777423
        Key_Cut = 16777424
        Key_Display = 16777425
        Key_DOS = 16777426
        Key_Documents = 16777427
        Key_Excel = 16777428
        Key_Explorer = 16777429
        Key_Game = 16777430
        Key_Go = 16777431
        Key_iTouch = 16777432
        Key_LogOff = 16777433
        Key_Market = 16777434
        Key_Meeting = 16777435
        Key_MenuKB = 16777436
        Key_MenuPB = 16777437
        Key_MySites = 16777438
        Key_News = 16777439
        Key_OfficeHome = 16777440
        Key_Option = 16777441
        Key_Paste = 16777442
        Key_Phone = 16777443
        Key_Calendar = 16777444
        Key_Reply = 16777445
        Key_Reload = 16777446
        Key_RotateWindows = 16777447
        Key_RotationPB = 16777448
        Key_RotationKB = 16777449
        Key_Save = 16777450
        Key_Send = 16777451
        Key_Spell = 16777452
        Key_SplitScreen = 16777453
        Key_Support = 16777454
        Key_TaskPane = 16777455
        Key_Terminal = 16777456
        Key_Tools = 16777457
        Key_Travel = 16777458
        Key_Video = 16777459
        Key_Word = 16777460
        Key_Xfer = 16777461
        Key_ZoomIn = 16777462
        Key_ZoomOut = 16777463
        Key_Away = 16777464
        Key_Messenger = 16777465
        Key_WebCam = 16777466
        Key_MailForward = 16777467
        Key_Pictures = 16777468
        Key_Music = 16777469
        Key_Battery = 16777470
        Key_Bluetooth = 16777471
        Key_WLAN = 16777472
        Key_UWB = 16777473
        Key_AudioForward = 16777474
        Key_AudioRepeat = 16777475
        Key_AudioRandomPlay = 16777476
        Key_Subtitle = 16777477
        Key_AudioCycleTrack = 16777478
        Key_Time = 16777479
        Key_Hibernate = 16777480
        Key_View = 16777481
        Key_TopMenu = 16777482
        Key_PowerDown = 16777483
        Key_Suspend = 16777484
        Key_ContrastAdjust = 16777485
        Key_MediaPause = 16777349
        Key_MediaTogglePlayPause = 16777350
        Key_LaunchG = 16777486
        Key_LaunchH = 16777487
        Key_ToggleCallHangup = 17825799
        Key_VoiceDial = 17825800
        Key_LastNumberRedial = 17825801
        Key_Camera = 17825824
        Key_CameraFocus = 17825825
        Key_TouchpadToggle = 16777488
        Key_TouchpadOn = 16777489
        Key_TouchpadOff = 16777490
        Key_MicMute = 16777491
        Key_Red = 16777492
        Key_Green = 16777493
        Key_Yellow = 16777494
        Key_Blue = 16777495
        Key_ChannelUp = 16777496
        Key_ChannelDown = 16777497
        Key_Guide = 16777498
        Key_Info = 16777499
        Key_Settings = 16777500
        Key_Exit = 16908298
        Key_MicVolumeUp = 16777501
        Key_MicVolumeDown = 16777502
        Key_New = 16777504
        Key_Open = 16777505
        Key_Find = 16777506
        Key_Undo = 16777507
        Key_Redo = 16777508
        Key_Dead_Stroke = 16781923
        Key_Dead_Abovecomma = 16781924
        Key_Dead_Abovereversedcomma = 16781925
        Key_Dead_Doublegrave = 16781926
        Key_Dead_Belowring = 16781927
        Key_Dead_Belowmacron = 16781928
        Key_Dead_Belowcircumflex = 16781929
        Key_Dead_Belowtilde = 16781930
        Key_Dead_Belowbreve = 16781931
        Key_Dead_Belowdiaeresis = 16781932
        Key_Dead_Invertedbreve = 16781933
        Key_Dead_Belowcomma = 16781934
        Key_Dead_Currency = 16781935
        Key_Dead_a = 16781952
        Key_Dead_A = 16781953
        Key_Dead_e = 16781954
        Key_Dead_E = 16781955
        Key_Dead_i = 16781956
        Key_Dead_I = 16781957
        Key_Dead_o = 16781958
        Key_Dead_O = 16781959
        Key_Dead_u = 16781960
        Key_Dead_U = 16781961
        Key_Dead_Small_Schwa = 16781962
        Key_Dead_Capital_Schwa = 16781963
        Key_Dead_Greek = 16781964
        Key_Dead_Lowline = 16781968
        Key_Dead_Aboveverticalline = 16781969
        Key_Dead_Belowverticalline = 16781970
        Key_Dead_Longsolidusoverlay = 16781971

    def __init__(self):
        self._camera_id = id(None)

    @property
    def camera(self):        
        return di(self._camera_id)

    def startup(self)->bool:
        return False

    def on_mouse_pressed(self, button:MouseButton, screen_pos:glm.vec2, global_pos:glm.vec2)->bool:
        return False

    def on_mouse_released(self, button:MouseButton, screen_pos:glm.vec2, global_pos:glm.vec2)->bool:
        return False
    
    def on_mouse_double_clicked(self, button:MouseButton, screen_pos:glm.vec2, global_pos:glm.vec2)->bool:
        return False

    def on_mouse_moved(self, screen_pos:glm.vec2, global_pos:glm.vec2)->bool:
        return False

    def on_wheel_scrolled(self, angle:glm.vec2, screen_pos:glm.vec2, global_pos:glm.vec2)->bool:
        return False

    def on_key_pressed(self, key:Key)->bool:
        return False

    def on_key_released(self, key:Key)->bool:
        return False

    def on_key_repeated(self, keys:set)->bool:
        return False