requires: {#Stream}. provides: {#Presentation}. "This provides the information-exchange protocol for inputting and outputting objects using Presentations, and adding context for them." Graphics addPrototype: #Presentation derivedFrom: {Mixin}. "Presentations are designed as a Mixin which encodes the UI type and representation with formatting." Presentation addSlot: #object. "The object presented." Presentation addSlot: #type. "The PresentationType object, describing the type of object, formatting and criteria that must be satisfied for this presentation's subject." Presentation addSlot: #view. "The View that this Presentation is applied to (separate from the target)." Presentation addSlot: #singleBox. "Boolean sensitivity" Presentation addSlot: #highlighting. "Boolean highlighting" Graphics addPrototype: #PresentationType derivedFrom: {Cloneable}. "Objects describing the type-characteristics of Presentation objects." PresentationType addSlot: #name valued: ''. PresentationType addSlot: #name valued: ''. PresentationType addSlot: #name valued: ''. PresentationType addSlot: #description valued: ''. "The name assigned for UI purposes." PresentationType addSlot: #keepsHistory. "Boolean for #history use." PresentationType addSlot: #history. "TODO: refactor keepsHistory into history isNil with overriding as needed." Graphics addPrototype: #View derivedFrom: {Cloneable}. "Views are a concept which allows specifying an output format style as an extra dispatch argument instead of providing specialized method names or hardcoding the style into the display medium. It is intended to be extended, but primarily based on Oddballs (cloning these is useless)." Graphics addPrototype: #TextView derivedFrom: {View}. Graphics addPrototype: #TextDialogView derivedFrom: {TextView}. Graphics addPrototype: #TextMenuView derivedFrom: {TextView}. Graphics addPrototype: #GadgetView derivedFrom: {View}. Graphics addPrototype: #GadgetMenuView derivedFrom: {GadgetView}. Graphics addPrototype: #GadgetDialogView derivedFrom: {GadgetView}. Graphics addPrototype: #HandDocumentationView derivedFrom: {TextView}. SceneElement Stream addSlot: #defaultView valued: View. "This is where the default View argument is obtained." "TODO: Move this to the appropriate place in the initialization." obj@(Root traits) presentAs: p@(Presentation traits) on: s@(Stream traits) view: v@(View traits) "Display the representation of obj on the view TODO: implement optional keyword forContext:." [ ]. obj@(Root traits) presentAs: p on: s [obj presentAs: p on: s view: s defaultView]. obj@(Root traits) presentOn: s [obj presentAs: obj presentationType on: s]. p@(Presentation traits) present: obj@(Root traits) on: s@(Stream traits) view: v@(View traits) "An alternate syntax. The presentation is used as the desired type." [ obj presentAs: p on: s view: v ]. p@(Presentation traits) present: obj@(Root traits) on: target "Get the default WriteStream to something." "TODO: determine a robust way of providing the default view." [p present: obj through: target writer]. p@(Presentation traits) acceptThrough: s@(Stream traits) from: v@(View traits) "Return the object parsed from s, which might not be of type p. TODO: implement optional keywords default, default-type" [ ]. p@(Presentation traits) acceptThrough: s [p acceptThrough: s from: s defaultView]. p@(Presentation traits) accept [p acceptThrough: Console reader from: TextView]. p@(Presentation traits) matches: context "presentation-matches-context-type" [ ]. "NOTE: CLIM function describe maps to printOn:/printName." "TODO: find out what accept-present-default translates to." p@(Presentation traits) positionTest: x@(Point traits) in: r@(SceneElement traits) "Definitively answers hit detection queries, ensuring x is within the output record, specialized for p." [ ]. p@(Presentation traits) highlightOn: s@(Stream traits) "Draw a highlight box on the output record in stream s." [ ]. p@(Presentation traits) unhighlightOn: s@(Stream traits) "Draw a highlight box on the output record in stream s." [ ]. "TODO: implement 23.4 below." "p@(Presentation traits) " "23.5" lobby addSlot: #InputContexts valued: Stack newEmpty. "Elements in CLIM of InputContexts are supposed to be a Presentation (type) tagged with indicating where in the control structure it was established. It is not strictly a stack, but the order reflects call order." "TODO: make this an attribute of some more general context type." l@lobby inputContext [l InputContexts top]. "23.6..." "------------------------------------" "Some actual presentation types:" Graphics ensureDelegatedNamespace: #presentations. Root traits addPrototype: #presentationType derivedFrom: {Presentation}. "Disabled until bootstrapped: Compiler SyntaxNode traits addPrototype: #presentationType derivedFrom: {Root traits presentationType}. " presentations addPrototype: #Root derivedFrom: {Presentation}. presentations addPrototype: #Boolean derivedFrom: {presentations Root}. True addPrototype: #presentationType derivedFrom: {presentations Boolean}. False addPrototype: #presentationType derivedFrom: {presentations Boolean}. Nil addPrototype: #presentationType derivedFrom: {presentations Root}. presentations addPrototype: #Command derivedFrom: {Presentation}. presentations addPrototype: #Null derivedFrom: {Presentation}. "This represents where there is no presentation that is applicable in the current input context."