... <- Box <- Window <- TitledWindow <- GadgetWindow <- AttributeWindow |
|
|
LargerLastAttributeField RedrawObject SpoutPosition StepList Target |
instance AttributeWindow tag; relativeOrigin: <0.0,0.0>; contentSize: <0.0,0.0>; viewFlags: 0x00000000; labelStyle: nilObject; color: 0; altColor: 0; shadow: nilObject; sound: nilObject; border: nilObject; canCoexist: false; persistentWindow: false; dontAutoExtend: false; ignoreGrid: false; closeAfterTouch: false; closeBeforeTouch: false; autoPosition: false; noCloseBox: false; downArrowVisible: false; upArrowVisible: false; rightArrowVisible: false; leftArrowVisible: false; autoMoveContents: false; searchable: false; customTitleColor: false; scaleWindowTitle: false; noBuiltInArrows: false; noZoom: false; autoCopyWindow: false; titleColor: 0; titleHeight: <0.0>; dependents: nilObject; balloonDot: <0.0,0.0>; target: nilObject; spoutPosition: <0.0,0.0>; promptField: nilObject; prefixField: nilObject; attributeFields: nilObject; labelButtons: nilObject; nextButton: nilObject; prevButton: nilObject; doneButton: nilObject; stepList: nilObject; stepsPerPanel: 0; currentPanel: 0; target: nilObject; redrawObject: nilObject; info: nilObject; controls: nilObject; observedControl: nilObject; resizeTextFields: false; isActive: false; shouldUpdateButtons: false; hasVisibleTextField: false; end instance;
Define Class AttributeWindow; inherits from GadgetWindow; inherits from AcceptsTyping; field spoutPosition: Dot; // position of window's balloon spout tip field promptField: TextField, weak; // prompt text that can replace the top attributeField field prefixField: TextField, weak; // label prefix for bottom attributeField (used for phone prefix display) field attributeFields: ObjectList; // list of text fields used for editing text attributes field labelButtons: ObjectList; // list of label buttons showing the names of the text fields and select them when touched field nextButton: Button, weak; // button that takes user to next panel field prevButton: Button, weak; // button that takes user back to previous panel field doneButton: Button, weak; // button that signals completion of panel series field stepList: AttributeStepList, weak, getter, setter; // used by StepList attribute field stepsPerPanel: Unsigned; // number of steps from step list taken per panel field currentPanel: Unsigned; // user's position in current step list, counting in panels field target: Object, weak, getter; // object that is undergoing edit // this overrides another Target attribute/field field redrawObject: Viewable, weak, getter, setter; // viewable to dirty when target is updated field info: Object, getter; // for Info attribute, set from panel steps; initialize to nilObject field controls: ObjectList, weak; // used internally; initialize to nilObject field observedControl: Viewable, weak; // used internally; initialize to nilObject field resizeTextFields: Boolean; // whether text fields should be resized automatically per step to occupy space not taken by label buttons or prefix field isActive: Boolean; // used internally field shouldUpdateButtons: Boolean; // used internally field hasVisibleTextField: Boolean; // used internally attribute SpoutPosition: Dot; // position of window's balloon spout tip attribute StepList: AttributeStepList; // current list of steps attribute RedrawObject: Viewable; // viewable to dirty when target is updated operation AcceptField(field: FormStepField); // passes the information in the field to its target, and updates the other fields (if any); // called by the form step field when it is deactivated and acceptImmediately is set on the step // override rarely operation UpdateAttributeText(), intrinsic; // gets the attribute text out of the target operation DeactivatingField(field: FormStepField); // called when deactivating a field in this window // default calls AcceptField if AcceptImmediately(field) overrides Confirm; // closes self after updating attribute(s) of target, and calls Confirmed; // called by GoToNext when at the end of the steps; // override rarely (override Confirmed instead) operation GoToNext(), safe, common; // updates attribute(s) of target; // sets up the next panel, or calls Confirm if at end of steps; // chains to next list of steps when appropriate; // just honks if cannotSetAttribute exception is thrown // override rarely operation GoToPrevious(), safe, common; // updates attribute(s) of target, and returns to previous panel in this list; // chains to previous list of steps when appropriate; // override rarely operation EachStepInPanel(function: EachStepInPanelFunction; parameters: Pointer; includeNilSteps: Boolean; passLabelButtons: Boolean): Object, noFail; // perform function for each step in the current panel, but stop if function returns result other than nilObject // if stopped, return the function result that caused stop, otherwise return nilObject // if a step is nilObject, function is only called if includeNilSteps is true // label buttons are only passed to function if passLabelButtons is true operation EachEditControlInPanel(function: EachEditControlInPanelFunction; parameters: Pointer): Object, noFail; // perform function for each edit control in the current panel, but stop if function returns result other than nilObject // if stopped, return the function result that caused stop, otherwise return nilObject operation IndexedLabelButtonAction(stepIndexInPanel: Unsigned), safe, common; // called by label button in window when it's pressed; // attribute LargerLowAttributeField: Boolean; // controls whether low attribute field of two-step window is a one liner with a prompt above it, attribute LargerLastAttributeField: Boolean; // controls whether last attribute field is a one liner with a prompt above it, // or is a multi-line text field filling most of attribute window // override rarely operation SetUpPanel(list: AttributeStepList; panel: Unsigned); // prepares the fields, controls, etc. of self to match the steps that are part of this panel // override rarely operation ToggleAttributeList(); // if the current step list is paired, toggle which one is used // otherwise, do nothing overrides AboutToHide; // overridden to cancel pending changes and delete stillborn name cards overrides AboutToShow; // starts observing target, to notice if it's destroyed while self is onscreen overrides BalloonDot; // overridden to get balloon dot from spoutPosition field overrides ZoomFromWhere; // overridden to zoom from balloon dot // overrides Info; // overridden to get info from a panel step (AttributeStep_stepInfo field) overrides Notice; // notices when user types into bottom field so Done button can be // replaced by Next button when appropriate; // also notices if target has been destroyed and hides self if so overrides SetTarget; // stops observing old target and begins observing new one overrides Stabilize; // make the fields consistent with the attribute data by writing them back overrides TypeKeys; // overridden to call GoToNext when return key is typed if neither attribute field is showing; // (if attribute field is showing, it handles return key similarly) overrides FindNextSubviewAcceptingTyping; // overridden to change search direction - we go first-to-last; also only looks at attributeFields operation AcceptAttributeData(forward: Boolean; done: Boolean): Boolean, intrinsic; // write the content of the fields (or other active elements) back to the attribute operation CleanUpControls(), intrinsic; operation DeleteOneContact(parameters: Pointer): Object, intrinsic; operation FindNextPanel(currentPanel: Unsigned; reallyGo: Boolean): Boolean, intrinsic; operation ObserveStep(startObserving: Boolean), intrinsic; intrinsic SetupFieldFlags(field: FormStepField; attributeStep: AttributeStep); intrinsic SetUpOneStep(step: AttributeStep; attributeField: FormStepField; labelButton: Button; parameters: Pointer): Object; end class;