github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/protocol/gui-element.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package protocol
     4  
     5  // GUIElement
     6  type GUIElement interface {
     7  	Name() string // It must be unique e.g. product
     8  	Type() GUIElementType
     9  	State() GUIElementState
    10  
    11  	HTML(outer bool) string
    12  	Text() string
    13  
    14  	// Create new element as copy of existing element, new element is a full (deep) copy of the element and
    15  	// is disconnected initially from the DOM.
    16  	Clone() GUIElement
    17  	CloneTo(dom GUIElement)
    18  
    19  	GetElementById(id string) GUIElement
    20  	GetElementsByName(name string) GUIElement
    21  	GetElementsByClassName(class string) []GUIElement
    22  	GetElementsByTagName(tag string) []GUIElement
    23  	GetElementsByTagNameNS(tag string) []GUIElement
    24  
    25  	HasFocus() bool
    26  
    27  	Append(GUIElement)
    28  	Prepend(GUIElement)
    29  
    30  	Parent() GUIElement
    31  	NthChild(n int) GUIElement
    32  	// NextSibling()
    33  	// PreviousSibling()
    34  	// RemoveChild()
    35  	// ReplaceChild()
    36  
    37  	// CaptureEvents()
    38  	// CreateEvent()
    39  	// ReleaseEvents()
    40  
    41  	EventTarget
    42  	// https://developer.mozilla.org/en-US/docs/Web/API/Element/clientHeight
    43  	GUIScroll
    44  }
    45  
    46  type GUIElementType uint8
    47  
    48  // https://github.com/sciter-sdk/go-sciter/blob/master/types.go#L1363
    49  // https://github.com/sciter-sdk/go-sciter/blob/master/sciter.go#L570
    50  type GUIElementState uint8
    51  
    52  // https://en.wikipedia.org/wiki/HTML_attribute
    53  // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
    54  // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
    55  const (
    56  	ElementStateUnset GUIElementState = iota
    57  	ElementStateNormal
    58  	ElementStateError
    59  
    60  	ElementStateOpening
    61  	ElementStateOpened
    62  	ElementStateClosing
    63  	ElementStateClosed
    64  
    65  	ElementStateToggling
    66  	ElementStatePushed
    67  
    68  	// User actions states
    69  	ElementStateHover
    70  	ElementStateActive
    71  	ElementStateFocused
    72  	ElementStateFocusedVisible
    73  	ElementStateFocusedWithin
    74  
    75  	// Resource states
    76  	ElementStatePlaying
    77  	ElementStatePaused
    78  	ElementStateWaiting
    79  
    80  	// Input states
    81  	ElementStateAutofilled
    82  	ElementStateEnabled
    83  	ElementStateDisabled
    84  	ElementStateReadOnly
    85  	ElementStateWriteOnly
    86  	ElementStateSelected
    87  	ElementStateChecked
    88  	ElementStateVisited
    89  	ElementStateHidden
    90  
    91  	// Drag states
    92  	ElementStateDraggable
    93  	ElementStateDragEnter
    94  	ElementStateDragStart
    95  	ElementStateDragging
    96  	ElementStateDragEnd
    97  	ElementStateDragExit
    98  	ElementStateDroped
    99  	ElementStateLeaved
   100  	ElementStateDragOver
   101  )