Container is the base class of ALL document model objects having their own screenBuffer, most notably the Document instance.
A container has its own inputDst used as an outputDst for all its children, i.e. the exposed drawing area for its children. In conjunction with the rectangular viewport used for clipping, that Dst may eventually be much bigger than what is actually displayed on the terminal, it can be used to virtually enlarge the available area, for clipping/scrolling/overflowing purpose, and so one...
Everything needing an intermediate screenBuffer is an instance of Container.
-
Constructor:
-
Methods:
-
Properties:
-
Inherit methods and properties from Element
- options
Object
, where:- inputX, inputY
number
the position of the inputDst relative to its outputDst, default to outputX, outputY or x, y when there is no clipping/scrolling - inputWidth, inputHeight
number
the size of the inputDst, default to outputWidth, outputHeight or width, height when there is no clipping/scrolling, i.e. when the inputDst is fully drawn into the outputDst - movable
boolean
when set, the container can be moved using with a mouse drag (default: false) - scrollable
boolean
if set, the container is scrollable (default: false) - hasHScrollBar
boolean
if set and if scrollable, the container has a horizontal scrollbar - hasVScrollBar
boolean
if set and if scrollable, the container has a vertical scrollbar - scrollX
number
the initial horizontal scroll value, default: 0 - scrollY
number
the initial vertical scroll value, default: 0 - palette
Palette
a Palette instance, default to the current document's palette - backgroundAttr
number
orobject
the background attributes for the inputDst screenBuffer, default to{ bgColor: 'default' }
- inputX, inputY
While Container is a super-class that is never directly instantiated, the derived class's constructor always call the Container constructor with the options
object.
This contains all options
that are common to all type of Container.
- rect
Rect
or Rect-likeobject
, see Rect
Resize the container viewport, the rectangle used to clip the inputDst before writing it to the outputDst.
- rect
Rect
or Rect-likeobject
, see Rect
Resize this container own screenBuffer, the inputDst for its children to write on.
- rect
Rect
or Rect-likeobject
, see Rect
Resize both the inputDst and the viewport with the same size (like calling .resizeInput() and .resizeViewport() with the same arguments).
- dx, dy
number
the delta of the position of the container relative to itself
Move that container relative to its current position. In other words, change the position of its own screenBuffer relative to its parent screenBuffer.
- x, y
number
the position of the container relative to its parent container
Move that container to a position relative to its parent's container. In other words, change the position of its own screenBuffer relative to its parent screenBuffer.
- x, y
number
the new scrolling coordinates
This scrolls the container to the x,y coordinates and updates scrollbars.
- dx, dy
number
the delta of the scroll
This scrolls the container from this x,y delta and updates scrollbars.
This scrolls the container to the top and updates scrollbars.
This scrolls the container to the bottom and updates scrollbars.
This property holds the underlying screenBuffer object. It can be used to achieve more complex stuffs.