Squeak Class Documentation category index | class index  
 
MorphicModel
  category: Morphic-Kernel
  superclass: BorderedMorph
  subclasses: ComponentLikeModel PlayWithMe1 Slider Player7 EToyGateKeeperEntry SystemWindow

MorphicModels are used to represent structures with state and behavior as well as graphical structure. A morphicModel is usually the root of a morphic tree depicting its appearance. The tree is constructed concretely by adding its consituent morphs to a world.

When a part is named in a world, it is given a new slot in the model. When a part is sensitized, it is named, and a set of mouse-driven methods is also generated in the model. These may be edited to induce particular behavior. When a variable is added through the morphic world, it is given a slot in the model, along with a set of access methods.

In addition for public variables (and this is the default for now), methods are generated and called in any outer model in which this model gets embedded, thus propagating variable changes outward.

instance methods
  access
  allKnownNames
model
modelOrNil
slotName
wantsSlot

  compilation
  addPartNameLike:withValue:
assureNameFor:
choosePartName
compileAccessForSlot:
compileInitMethods
compilePropagationMethods
installModelIn:
instanceVariableValues
nameFor:
namePartSilently:
propagate:as:
removeAll
slotSelectorFor:
use:orMakeModelSelectorFor:in:

  drag and drop
  allowSubmorphExtraction
isOpen

  geometry
  newBounds:
recomputeBounds

  initialization
  delete
duplicate:from:
initialize
model:
model:slotName:
releaseCachedState

  menu
  addCustomMenuItems:hand:
closeToEdits
openToEdits

  printing
  initString

  testing
  isMorphicModel

class methods
  compilation
  acceptsLoggingOfCompilation
categoryForSubclasses
chooseNewName
compileAccessorsFor:
compilePropagationForVarName:slotName:
newSubclass
officialClass
wantsChangeSetLogging

  housekeeping
  removeUninstantiatedModels

  instance creation
  includeInNewMorphMenu
new
newBounds:model:slotName:

  prototype access
  prototype
prototype:

  queries
  hasPrototype

instance methods
  access top  
 

allKnownNames

Return a list of all known names based on the scope of the receiver. If the receiver is a member of a uniclass, incorporate the original 1997 logic that queries the known names of the values of all the instance variables.


 

model


 

modelOrNil


 

slotName


 

wantsSlot

Override this default for models that want to be installed in theri model


  compilation top  
 

addPartNameLike:withValue:


 

assureNameFor:


 

choosePartName

When I am renamed, get a slot, make default methods, move any existing methods. ** Does not clean up old inst var name or methods**


 

compileAccessForSlot:

Write the method to get at this inst var.


 

compileInitMethods


 

compilePropagationMethods


 

installModelIn:

Simple morphs have no model


 

instanceVariableValues

MorphicModel76 someInstance instanceVariableValues


 

nameFor:

Return the name of the slot containing the given morph or nil if that morph has not been named.


 

namePartSilently:


 

propagate:as:


 

removeAll

Clear out all script methods and subpart instance variables in me. Start over.


 

slotSelectorFor:


 

use:orMakeModelSelectorFor:in:


  drag and drop top  
 

allowSubmorphExtraction


 

isOpen

Support drag/drop and other edits.


  geometry top  
 

newBounds:


 

recomputeBounds


  initialization top  
 

delete

Remove the receiver as a submorph of its owner and make its new owner be nil.


 

duplicate:from:

oldGuy has just been duplicated and will stay in this world. Make sure all the MorphicModel requirements are carried out for the copy. Ask user to rename it.


 

initialize


 

model:

Set my model and make me me a dependent of the given object.


 

model:slotName:


 

releaseCachedState

Release cached state of the receiver


  menu top  
 

addCustomMenuItems:hand:

Add morph-specific items to the given menu which was invoked by the given hand. This method provides is invoked both from the halo-menu and from the control-menu regimes.


 

closeToEdits

Disable this morph's ability to add and remove morphs via drag-n-drop.


 

openToEdits

Enable this morph's ability to add and remove morphs via drag-n-drop.


  printing top  
 

initString


  testing top  
 

isMorphicModel


class methods
  compilation top  
 

acceptsLoggingOfCompilation

Dont log sources for my automatically-generated subclasses. Can easily switch this back when it comes to deal with Versions, etc.


 

categoryForSubclasses


 

chooseNewName

Choose a new name for the receiver, persisting until an acceptable name is provided or until the existing name is resubmitted


 

compileAccessorsFor:


 

compilePropagationForVarName:slotName:


 

newSubclass


 

officialClass

We want to make a new instance of the receiver, which is a subclass of MorphicModel. Answer who to make a new subclass of. Also used to tell if a given class is a UniClass, existing only for its single instance.


 

wantsChangeSetLogging

Log changes for MorphicModel itself and for things like PlayWithMe2, but not for automatically-created subclasses like MorphicModel1, MorphicModel2, etc.


  housekeeping top  
 

removeUninstantiatedModels

With the user's permission, remove the classes of any models that have neither instances nor subclasses.


  instance creation top  
 

includeInNewMorphMenu

Only include Models that are appropriate


 

new

Return a copy of the prototype, if there is one.
Otherwise create a new instance normally.


 

newBounds:model:slotName:


  prototype access top  
 

prototype

Return the prototype for this morph.


 

prototype:

Store a copy of the given morph as a prototype to be copied to make new instances.


  queries top  
 

hasPrototype

Return true if there is a prototype for this morph.