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

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package protocol
     4  
     5  // GUIScroll indicate scroll behavior in any elements.
     6  // If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position
     7  // (at the start of the scrolled content), and then increasingly negative as you scroll towards the end of the content.
     8  type GUIScroll interface {
     9  	// https://developer.mozilla.org/en-US/docs/Web/API/Window/scroll
    10  	Scroll(x, y int, options GUIScrollOptions)
    11  	// Scrolls to the HTML element with the given id.
    12  	ScrollToID(id string)
    13  
    14  	// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth
    15  	ScrollWidth() int
    16  	// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight
    17  	ScrollHeight() int
    18  	// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTop
    19  	ScrollTop() int
    20  	// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
    21  	ScrollLeft() int
    22  
    23      // Returns true if the scrollbars are visible; otherwise, returns false.
    24  	// To hide/diasable/force-show scrollbars use CSS >>
    25  	// 		::-webkit-scrollbar { display: none; }	/* Hide - Chrome/Safari/Webkit */	
    26  	// 		scrollbar-width: none;	/* Hide - W3C Candidate Recommendation (Just FireFox) */	
    27  	// 		overflow: hidden;		/* Hide and disable scrollbars */
    28  	//		overflow-y: hidden; 	/* Hide and disable vertical scrollbar */
    29  	//		overflow-x: hidden; 	/* Hide and disable horizontal scrollbar */
    30  	// 		overflow: scroll;   	/* Show scrollbars */
    31  	// 		overflow-y: scroll; 	/* Show vertical scrollbar */
    32  	// 		overflow-x: scroll;		/* Show horizontal scrollbar */
    33  	Scrollbars() (x, y bool)
    34  
    35  	EventTarget
    36  }
    37  
    38  type GUIScrollOptions struct {
    39  	Behavior GUIScrollBehavior
    40  }
    41  
    42  // Specifies the scrolling animate behavior
    43  type GUIScrollBehavior uint8
    44  
    45  const (
    46  	GUIScrollBehavior_Auto GUIScrollBehavior = iota
    47  	GUIScrollBehavior_Smoothly
    48  	GUIScrollBehavior_Instantly // instantly in a single jump
    49  )
    50  
    51  type ScrollEvent uint8
    52  
    53  const (
    54  	ScrollEvent_Unset ScrollEvent = iota
    55  	ScrollEvent_HOME
    56  	ScrollEvent_END
    57  	ScrollEvent_STEP_PLUS
    58  	ScrollEvent_STEP_MINUS
    59  	ScrollEvent_PAGE_PLUS
    60  	ScrollEvent_PAGE_MINUS
    61  	ScrollEvent_POS
    62  	ScrollEvent_SLIDER_RELEASED
    63  	ScrollEvent_CORNER_PRESSED
    64  	ScrollEvent_CORNER_RELEASED
    65  )