Squeak Class Documentation category index | class index  
 
StackMorph
  category: Morphic-Stacks
  superclass: BookMorph
  subclasses:

A book that is very much like a HyperCard stack.

Each book page represents a different background. The page stays while different cards are projected onto it.
The data for a single card is stored in a CardPlayer. There is a list of objects that only appear on this card (privateMorphs) and the card-specific text to be inserted into the background fields.

Item How it is stored
a background a page of the StackMorph
a card data is in an instance of a subclass of CardPlayer.
A list of CardPlayers is in the 'cards' inst var of the StackMorph.
a background field a TextMorph on a page of the StackMorph
a background picture a morph of any kind on a page of the StackMorph
script for bkgnd button method in Player. Button is its costume.
text in a background field value of inst var 'field1' in a CardPlayer.
(The CardPlayer is also pointed at by the #cardInstance
property of the bkgnd field (TextMorph))
text in a card field in the TextMorph in privateMorphs in the CardPlayer.
picture on a card a morph of any kind in privateMorphs in the CardPlayer.
script for card button method in the CardPlayer. Button is its costume.

See VariableDock.

instance methods
  as yet unclassified
  commitCardData
defaultNameStemForNewPages
explainDesignations
insertCardOfBackground
insertCardOfBackground:
openInsideLook
relaxGripOnVariableNames
showDesignationsOfObjects
stackDo:

  background
  backgroundWithCard:
backgrounds
insertAsBackground:resize:
makeNewBackground
reassessBackgroundShape
reshapeBackground

  card access
  browseCardClass
cardIndexOf:
cards
currentCard
deleteCard
deleteCard:
goToCard
goToCard:
goToCardNumber:
goToFirstCardInBackground
goToFirstCardOfStack
goToLastCardInBackground
goToLastCardOfStack
goToNextCardInStack
goToPreviousCardInStack
insertCard
makeCurrentCardFirstInStack
makeCurrentCardLastInStack
moveCardOnePositionEarlier
moveCardOnePositionLater

  controls
  fullControlSpecs
pageControlsMorphFrom:
shortControlSpecs

  debugging
  inspectCurrentBackground
inspectCurrentCard
inspectCurrentStack

  initialization
  initialize
initializeToStandAlone
initializeWith:

  menu
  addBookMenuItemsTo:hand:
findText:
findText:inStrings:startAt:container:cardNum:
findViaTemplate
formatList:
getAllText
invokeBookMenu
offerBookishMenu
offerStackDebugMenu
templateMatches
writeSingletonData

  submorphs-accessing
  allNonSubmorphMorphs

class methods
  authoring prototype
  authoringPrototype
designationsExplainer

  misc
  discoverSlots:

  navigation buttons
  nextCardButton
previousCardButton

  parts bin
  descriptionForPartsBin

  viewer
  additionsToViewerCategories

instance methods
  as yet unclassified top  
 

commitCardData

Make certain that the player data are written back to the player instance


 

defaultNameStemForNewPages

Answer the stem to use as the default for names of cards in the stack


 

explainDesignations

Give the user an explanation of what the designations mean


 

insertCardOfBackground

Prompt the user for choice of a background, and insert a new card of that background


 

insertCardOfBackground:

Insert a new card of the given background and have it become the current card


 

openInsideLook

Open an inside-look at the current page. This is a previously-demoed feature not presently incorporated in released code,


 

relaxGripOnVariableNames

Have the current background relax its grip on existing variable name


 

showDesignationsOfObjects

Momentarily show which objects on the current card belong to which designation category


 

stackDo:

Evaluate aBlock on behalf of the receiver stack


  background top  
 

backgroundWithCard:

Answer the background which contains aCard.


 

backgrounds

Answer the list of backgrounds available in the receiver


 

insertAsBackground:resize:

Make a new background for the stack. Obtain a name for it from the user. It starts out life empty


 

makeNewBackground

Make a new background for the stack. Obtain a name for it from the user. It starts out life empty


 

reassessBackgroundShape

Have the current page reconsider its cards' instance structure


 

reshapeBackground

Abandon any memory of variable-name preferences for the current background, and reassess its instance structure


  card access top  
 

browseCardClass

Browse the class of the current card


 

cardIndexOf:

Answer the ordinal position of aCard in the receiver's list


 

cards

Answer a list of the cards of the receiver, in order


 

currentCard

Answer the current card of the current background of the receiver


 

deleteCard

Delete the current card from the stack


 

deleteCard:

Delete the current card from the stack.


 

goToCard

prompt the user for an ordinal number, and use that as a basis for choosing a new card to install in the receiver


 

goToCard:

Install the indicated destinationCard as the current card in the receiver. Any viewer currently open on the current card will get retargeted to look at the new one.


 

goToCardNumber:

Install the card whose ordinal number is provided as the current card in the stack


 

goToFirstCardInBackground

Install the initial card in the current background as the current card in the stack


 

goToFirstCardOfStack

Install the initial card in the stack as the current card


 

goToLastCardInBackground

