gadget
Factor handbook » UI framework » Building user interfaces

Next:Gadget geometry


Vocabulary
ui.gadgets

Class description
An object which displays itself on the screen and acts on user input gestures. Gadgets have the following slots:
pref-dima cached value for pref-dim; do not read or write this slot directly.
parentthe gadget containing this one, or f if this gadget is not part of the visible gadget hierarchy.
childrena vector of child gadgets. Do not modify this vector directly, instead use add-gadget, add-gadgets, unparent or clear-gadget.
graft-statea pair of boolean values that represent the current graft state of the gadget and what its next state will become.
orientationan orientation specifier. This slot is used by layout gadgets.
layout-statestores the layout state of the gadget. Do not read or write this slot directly, instead call relayout and relayout-1 if the gadget needs to be re-laid out.
visible?a boolean indicating if the gadget should display and receive user input.
root?if set to t, layout changes in this gadget will not propagate to the gadget's parent.
clipped?a boolean indicating if clipping will be enabled when drawing this gadget's children.
interioran implementation of the UI pen protocol
boundaryan implementation of the UI pen protocol
modela model or f; see Implementing controls

Gadgets subclass the rect class, and thus all instances have loc and dim instances holding their location and dimensions.

Notes
Other classes may inherit from gadget in order to re-implement generic words such as draw-gadget* and user-input*, or to define gestures with set-gestures.

Definition


TUPLE: gadget < rect
pref-dim parent children
{ orientation initial: { 0 1 } } focus
{ visible? initial: t } root? clipped? layout-state
{ graft-state initial: { f f } } graft-node interior
boundary model ;


Methods