# -*- coding: utf-8 -*-


'''
    "Object State Constants" (https://msdn.microsoft.com/en-us/library/windows/desktop/dd373609(v=vs.85).aspx)
    Константы, описывающие состояние WinForms кнопок, checkbox и прочих. Эти константы относятся к LegacyAccessible-паттерну,
    доступному через UIA.
'''

STATE_SYSTEM = {
    'UNAVAILABLE':     0x00000001,  # Если этот бит в поле state кнопки 0, то текст кнопки красный (к примеру, речь о кнопке Applay)
    'SELECTED':        0x00000002,
    'FOCUSED':         0x00000004,
    'PRESSED':         0x00000008,
    'CHECKED':         0x00000010,
    'MIXED':           0x00000020,
    'READONLY':        0x00000040,
    'HOTTRACKED':      0x00000080,
    'DEFAULT':         0x00000100,
    'EXPANDED':        0x00000200,
    'COLLAPSED':       0x00000400,
    'BUSY':            0x00000800,
    'FLOATING':        0x00001000,
    'MARQUEED':        0x00002000,
    'ANIMATED':        0x00004000,
    'INVISIBLE':       0x00008000,
    'OFFSCREEN':       0x00010000,
    'SIZEABLE':        0x00020000,
    'MOVEABLE':        0x00040000,
    'SELFVOICING':     0x00080000,
    'FOCUSABLE':       0x00100000,
    'SELECTABLE':      0x00200000,
    'LINKED':          0x00400000,
    'TRAVERSED':       0x00800000,
    'MULTISELECTABLE': 0x01000000,
    'EXTSELECTABLE':   0x02000000,
    'ALERT_LOW':       0x04000000,
    'ALERT_MEDIUM':    0x08000000,
    'ALERT_HIGH':      0x10000000,
    'VALID':           0x1fffffff
}

ROLE_SYSTEM = {
    'ALERT':               8,
    'ANIMATION':          54,
    'APPLICATION':        14,
    'BORDER':             19,
    'BUTTONDROPDOWN':     56,
    'BUTTONDROPDOWNGRID': 58,
    'BUTTONMENU':         57,
    'CARET':               7,
    'CELL':               29,
    'CHARACTER':          32,
    'CHART':              17,
    'CHECKBUTTON':        44,
    'CLIENT':             10,
    'CLOCK':              61,
    'COLUMN':             27,
    'COLUMNHEADER':       25,
    'COMBOBOX':           46,
    'CURSOR':              6,
    'DIAGRAM':            53,
    'DIAL':               49,
    'DIALOG':             18,
    'DOCUMENT':           15,
    'DROPLIST':           47,
    'EQUATION':           55,
    'GRAPHIC':            40,
    'GRIP':                4,
    'GROUPING':           20,
    'HELPBALLOON':        31,
    'HOTKEYFIELD':        50,
    'INDICATOR':          39,
    'LINK':               30,
    'LIST':               33,
    'LISTITEM':           34,
    'MENUBAR':             2,
    'MENUITEM':           12,
    'MENUPOPUP':          11,
    'OUTLINE':            35,
    'OUTLINEITEM':        36,
    'PAGETAB':            37,
    'PAGETABLIST':        60,
    'PANE':               16,
    'PROGRESSBAR':        48,
    'PROPERTYPAGE':       38,
    'PUSHBUTTON':         43,
    'RADIOBUTTON':        45,
    'ROW':                28,
    'ROWHEADER':          26,
    'SCROLLBAR':           3,
    'SEPARATOR':          21,
    'SLIDER':             51,
    'SOUND':               5,
    'SPINBUTTON':         52,
    'STATICTEXT':         41,
    'STATUSBAR':          23,
    'TABLE':              24,
    'TEXT':               42,
    'TITLEBAR':            1,
    'TOOLBAR':            22,
    'TOOLTIP':            13,
    'WHITESPACE':         59,
    'WINDOW':              9
}

STATE_SYSTEM_rev = {val:key for (key,val) in STATE_SYSTEM.items()}
ROLE_SYSTEM_rev  = {val:key for (key,val) in ROLE_SYSTEM.items()}
