View

abstract class View(accessibilityRole: AccessibilityRole? = null) : Renderable, Positionable

The smallest unit of displayable, interactive content within doodle. Views are the visual entities used to display components for an application. User input events are sent to all Views that are configured to receive them. This allows them to response to user interaction or convey such events to other parts of an application.

Author

Nicholas Eddy

Inheritors

Constructors

Link copied to clipboard
protected constructor(accessibilityRole: AccessibilityRole? = null)

Types

Link copied to clipboard
abstract class ClipPath

Defines a clipping path for a View's children.

Link copied to clipboard
object Companion
Link copied to clipboard

ClipPath based on a Ellipse. The contains check defaults to Ellipse.contains.

Link copied to clipboard

ClipPath based on a Polygon. The contains check defaults to Polygon.contains.

Link copied to clipboard
class SizePreferences(val idealSize: Size?, val minimumSize: Size)

Indicates the minimum and ideal sizes for a View.

Properties

Link copied to clipboard

Determines whether the View will be affected by Themes set in ThemeManager. Defaults to true

Link copied to clipboard

Indicates the View that contains a more detailed description for assistive technologies. This property overrides accessibilityLabel.

Link copied to clipboard

Provides a recognizable name for assistive technologies.

Link copied to clipboard

Indicates the View that contains a recognizable name for assistive technologies. This property overrides accessibilityLabel.

Link copied to clipboard

indicates the View's role for assistive technologies

Link copied to clipboard

Optional color that the View could use for its background

Link copied to clipboard

Smallest enclosing Rectangle around the View's bounds given it's transform.

Link copied to clipboard
override var bounds: Rectangle

The top, left, width, and height with respect to parent, or the Display if top-level. Unlike boundingBox, this value isn't affected by any applied transform.

Link copied to clipboard
Link copied to clipboard

Camera within the View's parent that affects how it is projected onto the screen.

Link copied to clipboard
Link copied to clipboard

The View's center point in its parent's coordinate system.

Link copied to clipboard
protected open val children: ObservableList<View>

List of child Views within this one

Link copied to clipboard

Notifies changes to children

Link copied to clipboard

A Path used to further clip the View's children within its bounds. The View's children cannot extend beyond its bounds, so specifying a value larger than it will not enable that.

Link copied to clipboard

Indicates whether the View's Canvas will be clipped so that nothing rendered shows beyond its bounds. Set this to false to support things like shadows or glows that aren't intended to be included in the normal bounding box.

Link copied to clipboard

The resolved content direction for this View, including any value inherited from its parent if localContentDirection is null. The final fallback value is LeftRight.

Link copied to clipboard
Link copied to clipboard

Cursor that is displayed whenever the pointer is over this View. This falls back to the parent's Cursor if not set.

Link copied to clipboard

Notifies changes to cursor

Link copied to clipboard

Notifies changes to displayed

Link copied to clipboard

Is true if the View is currently within the Display. NOTE: this does not mean the View has been rendered yet.

Link copied to clipboard

Current visible Rectangle for this View within it's coordinate space. This accounts for clipping by ancestors, but NOT cousins (siblings, anywhere in the hierarchy)

Link copied to clipboard
Link copied to clipboard

Recognizer used to determine whether a PointerEvent should result in a DragOperation

Link copied to clipboard

Receiver that determines what drop operations are supported by the View

Link copied to clipboard

Whether this View is enabled. The default is true.

Link copied to clipboard

Notifies changes to enabled

Link copied to clipboard

Notifies on the View's first render

Link copied to clipboard
Link copied to clipboard
open var focusable: Boolean

Whether this View is focusable The default is true.

Link copied to clipboard

Notifies changes to hasFocus

Link copied to clipboard
protected val focusCycleRoot: View?
Link copied to clipboard
Link copied to clipboard
var font: Font?

Optional font that the View could use for rendering. This falls back to parent's font if not set.

Link copied to clipboard

Optional color that the View could use for its foreground (i.e. text)

Link copied to clipboard

Whether the View has focus or not. The default is false.

Link copied to clipboard
override var height: Double

Vertical extent of bounds

Link copied to clipboard
override var idealSize: Size?

Size that would best display this View, or null if no preference

Link copied to clipboard
protected open var insets: Insets

Insets used to control how Layouts set the View's children away from its edge.

Link copied to clipboard
protected open var isFocusCycleRoot: Boolean
Link copied to clipboard

KeyListeners that are notified during the bubbling phase of key event handling.