Install the final card in the current background as the current card


 

goToLastCardOfStack

Install the final card in the stack as the current card


 

goToNextCardInStack

Make the card *after* the current card become the current card


 

goToPreviousCardInStack

Install the previous card as my current one


 

insertCard

Create a new card of the current background and make it become the current card


 

makeCurrentCardFirstInStack

Move the current card such that it becomes the first card in the stack


 

makeCurrentCardLastInStack

Move the current card such that it becomes the last card in the stack


 

moveCardOnePositionEarlier

Move the current card such that its ordinal position is one fewer than it formerly was. If the current card is already the first one one in the stack, then do nothing


 

moveCardOnePositionLater

Move the current card such that its ordinal position is one greater than it formerly was. If the current card is already the last one one in the stack, then do nothing


  controls top  
 

fullControlSpecs

Answer specifications for the long form of iconic stack/book controls


 

pageControlsMorphFrom:

Answer a controls morph derived from the spec supplied


 

shortControlSpecs

Answer specficiations for the shorter form of stack controls


  debugging top  
 

inspectCurrentBackground

Open an inspector on the corrent background. Ideally should put include the background name in the inspector's title.


 

inspectCurrentCard

For debugging: open an Inspector on the receiver's current card


 

inspectCurrentStack

Triggered from the stack-debug menu, open an Inspector on the receiver


  initialization top  
 

initialize

Initialize the stack


 

initializeToStandAlone

Set up the receiver, created by a #basicNew and now ready to be initialized, as a fully-formed morph suitable for providing a graphic for a parts bin surrogate, and, when such a parts-bin surrogate is clicked on, for attaching to the hand as a viable stand-alone morph. Because of historical precedent, #initialize has been expected to handle this burden, though a great number of morphs actually cannot stand alone. In any case, by default we call the historical #initialize, though unhappily, so that all existing morphs will work no worse than before when using this protocol.


 

initializeWith:

Install the card inside a new stack. Make no border or controls, so I the card's look is unchanged. Card already has a CardPlayer.


  menu top  
 

addBookMenuItemsTo:hand:

Add book-related items to the given menu


 

findText:

Turn to the next card that has all of the strings mentioned on it. Highlight where it is found. allText and allTextUrls have been set. Case insensitive search.
Resuming a search. If container's text is still in the list and secondary keys are still in the page, (1) search rest of that container. (2) search rest of containers on that page (3) pages till end of book, (4) from page 1 to this page again.


 

findText:inStrings:startAt:container:cardNum:

Call once to search a card of the stack. Return true if found and highlight the text. oldContainer should be NIL.
(oldContainer is only non-nil when (1) doing a 'search again' and (2) the page is in memory and (3) keys has just one element. oldContainer is a TextMorph.)


 

findViaTemplate

Current card is the template. Only search cards in this background. Look at cards directly (not allText). Key must be found in the same field as in the template. HyperCard style (multiple starts of words).
Put results in a list, outside the stack.


 

formatList:

Turn this plugglable list into a good looking morph.


 

getAllText

Collect the text for each card. Just point at strings so don't have to recopy them. (Parallel array of urls for ID of cards. Remote cards not working yet.)
allText = Array (cards size) of arrays (fields in it) of strings of text.
allTextUrls = Array (cards size) of urls or card numbers.


 

invokeBookMenu

Invoke the book's control panel menu.


 

offerBookishMenu

Offer a menu with book-related items in it


 

offerStackDebugMenu

Put up a menu offering debugging items for the stack


 

templateMatches

Current card is the template. Only search cards in this background. Look at cards directly (not allText). Key must be found in the same field as in the template. HyperCard style (multiple starts of words).
Put results in a list, outside the stack.


 

writeSingletonData

Backgrounds that have just one card, may never get their data written into a CardPlayer. Make sure we do it.


  submorphs-accessing top  
 

allNonSubmorphMorphs

Return a collection containing all morphs in this morph which are not currently in the submorph containment hierarchy. Especially the non-showing pages in BookMorphs.


class methods
  authoring prototype top  
 

authoringPrototype

Answer an instance of the receiver suitable for placing in a parts bin for authors


 

designationsExplainer

Answer a morph that contains designation explanation


  misc top  
 

discoverSlots:

Examine the parts of the morph for ones that couldHoldSeparateData. Return a pair of lists: Named morphs, and unnamed morphs (which may be labels, and non-data). Examine all submorphs.


  navigation buttons top  
 

nextCardButton

Answer a button that advances the user to the next card in the stack


 

previousCardButton

Answer a button that will take the user to the preceding card in the stack


  parts bin top  
 

descriptionForPartsBin

If the receiver is a member of a class that would like to be represented in a parts bin, answer the name by which it should be known, and a documentation string to be provided, for example, as balloon help. When the 'nativitySelector' is sent to the 'globalReceiver', it is expected that some kind of Morph will result. The parameters used in the implementation below are for documentation purposes only!


  viewer top  
 

additionsToViewerCategories

Answer a list of (<categoryName> <list of category specs>) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories.