module Sketchbook::Element
Direct including types
Defined in:
tree/element.crInstance Method Summary
-
#adopted
Hook called when this element is added as a child to an element capable of holding children.
-
#bounds : Rect
Returns the global bounding rect of this element.
-
#bring_to_front
Brings this element to the top of Z axis of its parent.
-
#drag(stream = events) : Stream(Point)
Emits mouse position deltas when this element is being dragged, as per the given event stream.
-
#enter(stream = events) : Stream(Point)
Pumps when cursor enters this element.
-
#events : Stream(SF::Event)
Pumps the event part of
#intake
. -
#input(stream = events) : Stream(Char)
Pumps printable characters that the user types with the keyboard from stream.
-
#intake
Central hub for events coming into this element.
-
#keypress(stream = events) : Stream(SF::Event::KeyPressed)
Pumps key press events from stream.
-
#keys(stream = events) : Stream(SF::Event::KeyEvent)
Pumps key events for keys that the user presses/releases from stream.
-
#leave(stream = events) : Stream(Point)
Pumps when cursor leaves this element.
-
#mouse_press(stream = events) : Stream(SF::Event::MouseButtonPressed)
Pumps mouse pressed events from stream.
-
#offset
Holds the local position (offset from parent) of this frame.
-
#offset=(offset)
Holds the local position (offset from parent) of this frame.
-
#parent : Group | Nil
Returns the parent element of this element.
-
#parent=(parent : Group | Nil)
Returns the parent element of this element.
-
#parent? : Group | Nil | Nil
Returns the parent element of this element.
-
#pos(accum = offset)
Returns the global position of this element.
-
#rejected
Hook called when this element is removed as a child from an element capable of holding children.
-
#render(target)
Renders this element on the screen.
-
#req
Returns the minimum required size for this element.
-
#size
Holds the size of this frame.
-
#size=(size)
Holds the size of this frame.
-
#transit(stream = events) : Stream(Tuple(Point, Bool))
Pumps {point, in bounds} for whether the cursor entered or left this element (at a specific point).
Instance Method Detail
Hook called when this element is added as a child to an element capable of holding children.
Brings this element to the top of Z axis of its parent. Does nothing if this element has no parent.
Emits mouse position deltas when this element is being dragged, as per the given event stream.
NOTE when this element is being dragged, #transit
events (and therefore #enter
and #leave
events)
are all ignored (because you can drag faster than
the element moves, and so go in/out of its bounds,
leaving it but not finishing the drag).
Pumps when cursor enters this element. Only true
is pumped.
Pumps printable characters that the user types with the keyboard from stream.
Central hub for events coming into this element.
The window (one that sent the event and the event itself are pumped.
Pumps key press events from stream.
Pumps key events for keys that the user presses/releases from stream.
Pumps when cursor leaves this element. Only false
is pumped.
Pumps mouse pressed events from stream.
Returns the parent element of this element. May be nil when this element is top-level.
Returns the parent element of this element. May be nil when this element is top-level.
Returns the parent element of this element. May be nil when this element is top-level.
Returns the global position of this element.
NOTE this method is recursive over parent and will fail at (very) deep element trees.
Hook called when this element is removed as a child from an element capable of holding children.
Holds the size of this frame. Sizes smaller than
the #req
uired size will be ignored.
Pumps {point, in bounds} for whether the cursor entered or left this element (at a specific point).
Does not pump when dragging. See #drag
for the reason.