Link copied to clipboard

KeyListeners that are notified during the sinking phase of key event handling

Link copied to clipboard
protected open var layout: Layout?

Layout responsible for positioning of this View's children

Link copied to clipboard

Indicates the direction of content within the View; used to support right-to-left locales. Setting this property to null will allow the View to inherit the value from its parent. The resolved value is obtained via contentDirection; and it will never be null.

Link copied to clipboard
override var minimumSize: Size

Minimum size preferred by the View, default is Empty

Link copied to clipboard

true if the View's contentDirection is RightLeft and mirrorWhenRightLeft is true.

Link copied to clipboard

Indicates whether the View should be mirrored (as though transformed using AffineTransform.flipHorizontally), when the contentDirection is RightLeft.

Link copied to clipboard

Indicates whether the framework should notify the View of changes to its visible region as a result of changes to bounds in its ancestor chain. The events for this require monitoring potentially large sets of Views in the hierarchy and the events can be frequent during layout changes. So the default value is false. But it is useful for things like efficient rendering of sub-portions (i.e. long list-like Views) where the cost is outweighed.

Link copied to clipboard

Overrides the next item read by assistive technologies when they move from this View. This is helpful when the display order (i.e. ordering of children in a parent) does not match the order they should be read in.

Link copied to clipboard

Indicates how opaque the View is. A value of 1 means the View should be fully opaque and 0 means fully transparent. Setting this property to 0 does not make a View invisible (i.e. visible might still be true). This property also does not affect how events (i.e. pointer and keyboard) are sent to the View.

Link copied to clipboard
Link copied to clipboard
var parent: View?

View that contains this one as a child, or null. A top-level Views will also return null; but they will also have displayed == true; so parent alone isn't sufficient to determine whether a View is in the display hierarchy.

Link copied to clipboard

Notifies changes to parent

Link copied to clipboard

PointerListeners that are notified during the bubbling phase of pointer event handling.

Link copied to clipboard

PointerListeners that are notified during the sinking phase of pointer event handling.

Link copied to clipboard

PointerMotionListeners that are notified during the sinking phase of pointer-motion event handling.

Link copied to clipboard

PointerMotionListeners that are notified during the sinking phase of pointer-motion event handling.

Link copied to clipboard

PointerMotionListeners that are ONLY notified if a View chooses to pass a pointer event through to Views below it. This allows actions to be taken for events that would otherwise be relayed to other, underlying Views.

Link copied to clipboard

PointerListeners that are ONLY notified if a View chooses to pass a pointer event through to Views below it. This allows actions to be taken for events that would otherwise be relayed to other, underlying Views.

Link copied to clipboard
override var position: Point

Top-left corner of bounds

Link copied to clipboard

Is true if the View has been rendered at least once.

Link copied to clipboard
override var size: Size

Width-height of bounds

Link copied to clipboard
Link copied to clipboard

The current text to display for tool-tips. The default is the empty string.

Link copied to clipboard

Affine transform applied to the View. This transform does not affect the View's bounds or how it is handled by Layout. It does affect the boundingBox, and how the View looks when rendered. Hit-detection is handled correctly such that the pointer intersects with the View as expected after transformation. So no additional handling is necessary in general. The default is Identity

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override var visible: Boolean

Whether this View is visible. The default is true.

Link copied to clipboard
override var width: Double

Horizontal extent of bounds

Link copied to clipboard
override var x: Double

Left edge of bounds

Link copied to clipboard
override var y: Double

Top edge of bounds

Link copied to clipboard
var zOrder: Int

Rendering order of this View within it's parent, or Display if top-level. Views with higher values are rendered above those with lower ones. The default is 0.

Functions

Link copied to clipboard
protected open fun addedToDisplay()

This method is invoked by the render system when the View is first added to the Display hierarchy. This happens when the View itself-- or one of it's ancestors--is added to the Display.

Link copied to clipboard
protected open infix fun ancestorOf(view: View): Boolean

Tells whether this View is an ancestor of the given View. A View is not considered an ancestor of itself.

Link copied to clipboard

Moves the View's center to the given point.

Link copied to clipboard
protected open fun child(at: Point): View?

Gets the child (if any) at the given point in the View's coordinate system (relative to the View).

Link copied to clipboard
protected operator fun contains(child: View): Boolean

Tells whether this View is child's parent. Unlike ancestorOf, this checks only a parent-child relationship.

open operator override fun contains(point: Point): Boolean

Checks whether a point (relative to parent or Display if top-level) is within the View's bounds. This method must account for any transform and camera applied to the View. The default implementation does this and delegates to intersects.

Link copied to clipboard
protected fun contentDirectionChanged()
Link copied to clipboard
protected fun cursorChanged(old: Cursor?, new: Cursor?)
Link copied to clipboard
protected open fun doLayout()

Causes the layout (if any) to re-layout the View's children

Link copied to clipboard
protected fun enabledChanged(old: Boolean, new: Boolean, filter: (View) -> Boolean)
Link copied to clipboard
protected open fun filterKeyEvent(event: KeyEvent)

This is an event invoked on a View in response to a key event triggered in the subsystem.

Link copied to clipboard
protected open fun filterPointerEvent(event: PointerEvent)

This is an event invoked on a View during the filter phase of a pointer event.

Link copied to clipboard
protected open fun filterPointerMotionEvent(event: PointerEvent)

This is an event invoked on a View during the filter phase of a pointer-motion event.

Link copied to clipboard
fun fromAbsolute(point: Point): Point

Maps a Point from absolute coordinate-space: relative to the un-transformed Display, into this View's coordinate-space.

Link copied to clipboard
operator fun get(traversalType: FocusTraversalPolicy.TraversalType): Set<KeyState>?

Gets the set of keys used to trigger this type of focus traversal.

Link copied to clipboard
protected open fun handleDisplayRectEvent(old: Rectangle, new: Rectangle)

This is an event invoked on a View in response to a change in the display rectangle.

Link copied to clipboard
protected open fun handleKeyEvent(event: KeyEvent)

This is an event invoked on a View in response to a key event triggered in the subsystem.

Link copied to clipboard
protected open fun handlePointerEvent(event: PointerEvent)

This is an event invoked on a View in response to a pointer event triggered in the subsystem.

Link copied to clipboard
protected open fun handlePointerMotionEvent(event: PointerEvent)

This is an event invoked on a View in response to a pointer-motion event triggered in the subsystem.

Link copied to clipboard
open infix fun intersects(point: Point): Boolean

Checks whether a point on the View's plane, but relative to its parent, intersects (is "touching") the View. This enables custom hit detection logic for Views that have non-rectangular shapes.

Link copied to clipboard
Link copied to clipboard
protected open fun relayout()

Prompts the View to lay out its children if it has a Layout installed.

Link copied to clipboard
protected open fun removedFromDisplay()

This method is invoked by the Render system when the View is no longer included in the Display hierarchy. This happens when the View itself-- or one of it's ancestors--is removed from the Display.

Link copied to clipboard
open override fun render(canvas: Canvas)

Gives the View an opportunity to render itself (excludes any children) to the given Canvas.

Link copied to clipboard
fun rerender()

Request the rendering subsystem to trigger a render call if needed.

Link copied to clipboard

Request the rendering subsystem to trigger a render call with no delay. Only use this method for time-sensitive drawing as is the case for animations.

Link copied to clipboard
protected fun revalidate()
Link copied to clipboard
fun View.scrollTo(rectangle: Rectangle)

Scrolls the View to the given region if it is within a ScrollPanel.

Link copied to clipboard
operator fun set(traversalType: FocusTraversalPolicy.TraversalType, keyStates: Set<KeyState>?)

Sets the keys used to control focus traversals of the given type.

Link copied to clipboard
protected open fun shouldHandlePointerEvent(event: PointerEvent): Boolean

Determines whether the given event should be passed through the View to underlying items. This method is only called when a View would normally be sent an event like the one provided.

Link copied to clipboard

Determines whether the given event should be passed through the View to underlying items. This method is only called when a View would normally be sent an event like the one provided.

Link copied to clipboard

Checked by the focus system before the focus is moved from a View. Returning false will prevent focus from moving. The default is true.

Link copied to clipboard
protected fun styleChanged(filter: (View) -> Boolean)
Link copied to clipboard
fun toAbsolute(point: Point): Point

Maps a Point within the View to absolute coordinate-space.

Link copied to clipboard
fun toLocal(point: Point, from: View?): Point

Maps a Point within from View into this View's coordinate-space.

Link copied to clipboard

Gets the tool-tip text based on the given PointerEvent. Override this method to provide multiple tool-tip text values for a single View.

Link copied to clipboard
fun toParent(point: Point): Point

Maps a Point within the View to its parent's coordinate-space, or the Display's if it is top-level.